forked from public/foundryvtt-reve-de-dragon
		
	
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { ITEM_TYPES } from "../constants.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";
 | |
|   }
 | |
| 
 | |
|   getEnduranceMax() { return Math.max(1, this.getVieMax() + this.getConstitution()) }
 | |
|   isCreature() { return true }
 | |
| 
 | |
|   canReceive(item) {
 | |
|     return item.type == ITEM_TYPES.competencecreature || item.isInventaire();
 | |
|   }
 | |
| 
 | |
|   async remiseANeuf() {
 | |
|     await this.removeEffects(e => true);
 | |
|     await this.supprimerBlessures(it => true);
 | |
|     await this.update({
 | |
|       'system.sante.endurance.value': this.system.sante.endurance.max,
 | |
|       'system.sante.vie.value': this.system.sante.vie.max,
 | |
|       'system.sante.fatigue.value': 0
 | |
|     });
 | |
|   }
 | |
| 
 | |
|   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);
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   mapCarac(caracCode) {
 | |
|     switch (caracCode) {
 | |
|       case 'vue': case 'ouie': case 'odoratgout': case 'empathie': case 'perception':
 | |
|         return 'perception'
 | |
|       case 'agilite':
 | |
|         return 'force'
 | |
|       case 'force': case 'constitution': case 'taille': case 'reve': case 'volonte':
 | |
|         return caracCode
 | |
|     }
 | |
|     return undefined
 | |
|   }
 | |
| }
 |