Gestion plus fines des entites et corrections sur initiative #915

This commit is contained in:
sladecraven 2021-11-08 14:58:06 +01:00
parent f24331865c
commit 2e83cbd366
7 changed files with 56 additions and 11 deletions

View File

@ -90,7 +90,7 @@ export class RdDCombatManager extends Combat {
let armeCombat, competence;
if (combatant.actor.data.type == 'creature' || combatant.actor.data.type == 'entite') {
for (const competenceItemData of combatant.actor.data.items) {
if (competenceItemData.data.iscombat) {
if (competenceItemData.data.data.iscombat) {
competence = duplicate(competenceItemData);
}
}
@ -434,8 +434,11 @@ export class RdDCombat {
else {
const defender = target?.actor;
const defenderTokenId = target?.data._id;
console.log("Defender: ", defender);
if ( defender.data._id == attacker.data._id) {
ui.notifications.warn("Vous vous attaquez vous-même !!!!");
} else if ( defender.type == 'entite' && defender.data.data.definition.typeentite == 'nonincarne') {
ui.notifications.warn("Vous ne pouvez pas cibler une entité non incarnée !!!!");
} else {
return this.create(attacker, defender, defenderTokenId, target)
}
@ -855,6 +858,11 @@ export class RdDCombat {
await this._sendMessageDefense(attackerRoll, defenderRoll);
}
}
/* -------------------------------------------- */
isPossession( attackerRoll) {
return attackerRoll.selectedCarac.label.toLowerCase() == 'possession';
}
/* -------------------------------------------- */
async _sendMessageDefense(attackerRoll, defenderRoll, essaisPrecedents = undefined) {
@ -873,6 +881,7 @@ export class RdDCombat {
const paramChatDefense = {
passeArme: attackerRoll.passeArme,
essais: attackerRoll.essais,
isPossession: this.isPossession( attackerRoll),
defender: Misc.data(this.defender),
attacker: Misc.data(this.attacker),
attackerId: this.attackerId,
@ -927,7 +936,7 @@ export class RdDCombat {
let items = defender.data.items;
items = items.filter(it => RdDItemArme.isArmeUtilisable(it) || RdDItemCompetenceCreature.isCompetenceParade(it));
for (let item of items) {
item.data.nbUsage = defender.getItemUse(item._id); // Ajout du # d'utilisation ce round
item.data.nbUsage = defender.getItemUse(item.id); // Ajout du # d'utilisation ce round
}
switch (competence.data.categorie) {
case 'tir':

File diff suppressed because one or more lines are too long

View File

@ -2,11 +2,11 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT",
"version": "1.5.27",
"version": "1.5.33",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "0.8.9",
"templateVersion": 126,
"templateVersion": 132,
"author": "LeRatierBretonnien",
"authors": [
{

View File

@ -40,6 +40,10 @@
"capacite_encombrement": 0
},
"entite": {
"definition": {
"categorieentite": "",
"typeentite": ""
},
"carac": {
"taille": {
"type": "number",
@ -667,6 +671,7 @@
"carac_value": 0,
"iscombat": false,
"isparade": false,
"ispossession": false,
"dommages": 0,
"description": "Compétence : ...",
"descriptionmj": ""

View File

@ -28,6 +28,7 @@
{{!-- Carac Tab --}}
<div class="tab items" data-group="primary" data-tab="carac">
<div class="grid grid-2col">
<div class="flex-group-left flexcol">
<ol class="carac-list alterne-list">
@ -45,8 +46,28 @@
{{/each}}
</ol>
</div>
<div class="flex-group-left flexcol">
<div class="flex-group-left flexcol">
<ol class="carac-list alterne-list">
<li class="competence flexrow list-item">
<span class="carac-label flexrow" name="catEntite">Catégorie : </span>
<select name="data.definition.categorieentite" value="{{data.definition.categorieentite}}" data-dtype="String">
{{#select data.definition.categorieentite}}
<option value="cauchemar">Cauchemar</option>
<option value="reve">Rêve</option>
{{/select}}
</select>
</li>
<li class="competence flexrow list-item">
<span class="carac-label flexrow" name="typeEntite">Type d'entité : </span>
<select name="data.definition.typeentite" value="{{data.definition.typeentite}}" data-dtype="String">
{{#select data.definition.typeentite}}
<option value="incarne">Incarnée</option>
<option value="nonincarne">Non Incarnée</option>
{{/select}}
</select>
</li>
{{#each data.attributs as |attr key|}}
<li class="competence flexrow list-item" data-attribute="{{key}}">
<span class="carac-label flexrow" name="data.attributs.{{key}}.label">{{attr.label}} : </span>

View File

@ -36,7 +36,7 @@
{{/unless}}
{{else}}
{{#each armes as |arme key|}}
<a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}' data-armeid='{{arme._id }}'>
<a class='chat-card-button' id='parer-button' data-attackerId='{{../attackerId}}' data-defenderTokenId='{{../defenderTokenId}}' data-armeid='{{arme.id }}'>
Parer avec {{arme.name}} à {{../diffLibre }}{{#if arme.data.nbUsage}} (Utilisations : {{arme.data.nbUsage}}){{/if}}
</a>
<br>

View File

@ -28,6 +28,10 @@
<label for="xp">Parade ? </label>
<input class="attribute-value" type="checkbox" name="data.isparade" {{#if data.isparade}}checked{{/if}}/>
</div>
<div class="form-group">
<label for="xp">Possession ? </label>
<input class="attribute-value" type="checkbox" name="data.ispossession" {{#if data.ispossession}}checked{{/if}}/>
</div>
<div class="form-group">
<label>Catégorie parade </label>
<select name="data.categorie_parade" id="categorie_parade" data-dtype="String">