Enchantement des gemmes et potions
This commit is contained in:
parent
b29027c61a
commit
d917f80e88
@ -1,4 +1,10 @@
|
|||||||
# 12.0
|
# 12.0
|
||||||
|
## 12.0.37 - Les enchantements d'Astrobazzarh
|
||||||
|
- les potions ont un état, seules les potions liquides sont enchantables
|
||||||
|
- les lancements de sorts du jour sont conservés jusqu'à chateau dormant
|
||||||
|
- lorsqu'un joueur souhaite enchanter une potion, les sorts d'enchantements/purification/permanence doivent avoir été lancés auparavant
|
||||||
|
- on peut enchanter des gemmes exactement comme des potions
|
||||||
|
|
||||||
## 12.0.36 - L'alchimie d'Astrobazzarh
|
## 12.0.36 - L'alchimie d'Astrobazzarh
|
||||||
- Nouveautés
|
- Nouveautés
|
||||||
- ajout d'un bouton pour enchanter les potions
|
- ajout d'un bouton pour enchanter les potions
|
||||||
|
@ -166,22 +166,29 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async $perteRevePotionsEnchantees() {
|
async $perteReveEnchantementsChateauDormants() {
|
||||||
const potionUpdates = this.itemTypes[ITEM_TYPES.potion].map(it => it.perteRevePotion())
|
const toUpdate = this.items.filter(it => [ITEM_TYPES.potion, ITEM_TYPES.gemme].includes(it.type))
|
||||||
|
.map(it => it.perteReveChateauDormant())
|
||||||
.filter(it => it != undefined)
|
.filter(it => it != undefined)
|
||||||
if (potionUpdates.length > 0) {
|
|
||||||
console.log('perte rêve de potions', potionUpdates)
|
if (toUpdate.length > 0) {
|
||||||
const messageUpdates = await Promise.all(potionUpdates.map(async p => await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, {
|
console.log('perte de rêve des enchantements', toUpdate)
|
||||||
pr: foundry.utils.getProperty(p, 'system.pr'),
|
const messageUpdates = await Promise.all(
|
||||||
alias: this.getAlias(),
|
toUpdate.map(async it => await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-pertereve-enchantement-chateaudormant.hbs`, it)))
|
||||||
potionName: p.name,
|
|
||||||
potionImg: p.img
|
|
||||||
})))
|
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
whisper: ChatUtility.getOwners(this),
|
whisper: ChatUtility.getOwners(this),
|
||||||
content: messageUpdates.reduce(Misc.joining('<br>'))
|
content: messageUpdates.reduce(Misc.joining('<br>'))
|
||||||
})
|
})
|
||||||
await this.updateEmbeddedDocuments('Item', potionUpdates);
|
await this.updateEmbeddedDocuments('Item', toUpdate.map(it => it.update));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async $suppressionLancementsSort() {
|
||||||
|
const updates = this.itemTypes[ITEM_TYPES.sort]
|
||||||
|
.filter(it => it.system.lancements.length > 0)
|
||||||
|
.map(it => { return { _id: it.id, 'system.lancements': [] } })
|
||||||
|
if (updates.length > 0) {
|
||||||
|
await this.updateEmbeddedDocuments('Item', updates)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,13 +284,14 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
};
|
};
|
||||||
|
|
||||||
await this._recuperationSante(message)
|
await this._recuperationSante(message)
|
||||||
await this._recupereMoralChateauDormant(message);
|
await this._recupereMoralChateauDormant(message)
|
||||||
await this._recupereChance();
|
await this._recupereChance()
|
||||||
await this.transformerStress();
|
await this.transformerStress()
|
||||||
await this.retourSeuilDeReve(message);
|
await this.retourSeuilDeReve(message)
|
||||||
await this.setBonusPotionSoin(0);
|
await this.setBonusPotionSoin(0)
|
||||||
await this.retourSust(message);
|
await this.retourSust(message)
|
||||||
await this.$perteRevePotionsEnchantees();
|
await this.$perteReveEnchantementsChateauDormants()
|
||||||
|
await this.$suppressionLancementsSort()
|
||||||
await RdDCoeur.applyCoeurChateauDormant(this, message)
|
await RdDCoeur.applyCoeurChateauDormant(this, message)
|
||||||
if (message.content != "") {
|
if (message.content != "") {
|
||||||
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
|
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
|
||||||
@ -1204,9 +1212,9 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async actionHerbe(item, onActionItem = async () => { }) {
|
async fabriquerDecoctionHerbe(item) {
|
||||||
if (item.isHerbeAPotion()) {
|
if (item.isHerbeAPotion()) {
|
||||||
return DialogFabriquerPotion.create(this, item, onActionItem);
|
return DialogFabriquerPotion.create(this, item);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1726,6 +1734,17 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
if (rollData.isSortReserve) {
|
if (rollData.isSortReserve) {
|
||||||
await this.sortMisEnReserve(selectedSort, rollData.competence, rollData.tmr.coord, Number(selectedSort.system.ptreve_reel));
|
await this.sortMisEnReserve(selectedSort, rollData.competence, rollData.tmr.coord, Number(selectedSort.system.ptreve_reel));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
console.log('lancement de sort', rollData.selectedSort)
|
||||||
|
const precedents = rollData.selectedSort.system.lancements ?? []
|
||||||
|
const lancements = [...precedents, {
|
||||||
|
timestamp: game.system.rdd.calendrier.getTimestamp(),
|
||||||
|
reve: rollData.selectedSort.system.ptreve_reel
|
||||||
|
}]
|
||||||
|
await this.updateEmbeddedDocuments('Item',
|
||||||
|
[{ _id: rollData.selectedSort._id, 'system.lancements': lancements }]
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rollData.depenseReve = 0;
|
rollData.depenseReve = 0;
|
||||||
@ -2849,12 +2868,13 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async fabriquerPotion(herbeData) {
|
async fabriquerPotion(herbeData) {
|
||||||
let newPotion = {
|
const newPotion = {
|
||||||
name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion',
|
name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion',
|
||||||
img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp",
|
img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp",
|
||||||
system: {
|
system: {
|
||||||
quantite: 1, cout: 0, encombrement: 0.1,
|
quantite: 1, cout: 0, encombrement: 0.1,
|
||||||
categorie: herbeData.system.categorie,
|
categorie: herbeData.system.categorie,
|
||||||
|
etat: 'Liquide',
|
||||||
herbe: herbeData.name,
|
herbe: herbeData.name,
|
||||||
rarete: herbeData.system.rarete,
|
rarete: herbeData.system.rarete,
|
||||||
herbebrins: herbeData.nbBrins,
|
herbebrins: herbeData.nbBrins,
|
||||||
@ -2862,29 +2882,23 @@ export class RdDActor extends RdDBaseActorSang {
|
|||||||
description: ""
|
description: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.createEmbeddedDocuments('Item', [newPotion], { renderSheet: true });
|
await this.createEmbeddedDocuments('Item', [newPotion])
|
||||||
|
await this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins)
|
||||||
let newQuantite = herbeData.system.quantite - herbeData.nbBrins;
|
|
||||||
let messageData = {
|
|
||||||
alias: this.getAlias(),
|
|
||||||
nbBrinsReste: newQuantite,
|
|
||||||
potion: newPotion,
|
|
||||||
herbe: herbeData
|
|
||||||
}
|
|
||||||
this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins);
|
|
||||||
|
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
whisper: ChatUtility.getOwners(this),
|
whisper: ChatUtility.getOwners(this),
|
||||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, messageData)
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html`, {
|
||||||
});
|
alias: this.getAlias(),
|
||||||
|
nbBrinsReste: herbeData.system.quantite - herbeData.nbBrins,
|
||||||
|
potion: newPotion,
|
||||||
|
herbe: herbeData
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async diminuerQuantiteObjet(id, nb, options = { supprimerSiZero: false }) {
|
async diminuerQuantiteObjet(id, nb, options = { supprimerSiZero: false }) {
|
||||||
const item = this.getItem(id);
|
await this.getItem(id)?.diminuerQuantite(nb, options);
|
||||||
if (item) {
|
|
||||||
await item.diminuerQuantite(nb, options);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -1,88 +1,79 @@
|
|||||||
import { Grammar } from "./grammar.js";
|
|
||||||
import { Misc } from "./misc.js";
|
import { Misc } from "./misc.js";
|
||||||
import { RdDUtility } from "./rdd-utility.js";
|
import { RdDUtility } from "./rdd-utility.js";
|
||||||
|
|
||||||
export class DialogFabriquerPotion extends Dialog {
|
export class DialogFabriquerPotion extends Dialog {
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async create(actor, item, onActionItem) {
|
static async create(actor, item) {
|
||||||
const min = DialogFabriquerPotion.nombreBrinsMinimum(item);
|
const brinsMinimum = DialogFabriquerPotion.nombreBrinsMinimum(item)
|
||||||
if (item.system.quantite < min) {
|
if (item.system.quantite < brinsMinimum) {
|
||||||
ui.notifications.warn(`Vous avez ${item.system.quantite} brins de ${item.name}, il en faut au moins ${min} pour faire une potion!`);
|
ui.notifications.warn(`Vous avez ${item.system.quantite} brins de ${item.name}, il en faut au moins ${brinsMinimum} pour faire une potion!`)
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
let potionData = DialogFabriquerPotion.prepareData(actor, item);
|
const potionData = DialogFabriquerPotion.prepareData(item, brinsMinimum)
|
||||||
|
const options = { classes: ["dialogfabriquerpotion"], width: 600, height: 160, 'z-index': 99999 }
|
||||||
|
const html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.html', potionData)
|
||||||
|
|
||||||
const html = await renderTemplate( 'systems/foundryvtt-reve-de-dragon/templates/dialog-fabriquer-potion-base.html', potionData);
|
new DialogFabriquerPotion(actor, potionData, html, options).render(true)
|
||||||
|
|
||||||
let options = { classes: ["dialogfabriquerpotion"], width: 600, height: 160, 'z-index': 99999 };
|
|
||||||
new DialogFabriquerPotion(actor, potionData, onActionItem, html, options).render(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static prepareData(actor, item) {
|
static prepareData(item, brinsMinimum) {
|
||||||
let potionData = foundry.utils.duplicate(item)
|
const brinsOptimal = DialogFabriquerPotion.nombreBrinsOptimal(item)
|
||||||
potionData.nbBrinsSelect = RdDUtility.buildListOptions(
|
return foundry.utils.mergeObject(foundry.utils.duplicate(item), {
|
||||||
DialogFabriquerPotion.nombreBrinsMinimum(item),
|
nbBrinsSelect: RdDUtility.buildListOptions(brinsMinimum, brinsOptimal),
|
||||||
DialogFabriquerPotion.nombreBrinsOptimal(item));
|
nbBrins: Math.min(item.system.quantite, brinsOptimal),
|
||||||
potionData.nbBrins = Math.min(potionData.system.quantite, DialogFabriquerPotion.nombreBrinsOptimal(potionData));
|
herbebonus: item.system.niveau
|
||||||
potionData.herbebonus = item.system.niveau;
|
})
|
||||||
potionData.buttonName = "Fabriquer";
|
|
||||||
return potionData;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
constructor(actor, potionData, onActionItem, html, options) {
|
constructor(actor, potionData, html, options) {
|
||||||
const conf = {
|
const conf = {
|
||||||
title: `Fabriquer une potion de ${potionData.system.categorie}`,
|
title: `Fabriquer une potion de ${potionData.system.categorie}`,
|
||||||
content: html,
|
content: html,
|
||||||
default: 'fabriquer',
|
default: 'fabriquer',
|
||||||
buttons: {
|
buttons: {
|
||||||
'fabriquer': {
|
'fabriquer': { label: "Fabriquer", callback: it => this.onFabriquer() }
|
||||||
label: potionData.buttonName, callback: it => this.onFabriquer()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
super(conf, options)
|
||||||
|
|
||||||
super(conf, options);
|
this.actor = actor
|
||||||
|
this.potionData = potionData
|
||||||
this.actor = actor;
|
|
||||||
this.potionData = potionData;
|
|
||||||
this.onActionItem = onActionItem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html)
|
||||||
this.html = html;
|
this.html = html
|
||||||
this.html.find("[name='nbBrins']").change(event => {
|
this.html.find("[name='nbBrins']").change(event => {
|
||||||
this.potionData.nbBrins = Misc.toInt(event.currentTarget.value);
|
this.potionData.nbBrins = Misc.toInt(event.currentTarget.value)
|
||||||
const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins);
|
const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins)
|
||||||
this.potionData.herbebonus = Math.max(0, this.potionData.system.niveau - brinsManquants)
|
this.potionData.herbebonus = Math.max(0, this.potionData.system.niveau - brinsManquants)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async onFabriquer() {
|
async onFabriquer() {
|
||||||
await this.html.find("[name='nbBrins']").change();
|
await this.html.find("[name='nbBrins']").change()
|
||||||
await this.actor.fabriquerPotion(this.potionData);
|
await this.actor.fabriquerPotion(this.potionData)
|
||||||
this.close();
|
this.close()
|
||||||
await this.onActionItem()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static nombreBrinsMinimum(herbeData) {
|
static nombreBrinsMinimum(herbeData) {
|
||||||
switch (herbeData.system.categorie ?? '') {
|
switch (herbeData.system.categorie ?? '') {
|
||||||
case "Soin": return 1 + Math.max(0, 12 - 2 * herbeData.system.niveau);
|
case "Soin": return 1 + Math.max(0, 12 - 2 * herbeData.system.niveau)
|
||||||
case "Repos": return 1 + Math.max(0, 7 - 2 * herbeData.system.niveau);
|
case "Repos": return 1 + Math.max(0, 7 - 2 * herbeData.system.niveau)
|
||||||
}
|
}
|
||||||
return 1;
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
static nombreBrinsOptimal(herbeData) {
|
static nombreBrinsOptimal(herbeData) {
|
||||||
switch (herbeData.system.categorie ?? '') {
|
switch (herbeData.system.categorie ?? '') {
|
||||||
case "Soin": return 12 - herbeData.system.niveau;
|
case "Soin": return 12 - herbeData.system.niveau
|
||||||
case "Repos": return 7 - herbeData.system.niveau;
|
case "Repos": return 7 - herbeData.system.niveau
|
||||||
}
|
}
|
||||||
return 1;
|
return 1
|
||||||
}
|
}
|
||||||
}
|
}
|
177
module/enchantement/dialog-enchanter.js
Normal file
177
module/enchantement/dialog-enchanter.js
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
import { ITEM_TYPES } from "../constants.js"
|
||||||
|
import { RdDItemSort } from "../item-sort.js"
|
||||||
|
import { Misc } from "../misc.js"
|
||||||
|
|
||||||
|
export const ACTION_ITEM_ENCHANTER = {
|
||||||
|
code: 'item-enchanter', label: 'Enchanter', icon: it => 'fa-solid fa-sparkles',
|
||||||
|
filter: it => game.user.isGM || DialogEnchanter.isEnchantable(it),
|
||||||
|
optionsFilter: options => options.editable,
|
||||||
|
action: (item, actor) => DialogEnchanter.enchanter(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DialogEnchanter extends Dialog {
|
||||||
|
|
||||||
|
static isEnchantable(item) {
|
||||||
|
if (!item.isEnchantementPossible) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (game.user.isGM) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if (item.system.prpermanent) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (!item.parent?.isHautRevant()) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return RdDItemSort.lancements(RdDItemSort.findEnchantement(item.parent)) > 0
|
||||||
|
|| RdDItemSort.lancements(RdDItemSort.findPurification(item.parent)) > 0
|
||||||
|
|| RdDItemSort.lancements(RdDItemSort.findPermanence(item.parent)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
static dateEnchantement() {
|
||||||
|
return game.system.rdd.calendrier.getTimestamp().debutJournee().indexDate
|
||||||
|
}
|
||||||
|
|
||||||
|
static async enchanter(item) {
|
||||||
|
const actor = item.parent
|
||||||
|
const sorts = {
|
||||||
|
enchantement: RdDItemSort.findEnchantement(actor),
|
||||||
|
purification: RdDItemSort.findPurification(actor),
|
||||||
|
permanence: RdDItemSort.findPermanence(actor)
|
||||||
|
}
|
||||||
|
const nouveauxpr = (sorts.enchantement?.system.lancements ?? []).map(it => it.reve)
|
||||||
|
const purification = (sorts.purification?.system.lancements ?? []).find(it => true)
|
||||||
|
const permanence = (sorts.permanence?.system.lancements ?? []).find(it => true)
|
||||||
|
|
||||||
|
const enchanter = {
|
||||||
|
type: item.type == ITEM_TYPES.potion ? 'potion' : Misc.typeName('Item', item.type),
|
||||||
|
actor: actor,
|
||||||
|
item: item,
|
||||||
|
reve: item.system.pr,
|
||||||
|
sorts: sorts,
|
||||||
|
nouveauxpr: nouveauxpr,
|
||||||
|
purification: purification != undefined,
|
||||||
|
permanence: permanence != undefined,
|
||||||
|
options: { isGM: game.user.isGM }
|
||||||
|
}
|
||||||
|
if (!item.isEnchantementPossible) {
|
||||||
|
ui.notifications.info("Seuls les liquides et les gemmes sont enchantables")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (item.system.prpermanent) {
|
||||||
|
ui.notifications.info(`La ${enchanter.type} est permanente`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!game.user.isGM) {
|
||||||
|
if (!(actor?.isPersonnage() || actor?.isHautRevant())) {
|
||||||
|
ui.notifications.info(`Seul un haut rêvant peut enchanter une ${enchanter.type}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (item.system.quantite != 1) {
|
||||||
|
ui.notifications.info(`Impossible d'enchanter ${item.system.quantite} ${enchanter.type}s ${item.system.quantite > 1 ? 'en une seule fois' : ''}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!(nouveauxpr.length > 0 || purification || permanence)) {
|
||||||
|
ui.notifications.info("Le haut-rêvant n'a lancé de rituel d'enchantement")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (item.system.magique && item.system.purifie && !purification && !permanence) {
|
||||||
|
ui.notifications.info(`La ${enchanter.type} est déjà enchantée et doit être purifiée`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/enchantement/dialog-enchanter.hbs`, enchanter)
|
||||||
|
const dialog = new DialogEnchanter(enchanter, html)
|
||||||
|
dialog.render(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(enchanter, html) {
|
||||||
|
let options = { classes: ["dialog-enchanter"], width: 400, height: 'fit-content', 'z-index': 99999 }
|
||||||
|
let conf = {
|
||||||
|
title: `Enchanter une ${enchanter.type}`,
|
||||||
|
content: html,
|
||||||
|
default: "enchanter",
|
||||||
|
buttons: {
|
||||||
|
"enchanter": { label: "Enchanter", callback: it => this.onEnchanter() }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
super(conf, options)
|
||||||
|
this.html = html
|
||||||
|
this.enchanter = enchanter
|
||||||
|
this.item = enchanter.item
|
||||||
|
}
|
||||||
|
|
||||||
|
activateListeners(html) {
|
||||||
|
super.activateListeners(html)
|
||||||
|
this.html = html
|
||||||
|
this.html.find("input.enchantement").change(event => this.$onSelectEnchantement(event))
|
||||||
|
this.html.find("input.reve").change(event => this.$onForceReve(event))
|
||||||
|
}
|
||||||
|
|
||||||
|
$onSelectEnchantement(event) {
|
||||||
|
const addReve = $(event.currentTarget).data('reve')
|
||||||
|
this.enchanter.idx = $(event.currentTarget).data('idx')
|
||||||
|
this.enchanter.reve = this.item.system.pr + Number(addReve)
|
||||||
|
this.html.find("input.reve").val(this.enchanter.reve)
|
||||||
|
for (let idx = 0; idx < this.enchanter.nouveauxpr.length; idx++) {
|
||||||
|
if (idx != this.enchanter.idx) {
|
||||||
|
this.html.find(`.enchantement[data-idx='${idx}']`).prop("checked", false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$onForceReve(event) {
|
||||||
|
const newReve = Number(event.currentTarget.value)
|
||||||
|
if (this.enchanter.reve != newReve) {
|
||||||
|
this.enchanter.idx = undefined
|
||||||
|
}
|
||||||
|
this.enchanter.reve = newReve
|
||||||
|
}
|
||||||
|
|
||||||
|
async onEnchanter() {
|
||||||
|
foundry.utils.mergeObject(this.enchanter,
|
||||||
|
{
|
||||||
|
rendrepurifie: this.html.find("input.rendrepurifie").prop("checked"),
|
||||||
|
rendrepermanent: this.html.find("input.rendrepermanent").prop("checked"),
|
||||||
|
addreve: this.enchanter.reve != this.item.system.pr
|
||||||
|
},
|
||||||
|
{ inplace: true })
|
||||||
|
const item = this.enchanter.item
|
||||||
|
const actor = this.enchanter.actor
|
||||||
|
|
||||||
|
if (this.enchanter.reve == 0) {
|
||||||
|
await item.update({
|
||||||
|
'system.pr': 0,
|
||||||
|
'system.magique': false,
|
||||||
|
'system.purifie': false,
|
||||||
|
'system.prpermanent': false,
|
||||||
|
'system.prdate': 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const isPurifiee = this.enchanter.addreve
|
||||||
|
? (this.enchanter.rendrepurifie && (item.item.system.pr == 0 ? true : item.system.purifie))
|
||||||
|
: (this.enchanter.rendrepurifie || item.system.purifie)
|
||||||
|
await item.update({
|
||||||
|
'system.pr': this.enchanter.reve,
|
||||||
|
'system.magique': true,
|
||||||
|
'system.purifie': isPurifiee,
|
||||||
|
'system.prpermanent': item.system.prpermanent || this.enchanter.rendrepermanent,
|
||||||
|
'system.prdate': DialogEnchanter.dateEnchantement()
|
||||||
|
})
|
||||||
|
if (actor) {
|
||||||
|
if (this.enchanter.rendrepurifie) {
|
||||||
|
await RdDItemSort.changeLancementsSort(this.enchanter.sorts.purification, it => it.slice(1));
|
||||||
|
}
|
||||||
|
if (this.enchanter.rendrepermanent) {
|
||||||
|
await RdDItemSort.changeLancementsSort(this.enchanter.sorts.permanence, it => it.slice(1));
|
||||||
|
}
|
||||||
|
if (this.enchanter.addreve && this.enchanter.idx != undefined) {
|
||||||
|
await RdDItemSort.changeLancementsSort(RdDItemSort.findEnchantement(actor), it => it.toSpliced(this.enchanter.idx, 1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,6 @@ import { ACTOR_TYPES, ITEM_TYPES } from "./constants.js";
|
|||||||
import { RdDItemSort } from "./item-sort.js";
|
import { RdDItemSort } from "./item-sort.js";
|
||||||
import { RdDUtility } from "./rdd-utility.js";
|
import { RdDUtility } from "./rdd-utility.js";
|
||||||
import { RdDItemCompetence } from "./item-competence.js";
|
import { RdDItemCompetence } from "./item-competence.js";
|
||||||
import { RdDGemme } from "./rdd-gemme.js";
|
|
||||||
import { HtmlUtility } from "./html-utility.js";
|
import { HtmlUtility } from "./html-utility.js";
|
||||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
||||||
import { SYSTEM_RDD } from "./constants.js";
|
import { SYSTEM_RDD } from "./constants.js";
|
||||||
@ -15,6 +14,7 @@ import { RdDItem } from "./item.js";
|
|||||||
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
||||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||||
import { ItemAction } from "./item/item-actions.js";
|
import { ItemAction } from "./item/item-actions.js";
|
||||||
|
import { RdDItemGemme } from "./item/gemme.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend the basic ItemSheet for RdD specific items
|
* Extend the basic ItemSheet for RdD specific items
|
||||||
@ -133,10 +133,6 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
formData.enchantement = await RdDTextEditor.enrichHTML(this.item.system.enchantement, this.item)
|
formData.enchantement = await RdDTextEditor.enrichHTML(this.item.system.enchantement, this.item)
|
||||||
formData.sureffet = await RdDTextEditor.enrichHTML(this.item.system.sureffet, this.item)
|
formData.sureffet = await RdDTextEditor.enrichHTML(this.item.system.sureffet, this.item)
|
||||||
}
|
}
|
||||||
if (this.item.type == ITEM_TYPES.gemme) {
|
|
||||||
formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList();
|
|
||||||
RdDGemme.calculDataDerivees(this.item)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.item.type == ITEM_TYPES.herbe) {
|
if (this.item.type == ITEM_TYPES.herbe) {
|
||||||
if (formData.options.isOwned && ['Soin', 'Repos'].includes(formData.system.categorie)) {
|
if (formData.options.isOwned && ['Soin', 'Repos'].includes(formData.system.categorie)) {
|
||||||
@ -164,7 +160,7 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
HtmlUtility.showControlWhen(this.html.find(".item-cout"), ReglesOptionnelles.isUsing('afficher-prix-joueurs')
|
HtmlUtility.showControlWhen(this.html.find(".item-cout"), ReglesOptionnelles.isUsing('afficher-prix-joueurs')
|
||||||
|| game.user.isGM
|
|| game.user.isGM
|
||||||
|| !this.item.isOwned);
|
|| !this.item.isOwned);
|
||||||
HtmlUtility.showControlWhen(this.html.find(".item-magique"), this.item.isMagique());
|
HtmlUtility.showControlWhen(this.html.find(".item-magique"), this.item.isMagique);
|
||||||
|
|
||||||
// Everything below here is only needed if the sheet is editable
|
// Everything below here is only needed if the sheet is editable
|
||||||
if (!this.options.editable) return;
|
if (!this.options.editable) return;
|
||||||
@ -193,7 +189,7 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
})
|
})
|
||||||
|
|
||||||
this.html.find('.creer-tache-livre').click((event) => this._getEventActor(event).creerTacheDepuisLivre(this.item));
|
this.html.find('.creer-tache-livre').click((event) => this._getEventActor(event).creerTacheDepuisLivre(this.item));
|
||||||
this.html.find('.creer-potion-base').click((event) => this._getEventActor(event).actionHerbe(this.item));
|
this.html.find('.creer-potion-base').click((event) => this._getEventActor(event).fabriquerDecoctionHerbe(this.item))
|
||||||
this.html.find('input[name="system.cacher_points_de_tache"]').change(async event => await this.item.update({ 'system.cacher_points_de_tache': event.currentTarget.checked }));
|
this.html.find('input[name="system.cacher_points_de_tache"]').change(async event => await this.item.update({ 'system.cacher_points_de_tache': event.currentTarget.checked }));
|
||||||
|
|
||||||
this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
|
this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
|
||||||
|
@ -22,7 +22,21 @@ export class RdDItemSort extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static addSpaceToNonNumeric(value) {
|
static addSpaceToNonNumeric(value) {
|
||||||
return Number.isNumeric(value) || ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes( String(value).charAt[0]) ? value : ' ' + RdDItemSort.toVar(value)
|
return Number.isNumeric(value) || ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(String(value).charAt[0]) ? value : ' ' + RdDItemSort.toVar(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
static lancements(sort) { return sort?.system.lancements.length ?? 0 }
|
||||||
|
|
||||||
|
static findEnchantement(actor) { return RdDItemSort.findSort(actor, 'Enchantement', ['Narcos', 'N']) }
|
||||||
|
static findPermanence(actor) { return RdDItemSort.findSort(actor, 'Permanence', ['Narcos', 'N']) }
|
||||||
|
static findPurification(actor) { return RdDItemSort.findSort(actor, 'Purification', ['Narcos', 'N']) }
|
||||||
|
|
||||||
|
static findSort(actor, name, draconics) {
|
||||||
|
return actor.itemTypes[ITEM_TYPES.sort].find(it => Grammar.includesLowerCaseNoAccent(it.name, name)
|
||||||
|
&& (draconics == undefined || draconics.includes(it.system.draconic)))
|
||||||
|
}
|
||||||
|
static async changeLancementsSort(sort, changement) {
|
||||||
|
await sort?.update({ 'system.lancements': changement(sort.system.lancements) });
|
||||||
}
|
}
|
||||||
|
|
||||||
static toVar(value) {
|
static toVar(value) {
|
||||||
@ -151,5 +165,4 @@ export class RdDItemSort extends Item {
|
|||||||
.map(it => it.split(':'))
|
.map(it => it.split(':'))
|
||||||
.map(it => { return { case: it[0], bonus: it[1] } });
|
.map(it => { return { case: it[0], bonus: it[1] } });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -41,9 +41,6 @@ const typesObjetsTemporels = [ITEM_TYPES.blessure, ITEM_TYPES.poison, ITEM_TYPES
|
|||||||
const typesObjetsEquipable = [ITEM_TYPES.arme, ITEM_TYPES.armure, ITEM_TYPES.objet];
|
const typesObjetsEquipable = [ITEM_TYPES.arme, ITEM_TYPES.armure, ITEM_TYPES.objet];
|
||||||
const typesEnvironnement = typesInventaireMateriel;
|
const typesEnvironnement = typesInventaireMateriel;
|
||||||
const encBrin = 0.00005; // un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc
|
const encBrin = 0.00005; // un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc
|
||||||
const encPepin = 0.0007; /* un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc
|
|
||||||
densité 3.5 (~2.3 à 4, parfois plus) -- https://www.juwelo.fr/guide-des-pierres/faits-et-chiffres/
|
|
||||||
*/
|
|
||||||
|
|
||||||
export const defaultItemImg = {
|
export const defaultItemImg = {
|
||||||
arme: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_gnome.webp",
|
arme: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_gnome.webp",
|
||||||
@ -85,7 +82,6 @@ export const defaultItemImg = {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
export class RdDItem extends Item {
|
export class RdDItem extends Item {
|
||||||
|
|
||||||
static get defaultIcon() {
|
static get defaultIcon() {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@ -184,7 +180,6 @@ export class RdDItem extends Item {
|
|||||||
isCompetenceCreature() { return this.type == ITEM_TYPES.competencecreature }
|
isCompetenceCreature() { return this.type == ITEM_TYPES.competencecreature }
|
||||||
isConteneur() { return this.type == ITEM_TYPES.conteneur; }
|
isConteneur() { return this.type == ITEM_TYPES.conteneur; }
|
||||||
isMonnaie() { return this.type == ITEM_TYPES.monnaie; }
|
isMonnaie() { return this.type == ITEM_TYPES.monnaie; }
|
||||||
isPotion() { return this.type == ITEM_TYPES.potion; }
|
|
||||||
isNourritureBoisson() { return this.type == ITEM_TYPES.nourritureboisson; }
|
isNourritureBoisson() { return this.type == ITEM_TYPES.nourritureboisson; }
|
||||||
isService() { return this.type == ITEM_TYPES.service; }
|
isService() { return this.type == ITEM_TYPES.service; }
|
||||||
|
|
||||||
@ -223,6 +218,12 @@ export class RdDItem extends Item {
|
|||||||
return this.getEnvironnements(milieux).length > 0
|
return this.getEnvironnements(milieux).length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get nameDisplay() {
|
||||||
|
return this.isMagique ? (this.name + ' <i class="fa-solid fa-sparkles"></i>') : this.name
|
||||||
|
}
|
||||||
|
|
||||||
|
get isEnchantementPossible() { return false }
|
||||||
|
|
||||||
getEnvironnements(milieux = undefined) {
|
getEnvironnements(milieux = undefined) {
|
||||||
const environnements = this.isInventaire() ? this.system.environnement : undefined;
|
const environnements = this.isInventaire() ? this.system.environnement : undefined;
|
||||||
if (milieux == undefined || !environnements) {
|
if (milieux == undefined || !environnements) {
|
||||||
@ -331,7 +332,7 @@ export class RdDItem extends Item {
|
|||||||
return this.type == ITEM_TYPES.objet && Grammar.includesLowerCaseNoAccent(this.name, 'cristal alchimique') && this.system.quantite > 0;
|
return this.type == ITEM_TYPES.objet && Grammar.includesLowerCaseNoAccent(this.name, 'cristal alchimique') && this.system.quantite > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
isMagique() {
|
get isMagique() {
|
||||||
return this.system.magique
|
return this.system.magique
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,6 +343,7 @@ export class RdDItem extends Item {
|
|||||||
isNomLike(texte) {
|
isNomLike(texte) {
|
||||||
return Grammar.includesLowerCaseNoAccent(this.name, texte)
|
return Grammar.includesLowerCaseNoAccent(this.name, texte)
|
||||||
}
|
}
|
||||||
|
|
||||||
isNomTypeLike(texte) {
|
isNomTypeLike(texte) {
|
||||||
return this.isNomLike(texte) || Grammar.includesLowerCaseNoAccent(Misc.typeName(this.type, 'Item'), texte)
|
return this.isNomLike(texte) || Grammar.includesLowerCaseNoAccent(Misc.typeName(this.type, 'Item'), texte)
|
||||||
}
|
}
|
||||||
@ -360,8 +362,6 @@ export class RdDItem extends Item {
|
|||||||
return 0;
|
return 0;
|
||||||
case ITEM_TYPES.herbe:
|
case ITEM_TYPES.herbe:
|
||||||
return this.getEncHerbe();
|
return this.getEncHerbe();
|
||||||
case ITEM_TYPES.gemme:
|
|
||||||
return encPepin * this.system.taille;
|
|
||||||
}
|
}
|
||||||
return Math.max(this.system.encombrement ?? 0, 0);
|
return Math.max(this.system.encombrement ?? 0, 0);
|
||||||
}
|
}
|
||||||
@ -427,10 +427,6 @@ export class RdDItem extends Item {
|
|||||||
|
|
||||||
itemSpecificActions() {
|
itemSpecificActions() {
|
||||||
const actions = ITEM_ACTIONS[this.type] ?? []
|
const actions = ITEM_ACTIONS[this.type] ?? []
|
||||||
// const actorTypes = actions.actorTypes ?? [ACTOR_TYPES.personnage]
|
|
||||||
// if (!actorTypes.includes(this.actor?.type)) {
|
|
||||||
// return []
|
|
||||||
// }
|
|
||||||
return actions
|
return actions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
112
module/item/gemme.js
Normal file
112
module/item/gemme.js
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
import { RdDItem } from "../item.js";
|
||||||
|
import { ACTION_ITEM_ENCHANTER } from "../enchantement/dialog-enchanter.js";
|
||||||
|
|
||||||
|
const tableGemmes = {
|
||||||
|
"almaze": { label: "Almaze", couleur: "Blanc" },
|
||||||
|
"aquafane": { label: "Aquafane", couleur: "Vert Profond" },
|
||||||
|
"asterite": { label: "Astérite", couleur: "Bleu, Violet ou Blanc" },
|
||||||
|
"cyanolithe": { label: "Cyanolithe", couleur: "Bleu Intense" },
|
||||||
|
"larmededragon": { label: "Larme de Dragon", couleur: "Rouge Intense" },
|
||||||
|
"muska": { label: "Muska", couleur: "Violet Profond" },
|
||||||
|
"nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense" },
|
||||||
|
"nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense, Rose, Vert ou Bleu Pâle" },
|
||||||
|
"oeildetigre": { label: "Oeil de Tigre", couleur: "Jaune" },
|
||||||
|
"scarlatine": { label: "Scarlatine", couleur: "Rouge Clair ou Orangé" },
|
||||||
|
"seliphane": { label: "Séliphane", couleur: "Vert Lumineux" },
|
||||||
|
"tournelune": { label: "Tournelune", couleur: "Violet ou Bleu" },
|
||||||
|
"zebraide": { label: "Zebraïde", couleur: "Bandes Bicolores, toutes couleurs" }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc
|
||||||
|
* densité 3.5 (~2.3 à 4, parfois plus) -- https://www.juwelo.fr/guide-des-pierres/faits-et-chiffres/
|
||||||
|
*/
|
||||||
|
const encPepin = 0.0007;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Item pour gérer les gemmes
|
||||||
|
*/
|
||||||
|
export class RdDItemGemme extends RdDItem {
|
||||||
|
|
||||||
|
static getGemmeTypeOptionList() {
|
||||||
|
// TODO: look how to map object key-value pairs
|
||||||
|
let options = ""
|
||||||
|
for (let gemmeKey in tableGemmes) {
|
||||||
|
options += `<option value="${gemmeKey}">${tableGemmes[gemmeKey].label}</option>`
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get defaultIcon() {
|
||||||
|
return "systems/foundryvtt-reve-de-dragon/icons/gemmes/almaze.webp"
|
||||||
|
}
|
||||||
|
|
||||||
|
get isEnchantementPossible() {
|
||||||
|
return this.enchantabilite > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
get inertie() { return 7 - Number(this.system.purete) }
|
||||||
|
get enchantabilite() { return this.system.taille - this.inertie }
|
||||||
|
|
||||||
|
getEnc() {
|
||||||
|
return encPepin * this.system.taille;
|
||||||
|
}
|
||||||
|
|
||||||
|
itemSpecificActions() {
|
||||||
|
return [ACTION_ITEM_ENCHANTER]
|
||||||
|
}
|
||||||
|
|
||||||
|
prepareDerivedData() {
|
||||||
|
super.prepareDerivedData()
|
||||||
|
this.system.cout = (this.system.taille * this.system.purete) + this.system.qualite
|
||||||
|
this.system.inertie = this.inertie
|
||||||
|
this.system.enchantabilite = this.enchantabilite
|
||||||
|
}
|
||||||
|
|
||||||
|
getUtilisation() {
|
||||||
|
switch (this.system.categorie) {
|
||||||
|
case 'Alchimie': case 'Autre': case 'AlchimieAutre':
|
||||||
|
// TODO: distinguer les remèdes alchimiques enchantables/non
|
||||||
|
return 'alchimie'
|
||||||
|
case 'Cuisine':
|
||||||
|
return 'cuisine'
|
||||||
|
case 'Remede': case 'Repos': case 'Soin':
|
||||||
|
return 'soins'
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
|
getProprietes() {
|
||||||
|
const proprietes = [
|
||||||
|
`<b>Taille</b>: ${this.system.taille}`,
|
||||||
|
`<b>Pureté</b>: ${this.system.purete}`,
|
||||||
|
`<b>Inertie</b>: ${this.system.inertie}`,
|
||||||
|
`<b>Enchantabilité</b>: ${this.system.enchantabilite}`
|
||||||
|
]
|
||||||
|
const proprietesMagiques = this.system.magique ? [
|
||||||
|
`<b>Enchantée</b> <i class="fa-solid fa-sparkles"></i> ${this.system.purifie ? ', purifiée' : ''} ${this.system.prpermanent ? 'permanente' : ''} `,
|
||||||
|
`<b>Points de rêve</b>: ${this.system.pr}`,
|
||||||
|
`<b>Puissance</b>: ${this.system.puissance}`,
|
||||||
|
] : []
|
||||||
|
return proprietes
|
||||||
|
.concat(proprietesMagiques)
|
||||||
|
.concat(this._inventaireTemplateChatData())
|
||||||
|
.filter(it => it != undefined)
|
||||||
|
}
|
||||||
|
|
||||||
|
perteReveChateauDormant() {
|
||||||
|
if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) {
|
||||||
|
const nouveauReve = Math.max(this.system.pr - 1, 0)
|
||||||
|
return {
|
||||||
|
alias: this.parent.getAlias(),
|
||||||
|
item: this,
|
||||||
|
update: {
|
||||||
|
_id: this.id,
|
||||||
|
'system.pr': nouveauReve,
|
||||||
|
'system.magique': nouveauReve > 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
@ -75,7 +75,7 @@ const _BOIRE = {
|
|||||||
const _DECOCTION = {
|
const _DECOCTION = {
|
||||||
code: 'item-decoction', label: 'Décoction', icon: it => 'fa-solid fa-flask-vial',
|
code: 'item-decoction', label: 'Décoction', icon: it => 'fa-solid fa-flask-vial',
|
||||||
optionsFilter: options => options.editable,
|
optionsFilter: options => options.editable,
|
||||||
action: (item, actor) => actor.actionHerbe(item)
|
action: (item, actor) => actor.fabriquerDecoctionHerbe(item)
|
||||||
}
|
}
|
||||||
const _OUVRIR = {
|
const _OUVRIR = {
|
||||||
code: 'item-edit', label: 'Ouvrir', icon: it => 'fa-solid fa-eye',
|
code: 'item-edit', label: 'Ouvrir', icon: it => 'fa-solid fa-eye',
|
||||||
|
@ -1,32 +1,18 @@
|
|||||||
import { ITEM_TYPES } from "../constants.js";
|
|
||||||
import { Grammar } from "../grammar.js";
|
import { Grammar } from "../grammar.js";
|
||||||
import { RdDItem } from "../item.js";
|
import { RdDItem } from "../item.js";
|
||||||
import { SystemCompendiums } from "../settings/system-compendiums.js";
|
import { SystemCompendiums } from "../settings/system-compendiums.js";
|
||||||
import { DialogEnchanter } from "./potion/dialog-enchanter.js";
|
import { ACTION_ITEM_ENCHANTER } from "../enchantement/dialog-enchanter.js";
|
||||||
|
|
||||||
const POTION_MAGIQUE = ['AlchimieEnchante', 'ReposEnchante', 'SoinEnchante', 'AutreEnchante']
|
|
||||||
const POTION_ENCHANTABLE = ['Alchimie', 'Repos', 'Soin', 'Autre']
|
|
||||||
.concat(POTION_MAGIQUE)
|
|
||||||
|
|
||||||
const MAP_CATEGORIE_ENCHANTEMENT = [
|
|
||||||
{ basique: 'Alchimie', enchante: 'AlchimieEnchante' },
|
|
||||||
{ basique: 'Repos', enchante: 'ReposEnchante' },
|
|
||||||
{ basique: 'Soin', enchante: 'SoinEnchante' },
|
|
||||||
{ basique: 'Autre', enchante: 'AutreEnchante' }]
|
|
||||||
|
|
||||||
|
// --- Actions sur les "potions"
|
||||||
const _CONSOMMER_POTION = {
|
const _CONSOMMER_POTION = {
|
||||||
code: 'item-potion-consommer', label: 'Consommer', icon: it => 'fa-solid fa-vial',
|
code: 'item-potion-consommer', label: 'Consommer', icon: it => 'fa-solid fa-vial',
|
||||||
optionsFilter: options => options.editable,
|
optionsFilter: options => options.editable,
|
||||||
action: (item, actor) => actor.consommerPotion(item)
|
action: (item, actor) => actor.consommerPotion(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
const _ENCHANTER = {
|
/**
|
||||||
code: 'item-enchanter', label: 'Enchanter', icon: it => 'fa-solid fa-sparkles',
|
* Item pour gérer les potions
|
||||||
filter: it => game.user.isGM || it.isEnchantable(),
|
*/
|
||||||
optionsFilter: options => options.editable,
|
|
||||||
action: (item, actor) => item.enchanterPotion()
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RdDItemPotion extends RdDItem {
|
export class RdDItemPotion extends RdDItem {
|
||||||
|
|
||||||
static async herbesSoins() {
|
static async herbesSoins() {
|
||||||
@ -45,114 +31,67 @@ export class RdDItemPotion extends RdDItem {
|
|||||||
return "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp"
|
return "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isEnchantementPossible() {
|
||||||
|
return this.system.etat == 'Liquide'
|
||||||
|
}
|
||||||
|
|
||||||
|
itemSpecificActions() {
|
||||||
|
return [_CONSOMMER_POTION, ACTION_ITEM_ENCHANTER]
|
||||||
|
}
|
||||||
|
|
||||||
prepareDerivedData() {
|
prepareDerivedData() {
|
||||||
super.prepareDerivedData()
|
super.prepareDerivedData()
|
||||||
this.system.puissance = this.system.magique ? this.calculPuissance() : 0
|
this.system.puissance = this.system.magique ? this.calculPuissance() : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
isPotion() { return true }
|
|
||||||
isEnchantable() { return POTION_ENCHANTABLE.includes(this.system.categorie) }
|
|
||||||
isMagique() { return POTION_MAGIQUE.includes(this.system.categorie) }
|
|
||||||
|
|
||||||
itemSpecificActions() {
|
|
||||||
return [_CONSOMMER_POTION, _ENCHANTER]
|
|
||||||
}
|
|
||||||
|
|
||||||
getActions(options = { warnIfNot: true }) {
|
|
||||||
const actionConsommer = this.prepareAction('Consommer', options.warnIfNot);
|
|
||||||
if (this.isEnchantable()) {
|
|
||||||
return [
|
|
||||||
actionConsommer,
|
|
||||||
this.prepareAction('Enchanter', options.warnIfNot)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
return [
|
|
||||||
actionConsommer
|
|
||||||
]
|
|
||||||
}
|
|
||||||
// TDOD: purifier?
|
|
||||||
getUtilisation() {
|
getUtilisation() {
|
||||||
switch (this.system.categorie) {
|
switch (this.system.categorie) {
|
||||||
case 'Alchimie': case 'AlchimieEnchante':
|
case 'Alchimie': case 'Autre': case 'AlchimieAutre':
|
||||||
case 'AlchimieAutre':
|
// TODO: distinguer les remèdes alchimiques enchantables/non
|
||||||
return 'alchimie'
|
return 'alchimie'
|
||||||
case 'Cuisine': return 'cuisine'
|
case 'Cuisine':
|
||||||
case 'Remede': case 'Repos': case 'ReposEnchante': case 'Soin': case 'SoinEnchante':
|
return 'cuisine'
|
||||||
|
case 'Remede': case 'Repos': case 'Soin':
|
||||||
return 'soins'
|
return 'soins'
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
_potionChatData() {
|
getProprietes() {
|
||||||
return [
|
const proprietes = [
|
||||||
`<b>Rareté</b>: ${this.system.rarete}`,
|
`<b>Rareté</b>: ${this.system.rarete} `,
|
||||||
`<b>Catégorie</b>: ${this.system.categorie}`,
|
`<b>Catégorie</b>: ${this.system.categorie}`,
|
||||||
...this._inventaireTemplateChatData()
|
`<b>Etat</b>: ${this.system.etat}`
|
||||||
]
|
]
|
||||||
|
const proprietesMagiques = this.system.magique ? [
|
||||||
|
`<b>Enchantée</b> <i class="fa-solid fa-sparkles"></i> ${this.system.purifie ? ', purifiée' : ''} ${this.system.prpermanent ? 'permanente' : ''} `,
|
||||||
|
`<b>Points de rêve</b>: ${this.system.pr}`,
|
||||||
|
] : []
|
||||||
|
return proprietes
|
||||||
|
.concat(proprietesMagiques)
|
||||||
|
.concat(this._inventaireTemplateChatData())
|
||||||
|
.filter(it => it != undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
async enchanterPotion() {
|
perteReveChateauDormant() {
|
||||||
const actor = this.parent;
|
|
||||||
if (actor && (!actor.isPersonnage() || !actor.isHautRevant())) {
|
|
||||||
ui.notifications.info('Seul un haut rêvant peut enchanter une potion')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const dailog = await DialogEnchanter.create(this, actor, (updates) => this.$onEnchanterPotion(updates));
|
|
||||||
dailog.render(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
perteRevePotion() {
|
|
||||||
if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) {
|
if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) {
|
||||||
const nouveauReve = Math.max(this.system.pr - 1, 0)
|
const nouveaupr = Math.max(this.system.pr - 1, 0)
|
||||||
return {
|
return {
|
||||||
_id: this.id,
|
alias: this.parent.getAlias(),
|
||||||
'system.pr': nouveauReve,
|
item: this,
|
||||||
'system.quantite': nouveauReve > 0 ? this.system.quantite : 0,
|
nouveaupr: nouveaupr,
|
||||||
'system.magique': nouveauReve > 0
|
update: {
|
||||||
|
_id: this.id,
|
||||||
|
'system.pr': nouveaupr,
|
||||||
|
'system.magique': nouveaupr > 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
async $onEnchanterPotion(enchanter) {
|
|
||||||
if (enchanter.nouveaupr == 0) {
|
|
||||||
await this.update({
|
|
||||||
name: this.name, // TODO: enlever "enchantée" ?
|
|
||||||
'system.pr': 0,
|
|
||||||
'system.purifie': false,
|
|
||||||
'system.magique': false,
|
|
||||||
'system.categorie': this.categorieEnchantement().basique,
|
|
||||||
'system.prpermanent': false,
|
|
||||||
'system.prdate': 0,
|
|
||||||
'system.quantite': this.parent ? 0 : this.system.quantite
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
await this.update({
|
|
||||||
name: this.name, // TODO: ajout "enchantée" ?
|
|
||||||
'system.pr': enchanter.nouveaupr,
|
|
||||||
'system.purifie': enchanter.purifier,
|
|
||||||
'system.magique': true,
|
|
||||||
'system.categorie': this.categorieEnchantement().enchante,
|
|
||||||
'system.prpermanent': enchanter.prpermanent,
|
|
||||||
'system.prdate': RdDItemPotion.dateEnchantement()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.sheet?.render(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
calculPuissance() { return this.system.herbebonus * this.system.pr }
|
calculPuissance() { return this.system.herbebonus * this.system.pr }
|
||||||
|
|
||||||
categorieEnchantement() {
|
|
||||||
const categorie = this.system.categorie
|
|
||||||
const categorieEnchantement = MAP_CATEGORIE_ENCHANTEMENT.find(it => [it.basique, it.enchante].includes(categorie))
|
|
||||||
return categorieEnchantement ?? { basique: categorie, enchante: categorie }
|
|
||||||
}
|
|
||||||
|
|
||||||
static dateEnchantement() {
|
|
||||||
return game.system.rdd.calendrier.getTimestamp().debutJournee().indexDate
|
|
||||||
}
|
|
||||||
|
|
||||||
static buildHerbesList(listeHerbes, max) {
|
static buildHerbesList(listeHerbes, max) {
|
||||||
let list = {}
|
let list = {}
|
||||||
for (let herbe of listeHerbes) {
|
for (let herbe of listeHerbes) {
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
export class DialogEnchanter extends Dialog {
|
|
||||||
|
|
||||||
static async create(item, actor, callback) {
|
|
||||||
const enchanter = {
|
|
||||||
actor: actor,
|
|
||||||
item: item,
|
|
||||||
nouveaupr: item.system.pr,
|
|
||||||
prpermanent: item.system.prpermanent,
|
|
||||||
purifier: false
|
|
||||||
}
|
|
||||||
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/item/potion/dialog-enchanter.hbs`, enchanter)
|
|
||||||
return new DialogEnchanter(enchanter, html, callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(enchanter, html, callback) {
|
|
||||||
let options = { classes: ["dialog-enchanter"], width: 400, height: 'fit-content', 'z-index': 99999 }
|
|
||||||
let conf = {
|
|
||||||
title: "Enchanter une potion",
|
|
||||||
content: html,
|
|
||||||
default: "enchanter",
|
|
||||||
buttons: {
|
|
||||||
"enchanter": { label: "Enchanter", callback: it => this.onEnchanter() }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
super(conf, options)
|
|
||||||
|
|
||||||
this.callback = callback
|
|
||||||
this.enchanter = enchanter
|
|
||||||
}
|
|
||||||
|
|
||||||
activateListeners(html) {
|
|
||||||
super.activateListeners(html)
|
|
||||||
this.html = html
|
|
||||||
this.html.find("input.nouveaupr").change(event => this.enchanter.nouveaupr = Number(event.currentTarget.value))
|
|
||||||
this.html.find("input.purifier").change(event => this.enchanter.purifier = event.currentTarget.checked)
|
|
||||||
this.html.find("input.prpermanent").change(event => this.enchanter.prpermanent = event.currentTarget.checked)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async onEnchanter() {
|
|
||||||
await this.html.find(".nouveaupr").change()
|
|
||||||
this.callback(this.enchanter);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
38
module/item/sheet-gemme.js
Normal file
38
module/item/sheet-gemme.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { ITEM_TYPES } from "../constants.js";
|
||||||
|
import { DialogEnchanter } from "../enchantement/dialog-enchanter.js";
|
||||||
|
import { RdDTimestamp } from "../time/rdd-timestamp.js";
|
||||||
|
import { RdDItemGemme } from "./gemme.js";
|
||||||
|
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
|
||||||
|
|
||||||
|
export class RdDGemmeItemSheet extends RdDItemInventaireSheet {
|
||||||
|
|
||||||
|
static get ITEM_TYPE() { return ITEM_TYPES.gemme };
|
||||||
|
|
||||||
|
async getData() {
|
||||||
|
const formData = foundry.utils.mergeObject(await super.getData(),
|
||||||
|
{
|
||||||
|
inertie: this.item.inertie,
|
||||||
|
enchantabilite: this.item.enchantabilite,
|
||||||
|
isEnchantementPossible: this.item.isEnchantementPossible,
|
||||||
|
gemmeTypeList: RdDItemGemme.getGemmeTypeOptionList(),
|
||||||
|
dateActuelle: game.system.rdd.calendrier.dateCourante(),
|
||||||
|
enchantement: RdDTimestamp.splitIndexDate(this.item.system.prdate)
|
||||||
|
})
|
||||||
|
return formData
|
||||||
|
}
|
||||||
|
|
||||||
|
activateListeners(html) {
|
||||||
|
super.activateListeners(html);
|
||||||
|
|
||||||
|
this.html.find('.item-enchanter').click((event) => DialogEnchanter.enchanter(this.item))
|
||||||
|
|
||||||
|
this.html.find('.date-enchantement').change((event) => {
|
||||||
|
const jour = Number(this.html.find('input.date-enchantement[name="enchantement.jour"]').val())
|
||||||
|
const mois = RdDTimestamp.definition(this.html.find('select.date-enchantement[name="enchantement.mois"]').val())
|
||||||
|
const indexDate = game.system.rdd.calendrier.getIndexFromDate(jour, mois.heure)
|
||||||
|
this.item.update({ 'system.prdate': indexDate })
|
||||||
|
console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import { ITEM_TYPES } from "../constants.js";
|
import { ITEM_TYPES } from "../constants.js";
|
||||||
|
import { DialogEnchanter } from "../enchantement/dialog-enchanter.js";
|
||||||
import { RdDTimestamp } from "../time/rdd-timestamp.js";
|
import { RdDTimestamp } from "../time/rdd-timestamp.js";
|
||||||
import { RdDItemPotion } from "./potion.js";
|
import { RdDItemPotion } from "./potion.js";
|
||||||
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
|
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
|
||||||
@ -18,14 +19,12 @@ export class RdDPotionItemSheet extends RdDItemInventaireSheet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get potion(){ return this.item }
|
|
||||||
|
|
||||||
async getData() {
|
async getData() {
|
||||||
const formData = await super.getData()
|
const formData = await super.getData()
|
||||||
formData.enchantable = this.potion.isEnchantable()
|
formData.isEnchantementPossible = this.item.isEnchantementPossible
|
||||||
const enchantement = this.potion.categorieEnchantement()
|
formData.isSoins = this.item.categorie == 'Soin'
|
||||||
formData.isSoins = enchantement.basique == 'Soin'
|
formData.isRepos = this.item.categorie == 'Repos'
|
||||||
formData.isRepos = enchantement.basique == 'Repos'
|
|
||||||
if (formData.isSoins) {
|
if (formData.isSoins) {
|
||||||
const herbesSoins = await RdDItemPotion.herbesSoins()
|
const herbesSoins = await RdDItemPotion.herbesSoins()
|
||||||
RdDPotionItemSheet.$calculBonusHerbe(formData, herbesSoins, 12);
|
RdDPotionItemSheet.$calculBonusHerbe(formData, herbesSoins, 12);
|
||||||
@ -37,20 +36,20 @@ export class RdDPotionItemSheet extends RdDItemInventaireSheet {
|
|||||||
formData.herbesRepos = RdDItemPotion.buildHerbesList(herbesRepos, 7)
|
formData.herbesRepos = RdDItemPotion.buildHerbesList(herbesRepos, 7)
|
||||||
}
|
}
|
||||||
formData.dateActuelle = game.system.rdd.calendrier.dateCourante()
|
formData.dateActuelle = game.system.rdd.calendrier.dateCourante()
|
||||||
formData.enchantement = RdDTimestamp.splitIndexDate(this.potion.system.prdate)
|
formData.enchantement = RdDTimestamp.splitIndexDate(this.item.system.prdate)
|
||||||
return formData
|
return formData
|
||||||
}
|
}
|
||||||
|
|
||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
super.activateListeners(html);
|
super.activateListeners(html);
|
||||||
|
|
||||||
this.html.find('.item-enchanter').click((event) => this.potion.enchanterPotion())
|
this.html.find('.item-enchanter').click((event) => DialogEnchanter.enchanter(this.item))
|
||||||
|
|
||||||
this.html.find('.date-enchantement').change((event) => {
|
this.html.find('.date-enchantement').change((event) => {
|
||||||
const jour = Number(this.html.find('input.date-enchantement[name="enchantement.jour"]').val())
|
const jour = Number(this.html.find('input.date-enchantement[name="enchantement.jour"]').val())
|
||||||
const mois = RdDTimestamp.definition(this.html.find('select.date-enchantement[name="enchantement.mois"]').val())
|
const mois = RdDTimestamp.definition(this.html.find('select.date-enchantement[name="enchantement.mois"]').val())
|
||||||
const indexDate = game.system.rdd.calendrier.getIndexFromDate(jour, mois.heure)
|
const indexDate = game.system.rdd.calendrier.getIndexFromDate(jour, mois.heure)
|
||||||
this.potion.update({ 'system.prdate': indexDate })
|
this.item.update({ 'system.prdate': indexDate })
|
||||||
console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`)
|
console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -589,6 +589,42 @@ class _12_0_32_MigrationRaces extends Migration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _12_0_37_MigrationAlchimieEtat extends Migration {
|
||||||
|
get code() { return "migration-alchimie-etat" }
|
||||||
|
get version() { return "12.0.37" }
|
||||||
|
|
||||||
|
async migrate() {
|
||||||
|
await this.applyItemsUpdates(items => items
|
||||||
|
.filter(it => [ITEM_TYPES.potion].includes(it.type))
|
||||||
|
.map(it => this.migratePotion(it))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
mappingCategorie(categorie) {
|
||||||
|
switch (categorie) {
|
||||||
|
case 'AlchimieEnchante': return 'Alchimie'
|
||||||
|
case 'ReposEnchante': return 'Repos'
|
||||||
|
case 'SoinEnchante': return 'Soin'
|
||||||
|
case 'AutreEnchante': return 'Autre'
|
||||||
|
}
|
||||||
|
return categorie
|
||||||
|
}
|
||||||
|
|
||||||
|
mappingEtat(categorie) {
|
||||||
|
return ['Alchimie', 'Repos', 'Soin', 'Autre'].includes(categorie) ? 'Liquide' : 'Autre'
|
||||||
|
}
|
||||||
|
|
||||||
|
async migratePotion(potion) {
|
||||||
|
const newCategorie = this.mappingCategorie(potion.system.categorie)
|
||||||
|
return {
|
||||||
|
_id: potion.id,
|
||||||
|
'system.etat': this.mappingEtat(potion.system.categorie),
|
||||||
|
'system.magique': potion.system.pr > 0,
|
||||||
|
'system.categorie': newCategorie
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Migrations {
|
export class Migrations {
|
||||||
static getMigrations() {
|
static getMigrations() {
|
||||||
return [
|
return [
|
||||||
@ -610,6 +646,7 @@ export class Migrations {
|
|||||||
new _11_2_20_MigrationAstrologie(),
|
new _11_2_20_MigrationAstrologie(),
|
||||||
new _12_0_26_MigrationVoieSorts(),
|
new _12_0_26_MigrationVoieSorts(),
|
||||||
new _12_0_32_MigrationRaces(),
|
new _12_0_32_MigrationRaces(),
|
||||||
|
new _12_0_37_MigrationAlchimieEtat(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
const tableGemmes = {
|
|
||||||
"almaze": { label: "Almaze", couleur: "Blanc"},
|
|
||||||
"aquafane": { label: "Aquafane", couleur: "Vert Profond"},
|
|
||||||
"asterite": { label: "Astérite", couleur: "Bleu, Violet ou Blanc"},
|
|
||||||
"cyanolithe": { label: "Cyanolithe", couleur: "Bleu Intense"},
|
|
||||||
"larmededragon": { label: "Larme de Dragon", couleur: "Rouge Intense"},
|
|
||||||
"muska": { label: "Muska", couleur: "Violet Profond"},
|
|
||||||
"nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense"},
|
|
||||||
"nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense, Rose, Vert ou Bleu Pâle"},
|
|
||||||
"oeildetigre": { label: "Oeil de Tigre", couleur: "Jaune"},
|
|
||||||
"scarlatine": { label: "Scarlatine", couleur: "Rouge Clair ou Orangé"},
|
|
||||||
"seliphane": { label: "Séliphane", couleur: "Vert Lumineux"},
|
|
||||||
"tournelune": { label: "Tournelune", couleur: "Violet ou Bleu"},
|
|
||||||
"zebraide": { label: "Zebraïde", couleur: "Bandes Bicolores, toutes couleurs"}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RdDGemme extends Item {
|
|
||||||
|
|
||||||
static getGemmeTypeOptionList() {
|
|
||||||
// TODO: look how to map object key-value pairs
|
|
||||||
let options = ""
|
|
||||||
for (let gemmeKey in tableGemmes) {
|
|
||||||
options += `<option value="${gemmeKey}">${tableGemmes[gemmeKey].label}</option>`
|
|
||||||
}
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static calculDataDerivees(gemme) {
|
|
||||||
gemme.system.cout = (gemme.system.taille * gemme.system.purete) + gemme.system.qualite;
|
|
||||||
gemme.system.inertie = 7 - gemme.system.purete;
|
|
||||||
gemme.system.enchantabilite = gemme.system.taille - gemme.system.inertie;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -77,6 +77,8 @@ import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
|
|||||||
import { RdDJournalSheet } from "./journal/journal-sheet.js"
|
import { RdDJournalSheet } from "./journal/journal-sheet.js"
|
||||||
import { RdDPotionItemSheet } from "./item/sheet-potion.js"
|
import { RdDPotionItemSheet } from "./item/sheet-potion.js"
|
||||||
import { RdDItemPotion } from "./item/potion.js"
|
import { RdDItemPotion } from "./item/potion.js"
|
||||||
|
import { RdDItemGemme } from "./item/gemme.js"
|
||||||
|
import { RdDGemmeItemSheet } from "./item/sheet-gemme.js"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RdD system
|
* RdD system
|
||||||
@ -100,17 +102,18 @@ export class SystemReveDeDragon {
|
|||||||
this.itemClasses = {
|
this.itemClasses = {
|
||||||
armure: RdDItemArmure,
|
armure: RdDItemArmure,
|
||||||
blessure: RdDItemBlessure,
|
blessure: RdDItemBlessure,
|
||||||
|
gemme: RdDItemGemme,
|
||||||
maladie: RdDItemMaladie,
|
maladie: RdDItemMaladie,
|
||||||
ombre: RdDItemOmbre,
|
ombre: RdDItemOmbre,
|
||||||
poison: RdDItemPoison,
|
poison: RdDItemPoison,
|
||||||
queue: RdDItemQueue,
|
|
||||||
tete: RdDItemTete,
|
|
||||||
potion: RdDItemPotion,
|
potion: RdDItemPotion,
|
||||||
|
queue: RdDItemQueue,
|
||||||
race: RdDItemRace,
|
race: RdDItemRace,
|
||||||
rencontre: RdDRencontre,
|
rencontre: RdDRencontre,
|
||||||
service: RdDItemService,
|
service: RdDItemService,
|
||||||
signedraconique: RdDItemSigneDraconique,
|
signedraconique: RdDItemSigneDraconique,
|
||||||
souffle: RdDItemSouffle,
|
souffle: RdDItemSouffle,
|
||||||
|
tete: RdDItemTete,
|
||||||
}
|
}
|
||||||
this.actorClasses = {
|
this.actorClasses = {
|
||||||
commerce: RdDCommerce,
|
commerce: RdDCommerce,
|
||||||
@ -190,22 +193,10 @@ export class SystemReveDeDragon {
|
|||||||
Items.unregisterSheet("core", ItemSheet)
|
Items.unregisterSheet("core", ItemSheet)
|
||||||
RdDActorExportSheet.init()
|
RdDActorExportSheet.init()
|
||||||
|
|
||||||
RdDItemSheet.register(RdDSigneDraconiqueItemSheet)
|
|
||||||
RdDItemSheet.register(RdDRencontreItemSheet)
|
|
||||||
RdDItemSheet.register(RdDConteneurItemSheet)
|
|
||||||
RdDItemSheet.register(RdDHerbeItemSheet)
|
|
||||||
RdDItemSheet.register(RdDFauneItemSheet)
|
|
||||||
RdDItemSheet.register(RdDPlanteItemSheet)
|
|
||||||
RdDItemSheet.register(RdDPotionItemSheet)
|
|
||||||
RdDItemSheet.register(RdDIngredientItemSheet)
|
|
||||||
RdDItemSheet.register(RdDServiceItemSheet)
|
|
||||||
RdDItemSheet.register(RdDBlessureItemSheet)
|
|
||||||
RdDJournalSheet.register()
|
|
||||||
|
|
||||||
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
||||||
types: [
|
types: [
|
||||||
"objet", "arme", "armure", "livre", "munition",
|
"objet", "arme", "armure", "livre", "munition",
|
||||||
"monnaie", "nourritureboisson", "gemme",
|
"monnaie", "nourritureboisson",
|
||||||
],
|
],
|
||||||
makeDefault: true
|
makeDefault: true
|
||||||
})
|
})
|
||||||
@ -220,6 +211,19 @@ export class SystemReveDeDragon {
|
|||||||
],
|
],
|
||||||
makeDefault: true
|
makeDefault: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
RdDItemSheet.register(RdDBlessureItemSheet)
|
||||||
|
RdDItemSheet.register(RdDConteneurItemSheet)
|
||||||
|
RdDItemSheet.register(RdDFauneItemSheet)
|
||||||
|
RdDItemSheet.register(RdDGemmeItemSheet)
|
||||||
|
RdDItemSheet.register(RdDHerbeItemSheet)
|
||||||
|
RdDItemSheet.register(RdDIngredientItemSheet)
|
||||||
|
RdDItemSheet.register(RdDPlanteItemSheet)
|
||||||
|
RdDItemSheet.register(RdDPotionItemSheet)
|
||||||
|
RdDItemSheet.register(RdDRencontreItemSheet)
|
||||||
|
RdDItemSheet.register(RdDServiceItemSheet)
|
||||||
|
RdDItemSheet.register(RdDSigneDraconiqueItemSheet)
|
||||||
|
RdDJournalSheet.register()
|
||||||
|
|
||||||
// préparation des différents modules
|
// préparation des différents modules
|
||||||
console.log(`Initializing Reve de Dragon Hooks and handlers`)
|
console.log(`Initializing Reve de Dragon Hooks and handlers`)
|
||||||
|
@ -192,7 +192,8 @@ export class RdDUtility {
|
|||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-categories.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-categories.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-ingredient.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-ingredient.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-parade.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-parade.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/item/potion-enum-categorie.hbs',
|
'systems/foundryvtt-reve-de-dragon/templates/item/enum-categorie-alchimie.hbs',
|
||||||
|
'systems/foundryvtt-reve-de-dragon/templates/item/enum-etat-alchimie.hbs',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-queue.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-queue.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-categorie-vehicule.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-competence.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-competence.html',
|
||||||
@ -206,6 +207,7 @@ export class RdDUtility {
|
|||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-type.html',
|
'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-type.html',
|
||||||
// Partials
|
// Partials
|
||||||
|
'systems/foundryvtt-reve-de-dragon/templates/enchantement/partial-enchantement.hbs',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/coeur/chat-effet-tendre-moment.hbs',
|
'systems/foundryvtt-reve-de-dragon/templates/coeur/chat-effet-tendre-moment.hbs',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/coeur/afficher-coeur.hbs',
|
'systems/foundryvtt-reve-de-dragon/templates/coeur/afficher-coeur.hbs',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats-recherche.hbs',
|
'systems/foundryvtt-reve-de-dragon/templates/tirage/liste-resultats-recherche.hbs',
|
||||||
@ -262,7 +264,6 @@ export class RdDUtility {
|
|||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-sante.hbs',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-sante.hbs',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html',
|
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html',
|
'systems/foundryvtt-reve-de-dragon/templates/chat-fabriquer-potion-base.html',
|
||||||
'systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html'
|
'systems/foundryvtt-reve-de-dragon/templates/chat-signe-draconique-actor.html'
|
||||||
];
|
];
|
||||||
@ -339,6 +340,7 @@ export class RdDUtility {
|
|||||||
Handlebars.registerHelper('rarete-getChamp', (rarete, field) => RdDRaretes.getChamp(rarete, field));
|
Handlebars.registerHelper('rarete-getChamp', (rarete, field) => RdDRaretes.getChamp(rarete, field));
|
||||||
Handlebars.registerHelper('item-action-applies', (action, item, options) => ItemAction.applies(action, item, options))
|
Handlebars.registerHelper('item-action-applies', (action, item, options) => ItemAction.applies(action, item, options))
|
||||||
Handlebars.registerHelper('item-action-icon', (action, item) => ItemAction.icon(action, item))
|
Handlebars.registerHelper('item-action-icon', (action, item) => ItemAction.icon(action, item))
|
||||||
|
Handlebars.registerHelper('item-name', (item) => item.nameDisplay)
|
||||||
|
|
||||||
// TMRs
|
// TMRs
|
||||||
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
|
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
|
||||||
|
@ -2358,6 +2358,7 @@ items:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Epais
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -3897,7 +3898,8 @@ items:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -4919,6 +4921,7 @@ items:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Epais
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -5349,7 +5352,8 @@ items:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -5605,7 +5609,8 @@ items:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -5765,7 +5770,8 @@ items:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -6437,7 +6443,8 @@ items:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -6672,6 +6679,7 @@ items:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Solide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -7157,6 +7165,7 @@ items:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Poudre
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -7610,7 +7619,8 @@ items:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -7690,6 +7700,7 @@ items:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Solide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
@ -7768,6 +7779,7 @@ items:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Epais
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -29,6 +29,7 @@ system:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Epais
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -30,7 +30,8 @@ system:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -29,6 +29,7 @@ system:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Epais
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -30,7 +30,8 @@ system:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -30,7 +30,8 @@ system:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -28,7 +28,8 @@ system:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -30,7 +30,8 @@ system:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -29,6 +29,7 @@ system:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Solide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -29,6 +29,7 @@ system:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Poudre
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -30,7 +30,8 @@ system:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -29,6 +29,7 @@ system:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Solide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -29,6 +29,7 @@ system:
|
|||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Remede
|
categorie: Remede
|
||||||
|
etat: Epais
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -3344,7 +3344,8 @@ items:
|
|||||||
indexDate: -1
|
indexDate: -1
|
||||||
indexMinute: 0
|
indexMinute: 0
|
||||||
rarete: ''
|
rarete: ''
|
||||||
categorie: Alchimie
|
categorie: Remede
|
||||||
|
etat: Liquide
|
||||||
herbe: ''
|
herbe: ''
|
||||||
herbebrins: 0
|
herbebrins: 0
|
||||||
herbebonus: 0
|
herbebonus: 0
|
||||||
|
@ -589,6 +589,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"enchantable": {
|
||||||
|
"magique": false,
|
||||||
|
"pr": 0,
|
||||||
|
"purifie": false,
|
||||||
|
"prpermanent": false,
|
||||||
|
"prdate": 0
|
||||||
|
},
|
||||||
"equipement": {
|
"equipement": {
|
||||||
"equipe": false
|
"equipe": false
|
||||||
},
|
},
|
||||||
@ -739,7 +746,7 @@
|
|||||||
"templates": ["description", "inventaire"]
|
"templates": ["description", "inventaire"]
|
||||||
},
|
},
|
||||||
"gemme": {
|
"gemme": {
|
||||||
"templates": ["description", "inventaire"],
|
"templates": ["description", "enchantable", "inventaire", "temporel"],
|
||||||
"type": "",
|
"type": "",
|
||||||
"taille": 0,
|
"taille": 0,
|
||||||
"purete": 0,
|
"purete": 0,
|
||||||
@ -795,18 +802,14 @@
|
|||||||
"niveau_maximum": 0
|
"niveau_maximum": 0
|
||||||
},
|
},
|
||||||
"potion": {
|
"potion": {
|
||||||
"templates": ["description", "inventaire", "temporel"],
|
"templates": ["description", "enchantable", "inventaire", "temporel"],
|
||||||
"rarete": "",
|
"rarete": "",
|
||||||
"categorie": "",
|
"categorie": "",
|
||||||
|
"etat": "",
|
||||||
"herbe": "",
|
"herbe": "",
|
||||||
"herbebrins": 0,
|
"herbebrins": 0,
|
||||||
"herbebonus": 0,
|
"herbebonus": 0,
|
||||||
"reposalchimique": false,
|
"reposalchimique": false
|
||||||
"magique": false,
|
|
||||||
"pr": 0,
|
|
||||||
"purifie": false,
|
|
||||||
"prpermanent": false,
|
|
||||||
"prdate": 0
|
|
||||||
},
|
},
|
||||||
"service": {
|
"service": {
|
||||||
"templates": ["description", "inventaire"],
|
"templates": ["description", "inventaire"],
|
||||||
@ -903,7 +906,7 @@
|
|||||||
"value": 0
|
"value": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"attributs":{
|
"attributs": {
|
||||||
"protection": {
|
"protection": {
|
||||||
"value": 0
|
"value": 0
|
||||||
}
|
}
|
||||||
@ -950,7 +953,8 @@
|
|||||||
"xp": 0,
|
"xp": 0,
|
||||||
"bonuscase": "",
|
"bonuscase": "",
|
||||||
"isrituel": false,
|
"isrituel": false,
|
||||||
"coutseuil": 0
|
"coutseuil": 0,
|
||||||
|
"lancements": []
|
||||||
},
|
},
|
||||||
"sortreserve": {
|
"sortreserve": {
|
||||||
"sortid": "",
|
"sortid": "",
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
{{else}}far fa-plus-square
|
{{else}}far fa-plus-square
|
||||||
{{/if~}}"></i>
|
{{/if~}}"></i>
|
||||||
<img class="sheet-competence-img" src="{{item.img}}"/>
|
<img class="sheet-competence-img" src="{{item.img}}"/>
|
||||||
<span>{{item.name}}</span>
|
<span>{{item.name}}{{#if item.system.magique}} <i class="fa-solid fa-sparkles" data-tooltip="Enchantement"></i>{{/if}}</span>
|
||||||
</a>
|
</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
<img class="sheet-competence-img" src="{{item.img}}"/>
|
<img class="sheet-competence-img" src="{{item.img}}"/>
|
||||||
<span>{{item.name}}
|
<span>{{item.name}}{{#if item.system.magique}} <i class="fa-solid fa-sparkles" data-tooltip="Enchantement"></i>{{/if}}</span>
|
||||||
{{#if (eq item.type 'arme')}}
|
{{#if (eq item.type 'arme')}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/icon-arme-broken.hbs" item}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/icon-arme-broken.hbs" item}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
9
templates/chat-pertereve-enchantement-chateaudormant.hbs
Normal file
9
templates/chat-pertereve-enchantement-chateaudormant.hbs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<img class="chat-icon" src="{{item.img}}" data-tooltip="{{item.name}}" />
|
||||||
|
<h4>
|
||||||
|
La {{item.type}} enchantée {{item.name}} de {{alias}} a perdu un Point de Rêve (nouveau total : {{nouveaupr}}).</h4>
|
||||||
|
<hr>
|
||||||
|
<div>
|
||||||
|
{{#if (and (eq item.type 'potion') (eq nouveaupr 0))}}
|
||||||
|
Sa {{item.type}} étant désormais à 0 Point de Rêve, elle est inutilisable et peut être jetée.
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
@ -1,9 +0,0 @@
|
|||||||
<img class="chat-icon" src="{{potionImg}}" data-tooltip="{{potionName}}" />
|
|
||||||
<h4>
|
|
||||||
La potion enchantée {{potionName}} de {{alias}} a perdu un Point de Rêve (nouveau total : {{pr}}).</h4>
|
|
||||||
<hr>
|
|
||||||
<div>
|
|
||||||
{{#if (eq pr 0)}}
|
|
||||||
Sa potion étant désormais à 0 Point de Rêve, elle est inutilisable et doit être jetée.
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
50
templates/enchantement/dialog-enchanter.hbs
Normal file
50
templates/enchantement/dialog-enchanter.hbs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<form class="rdd-dialog-enchanter">
|
||||||
|
<img class="chat-icon" src="{{item.img}}" data-tooltip="Enchanter {{item.name}}" />
|
||||||
|
<div class="flexcol">
|
||||||
|
<h4>Enchanter {{item.name}}</h4>
|
||||||
|
<div class="flexrow">
|
||||||
|
<label class="flex-grow">Points de rêve (actuels: {{item.system.pr}})</label>
|
||||||
|
<input class="attribute-value reve flex-shrink number-x2"
|
||||||
|
data-dtype="Number" type="number" min="0" max="50"
|
||||||
|
name="reve" value="{{reve}}" {{#unless options.isGM}}disabled{{/unless}}/>
|
||||||
|
</div>
|
||||||
|
{{#if (or options.isGM (not item.system.magique) item.system.purifie purification)}}
|
||||||
|
{{#each nouveauxpr as |nouveaupr idx|}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<label class="flex-grow">Enchantement de {{nouveaupr}} points de rêve</label>
|
||||||
|
<input class="attribute-value enchantement flex-shrink" type="checkbox" data-reve="{{nouveaupr}}" data-idx="{{idx}}"
|
||||||
|
{{#if (eq idx ../idx)}}checked{{/if}}>
|
||||||
|
</input>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (or purification options.isGM)}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<label for="rendrepurifie">Purifier {{#if (and item.system.magique item.system.purifie)}}(déja purifiée){{/if}}</label>
|
||||||
|
<input class="attribute-value rendrepurifie" type="checkbox" name="rendrepurifie"
|
||||||
|
{{#unless options.isGM}}
|
||||||
|
{{#if item.system.magique}}
|
||||||
|
{{#if item.system.purifie}}
|
||||||
|
disabled
|
||||||
|
{{else if purification}}
|
||||||
|
checked disabled
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
{{#unless purification}}
|
||||||
|
disabled
|
||||||
|
{{/unless}}
|
||||||
|
{{/if}}
|
||||||
|
{{/unless}} />
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if (or permanence options.isGM)}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<label for="rendrepermanent">Potion permanente</label>
|
||||||
|
<input class="attribute-value rendrepermanent" type="checkbox" name="rendrepermanent"/>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
34
templates/enchantement/partial-enchantement.hbs
Normal file
34
templates/enchantement/partial-enchantement.hbs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{{#if isEnchantementPossible}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="system.magique">Magique {{#if system.magique}}<i class="fa-solid fa-sparkles"></i>{{/if}}</label>
|
||||||
|
<input class="attribute-value" type="checkbox" name="system.magique" {{#if system.magique}}checked{{/if}}/>
|
||||||
|
<label></label>
|
||||||
|
</div>
|
||||||
|
{{#if system.magique}}
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="system.pr">Points de rêve</label>
|
||||||
|
<input class="attribute-value" type="text" name="system.pr" value="{{system.pr}}" data-dtype="Number" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="system.purifie">Purifiée</label>
|
||||||
|
<input class="attribute-value" type="checkbox" name="system.purifie" {{#if system.purifie}}checked{{/if}}/>
|
||||||
|
<label></label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="system.prpermanent">Permanente</label>
|
||||||
|
<input class="attribute-value" type="checkbox" name="system.prpermanent" {{#if system.prpermanent}}checked{{/if}}/>
|
||||||
|
<label></label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="enchantement.jour">Date de l'Enchantement : Jour/Mois (date actuelle : {{dateActuelle}})</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="number" name="enchantement.jour" class="date-enchantement" value="{{enchantement.jour}}" data-dtype="Number" min="1" max="28"/>
|
||||||
|
<select name="enchantement.mois" class="date-enchantement" data-dtype="String">
|
||||||
|
{{#select enchantement.mois}}
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
@ -6,9 +6,3 @@
|
|||||||
<option value="Repos">Potion de Repos</option>
|
<option value="Repos">Potion de Repos</option>
|
||||||
<option value="Soin">Potion de Soin</option>
|
<option value="Soin">Potion de Soin</option>
|
||||||
<option value="Autre">Potion Autre</option>
|
<option value="Autre">Potion Autre</option>
|
||||||
{{#if enchantable}}
|
|
||||||
<option value="AlchimieEnchante">Potion d'Alchimie Enchantée</option>
|
|
||||||
<option value="ReposEnchante">Potion de Repos Enchantée</option>
|
|
||||||
<option value="SoinEnchante">Potion de Soin Enchantée</option>
|
|
||||||
<option value="AutreEnchante">Potion Autre Enchantée</option>
|
|
||||||
{{/if}}
|
|
8
templates/item/enum-etat-alchimie.hbs
Normal file
8
templates/item/enum-etat-alchimie.hbs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<option value=""></option>
|
||||||
|
<option value="Liquide">Liquide</option>
|
||||||
|
<option value="Epais">Liquide épais</option>
|
||||||
|
<option value="Onguent">Onguent</option>
|
||||||
|
<option value="Poudre">Poudre</option>
|
||||||
|
<option value="Solide">Solide</option>
|
||||||
|
<option value="Solide">Solide</option>
|
||||||
|
<option value="Autre">Autre</option>
|
@ -1,5 +1,17 @@
|
|||||||
|
{{log this}}
|
||||||
<form class="{{cssClass}}" autocomplete="off">
|
<form class="{{cssClass}}" autocomplete="off">
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.html"}}
|
<header class="sheet-header">
|
||||||
|
<img class="profile-img" src="{{img}}" data-edit="img" data-tooltip="{{name}}"/>
|
||||||
|
<div class="header-fields">
|
||||||
|
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
|
||||||
|
<span>
|
||||||
|
{{#if isEnchantementPossible}}
|
||||||
|
<a class="item-enchanter chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Enchanter cette gemme">Enchanter</a>
|
||||||
|
{{/if}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
<nav class="sheet-tabs tabs" data-group="primary">
|
<nav class="sheet-tabs tabs" data-group="primary">
|
||||||
<a class="item" data-tab="informations">Informations</a>
|
<a class="item" data-tab="informations">Informations</a>
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.html"}}
|
||||||
@ -30,6 +42,7 @@
|
|||||||
<label>Enchantabilité</label>
|
<label>Enchantabilité</label>
|
||||||
<input class="attribute-value" type="text" name="system.enchantabilite" value="{{system.enchantabilite}}" data-dtype="Number" disabled/>
|
<input class="attribute-value" type="text" name="system.enchantabilite" value="{{system.enchantabilite}}" data-dtype="Number" disabled/>
|
||||||
</div>
|
</div>
|
||||||
|
{{>'systems/foundryvtt-reve-de-dragon/templates/enchantement/partial-enchantement.hbs'}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
{{#if options.isOwned}}
|
{{#if options.isOwned}}
|
||||||
<a class="item-potion-consommer chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Consommer cette potion et appliquer ses effets">Consommer</a>
|
<a class="item-potion-consommer chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Consommer cette potion et appliquer ses effets">Consommer</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if enchantable}}
|
{{#if isEnchantementPossible}}
|
||||||
<a class="item-enchanter chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Enchanter cette potion">Enchanter</a>
|
<a class="item-enchanter chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Enchanter cette potion">Enchanter</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
@ -33,7 +33,15 @@
|
|||||||
<label for="system.categorie">Catégorie</label>
|
<label for="system.categorie">Catégorie</label>
|
||||||
<select name="system.categorie" class="categoriepotion" data-dtype="String">
|
<select name="system.categorie" class="categoriepotion" data-dtype="String">
|
||||||
{{#select system.categorie}}
|
{{#select system.categorie}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/potion-enum-categorie.hbs" this}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/enum-categorie-alchimie.hbs" this}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="system.etat">Etat / consistance</label>
|
||||||
|
<select name="system.etat" class="etat" data-dtype="String">
|
||||||
|
{{#select system.etat}}
|
||||||
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/enum-etat-alchimie.hbs" this}}
|
||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -63,43 +71,20 @@
|
|||||||
<input class="attribute-value" type="checkbox" name="system.reposalchimique" {{#if system.reposalchimique}}checked{{/if}}/>
|
<input class="attribute-value" type="checkbox" name="system.reposalchimique" {{#if system.reposalchimique}}checked{{/if}}/>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if enchantable}}
|
{{#if system.magique}}
|
||||||
{{#if system.magique}}
|
<div class="form-group">
|
||||||
<div class="form-group">
|
{{#if isSoins}}
|
||||||
<label for="system.pr">Points de rêve</label>
|
<label>Points de guérison</label>
|
||||||
<input class="attribute-value" type="text" name="system.pr" value="{{system.pr}}" data-dtype="Number" />
|
{{else if isRepos}}
|
||||||
</div>
|
<label>Points de repos</label>
|
||||||
{{#if isSoins}}
|
{{else}}
|
||||||
<div class="form-group">
|
<label>Puissance</label>
|
||||||
<label>Points de guérison</label>
|
|
||||||
<input class="attribute-value" type="text" name="system.puissance" value="{{system.puissance}}" disabled />
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{#if isRepos}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Points de repos</label>
|
|
||||||
<input class="attribute-value" type="text" name="system.puissance" value="{{system.puissance}}" disabled />
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="system.prpermanent">Permanente ? </label>
|
|
||||||
<input class="attribute-value" type="checkbox" name="system.prpermanent" {{#if system.prpermanent}}checked{{/if}}/>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="enchantement.jour">Date de l'Enchantement : Jour/Mois (date actuelle : {{dateActuelle}})</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="number" name="enchantement.jour" class="date-enchantement" value="{{enchantement.jour}}" data-dtype="Number" min="1" max="28"/>
|
|
||||||
<select name="enchantement.mois" class="date-enchantement" data-dtype="String">
|
|
||||||
{{#select enchantement.mois}}
|
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-heures.html"}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
<input class="attribute-value" type="text" name="system.puissance" value="{{system.puissance}}" disabled />
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{>'systems/foundryvtt-reve-de-dragon/templates/enchantement/partial-enchantement.hbs'}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
|
||||||
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
|
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
<form class="rdd-dialog-enchanter">
|
|
||||||
<img class="chat-icon" src="{{item.img}}" data-tooltip="Enchanter {{item.name}}" />
|
|
||||||
<div class="flexcol">
|
|
||||||
<h4>Enchanter {{item.name}}</h4>
|
|
||||||
<div class="flexrow">
|
|
||||||
<label class="flex-grow">Nouveaux points de rêve</label>
|
|
||||||
<input class="attribute-value nouveaupr flex-shrink number-x2" type="number" name="nouveaupr" value="{{nouveaupr}}"
|
|
||||||
min="0" max="50" data-dtype="Number" />
|
|
||||||
</div>
|
|
||||||
{{!-- <div class="flexrow">
|
|
||||||
<input class="attribute-value purifier" type="checkbox" name="purifier" {{#if purifier}}checked{{/if}}>
|
|
||||||
<label for="purifier">Purifier</label>
|
|
||||||
</input>
|
|
||||||
</div> --}}
|
|
||||||
<div class="flexrow">
|
|
||||||
<input class="attribute-value prpermanent" type="checkbox" name="prpermanent" {{#if purifier}}checked{{/if}}>
|
|
||||||
<label for="prpermanent">Permanente</label>
|
|
||||||
</input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user