forked from public/foundryvtt-reve-de-dragon
Support des blurettes
On peut définir Blurette comme type d'entité. Pas de jet poour s'accorder aux blurettes.
This commit is contained in:
@ -33,7 +33,8 @@ import { RollDataAjustements } from "./rolldata-ajustements.js";
|
||||
import { DialogItemAchat } from "./dialog-item-achat.js";
|
||||
import { RdDItem } from "./item.js";
|
||||
import { RdDPossession } from "./rdd-possession.js";
|
||||
import { SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
@ -239,7 +240,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getForce() {
|
||||
if (this.isEntiteCauchemar()) {
|
||||
if (this.isEntite()) {
|
||||
return Misc.toInt(Misc.templateData(this).carac.reve?.value);
|
||||
}
|
||||
return Misc.toInt(Misc.templateData(this).carac.force?.value);
|
||||
@ -612,7 +613,10 @@ export class RdDActor extends Actor {
|
||||
content: "Remise à neuf de " + this.name
|
||||
};
|
||||
const actorData = Misc.data(this);
|
||||
if (this.isEntiteCauchemar()) {
|
||||
if (this.isEntite([ENTITE_NONINCARNE])) {
|
||||
return;
|
||||
}
|
||||
if (this.isEntite([ENTITE_INCARNE, ENTITE_BLURETTE])) {
|
||||
await this.santeIncDec("endurance", actorData.data.sante.endurance.max - actorData.data.sante.endurance.value);
|
||||
}
|
||||
else {
|
||||
@ -1622,7 +1626,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async setSonne(sonne = true) {
|
||||
if (this.isEntiteCauchemar()) {
|
||||
if (this.isEntite()) {
|
||||
return;
|
||||
}
|
||||
if (!game.combat && sonne) {
|
||||
@ -1634,7 +1638,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getSConst() {
|
||||
if (this.isEntiteCauchemar()) {
|
||||
if (this.isEntite()) {
|
||||
return 0;
|
||||
}
|
||||
return RdDCarac.calculSConst(Misc.templateData(this).carac.constitution.value);
|
||||
@ -1751,7 +1755,7 @@ export class RdDActor extends Actor {
|
||||
result.newValue = Math.max(minValue, Math.min(compteur.value + inc, compteur.max));
|
||||
//console.log("New value ", inc, minValue, result.newValue);
|
||||
let fatigue = 0;
|
||||
if (name == "endurance" && !this.isEntiteCauchemar()) {
|
||||
if (name == "endurance" && !this.isEntite()) {
|
||||
if (result.newValue == 0 && inc < 0 && !isCritique) { // perte endurance et endurance devient 0 (sauf critique) -> -1 vie
|
||||
sante.vie.value--;
|
||||
result.perteVie = true;
|
||||
@ -1788,7 +1792,7 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
isDead() {
|
||||
return !this.isEntiteCauchemar() && Misc.templateData(this).sante.vie.value < -this.getSConst()
|
||||
return !this.isEntite() && Misc.templateData(this).sante.vie.value < -this.getSConst()
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -3347,7 +3351,7 @@ export class RdDActor extends Actor {
|
||||
let encaissement = await this.jetEncaissement(rollData);
|
||||
|
||||
this.ajouterBlessure(encaissement); // Will upate the result table
|
||||
const perteVie = this.isEntiteCauchemar()
|
||||
const perteVie = this.isEntite()
|
||||
? { newValue: 0 }
|
||||
: await this.santeIncDec("vie", - encaissement.vie);
|
||||
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, encaissement.critiques > 0);
|
||||
@ -3362,7 +3366,7 @@ export class RdDActor extends Actor {
|
||||
sonne: perteEndurance.sonne,
|
||||
jetEndurance: perteEndurance.jetEndurance,
|
||||
endurance: santeOrig.endurance.value - perteEndurance.newValue,
|
||||
vie: this.isEntiteCauchemar() ? 0 : (santeOrig.vie.value - perteVie.newValue),
|
||||
vie: this.isEntite() ? 0 : (santeOrig.vie.value - perteVie.newValue),
|
||||
show: defenderRoll?.show ?? {}
|
||||
});
|
||||
|
||||
@ -3552,8 +3556,8 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async accorder(entite, when = 'avant-encaissement') {
|
||||
if (when != game.settings.get(SYSTEM_RDD, "accorder-entite-cauchemar")
|
||||
|| !entite.isEntiteCauchemar()
|
||||
|| entite.isEntiteCauchemarAccordee(this)) {
|
||||
|| !entite.isEntite([ENTITE_INCARNE])
|
||||
|| entite.isEntiteAccordee(this)) {
|
||||
return true;
|
||||
}
|
||||
const tplData = Misc.templateData(this);
|
||||
@ -3577,20 +3581,21 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
isEntiteCauchemar() {
|
||||
return this.data.type == 'entite';
|
||||
isEntite(typeentite = [] ) {
|
||||
return this.data.type == 'entite' && (typeentite.length == 0 || typeentite.includes(this.data.data.typeentite));
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
isEntiteCauchemarAccordee(attaquant) {
|
||||
if (!this.isEntiteCauchemar()) { return true; }
|
||||
isEntiteAccordee(attaquant) {
|
||||
if (!this.isEntite([ENTITE_INCARNE]))
|
||||
{ return true; }
|
||||
let resonnance = Misc.templateData(this).sante.resonnance;
|
||||
return (resonnance.actors.find(it => it == attaquant.id));
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async setEntiteReveAccordee(attaquant) {
|
||||
if (!this.isEntiteCauchemar()) {
|
||||
if (!this.isEntite([ENTITE_INCARNE])) {
|
||||
ui.notifications.error("Impossible de s'accorder à " + this.name + ": ce n'est pas une entite de cauchemer/rêve");
|
||||
return;
|
||||
}
|
||||
@ -4153,7 +4158,7 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async setStatusEffect(label, status, updates = {}) {
|
||||
if (this.isEntiteCauchemar() || this.data.type == 'vehicule') {
|
||||
if (this.isEntite() || this.data.type == 'vehicule') {
|
||||
return;
|
||||
}
|
||||
console.log("setStatusEffect", label, status, updates)
|
||||
|
Reference in New Issue
Block a user