foundryvtt-reve-de-dragon/module/tmr/trou-noir.js

32 lines
1.1 KiB
JavaScript
Raw Normal View History

import { Grammar } from "../grammar.js";
import { TMRUtility } from "../tmr-utility.js";
2023-11-15 22:14:00 +01:00
import { tmrTokenZIndex } from "../tmr-constants.js";
import { Draconique } from "./draconique.js";
export class TrouNoir extends Draconique {
type() { return 'souffle' }
match(item) { return Draconique.isSouffleDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('trou noir'); }
manualMessage() { return false }
async onActorCreateOwned(actor, souffle) {
2022-06-12 12:14:55 +02:00
const existants = actor.items.filter(it => this.isCase(it)).map(it => it.system.coord);
2023-11-11 22:33:30 +01:00
const selectedTMR = await TMRUtility.getTMRAleatoire(tmr => !(TMRUtility.isCaseHumide(tmr) || existants.includes(tmr.coord)));
2023-11-15 22:14:00 +01:00
await this.createCaseTmr(actor, 'Trou noir', selectedTMR, souffle.id);
}
code() { return 'trounoir' }
2023-11-15 22:14:00 +01:00
tooltip(linkData) { return `Trou noir` }
img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/trounoir.svg' }
createSprite(pixiTMR) {
return pixiTMR.sprite(this.code(),
{
zIndex: tmrTokenZIndex.trounoir,
2023-11-15 22:14:00 +01:00
decallage: pixiTMR.sizes.decallage(0, 0),
taille: () => pixiTMR.sizes.full,
});
}
}