Utilisation du nom du Nom du token
suite (pour les encaissements)
This commit is contained in:
parent
3906cb0a7b
commit
b892068b38
@ -415,47 +415,47 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async encaisser() { await RdDEncaisser.encaisser(this) }
|
async encaisser() { await RdDEncaisser.encaisser(this) }
|
||||||
|
|
||||||
async encaisserDommages(rollData, attacker = undefined, attackerToken = undefined, show = undefined) {
|
async encaisserDommages(rollData, attacker = undefined, show = undefined, attackerToken = undefined, defenderToken = undefined) {
|
||||||
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
|
if (attacker && !await attacker.accorder(this, 'avant-encaissement')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const armure = await this.computeArmure(rollData);
|
const armure = await this.computeArmure(rollData);
|
||||||
if (ReglesOptionnelles.isUsing('validation-encaissement-gr')) {
|
if (ReglesOptionnelles.isUsing('validation-encaissement-gr')) {
|
||||||
await this.encaisserDommagesValidationGR(rollData, armure, attackerToken, show);
|
await this.encaisserDommagesValidationGR(rollData, armure, show, attackerToken, defenderToken);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const jet = await RdDUtility.jetEncaissement(this, rollData, armure, { showDice: SHOW_DICE });
|
const jet = await RdDUtility.jetEncaissement(this, rollData, armure, { showDice: SHOW_DICE });
|
||||||
await this.$onEncaissement(jet, show, attackerToken)
|
await this.$onEncaissement(jet, show, attackerToken, defenderToken)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async encaisserDommagesValidationGR(rollData, armure, attackerToken, show) {
|
async encaisserDommagesValidationGR(rollData, armure, show, attackerToken, defenderToken) {
|
||||||
if (!game.user.isGM) {
|
if (!game.user.isGM) {
|
||||||
RdDBaseActor.remoteActorCall({
|
RdDBaseActor.remoteActorCall({
|
||||||
tokenId: this.token?.id,
|
tokenId: this.token?.id,
|
||||||
actorId: this.id,
|
actorId: this.id,
|
||||||
method: 'encaisserDommagesValidationGR',
|
method: 'encaisserDommagesValidationGR',
|
||||||
args: [rollData, armure, attackerToken, show]
|
args: [rollData, armure, show, attackerToken, defenderToken]
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
DialogValidationEncaissement.validerEncaissement(this, rollData, armure,
|
DialogValidationEncaissement.validerEncaissement(this, rollData, armure,
|
||||||
jet => this.$onEncaissement(jet, show, attackerToken));
|
jet => this.$onEncaissement(jet, show, attackerToken, defenderToken));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async $onEncaissement(jet, show, attackerToken) {
|
async $onEncaissement(jet, show, attackerToken, defenderToken) {
|
||||||
await this.onAppliquerJetEncaissement(jet, attackerToken);
|
await this.onAppliquerJetEncaissement(jet, attackerToken);
|
||||||
await this.$afficherEncaissement(jet, show);
|
await this.$afficherEncaissement(jet, show, defenderToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
async onAppliquerJetEncaissement(encaissement, attackerToken) { }
|
async onAppliquerJetEncaissement(encaissement, attackerToken) { }
|
||||||
|
|
||||||
async $afficherEncaissement(encaissement, show) {
|
async $afficherEncaissement(encaissement, show, defenderToken) {
|
||||||
foundry.utils.mergeObject(encaissement, {
|
foundry.utils.mergeObject(encaissement, {
|
||||||
alias: this.name,
|
alias: defenderToken?.name ?? this.name,
|
||||||
hasPlayerOwner: this.hasPlayerOwner,
|
hasPlayerOwner: this.hasPlayerOwner,
|
||||||
show: show ?? {}
|
show: show ?? {}
|
||||||
});
|
}, {overwrite: false});
|
||||||
|
|
||||||
await ChatUtility.createChatWithRollMode(
|
await ChatUtility.createChatWithRollMode(
|
||||||
{
|
{
|
||||||
|
@ -887,7 +887,7 @@ export class RdDCombat {
|
|||||||
attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker, this.defender.isEntite());
|
attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker, this.defender.isEntite());
|
||||||
let defenderRoll = { attackerRoll: attackerRoll, passeArme: attackerRoll.passeArme, show: {} }
|
let defenderRoll = { attackerRoll: attackerRoll, passeArme: attackerRoll.passeArme, show: {} }
|
||||||
attackerRoll.show = {
|
attackerRoll.show = {
|
||||||
cible: this.target ? this.defender.name : 'la cible',
|
cible: this.defenderToken?.name ?? 'la cible',
|
||||||
isRecul: (attackerRoll.particuliere == 'force' || attackerRoll.tactique == 'charge')
|
isRecul: (attackerRoll.particuliere == 'force' || attackerRoll.tactique == 'charge')
|
||||||
}
|
}
|
||||||
await RdDResolutionTable.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.html');
|
await RdDResolutionTable.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.html');
|
||||||
@ -1317,7 +1317,7 @@ export class RdDCombat {
|
|||||||
attackerRoll.defenderTokenId = this.defenderToken.id;
|
attackerRoll.defenderTokenId = this.defenderToken.id;
|
||||||
|
|
||||||
await this.computeRecul(defenderRoll);
|
await this.computeRecul(defenderRoll);
|
||||||
await this.defender.encaisserDommages(attackerRoll, this.attacker, this.attackerToken, defenderRoll?.show);
|
await this.defender.encaisserDommages(attackerRoll, this.attacker, defenderRoll?.show, this.attackerToken, this.defenderToken);
|
||||||
}
|
}
|
||||||
else { // envoi à un GM: les joueurs n'ont pas le droit de modifier les personnages qu'ils ne possèdent pas
|
else { // envoi à un GM: les joueurs n'ont pas le droit de modifier les personnages qu'ils ne possèdent pas
|
||||||
game.socket.emit(SYSTEM_SOCKET_ID, {
|
game.socket.emit(SYSTEM_SOCKET_ID, {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{{#if isGM}}
|
{{#if isGM}}
|
||||||
{{log this}}
|
|
||||||
<span>
|
<span>
|
||||||
{{#if (gt endurance 0)}}
|
{{#if (gt endurance 0)}}
|
||||||
De plus, {{alias}} a perdu {{endurance}} points d'endurance
|
De plus, {{alias}} a perdu {{endurance}} points d'endurance
|
||||||
|
Loading…
Reference in New Issue
Block a user