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

29 lines
690 B
JavaScript
Raw Normal View History

2023-11-03 20:21:17 +01:00
import { RdDBaseActor } from "./base-actor.js";
export class RdDVehicule extends RdDBaseActor {
static get defaultIcon() {
return "systems/foundryvtt-reve-de-dragon/icons/vehicules/charette.webp";
}
isVehicule() { return true }
canReceive(item) {
return item.isInventaire();
}
getEncombrementMax() {
return this.system.capacite_encombrement;
}
async vehicleIncDec(name, inc) {
if (!['resistance', 'structure'].includes(name)) {
return
}
const newValue = this.system.etat[name].value + inc;
if (0 <= newValue && newValue <= this.system.etat[name].max) {
await this.update({ [`system.etat.${name}.value`]: newValue })
}
}
}