forked from public/foundryvtt-reve-de-dragon
Bouton "don de haut-rêve"
Pour permettre au MJ de rendre un personnage haut rêvant sans avoir à chercher dans les compendiums
This commit is contained in:
@ -214,6 +214,8 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
});
|
||||
// Boutons spéciaux MJs
|
||||
this.html.find('.forcer-tmr-aleatoire').click(async event => this.actor.reinsertionAleatoire("Action MJ"))
|
||||
this.html.find('.don-de-haut-reve').click(async event => this.actor.addDonDeHautReve())
|
||||
|
||||
this.html.find('.afficher-tmr').click(async event => this.actor.changeTMRVisible())
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||
import { DialogChoixXpCarac } from "./dialog-choix-xp-carac.js";
|
||||
import { RdDItemArme } from "./item-arme.js";
|
||||
import { RdDCombatManager } from "./rdd-combat.js";
|
||||
import { RdDItemTete } from "./item/tete.js";
|
||||
import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||
|
||||
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
|
||||
|
||||
@ -87,7 +89,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
$computeIsHautRevant() {
|
||||
this.system.attributs.hautrevant.value = this.itemTypes['tete'].find(it => Grammar.equalsInsensitive(it.name, 'don de haut-reve'))
|
||||
this.system.attributs.hautrevant.value = this.itemTypes[ITEM_TYPES.tete].find(it => RdDItemTete.isDonDeHautReve(it))
|
||||
? "Haut rêvant"
|
||||
: "";
|
||||
}
|
||||
@ -989,6 +991,20 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addDonDeHautReve() {
|
||||
if (!game.user.isGM || this.isHautRevant()) {
|
||||
return
|
||||
}
|
||||
const tetes = await SystemCompendiums.getItems("tetes-de-dragon-pour-tous-personnages", ITEM_TYPES.tete)
|
||||
let don = tetes.filter(it => RdDItemTete.isDonDeHautReve(it)).map(it => it.toObject())
|
||||
if (don.length > 0) {
|
||||
this.createEmbeddedDocuments('Item', don)
|
||||
}
|
||||
else {
|
||||
ui.notifications.warn('Impossible de trouver la tête "don de haut-rêve", vérifiez le compendium de têtes pour tous personnages')
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async reinsertionAleatoire(raison, accessible = tmr => true) {
|
||||
|
14
module/item/tete.js
Normal file
14
module/item/tete.js
Normal file
@ -0,0 +1,14 @@
|
||||
import { Grammar } from "../grammar.js"
|
||||
import { ITEM_TYPES, RdDItem } from "../item.js"
|
||||
|
||||
export class RdDItemTete extends RdDItem {
|
||||
|
||||
static get defaultIcon() {
|
||||
return "systems/foundryvtt-reve-de-dragon/icons/tete_dragon.webp"
|
||||
}
|
||||
|
||||
static isDonDeHautReve(tete) {
|
||||
return tete.type == ITEM_TYPES.tete && Grammar.equalsInsensitive(tete.name, "Don de Haut-Rêve")
|
||||
}
|
||||
|
||||
}
|
@ -70,6 +70,7 @@ import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.
|
||||
import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js"
|
||||
import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
|
||||
import { RdDItemSort } from "./item-sort.js"
|
||||
import { RdDItemTete } from "./item/tete.js"
|
||||
|
||||
/**
|
||||
* RdD system
|
||||
@ -97,6 +98,7 @@ export class SystemReveDeDragon {
|
||||
ombre: RdDItemOmbre,
|
||||
poison: RdDItemPoison,
|
||||
queue: RdDItemQueue,
|
||||
tete: RdDItemTete,
|
||||
rencontre: RdDRencontre,
|
||||
service: RdDItemService,
|
||||
signedraconique: RdDItemSigneDraconique,
|
||||
|
@ -145,8 +145,8 @@ export class RdDUtility {
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.hbs',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queue.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-souffles.html',
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { HIDE_DICE, SYSTEM_RDD } from "../constants.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { RdDItem } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDDice } from "../rdd-dice.js";
|
||||
@ -84,15 +85,14 @@ export class SystemCompendiums extends FormApplication {
|
||||
static async getWorldOrCompendiumItems(itemType, compendium) {
|
||||
let items = game.items.filter(it => it.type == itemType)
|
||||
if (compendium) {
|
||||
const ids = items.map(it => it.id);
|
||||
const names = items.map(it => it.name.toLowerCase());
|
||||
const compendiumItems = await SystemCompendiums.getItems(compendium);
|
||||
items = items.concat(compendiumItems
|
||||
.filter(it => it.type == itemType)
|
||||
const ids = items.map(it => it.id)
|
||||
const names = items.map(it => Grammar.toLowerCaseNoAccent(it.name))
|
||||
const compendiumItems = await SystemCompendiums.getItems(compendium, itemType)
|
||||
return items.concat(compendiumItems
|
||||
.filter(it => !ids.includes(it.id))
|
||||
.filter(it => !names.includes(it.name.toLowerCase())));
|
||||
.filter(it => !names.includes(Grammar.equalsInsensitive(it.name))))
|
||||
}
|
||||
return items;
|
||||
return items
|
||||
}
|
||||
|
||||
static async loadDocument(document) {
|
||||
|
Reference in New Issue
Block a user