foundryvtt-reve-de-dragon/module/tmr/pelerinage.js

39 lines
1.2 KiB
JavaScript

import { Grammar } from "../grammar.js";
import { TMRUtility } from "../tmr-utility.js";
import { tmrTokenZIndex } from "../tmr-constants.js";
import { Draconique } from "./draconique.js";
import { TMRAnimations } from "./animation.js";
export class Pelerinage extends Draconique {
type() { return 'queue' }
match(item) { return Draconique.isQueueDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('pelerinage'); }
manualMessage() { return false }
async onActorCreateOwned(actor, queue) {
let tmr = await TMRUtility.getTMRAleatoire();
await this.createCaseTmr(actor, 'Pèlerinage', tmr, queue.id);
}
code() { return 'pelerinage' }
tooltip(linkData) { return `Lieu de pèlerinage` }
img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/pelerinage.svg' }
createSprite(pixiTMR) {
return TMRAnimations.withAnimation(
pixiTMR.sprite(this.code(), {
zIndex: tmrTokenZIndex.conquete,
decallage: pixiTMR.sizes.decallage(0, 0),
taille: () => pixiTMR.sizes.half,
}),
pixiTMR,
TMRAnimations.changeZoom()
)
}
async onActorDeleteCaseTmr(actor, casetmr) {
await actor.deleteEmbeddedDocuments('Item', [casetmr.system.sourceid]);
}
}