2021-02-12 18:31:49 +01:00
|
|
|
import { Grammar } from "../grammar.js";
|
|
|
|
import { tmrConstants, tmrTokenZIndex, TMRUtility } from "../tmr-utility.js";
|
|
|
|
import { Draconique } from "./draconique.js";
|
|
|
|
|
|
|
|
export class Pelerinage extends Draconique {
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
type() { return 'queue' }
|
|
|
|
match(item) { return Draconique.isQueueDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('pelerinage'); }
|
|
|
|
manualMessage() { return false }
|
|
|
|
|
|
|
|
async onActorCreateOwned(actor, queue) {
|
2021-05-11 21:45:43 +02:00
|
|
|
let tmr = await TMRUtility.getTMRAleatoire();
|
2021-03-29 23:41:08 +02:00
|
|
|
await this.createCaseTmr(actor, 'Pèlerinage: ' + tmr.label, tmr, queue.id);
|
2021-02-12 18:31:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
code() { return 'pelerinage' }
|
|
|
|
tooltip(linkData) { return `Votre pèlerinage en ${this.tmrLabel(linkData)}` }
|
2021-05-02 21:08:50 +02:00
|
|
|
img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/pelerin.webp' }
|
2021-02-12 18:31:49 +01:00
|
|
|
|
|
|
|
createSprite(pixiTMR) {
|
|
|
|
return pixiTMR.sprite(this.code(), {
|
|
|
|
zIndex: tmrTokenZIndex.conquete,
|
|
|
|
alpha: 1,
|
2021-05-04 12:22:19 +02:00
|
|
|
taille: tmrConstants.full,
|
|
|
|
decallage: tmrConstants.center
|
2021-02-12 18:31:49 +01:00
|
|
|
});
|
|
|
|
}
|
2021-02-28 01:52:58 +01:00
|
|
|
|
|
|
|
async onActorDeleteCaseTmr(actor, casetmr) {
|
2021-03-29 23:41:08 +02:00
|
|
|
await actor.deleteEmbeddedDocuments('Item', [casetmr.data.sourceid]);
|
2021-02-28 01:52:58 +01:00
|
|
|
}
|
|
|
|
|
2021-02-12 18:31:49 +01:00
|
|
|
}
|