RollV2, tchat et appel chance
gestion des appels à la chance pour tout jet V2 correction de soucis forçage du jet continuation des messages de défense
This commit is contained in:
@@ -18,7 +18,8 @@ import { RdDInitiative } from "./initiative.mjs";
|
||||
import RollDialog from "./roll/roll-dialog.mjs";
|
||||
import { PART_DEFENSE } from "./roll/roll-part-defense.mjs";
|
||||
import { RollDialogAdapter } from "./roll/roll-dialog-adapter.mjs";
|
||||
import { DIFF, ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE } from "./roll/roll-constants.mjs";
|
||||
import { ROLL_TYPE_ATTAQUE, ROLL_TYPE_DEFENSE } from "./roll/roll-constants.mjs";
|
||||
import { OptionsAvancees, ROLL_DIALOG_V2_TEST } from "./settings/options-avancees.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const premierRoundInit = [
|
||||
@@ -402,19 +403,19 @@ export class RdDCombat {
|
||||
/* -------------------------------------------- */
|
||||
static registerChatCallbacks(html) {
|
||||
for (let button of [
|
||||
'.defense-button',
|
||||
'.parer-button',
|
||||
'.esquiver-button',
|
||||
'.button-defense',
|
||||
'.button-parade',
|
||||
'.button-esquive',
|
||||
'.button-encaisser',
|
||||
'.particuliere-attaque',
|
||||
'.encaisser-button',
|
||||
'.appel-chance-defense',
|
||||
'.appel-destinee-defense',
|
||||
'.appel-chance-attaque',
|
||||
'.appel-destinee-attaque',
|
||||
'.echec-total-attaque',
|
||||
'.appel-chance',
|
||||
'.chat-encaissement',
|
||||
'.resister-recul',
|
||||
// '.appel-chance',
|
||||
// '.chat-encaissement',
|
||||
// '.resister-recul',
|
||||
]) {
|
||||
$(html).on("click", button, event => {
|
||||
const rddCombat = RdDCombat.rddCombatForAttackerAndDefender(
|
||||
@@ -474,11 +475,11 @@ export class RdDCombat {
|
||||
|
||||
switch (button) {
|
||||
case '.particuliere-attaque': return await this.choixParticuliere(attackerRoll, event.currentTarget.attributes['data-mode'].value);
|
||||
case '.defense-button': return this.defenseV2(attackerRoll);
|
||||
case '.button-defense': return this.defenseV2(attackerRoll);
|
||||
|
||||
case '.parer-button': return this.parade(attackerRoll, armeParadeId);
|
||||
case '.esquiver-button': return this.esquive(attackerRoll, compId, competence);
|
||||
case '.encaisser-button': return this.encaisser(attackerRoll, defenderRoll);
|
||||
case '.button-parade': return this.parade(attackerRoll, armeParadeId);
|
||||
case '.button-esquive': return this.esquive(attackerRoll, compId, competence);
|
||||
case '.button-encaisser': return this.encaisser(attackerRoll, defenderRoll);
|
||||
case '.echec-total-attaque': return this._onEchecTotal(attackerRoll);
|
||||
|
||||
case '.appel-chance-attaque': return this.attacker.rollAppelChance(
|
||||
@@ -488,11 +489,9 @@ export class RdDCombat {
|
||||
() => this.defenseChanceuse(attackerRoll, defenderRoll),
|
||||
() => this.afficherOptionsDefense(attackerRoll, defenderRoll, { defenseChance: true }));
|
||||
case '.appel-destinee-attaque': return this.attacker.appelDestinee(
|
||||
() => this.attaqueSignificative(attackerRoll),
|
||||
() => { });
|
||||
() => this.attaqueSignificative(attackerRoll));
|
||||
case '.appel-destinee-defense': return this.defender.appelDestinee(
|
||||
() => this.defenseDestinee(defenderRoll),
|
||||
() => { });
|
||||
() => this.defenseDestinee(defenderRoll));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,10 +968,8 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
async defenseV2(attackerRoll) {
|
||||
|
||||
// this._prepareParade(attackerRoll, arme, competence);
|
||||
const rollData =
|
||||
{
|
||||
await this.doRollDefense({
|
||||
ids: {
|
||||
actorId: this.defender.id,
|
||||
actorTokenId: this.defenderTokenId,
|
||||
@@ -982,24 +979,26 @@ export class RdDCombat {
|
||||
type: { allowed: ['defense'], current: 'defense' },
|
||||
attackerRoll: RollDialogAdapter.mapActionAttaque(attackerRoll),
|
||||
passeArme: attackerRoll.passeArme,
|
||||
}
|
||||
|
||||
await RollDialog.create(rollData, {
|
||||
onRollDone: (dialog) => {
|
||||
// dialog.close()
|
||||
},
|
||||
customChatMessage: true,
|
||||
callbacks: [async (roll) => {
|
||||
this.removeChatMessageActionsPasseArme(roll.passeArme)
|
||||
// defense: esquive / arme de parade / competence de défense
|
||||
if (!RdDCombat.isParticuliere(roll)) {
|
||||
await roll.active.actor.incDecItemUse(roll.current[PART_DEFENSE].defense?.id,)
|
||||
}
|
||||
await this._onDefense(roll)
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
async doRollDefense(rollData) {
|
||||
await RollDialog.create(rollData, {
|
||||
onRollDone: (dialog) => {
|
||||
if (!OptionsAvancees.isUsing(ROLL_DIALOG_V2_TEST))
|
||||
dialog.close()
|
||||
},
|
||||
customChatMessage: true,
|
||||
callbacks: [async (roll) => {
|
||||
this.removeChatMessageActionsPasseArme(roll.passeArme);
|
||||
// defense: esquive / arme de parade / competence de défense
|
||||
if (!RdDCombat.isParticuliere(roll)) {
|
||||
await roll.active.actor.incDecItemUse(roll.current[PART_DEFENSE].defense?.id);
|
||||
}
|
||||
await this._onDefense(roll);
|
||||
}]
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_prepareParade(attackerRoll, armeParade, competenceParade) {
|
||||
@@ -1369,6 +1368,3 @@ export class RdDCombat {
|
||||
}
|
||||
}
|
||||
|
||||
function newFunction(attackerRoll) {
|
||||
return attackerRoll.diffLibre;
|
||||
}
|
||||
|
Reference in New Issue
Block a user