Fix parade créatures
This commit is contained in:
parent
23966c1056
commit
0d599d41f9
@ -2119,10 +2119,10 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCompetenceCreature(compName) {
|
||||
let competence = this.getCompetence(compName);
|
||||
const competence = this.getCompetence(compName);
|
||||
if (competence.type == 'competencecreature' && competence.data.iscombat) {
|
||||
let competence = this.getCompetence(compName);
|
||||
RdDCombat.createUsingTarget(this).attaque(competence, armeItem);
|
||||
const arme = RdDItemCompetenceCreature.toArme(competence);
|
||||
RdDCombat.createUsingTarget(this).attaque(competence, arme);
|
||||
}
|
||||
else {
|
||||
this.rollCompetence(competence.name);
|
||||
@ -2131,7 +2131,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme(compName, armeName = undefined) {
|
||||
let arme = this.data.items.find(item => item.name == armeName && RdDItemArme.isArme(item));
|
||||
let arme = armeName ? this.data.items.find(item => item.name == armeName && RdDItemArme.isArme(item)) : undefined;
|
||||
let competence = this.getCompetence(compName);
|
||||
|
||||
if (arme || armeName || (competence.type == 'competencecreature' && competence.data.iscombat)) {
|
||||
@ -2151,6 +2151,11 @@ export class RdDActor extends Actor {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
getArmeParade(armeParadeId) {
|
||||
const item = armeParadeId ? this.getOwnedItem(armeParadeId) : undefined;
|
||||
return RdDItemArme.getArmeData(item);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async equiperObjet(itemID) {
|
||||
let item = this.getOwnedItem(itemID);
|
||||
|
@ -25,7 +25,7 @@ export class RdDItemArme extends Item {
|
||||
switch (item ? item.data.type : '') {
|
||||
case 'arme': return item.data;
|
||||
case 'competencecreature':
|
||||
return RdDItemCompetenceCreature.toArme(item);
|
||||
return RdDItemCompetenceCreature.toArme(item.data);
|
||||
}
|
||||
return RdDItemArme.mainsNues();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ export class RdDItemCompetenceCreature extends Item {
|
||||
rollData.competence.data.categorie = "creature";
|
||||
rollData.selectedCarac = rollData.carac.carac_creature;
|
||||
if (rollData.competence.data.iscombat) {
|
||||
rollData.arme = RdDItemCompetenceCreature.toArme(rollData.competence)
|
||||
rollData.arme = RdDItemCompetenceCreature.toArme(rollData.competence);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async attaque(competence, arme) {
|
||||
async attaque(competence, arme = undefined) {
|
||||
if (!await this.accorderEntite('avant-attaque')) {
|
||||
return;
|
||||
}
|
||||
@ -535,8 +535,8 @@ export class RdDCombat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async parade(attackerRoll, armeParadeId) {
|
||||
let arme = RdDItemArme.getArmeData(armeParadeId ? this.defender.getOwnedItem(armeParadeId) : null);
|
||||
|
||||
let arme = this.defender.getArmeParade(armeParadeId);
|
||||
|
||||
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
|
||||
|
||||
let rollData = this._prepareParade(attackerRoll, arme);
|
||||
@ -559,10 +559,11 @@ export class RdDCombat {
|
||||
dialog.render(true);
|
||||
}
|
||||
|
||||
|
||||
_prepareParade(attackerRoll, armeParade) {
|
||||
const compName = armeParade.data.competence;
|
||||
const armeAttaque = attackerRoll.arme;
|
||||
|
||||
|
||||
let rollData = {
|
||||
passeArme: attackerRoll.passeArme,
|
||||
forceValue: this.defender.getForceValue(),
|
||||
@ -581,15 +582,16 @@ export class RdDCombat {
|
||||
if (this.defender.isCreature()) {
|
||||
RdDItemCompetenceCreature.setRollDataCreature(rollData);
|
||||
}
|
||||
|
||||
return rollData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_getDiviseurSignificative(defenderRoll) {
|
||||
let facteurSign = 1;
|
||||
if (defenderRoll.surprise == 'demi'){
|
||||
if (defenderRoll.surprise == 'demi') {
|
||||
facteurSign *= 2;
|
||||
}
|
||||
}
|
||||
if (defenderRoll.needParadeSignificative) {
|
||||
facteurSign *= 2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user