parade corps à corps #68
This commit is contained in:
parent
afe5ddcb8d
commit
b4f298256a
@ -69,9 +69,10 @@ export class RdDItemArme extends Item {
|
||||
}
|
||||
|
||||
static mainsNues() {
|
||||
return {
|
||||
const mainsNues = {
|
||||
name: "Mains nues",
|
||||
data: { unemain: true, deuxmains: false, dommages: 0, dommagesReels: 0, mortalite: 'non-mortel' }
|
||||
}
|
||||
data: { unemain: true, deuxmains: false, dommages: 0, dommagesReels: 0, mortalite: 'non-mortel', competence: 'Corps à corps' }
|
||||
};
|
||||
return mainsNues
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,10 @@ export class RdDCombat {
|
||||
}
|
||||
switch (button) {
|
||||
case '#particuliere-attaque': return await this.choixParticuliere(rollData, event.currentTarget.attributes['data-mode'].value);
|
||||
case '#parer-button': return this.parade(rollData, event.currentTarget.attributes['data-armeid'].value);
|
||||
case '#parer-button': {
|
||||
const armeId = event.currentTarget.attributes['data-armeid'];
|
||||
return this.parade(rollData, armeId ? armeId.value : undefined);
|
||||
}
|
||||
case '#esquiver-button': return this.esquive(rollData);
|
||||
case '#encaisser-button': return this.encaisser(rollData, event.currentTarget.attributes['data-defenderTokenId'].value);
|
||||
}
|
||||
@ -255,7 +258,10 @@ export class RdDCombat {
|
||||
for (const arme of this._filterArmesParade(this.defender.data.items, rollData.competence.data.categorie)) {
|
||||
content += "<br><a class='chat-card-button' id='parer-button' data-attackerId='" + this.attackerId + "' data-defenderTokenId='" + this.defenderTokenId + "' data-armeid='" + arme._id + "'>Parer avec " + arme.name + "</a>";
|
||||
}
|
||||
|
||||
// corps à corps
|
||||
if (rollData.dmg.mortalite != 'mortel') {
|
||||
content += "<br><a class='chat-card-button' id='parer-button' data-attackerId='" + this.attackerId + "' data-defenderTokenId='" + this.defenderTokenId + "'>Parer à mains nues</a>";
|
||||
}
|
||||
// esquive
|
||||
if (rollData.competence.data.categorie == 'melee' || rollData.competence.data.categorie == "lancer" || rollData.competence.data.categorie == 'competencecreature') {
|
||||
content += "<br><a class='chat-card-button' id='esquiver-button' data-attackerId='" + this.attackerId + "' data-defenderTokenId='" + this.defenderTokenId + "'>Esquiver</a>";
|
||||
@ -339,7 +345,8 @@ export class RdDCombat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async parade(attackerRoll, armeParadeId) {
|
||||
let arme = this.defender.getOwnedItem(armeParadeId);
|
||||
|
||||
let arme = this._findArmeParade(armeParadeId);
|
||||
|
||||
console.log("RdDCombat.parade >>>", attackerRoll, armeParadeId, arme);
|
||||
|
||||
@ -361,13 +368,21 @@ export class RdDCombat {
|
||||
dialog.render(true);
|
||||
}
|
||||
|
||||
_prepareParade(attackerRoll, arme) {
|
||||
_findArmeParade(armeParadeId) {
|
||||
if (armeParadeId) {
|
||||
const armeItem = this.defender.getOwnedItem(armeParadeId);
|
||||
return armeItem.data;
|
||||
|
||||
}
|
||||
return RdDItemArme.mainsNues()
|
||||
}
|
||||
|
||||
_prepareParade(attackerRoll, armeParade) {
|
||||
const isCreature = this.defender.isCreature();
|
||||
const compName = isCreature ? arme.name : arme.data.data.competence;
|
||||
const compName = isCreature ? armeParade.name : armeParade.data.competence;
|
||||
const competence = this.defender.getCompetence(compName);
|
||||
const armeAttaque = attackerRoll.arme;
|
||||
const armeParade = arme.data;
|
||||
|
||||
|
||||
if (compName != competence.name) {
|
||||
// TODO: toujours utiliser competence.name ...
|
||||
ui.notifications.warn("Différence entre compétence " + competence.name + " et compétence de l'arme " + compName);
|
||||
@ -378,7 +393,7 @@ export class RdDCombat {
|
||||
diffLibre: attackerRoll.diffLibre,
|
||||
attackerRoll: attackerRoll,
|
||||
competence: competence,
|
||||
arme: arme.data,
|
||||
arme: armeParade,
|
||||
surprise: this.defender.getSurprise(),
|
||||
surpriseDefenseur: this.defender.getSurprise(),
|
||||
needSignificative: this._needSignificative(attackerRoll) || RdDItemArme.needParadeSignificative(armeAttaque, armeParade),
|
||||
|
Loading…
Reference in New Issue
Block a user