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 })
    }
  }

}
