forked from public/foundryvtt-reve-de-dragon
Séparation de l'Actor Vehicule
This commit is contained in:
28
module/actor/vehicule.js
Normal file
28
module/actor/vehicule.js
Normal file
@ -0,0 +1,28 @@
|
||||
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 })
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user