29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
|
import { tmrColors, tmrConstants, TMRUtility } from "../tmr-utility.js";
|
||
|
import { Draconique } from "./draconique.js";
|
||
|
|
||
|
export class ReserveExtensible extends Draconique {
|
||
|
constructor() {
|
||
|
super();
|
||
|
}
|
||
|
|
||
|
type() { return 'tete' }
|
||
|
match(item) { return Draconique.isTeteDragon(item) && item.name.toLowerCase().includes("réserve extensible"); }
|
||
|
manualMessage() { return "Vous pouvez re-configurer votre Réserve extensible" }
|
||
|
async onActorCreateOwned(actor, item) { await this._creerCaseTmr(actor); }
|
||
|
|
||
|
code() { return 'reserve_extensible' }
|
||
|
tooltip(linkData) { return `Réserve extensible en ${TMRUtility.getTMR(linkData.data.coord).label} !` }
|
||
|
img() { return 'icons/svg/chest.svg' }
|
||
|
|
||
|
_createSprite(pixiTMR) {
|
||
|
return pixiTMR.sprite(this.code(), { color: tmrColors.tetes, decallage: tmrConstants.left});
|
||
|
}
|
||
|
|
||
|
async _creerCaseTmr(actor) {
|
||
|
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
|
||
|
const tmr = TMRUtility.getTMRAleatoire(it => !(it.type == 'fleuve' || existants.includes(it.coord)));
|
||
|
await this.createCaseTmr(actor, "Nouvelle Réserve extensible", tmr);
|
||
|
}
|
||
|
|
||
|
}
|