Calculs des informations dérivées
Calcul automatique des informations dérivées: - vie max - endurance max - bonus dommages Ces informations ne peuvent plus être saisies. L'endurance max des animaux est vie+constitution. Les entités non-incarnées n'ont pas de +dom
This commit is contained in:
@ -6,6 +6,7 @@ import { RdDBaseActorReve } from "./base-actor-reve.js";
|
||||
import { RdDDice } from "../rdd-dice.js";
|
||||
import { RdDItemBlessure } from "../item/blessure.js";
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { Misc } from "../misc.js";
|
||||
|
||||
/**
|
||||
* Classe de base pour les acteurs qui peuvent subir des blessures
|
||||
@ -14,25 +15,32 @@ import { ChatUtility } from "../chat-utility.js";
|
||||
*/
|
||||
export class RdDBaseActorSang extends RdDBaseActorReve {
|
||||
|
||||
prepareActorData() {
|
||||
this.system.sante.vie.max = Math.ceil((this.getTaille() + this.getConstitution()) / 2)
|
||||
this.system.sante.vie.value = Math.min(this.system.sante.vie.value, this.system.sante.vie.max)
|
||||
super.prepareActorData()
|
||||
this.system.attributs.encombrement.value = this.getEncombrementMax()
|
||||
}
|
||||
|
||||
getForce() { return Number(this.system.carac.force?.value ?? 0) }
|
||||
getForce() { return Misc.toInt(this.system.carac.force?.value) }
|
||||
getConstitution() { return Misc.toInt(this.system.carac.constitution?.value) }
|
||||
getVolonte() { return Misc.toInt(this.system.carac.volonte?.value) }
|
||||
|
||||
getBonusDegat() { return Number(this.system.attributs?.plusdom?.value ?? 0) }
|
||||
getProtectionNaturelle() { return Number(this.system.attributs?.protection?.value ?? 0) }
|
||||
getSConst() { return 0 }
|
||||
getVieMax() { return Misc.toInt(this.system.sante.vie?.max) }
|
||||
getEnduranceMax() { return Math.max(1, this.getTaille() + this.getConstitution()) }
|
||||
getFatigueMax() { return this.getEnduranceMax() * 2 }
|
||||
|
||||
getEnduranceMax() { return Math.max(1, Math.min(this.system.sante.endurance.max, MAX_ENDURANCE_FATIGUE)) }
|
||||
getProtectionNaturelle() { return Misc.toInt(this.system.attributs?.protection?.value) }
|
||||
|
||||
getFatigueActuelle() {
|
||||
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
|
||||
return Math.max(0, Math.min(this.getFatigueMax(), this.system.sante.fatigue?.value ?? 0));
|
||||
return Math.max(0, Math.min(this.getFatigueMax(), Misc.toInt(this.system.sante.fatigue?.value)))
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
getFatigueRestante() { return this.getFatigueMax() - this.getFatigueActuelle() }
|
||||
getFatigueMin() { return this.system.sante.endurance.max - this.system.sante.endurance.value }
|
||||
getFatigueMax() { return this.getEnduranceMax() * 2 }
|
||||
|
||||
malusFatigue() {
|
||||
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
|
||||
@ -42,7 +50,6 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getEncombrementMax() { return Number(this.system.attributs?.encombrement?.value ?? 0) }
|
||||
isSurenc() { return this.computeMalusSurEncombrement() < 0 }
|
||||
|
||||
computeMalusSurEncombrement() {
|
||||
|
Reference in New Issue
Block a user