forked from public/foundryvtt-reve-de-dragon
pelerinage
+ suppression des cases quand le souffle/queue sont supprimés
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { tmrColors, tmrConstants, tmrTokenZIndex, TMRUtility } from "../tmr-utility.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { tmrConstants, tmrTokenZIndex, TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
|
||||
export class PresentCites extends Draconique {
|
||||
@ -9,15 +10,15 @@ export class PresentCites extends Draconique {
|
||||
}
|
||||
|
||||
type() { return 'tete' }
|
||||
match(item) { return Draconique.isTeteDragon(item) && item.name.toLowerCase() == 'présent des cités'; }
|
||||
match(item) { return Draconique.isTeteDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('present des cites'); }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, item) { await this._ajouterPresents(actor); }
|
||||
async onActorCreateOwned(actor, tete) { await this._ajouterPresents(actor, tete); }
|
||||
|
||||
code() { return 'present-cites' }
|
||||
tooltip(linkData) { return `La ${this.tmrLabel(linkData)} a un présent` }
|
||||
img() { return 'systems/foundryvtt-reve-de-dragon/icons/tmr/gift.svg' }
|
||||
|
||||
_createSprite(pixiTMR) {
|
||||
createSprite(pixiTMR) {
|
||||
return pixiTMR.sprite(this.code(),
|
||||
{
|
||||
zIndex: tmrTokenZIndex.tetes,
|
||||
@ -28,7 +29,7 @@ export class PresentCites extends Draconique {
|
||||
});
|
||||
}
|
||||
|
||||
async _ajouterPresents(actor) {
|
||||
async _ajouterPresents(actor, tete) {
|
||||
let existants = actor.data.items.filter(it => this.isCase(it)).map(it => it.data.coord);
|
||||
if (existants.length > 0) {
|
||||
ChatMessage.create({
|
||||
@ -39,7 +40,7 @@ export class PresentCites extends Draconique {
|
||||
else {
|
||||
let cites = TMRUtility.filterTMR(it => it.type == 'cite');
|
||||
for (let tmr of cites) {
|
||||
await this.createCaseTmr(actor, 'Présent: ' + tmr.label, tmr);
|
||||
await this.createCaseTmr(actor, 'Présent: ' + tmr.label, tmr, tete._id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user