#65 Gestion parade entités/creatures

This commit is contained in:
sladecraven 2020-12-08 22:27:28 +01:00
parent a263350b56
commit 399a7b2d30
4 changed files with 32 additions and 8 deletions

View File

@ -1547,18 +1547,27 @@ export class RdDActor extends Actor {
difficultesLibres: CONFIG.RDD.difficultesLibres, difficultesLibres: CONFIG.RDD.difficultesLibres,
etat: this.data.data.compteurs.etat.value, etat: this.data.data.compteurs.etat.value,
diffConditions: 0, diffConditions: 0,
forceValue :this.data.data.carac.force.value, // Utilisé pour le jet de recul forceValue : (this.data.data.carac.force) ? this.data.data.carac.force.value : 0, // Utilisé pour le jet de recul
diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0, diffLibre: (attackerRoll) ? attackerRoll.diffLibre : 0,
attackerRoll: attackerRoll, attackerRoll: attackerRoll,
finalLevel: 0, finalLevel: 0,
coupsNonMortels: false, coupsNonMortels: false,
malusArmureValue: (this.data.data.attributs) ? this.data.data.attributs.malusarmure.value : 0, malusArmureValue: 0,
surencMalusFlag: (this.data.data.compteurs.surenc.value < 0), surencMalusFlag: false,
surencMalusValue: this.data.data.compteurs.surenc.value, surencMalusValue: 0,
surencMalusApply: false, surencMalusApply: false,
isNatation: name.toLowerCase().includes("natation"), isNatation: false,
useEncForNatation: false, useEncForNatation: false,
encValueForNatation: (this.encombrementTotal) ? Math.round(this.encombrementTotal) : 0 encValueForNatation: 0
}
if ( this.type == 'personnage ') {
rollData.malusArmureValue = (this.data.data.attributs) ? this.data.data.attributs.malusarmure.value : 0;
rollData.surencMalusFlag = (this.data.data.compteurs.surenc.value < 0);
rollData.surencMalusValue = this.data.data.compteurs.surenc.value;
rollData.surencMalusApply = false;
rollData.isNatation = name.toLowerCase().includes("natation");
rollData.useEncForNatation = false;
rollData.encValueForNatation = (this.encombrementTotal) ? Math.round(this.encombrementTotal) : 0;
} }
if ( competence.type == 'competencecreature') { // Specific case for Creatures if ( competence.type == 'competencecreature') { // Specific case for Creatures
@ -1696,8 +1705,12 @@ export class RdDActor extends Actor {
{ {
let armeItem = this.getOwnedItem(armeId); // Item.data.data ! let armeItem = this.getOwnedItem(armeId); // Item.data.data !
console.log("Going to PARY !!!!!!!!!", armeItem, attackerRoll.diffLibre); console.log("Going to PARY !!!!!!!!!", armeItem, attackerRoll.diffLibre);
if (armeItem.type == 'competencecreature') {
this.rollCompetence( armeItem.name, armeItem.data, attackerRoll, attacker);
} else {
this.rollCompetence( armeItem.data.data.competence, armeItem.data, attackerRoll, attacker); this.rollCompetence( armeItem.data.data.competence, armeItem.data, attackerRoll, attacker);
} }
}
/* -------------------------------------------- */ /* -------------------------------------------- */
esquiverAttaque( attackerRoll, attacker = undefined ) esquiverAttaque( attackerRoll, attacker = undefined )

View File

@ -631,6 +631,8 @@ export class RdDUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getArmeCategory( arme ) static getArmeCategory( arme )
{ {
if ( arme.data.competence == undefined) return 'competencecreature';
let compname = arme.data.competence.toLowerCase(); let compname = arme.data.competence.toLowerCase();
if ( compname.match("hache") ) return "hache"; if ( compname.match("hache") ) return "hache";
if ( compname.match("hast") ) return "hast"; if ( compname.match("hast") ) return "hast";
@ -669,13 +671,17 @@ export class RdDUtility {
rollMode: true rollMode: true
}; };
if ( rollData.competence.data.categorie == 'melee' || rollData.competence.data.categorie == 'creature') { // Melee attack or creature if ( rollData.competence.data.categorie == 'melee' || rollData.competence.data.categorie == 'competencecreature') { // Melee attack or creature
let defenderArmes = []; let defenderArmes = [];
for (const arme of myTarget.data.items) { for (const arme of myTarget.data.items) {
if (arme.type == "arme" && this.isArmeMelee(arme.data.competence)) { if (arme.type == "arme" && this.isArmeMelee(arme.data.competence)) {
defenderArmes.push( arme ); defenderArmes.push( arme );
defenseMsg.content += "<br><a class='chat-card-button' id='parer-button' data-attackerid='"+attacker.data._id + "' data-defendertokenid='" + target.data._id + "' data-armeid='"+arme._id+"'>Parer avec " + arme.name + "</a></span>"; defenseMsg.content += "<br><a class='chat-card-button' id='parer-button' data-attackerid='"+attacker.data._id + "' data-defendertokenid='" + target.data._id + "' data-armeid='"+arme._id+"'>Parer avec " + arme.name + "</a></span>";
} }
if (arme.type == "competencecreature" && arme.data.isparade) {
defenderArmes.push( arme );
defenseMsg.content += "<br><a class='chat-card-button' id='parer-button' data-attackerid='"+attacker.data._id + "' data-defendertokenid='" + target.data._id + "' data-armeid='"+arme._id+"'>Parer avec " + arme.name + "</a></span>";
}
} }
defenseMsg.content += "<br><a class='chat-card-button' id='esquiver-button' data-attackerid='"+attacker.data._id + "' data-defendertokenid='" + target.data._id + "'>Esquiver</a></span>"; defenseMsg.content += "<br><a class='chat-card-button' id='esquiver-button' data-attackerid='"+attacker.data._id + "' data-defendertokenid='" + target.data._id + "'>Esquiver</a></span>";
} }

View File

@ -599,6 +599,7 @@
"niveau": 0, "niveau": 0,
"carac_value": 0, "carac_value": 0,
"iscombat": false, "iscombat": false,
"isparade": false,
"dommages": 0, "dommages": 0,
"description": "Compétence : ..." "description": "Compétence : ..."
}, },

View File

@ -20,6 +20,10 @@
<label for="xp">Arme ? </label> <label for="xp">Arme ? </label>
<input class="attribute-value" type="checkbox" name="data.iscombat" {{#if data.iscombat}}checked{{/if}}/> <input class="attribute-value" type="checkbox" name="data.iscombat" {{#if data.iscombat}}checked{{/if}}/>
</div> </div>
<div class="form-group">
<label for="xp">Parade ? </label>
<input class="attribute-value" type="checkbox" name="data.isparade" {{#if data.isparade}}checked{{/if}}/>
</div>
<div class="form-group"> <div class="form-group">
<label for="niveau">Dommages (+dom), si applicable </label> <label for="niveau">Dommages (+dom), si applicable </label>
<input class="attribute-value" type="text" name="data.dommages" value="{{data.dommages}}" data-dtype="Number"/> <input class="attribute-value" type="text" name="data.dommages" value="{{data.dommages}}" data-dtype="Number"/>