foundryvtt-reve-de-dragon/module/actor/creature.js

37 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2023-11-04 17:48:50 +01:00
import { ENTITE_INCARNE } from "../constants.js";
import { ITEM_TYPES } from "../item.js";
2023-11-04 17:48:50 +01:00
import { STATUSES } from "../settings/status-effects.js";
import { RdDBaseActorSang } from "./base-actor-sang.js";
export class RdDCreature extends RdDBaseActorSang {
static get defaultIcon() {
return "systems/foundryvtt-reve-de-dragon/icons/creatures/bramart.svg";
}
isCreature() { return true }
canReceive(item) {
return item.type == ITEM_TYPES.competencecreature || item.isInventaire();
2023-11-04 17:48:50 +01:00
}
async remiseANeuf() {
await this.removeEffects(e => true);
await this.supprimerBlessures(it => true);
await this.update({
2023-11-04 17:48:50 +01:00
'system.sante.endurance.value': this.system.sante.endurance.max,
'system.sante.vie.value': this.system.sante.vie.max,
'system.sante.fatigue.value': 0
});
2023-11-04 17:48:50 +01:00
}
async finDeRoundBlessures() {
const nbGraves = this.filterItems(it => it.isGrave(), 'blessure').length;
if (nbGraves > 0) {
// Gestion blessure graves : -1 pt endurance par blessure grave
await this.santeIncDec("endurance", -nbGraves);
}
}
}