Cleanup accorder entité
Méthode pour accorder une entité en double (dont une version sans xp, et message mal formaté)
This commit is contained in:
parent
2122a54db7
commit
e652027b02
@ -3589,17 +3589,17 @@ export class RdDActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async accorder(entite, when = 'avant-encaissement') {
|
async accorder(entite, when = 'avant-encaissement') {
|
||||||
if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar")
|
if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar")
|
||||||
|
|| entite == undefined
|
||||||
|| !entite.isEntite([ENTITE_INCARNE])
|
|| !entite.isEntite([ENTITE_INCARNE])
|
||||||
|| entite.isEntiteAccordee(this)) {
|
|| entite.isEntiteAccordee(this)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const tplData = this.system;
|
const rolled = await RdDResolutionTable.roll(this.getReveActuel(), - Number(entite.system.carac.niveau.value));
|
||||||
let rolled = await RdDResolutionTable.roll(this.getReveActuel(), - Number(entite.system.carac.niveau.value));
|
|
||||||
const rollData = {
|
const rollData = {
|
||||||
alias: this.name,
|
alias: this.name,
|
||||||
rolled: rolled,
|
rolled: rolled,
|
||||||
entite: entite.name,
|
entite: entite.name,
|
||||||
selectedCarac: tplData.carac.reve
|
selectedCarac: this.system.carac.reve
|
||||||
};
|
};
|
||||||
|
|
||||||
if (rolled.isSuccess) {
|
if (rolled.isSuccess) {
|
||||||
|
@ -767,7 +767,7 @@ export class RdDCombat {
|
|||||||
// whisper: ChatMessage.getWhisperRecipients("GM")})
|
// whisper: ChatMessage.getWhisperRecipients("GM")})
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (!await this.accorderEntite('avant-attaque')) {
|
if (!await this.attacker.accorder(this.defender, 'avant-attaque')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (arme.system.cac == 'empoignade' && this.attacker.isCombatTouche()) {
|
if (arme.system.cac == 'empoignade' && this.attacker.isCombatTouche()) {
|
||||||
@ -886,7 +886,7 @@ export class RdDCombat {
|
|||||||
}
|
}
|
||||||
await RdDResolutionTable.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.html');
|
await RdDResolutionTable.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.html');
|
||||||
|
|
||||||
if (!await this.accorderEntite('avant-defense')) {
|
if (!await this.attacker.accorder(this.defender, 'avant-defense')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1319,35 +1319,6 @@ export class RdDCombat {
|
|||||||
this.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
|
this.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
/* retourne true si on peut continuer, false si on ne peut pas continuer */
|
|
||||||
async accorderEntite(when = 'avant-encaissement') {
|
|
||||||
if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar")
|
|
||||||
|| this.defender == undefined
|
|
||||||
|| !this.defender.isEntite([ENTITE_INCARNE])
|
|
||||||
|| this.defender.isEntiteAccordee(this.attacker)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
let rolled = await RdDResolutionTable.roll(this.attacker.getReveActuel(), - Number(this.defender.system.carac.niveau.value));
|
|
||||||
|
|
||||||
let message = {
|
|
||||||
content: "Jet de points actuels de rêve à " + rolled.finalLevel + RdDResolutionTable.explain(rolled) + "<br>",
|
|
||||||
whisper: ChatMessage.getWhisperRecipients(this.attacker.name)
|
|
||||||
};
|
|
||||||
|
|
||||||
if (rolled.isSuccess) {
|
|
||||||
await this.defender.setEntiteReveAccordee(this.attacker);
|
|
||||||
message.content += this.attacker.name + " s'est accordé avec " + this.defender.name;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
message.content += this.attacker.name + " n'est pas accordé avec " + this.defender.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
ChatMessage.create(message);
|
|
||||||
return rolled.isSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async displayActorCombatStatus(combat, actor) {
|
static async displayActorCombatStatus(combat, actor) {
|
||||||
let formData = {
|
let formData = {
|
||||||
|
Loading…
Reference in New Issue
Block a user