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

36 lines
1.2 KiB
JavaScript
Raw Normal View History

import { Grammar } from "../grammar.js";
import { tmrColors, tmrConstants, tmrTokenZIndex, TMRUtility } from "../tmr-utility.js";
import { Draconique } from "./draconique.js";
export class TrouNoir extends Draconique {
constructor() {
super();
}
type() { return 'souffle' }
match(item) { return Draconique.isSouffleDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('trou noir'); }
manualMessage() { return false }
async onActorCreateOwned(actor, souffle) {
const existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
2021-05-11 21:45:43 +02:00
const tmr = await TMRUtility.getTMRAleatoire(it => !(TMRUtility.isCaseHumide(it) || existants.includes(it.coord)));
await this.createCaseTmr(actor, 'Trou noir: ' + tmr.label, tmr, souffle.id);
}
code() { return 'trounoir' }
tooltip(linkData) { return `Trou noir en ${this.tmrLabel(linkData)} !` }
img() { return 'icons/svg/explosion.svg' }
createSprite(pixiTMR) {
return pixiTMR.sprite(this.code(),
{
zIndex: tmrTokenZIndex.trounoir,
color: tmrColors.trounoir,
alpha: 1, taille:
tmrConstants.full,
decallage: { x: 2, y: 2 },
});
}
}