2025-01-11 19:45:58 +01:00
|
|
|
import { Grammar } from "../grammar.js";
|
2024-09-25 22:56:24 +02:00
|
|
|
import { ITEM_TYPES } from "../item.js";
|
2025-01-11 19:45:58 +01:00
|
|
|
import { LIST_CARAC_AUTRES } from "../rdd-carac.js";
|
2023-11-04 17:48:50 +01:00
|
|
|
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";
|
|
|
|
}
|
|
|
|
|
2024-12-04 15:55:09 +01:00
|
|
|
getEnduranceMax() { return Math.max(1, this.getVieMax() + this.getConstitution()) }
|
2023-11-04 17:48:50 +01:00
|
|
|
isCreature() { return true }
|
|
|
|
|
|
|
|
canReceive(item) {
|
2024-09-25 22:56:24 +02:00
|
|
|
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);
|
2023-11-21 16:03:26 +01:00
|
|
|
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-21 16:03:26 +01:00
|
|
|
});
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-01-11 19:45:58 +01:00
|
|
|
mapCarac(caracCode) {
|
|
|
|
switch (caracCode) {
|
2025-01-13 21:44:02 +01:00
|
|
|
case 'vue': case 'ouie': case 'odoratgout': case 'empathie': case 'perception':
|
2025-01-11 19:45:58 +01:00
|
|
|
return 'perception'
|
2025-01-13 21:44:02 +01:00
|
|
|
case 'agilite':
|
|
|
|
return 'force'
|
|
|
|
case 'force': case 'constitution': case 'taille': case 'reve': case 'volonte':
|
|
|
|
return caracCode
|
2025-01-11 19:45:58 +01:00
|
|
|
}
|
2025-01-13 21:44:02 +01:00
|
|
|
return undefined
|
2025-01-11 19:45:58 +01:00
|
|
|
}
|
|
|
|
|
2023-11-04 17:48:50 +01:00
|
|
|
}
|