Merge pull request '12.0.37 - Les enchantements d'Astrobazzarh' (#742) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
All checks were successful
Release Creation / build (release) Successful in 1m38s

Reviewed-on: #742
This commit is contained in:
uberwald 2025-01-21 09:37:15 +01:00
commit 24518642a7
54 changed files with 777 additions and 449 deletions

View File

@ -1,4 +1,10 @@
# 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
- Nouveautés
- ajout d'un bouton pour enchanter les potions

View File

@ -19,7 +19,6 @@ import { RdDEmpoignade } from "./rdd-empoignade.js";
import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js";
import { RdDCoeur } from "./coeur/rdd-coeur.js";
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
import { RdDItemRace } from "./item/race.js";
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
/* -------------------------------------------- */

View File

@ -166,22 +166,29 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async $perteRevePotionsEnchantees() {
const potionUpdates = this.itemTypes[ITEM_TYPES.potion].map(it => it.perteRevePotion())
async $perteReveEnchantementsChateauDormants() {
const toUpdate = this.items.filter(it => [ITEM_TYPES.potion, ITEM_TYPES.gemme].includes(it.type))
.map(it => it.perteReveChateauDormant())
.filter(it => it != undefined)
if (potionUpdates.length > 0) {
console.log('perte rêve de potions', potionUpdates)
const messageUpdates = await Promise.all(potionUpdates.map(async p => await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, {
pr: foundry.utils.getProperty(p, 'system.pr'),
alias: this.getAlias(),
potionName: p.name,
potionImg: p.img
})))
if (toUpdate.length > 0) {
console.log('perte de rêve des enchantements', toUpdate)
const messageUpdates = await Promise.all(
toUpdate.map(async it => await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-pertereve-enchantement-chateaudormant.hbs`, it)))
ChatMessage.create({
whisper: ChatUtility.getOwners(this),
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._recupereMoralChateauDormant(message);
await this._recupereChance();
await this.transformerStress();
await this.retourSeuilDeReve(message);
await this.setBonusPotionSoin(0);
await this.retourSust(message);
await this.$perteRevePotionsEnchantees();
await this._recupereMoralChateauDormant(message)
await this._recupereChance()
await this.transformerStress()
await this.retourSeuilDeReve(message)
await this.setBonusPotionSoin(0)
await this.retourSust(message)
await this.$perteReveEnchantementsChateauDormants()
await this.$suppressionLancementsSort()
await RdDCoeur.applyCoeurChateauDormant(this, message)
if (message.content != "") {
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()) {
return DialogFabriquerPotion.create(this, item, onActionItem);
return DialogFabriquerPotion.create(this, item);
}
return;
}
@ -1726,6 +1734,17 @@ export class RdDActor extends RdDBaseActorSang {
if (rollData.isSortReserve) {
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 {
rollData.depenseReve = 0;
@ -2849,12 +2868,13 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async fabriquerPotion(herbeData) {
let newPotion = {
const newPotion = {
name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion',
img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp",
system: {
quantite: 1, cout: 0, encombrement: 0.1,
categorie: herbeData.system.categorie,
etat: 'Liquide',
herbe: herbeData.name,
rarete: herbeData.system.rarete,
herbebrins: herbeData.nbBrins,
@ -2862,29 +2882,23 @@ export class RdDActor extends RdDBaseActorSang {
description: ""
}
}
await this.createEmbeddedDocuments('Item', [newPotion], { renderSheet: true });
let newQuantite = herbeData.system.quantite - herbeData.nbBrins;
let messageData = {
alias: this.getAlias(),
nbBrinsReste: newQuantite,
potion: newPotion,
herbe: herbeData
}
this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins);
await this.createEmbeddedDocuments('Item', [newPotion])
await this.diminuerQuantiteObjet(herbeData._id, herbeData.nbBrins)
ChatMessage.create({
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 }) {
const item = this.getItem(id);
if (item) {
await item.diminuerQuantite(nb, options);
}
await this.getItem(id)?.diminuerQuantite(nb, options);
}
/* -------------------------------------------- */

View File

@ -108,7 +108,6 @@ export class RdDBaseActorSheet extends ActorSheet {
this.html.find('.item-equip-armure').click(async event => this.actor.equiperObjet(this.getItem(event)))
this.html.find('.item-delete').click(async event => RdDUtility.confirmActorItemDelete(this.getItem(event), this.actor));
this.html.find('.item-split').click(async event => RdDSheetUtility.splitItem(this.getItem(event), this.actor))
this.html.find('.item-quantite-plus').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), 1));
this.html.find('.item-quantite-moins').click(async event => this.actor.itemQuantiteIncDec(this.getItemId(event), -1));

View File

@ -1,88 +1,79 @@
import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
import { RdDUtility } from "./rdd-utility.js";
export class DialogFabriquerPotion extends Dialog {
/* -------------------------------------------- */
static async create(actor, item, onActionItem) {
const min = DialogFabriquerPotion.nombreBrinsMinimum(item);
if (item.system.quantite < min) {
ui.notifications.warn(`Vous avez ${item.system.quantite} brins de ${item.name}, il en faut au moins ${min} pour faire une potion!`);
return;
static async create(actor, item) {
const brinsMinimum = DialogFabriquerPotion.nombreBrinsMinimum(item)
if (item.system.quantite < brinsMinimum) {
ui.notifications.warn(`Vous avez ${item.system.quantite} brins de ${item.name}, il en faut au moins ${brinsMinimum} pour faire une potion!`)
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);
let options = { classes: ["dialogfabriquerpotion"], width: 600, height: 160, 'z-index': 99999 };
new DialogFabriquerPotion(actor, potionData, onActionItem, html, options).render(true);
new DialogFabriquerPotion(actor, potionData, html, options).render(true)
}
/* -------------------------------------------- */
static prepareData(actor, item) {
let potionData = foundry.utils.duplicate(item)
potionData.nbBrinsSelect = RdDUtility.buildListOptions(
DialogFabriquerPotion.nombreBrinsMinimum(item),
DialogFabriquerPotion.nombreBrinsOptimal(item));
potionData.nbBrins = Math.min(potionData.system.quantite, DialogFabriquerPotion.nombreBrinsOptimal(potionData));
potionData.herbebonus = item.system.niveau;
potionData.buttonName = "Fabriquer";
return potionData;
static prepareData(item, brinsMinimum) {
const brinsOptimal = DialogFabriquerPotion.nombreBrinsOptimal(item)
return foundry.utils.mergeObject(foundry.utils.duplicate(item), {
nbBrinsSelect: RdDUtility.buildListOptions(brinsMinimum, brinsOptimal),
nbBrins: Math.min(item.system.quantite, brinsOptimal),
herbebonus: item.system.niveau
})
}
/* -------------------------------------------- */
constructor(actor, potionData, onActionItem, html, options) {
constructor(actor, potionData, html, options) {
const conf = {
title: `Fabriquer une potion de ${potionData.system.categorie}`,
content: html,
default: 'fabriquer',
buttons: {
'fabriquer': {
label: potionData.buttonName, callback: it => this.onFabriquer()
'fabriquer': { label: "Fabriquer", callback: it => this.onFabriquer() }
}
}
};
super(conf, options)
super(conf, options);
this.actor = actor;
this.potionData = potionData;
this.onActionItem = onActionItem;
this.actor = actor
this.potionData = potionData
}
/* -------------------------------------------- */
activateListeners(html) {
super.activateListeners(html);
this.html = html;
super.activateListeners(html)
this.html = html
this.html.find("[name='nbBrins']").change(event => {
this.potionData.nbBrins = Misc.toInt(event.currentTarget.value);
const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins);
this.potionData.nbBrins = Misc.toInt(event.currentTarget.value)
const brinsManquants = Math.max(0, DialogFabriquerPotion.nombreBrinsOptimal(this.potionData) - this.potionData.nbBrins)
this.potionData.herbebonus = Math.max(0, this.potionData.system.niveau - brinsManquants)
});
})
}
/* -------------------------------------------- */
async onFabriquer() {
await this.html.find("[name='nbBrins']").change();
await this.actor.fabriquerPotion(this.potionData);
this.close();
await this.onActionItem()
await this.html.find("[name='nbBrins']").change()
await this.actor.fabriquerPotion(this.potionData)
this.close()
}
static nombreBrinsMinimum(herbeData) {
switch (herbeData.system.categorie ?? '') {
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 "Soin": return 1 + Math.max(0, 12 - 2 * herbeData.system.niveau)
case "Repos": return 1 + Math.max(0, 7 - 2 * herbeData.system.niveau)
}
return 1;
return 1
}
static nombreBrinsOptimal(herbeData) {
switch (herbeData.system.categorie ?? '') {
case "Soin": return 12 - herbeData.system.niveau;
case "Repos": return 7 - herbeData.system.niveau;
case "Soin": return 12 - herbeData.system.niveau
case "Repos": return 7 - herbeData.system.niveau
}
return 1;
return 1
}
}

View 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))
}
}
}
}
}

View File

@ -2,7 +2,6 @@ import { ACTOR_TYPES, ITEM_TYPES } from "./constants.js";
import { RdDItemSort } from "./item-sort.js";
import { RdDUtility } from "./rdd-utility.js";
import { RdDItemCompetence } from "./item-competence.js";
import { RdDGemme } from "./rdd-gemme.js";
import { HtmlUtility } from "./html-utility.js";
import { ReglesOptionnelles } from "./settings/regles-optionnelles.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 { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
import { ItemAction } from "./item/item-actions.js";
import { RdDItemGemme } from "./item/gemme.js";
/**
* 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.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 (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')
|| game.user.isGM
|| !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
if (!this.options.editable) return;
@ -193,30 +189,26 @@ export class RdDItemSheet extends ItemSheet {
})
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('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
if (this.actor) {
// TODO
this.html.find('.actionItem').click(event => ItemAction.onActionItem(event, this.actor, this.options))
// TODO: utiliser un itemAction?
this.html.find('.item-potion-consommer').click(event => this.itemActionConsommer(event))
this.html.find('.item-split').click( event => this.itemActionSplit(event))
this.html.find('.item-edit').click(async event => RdDSheetUtility.getItem(event, this.actor)?.sheet.render(true));
this.html.find('.item-delete').click(async event => this.itemActionDelete(event));
this.html.find('.item-quantite-plus').click(async event => {
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), 1)
this.render();
});
this.render()
})
this.html.find('.item-quantite-moins').click(async event => {
await this.actor.itemQuantiteIncDec(RdDSheetUtility.getItemId(event), -1)
this.render();
});
this.render()
})
}
const updateItemTimestamp = (path, timestamp) => this.item.update({ [path]: foundry.utils.duplicate(timestamp) })

View File

@ -25,6 +25,20 @@ export class RdDItemSort extends Item {
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) {
return value ? value.replace('variable', 'var') : ''
}
@ -151,5 +165,4 @@ export class RdDItemSort extends Item {
.map(it => it.split(':'))
.map(it => { return { case: it[0], bonus: it[1] } });
}
}

View File

@ -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 typesEnvironnement = typesInventaireMateriel;
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 = {
arme: "systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_gnome.webp",
@ -85,7 +82,6 @@ export const defaultItemImg = {
/* -------------------------------------------- */
export class RdDItem extends Item {
static get defaultIcon() {
return undefined;
}
@ -184,7 +180,6 @@ export class RdDItem extends Item {
isCompetenceCreature() { return this.type == ITEM_TYPES.competencecreature }
isConteneur() { return this.type == ITEM_TYPES.conteneur; }
isMonnaie() { return this.type == ITEM_TYPES.monnaie; }
isPotion() { return this.type == ITEM_TYPES.potion; }
isNourritureBoisson() { return this.type == ITEM_TYPES.nourritureboisson; }
isService() { return this.type == ITEM_TYPES.service; }
@ -223,6 +218,12 @@ export class RdDItem extends Item {
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) {
const environnements = this.isInventaire() ? this.system.environnement : undefined;
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;
}
isMagique() {
get isMagique() {
return this.system.magique
}
@ -342,6 +343,7 @@ export class RdDItem extends Item {
isNomLike(texte) {
return Grammar.includesLowerCaseNoAccent(this.name, texte)
}
isNomTypeLike(texte) {
return this.isNomLike(texte) || Grammar.includesLowerCaseNoAccent(Misc.typeName(this.type, 'Item'), texte)
}
@ -360,8 +362,6 @@ export class RdDItem extends Item {
return 0;
case ITEM_TYPES.herbe:
return this.getEncHerbe();
case ITEM_TYPES.gemme:
return encPepin * this.system.taille;
}
return Math.max(this.system.encombrement ?? 0, 0);
}
@ -427,10 +427,6 @@ export class RdDItem extends Item {
itemSpecificActions() {
const actions = ITEM_ACTIONS[this.type] ?? []
// const actorTypes = actions.actorTypes ?? [ACTOR_TYPES.personnage]
// if (!actorTypes.includes(this.actor?.type)) {
// return []
// }
return actions
}

112
module/item/gemme.js Normal file
View 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
}
}

View File

@ -27,6 +27,12 @@ const _MONTRER = {
code: 'item-montrer', label: 'Montrer', icon: it => 'fa-solid fa-comment',
action: (item, actor) => item.postItemToChat()
}
const _SPLIT = {
code: 'item-split', label: 'Séparer le goupe', icon: it => 'fa-solid fa-unlink',
filter: it => Misc.toInt(it.system.quantite) > 1,
action: (item, actor) => RdDSheetUtility.splitItem(item, actor)
}
const _EDIT = {
code: 'item-edit', label: 'Editer', icon: it => 'fa-solid fa-edit',
action: (item, actor) => item.sheet.render(true)
@ -69,7 +75,7 @@ const _BOIRE = {
const _DECOCTION = {
code: 'item-decoction', label: 'Décoction', icon: it => 'fa-solid fa-flask-vial',
optionsFilter: options => options.editable,
action: (item, actor) => actor.actionHerbe(item)
action: (item, actor) => actor.fabriquerDecoctionHerbe(item)
}
const _OUVRIR = {
code: 'item-edit', label: 'Ouvrir', icon: it => 'fa-solid fa-eye',
@ -89,19 +95,6 @@ const _REFOULER = {
action: (item, actor) => actor.actionRefoulement(item)
}
const _CONSOMMER_POTION = {
code: 'item-potion-consommer', label: 'Consommer', icon: it => 'fa-solid fa-vial',
optionsFilter: options => options.editable,
action: (item, actor) => actor.consommerPotion(item)
}
const _ENCHANTER = {
code: 'item-enchanter', label: 'Enchanter', icon: it => 'fa-solid fa-sparkles',
filter: it => it.isEnchantable(),
optionsFilter: options => options.editable,
action: (item, actor) => item.enchanterPotion()
}
const _SORT_RESERVE = {
code: 'item-sortreserve-add', label: 'Ajouter en réserve', icon: it => 'fa-solid fa-sparkles',
filter: it => game.user.isGM && !it.system.isrituel,
@ -109,7 +102,7 @@ const _SORT_RESERVE = {
}
export const COMMON_ACTIONS = [_EQUIPER]
export const DEFAULT_ACTIONS = [_SPACEHOLDER, _VENDRE, _MONTRER, _EDIT, _DELETE]
export const DEFAULT_ACTIONS = [_SPACEHOLDER, _SPLIT, _VENDRE, _MONTRER, _EDIT, _DELETE]
export const ITEM_ACTIONS = {
faune: [_CUISINER, _MANGER_CRU],
@ -120,7 +113,6 @@ export const ITEM_ACTIONS = {
nourritureboisson: [_MANGER, _BOIRE],
ombre: [_REFOULER],
plante: [_CUISINER, _MANGER_CRU],
potion: [_CONSOMMER_POTION, _ENCHANTER],
queue: [_REFOULER],
sort: [_SORT_RESERVE],
service: [_ACHAT_SERVICE]
@ -130,7 +122,7 @@ export const ITEM_ACTIONS = {
export class ItemAction {
static applies(action, item, options) {
return action
return action && item
&& item.isActionAllowed(action.code)
&& (!action.filter || action.filter(item))
&& (!action.optionsFilter || action.optionsFilter(options))
@ -146,7 +138,7 @@ export class ItemAction {
static onActionItem(event, actor, options) {
const item = RdDSheetUtility.getItem(event, actor)
const code = $(event.currentTarget).data('code')
const action = item.itemActions().find(it => it.code == code)
const action = item?.itemActions().find(it => it.code == code)
if (action && (!action.optionsFilter || action.optionsFilter(options))) {
action.action(item, actor)
}

View File

@ -1,20 +1,18 @@
import { ITEM_TYPES } from "../constants.js";
import { Grammar } from "../grammar.js";
import { RdDItem } from "../item.js";
import { SystemCompendiums } from "../settings/system-compendiums.js";
import { ITEM_ACTIONS } from "./item-actions.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 = {
code: 'item-potion-consommer', label: 'Consommer', icon: it => 'fa-solid fa-vial',
optionsFilter: options => options.editable,
action: (item, actor) => actor.consommerPotion(item)
}
/**
* Item pour gérer les potions
*/
export class RdDItemPotion extends RdDItem {
static async herbesSoins() {
@ -33,114 +31,67 @@ export class RdDItemPotion extends RdDItem {
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() {
super.prepareDerivedData()
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 ITEM_ACTIONS[ITEM_TYPES.potion]
}
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() {
switch (this.system.categorie) {
case 'Alchimie': case 'AlchimieEnchante':
case 'AlchimieAutre':
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 'ReposEnchante': case 'Soin': case 'SoinEnchante':
case 'Cuisine':
return 'cuisine'
case 'Remede': case 'Repos': case 'Soin':
return 'soins'
}
return ''
}
_potionChatData() {
return [
getProprietes() {
const proprietes = [
`<b>Rareté</b>: ${this.system.rarete} `,
`<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() {
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() {
perteReveChateauDormant() {
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 {
alias: this.parent.getAlias(),
item: this,
nouveaupr: nouveaupr,
update: {
_id: this.id,
name: this.name,
img: this.img,
'system.pr': nouveauReve,
'system.quantite': nouveauReve > 0 ? this.system.quantite : 0,
'system.magique': nouveauReve > 0
'system.pr': nouveaupr,
'system.magique': nouveaupr > 0
}
}
}
return undefined
}
async $onEnchanterPotion(enchanter) {
if (enchanter.nouveaupr == 0) {
await this.update({
'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({
'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 }
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) {
let list = {}
for (let herbe of listeHerbes) {

View File

@ -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);
}
}

View 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}`)
});
}
}

View File

@ -1,4 +1,5 @@
import { ITEM_TYPES } from "../constants.js";
import { DialogEnchanter } from "../enchantement/dialog-enchanter.js";
import { RdDTimestamp } from "../time/rdd-timestamp.js";
import { RdDItemPotion } from "./potion.js";
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
@ -18,14 +19,12 @@ export class RdDPotionItemSheet extends RdDItemInventaireSheet {
}
}
}
get potion(){ return this.item }
async getData() {
const formData = await super.getData()
formData.enchantable = this.potion.isEnchantable()
const enchantement = this.potion.categorieEnchantement()
formData.isSoins = enchantement.basique == 'Soin'
formData.isRepos = enchantement.basique == 'Repos'
formData.isEnchantementPossible = this.item.isEnchantementPossible
formData.isSoins = this.item.categorie == 'Soin'
formData.isRepos = this.item.categorie == 'Repos'
if (formData.isSoins) {
const herbesSoins = await RdDItemPotion.herbesSoins()
RdDPotionItemSheet.$calculBonusHerbe(formData, herbesSoins, 12);
@ -37,20 +36,20 @@ export class RdDPotionItemSheet extends RdDItemInventaireSheet {
formData.herbesRepos = RdDItemPotion.buildHerbesList(herbesRepos, 7)
}
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
}
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) => {
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.potion.update({ 'system.prdate': indexDate })
this.item.update({ 'system.prdate': indexDate })
console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`)
});

View File

@ -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 {
static getMigrations() {
return [
@ -610,6 +646,7 @@ export class Migrations {
new _11_2_20_MigrationAstrologie(),
new _12_0_26_MigrationVoieSorts(),
new _12_0_32_MigrationRaces(),
new _12_0_37_MigrationAlchimieEtat(),
];
}

View File

@ -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;
}
}

View File

@ -77,6 +77,8 @@ import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
import { RdDJournalSheet } from "./journal/journal-sheet.js"
import { RdDPotionItemSheet } from "./item/sheet-potion.js"
import { RdDItemPotion } from "./item/potion.js"
import { RdDItemGemme } from "./item/gemme.js"
import { RdDGemmeItemSheet } from "./item/sheet-gemme.js"
/**
* RdD system
@ -100,17 +102,18 @@ export class SystemReveDeDragon {
this.itemClasses = {
armure: RdDItemArmure,
blessure: RdDItemBlessure,
gemme: RdDItemGemme,
maladie: RdDItemMaladie,
ombre: RdDItemOmbre,
poison: RdDItemPoison,
queue: RdDItemQueue,
tete: RdDItemTete,
potion: RdDItemPotion,
queue: RdDItemQueue,
race: RdDItemRace,
rencontre: RdDRencontre,
service: RdDItemService,
signedraconique: RdDItemSigneDraconique,
souffle: RdDItemSouffle,
tete: RdDItemTete,
}
this.actorClasses = {
commerce: RdDCommerce,
@ -190,22 +193,10 @@ export class SystemReveDeDragon {
Items.unregisterSheet("core", ItemSheet)
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, {
types: [
"objet", "arme", "armure", "livre", "munition",
"monnaie", "nourritureboisson", "gemme",
"monnaie", "nourritureboisson",
],
makeDefault: true
})
@ -221,6 +212,19 @@ export class SystemReveDeDragon {
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
console.log(`Initializing Reve de Dragon Hooks and handlers`)
CONFIG.Combat.documentClass = RdDCombatManager

View File

@ -66,10 +66,12 @@ export class RdDSheetUtility {
}
static async splitItem(item, actor, onSplit = () => { }) {
const dialog = await DialogSplitItem.create(item, async (item, split) => {
const _onSplit = async (item, split) => {
await RdDSheetUtility._onSplitItem(item, split, actor);
onSplit();
});
await RdDSheetUtility.renderItemBranch(actor, item)
}
const dialog = await DialogSplitItem.create(item, _onSplit)
dialog.render(true)
}

View File

@ -192,7 +192,8 @@ export class RdDUtility {
'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-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-vehicule.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-type.html',
// 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/afficher-coeur.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-competence-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-signe-draconique-actor.html'
];
@ -339,6 +340,7 @@ export class RdDUtility {
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-icon', (action, item) => ItemAction.icon(action, item))
Handlebars.registerHelper('item-name', (item) => item.nameDisplay)
// TMRs
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));

View File

@ -2358,6 +2358,7 @@ items:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Epais
herbe: ''
herbebrins: 0
herbebonus: 0
@ -3897,7 +3898,8 @@ items:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0
@ -4919,6 +4921,7 @@ items:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Epais
herbe: ''
herbebrins: 0
herbebonus: 0
@ -5349,7 +5352,8 @@ items:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0
@ -5605,7 +5609,8 @@ items:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0
@ -5765,7 +5770,8 @@ items:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0
@ -6437,7 +6443,8 @@ items:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0
@ -6672,6 +6679,7 @@ items:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Solide
herbe: ''
herbebrins: 0
herbebonus: 0
@ -7157,6 +7165,7 @@ items:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Poudre
herbe: ''
herbebrins: 0
herbebonus: 0
@ -7610,7 +7619,8 @@ items:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0
@ -7690,6 +7700,7 @@ items:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Solide
herbe: ''
herbebrins: 0
herbebonus: 0
@ -7768,6 +7779,7 @@ items:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Epais
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -29,6 +29,7 @@ system:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Epais
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -30,7 +30,8 @@ system:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -29,6 +29,7 @@ system:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Epais
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -30,7 +30,8 @@ system:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -30,7 +30,8 @@ system:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -28,7 +28,8 @@ system:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -30,7 +30,8 @@ system:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -29,6 +29,7 @@ system:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Solide
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -29,6 +29,7 @@ system:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Poudre
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -30,7 +30,8 @@ system:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -29,6 +29,7 @@ system:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Solide
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -29,6 +29,7 @@ system:
indexMinute: 0
rarete: ''
categorie: Remede
etat: Epais
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -3344,7 +3344,8 @@ items:
indexDate: -1
indexMinute: 0
rarete: ''
categorie: Alchimie
categorie: Remede
etat: Liquide
herbe: ''
herbebrins: 0
herbebonus: 0

View File

@ -467,7 +467,7 @@ table {border: 1px solid #7a7971;}
text-align: left;
}
.equipement-nom {
flex-grow : 4;
flex-grow : 3;
margin: 0;
justify-content: center;
text-align: left;

View File

@ -589,6 +589,13 @@
}
}
},
"enchantable": {
"magique": false,
"pr": 0,
"purifie": false,
"prpermanent": false,
"prdate": 0
},
"equipement": {
"equipe": false
},
@ -739,7 +746,7 @@
"templates": ["description", "inventaire"]
},
"gemme": {
"templates": ["description", "inventaire"],
"templates": ["description", "enchantable", "inventaire", "temporel"],
"type": "",
"taille": 0,
"purete": 0,
@ -795,18 +802,14 @@
"niveau_maximum": 0
},
"potion": {
"templates": ["description", "inventaire", "temporel"],
"templates": ["description", "enchantable", "inventaire", "temporel"],
"rarete": "",
"categorie": "",
"etat": "",
"herbe": "",
"herbebrins": 0,
"herbebonus": 0,
"reposalchimique": false,
"magique": false,
"pr": 0,
"purifie": false,
"prpermanent": false,
"prdate": 0
"reposalchimique": false
},
"service": {
"templates": ["description", "inventaire"],
@ -950,7 +953,8 @@
"xp": 0,
"bonuscase": "",
"isrituel": false,
"coutseuil": 0
"coutseuil": 0,
"lancements": []
},
"sortreserve": {
"sortid": "",

View File

@ -4,7 +4,7 @@
{{#each rencontres as |rencontre key|}}
<li class="item flexrow" data-item-id="{{rencontre._id}}" data-attribute="{{key}}" data-tooltip="Rencontre: {{rencontre.name}}">
<img class="sheet-competence-img" src="{{rencontre.img}}"/>
<span class="item-edit flex-grow"><a>
<span class="item-edit flex-grow-3"><a>
{{rencontre.name}} r{{rencontre.system.force}} ({{rencontre.system.coord}} - {{caseTmr-label rencontre.system.coord}})
</a></span>
{{#if rencontre.system.date}}

View File

@ -4,8 +4,8 @@
{{#each signedraconiques as |signe key|}}
<li class="item list-item flexrow" data-item-id="{{signe._id}}" data-attribute="{{key}}" data-tooltip="Signe: {{signe.name}}">
<img class="sheet-competence-img" src="{{signe.img}}"/>
<span class="item-edit flex-grow"><a>{{signe.name}}</a></span>
<span class="flex-shrink">{{signe.system.difficulte}}</span>
<span class="flex-grow-3 item-edit flex-grow"><a>{{signe.name}}</a></span>
<span class="flex-group-right flex-shrink">{{signe.system.difficulte}}</span>
{{>'systems/foundryvtt-reve-de-dragon/templates/actor/item-action-controls.hbs' item=signe options=@root.options}}
</li>
{{/each}}

View File

@ -9,11 +9,11 @@
{{else}}far fa-plus-square
{{/if~}}"></i>
<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>
{{else}}
<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')}}
{{>"systems/foundryvtt-reve-de-dragon/templates/item/icon-arme-broken.hbs" item}}
{{/if}}
@ -25,8 +25,8 @@
<a class="item-quantite-moins" data-tooltip="Diminuer la quantité de {{item.name}}"><i class="fa-solid fa-square-minus"></i></a>
{{/if}}
{{item.system.quantite}}
{{#if (gt item.system.quantite 1)}}
<a class="item-split" data-tooltip="Séparer le groupe de {{item.name}}"><i class="fas fa-unlink"></i></a>
{{#if @root.options.isGM}}
<a class="item-quantite-plus" data-tooltip="Augmenter la quantité de {{item.name}}"><i class="fa-solid fa-square-plus"></i></a>
{{/if}}
</span>
<span class="equipement-detail">{{numberFormat item.system.encTotal decimals=2}}</span>

View File

@ -18,7 +18,7 @@
<ul class="item-list alterne-list">
<li class="competence-header flexrow">
<span class="equipement-nom">Nom</span>
<span class="equipement-detail">Q.</span>
<span class="equipement-detail-buttons">Q.</span>
<span class="equipement-detail">Enc.</span>
<span class="equipement-actions">Actions</span>
</li>

View File

@ -1,6 +1,5 @@
<img class="chat-icon" src="{{competence.img}}" />
<h4>
{{log 'rollData' this}}
{{#if (eq mode "empoigner")}}
{{attacker.name}} tente d'empoigner {{defender.name}}
{{/if}}

View File

@ -7,7 +7,6 @@
{{else}}
<li>Selon les murs et la lumière, la cible {{defender.name}} n'est pas visible de {{attacker.name}}.</li>
{{/if}}
{{log defender}}
<li>Portée {{portee.msg}} pour l'arme {{rollData.arme.name}} : {{portee.diff}}</li>
<li>De taille {{taille.msg}}: {{taille.diff}}</li>
<li>Mouvement {{activite.msg}}: {{activite.diff}}</li>

View 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>

View File

@ -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>

View File

@ -18,7 +18,6 @@
<label>xp</label>
<span>ajout</span>
</li>
{{log 'choix-xp' @root}}
{{#each caracs as |carac key|}}
<li class="xpCarac-option item list-item flexrow" data-carac-label="{{carac.label}}">

View File

@ -1,6 +1,5 @@
<form class="skill-roll-dialog">
<h2 class="dialog-roll-title"></h2>
{{log 'dialog-roll' this}}
<div class="grid grid-2col">
<div class="flex-group-left">
<div class="flexrow">

View 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>

View 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}}

View File

@ -6,9 +6,3 @@
<option value="Repos">Potion de Repos</option>
<option value="Soin">Potion de Soin</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}}

View 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>

View File

@ -1,5 +1,17 @@
{{log this}}
<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">
<a class="item" data-tab="informations">Informations</a>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.html"}}
@ -30,6 +42,7 @@
<label>Enchantabilité</label>
<input class="attribute-value" type="text" name="system.enchantabilite" value="{{system.enchantabilite}}" data-dtype="Number" disabled/>
</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/partial-item-description.html"}}
</div>

View File

@ -7,7 +7,7 @@
{{#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>
{{/if}}
{{#if enchantable}}
{{#if isEnchantementPossible}}
<a class="item-enchanter chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Enchanter cette potion">Enchanter</a>
{{/if}}
</span>
@ -33,7 +33,15 @@
<label for="system.categorie">Catégorie</label>
<select name="system.categorie" class="categoriepotion" data-dtype="String">
{{#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>
</div>
@ -64,42 +72,19 @@
</div>
{{/if}}
{{/if}}
{{#if enchantable}}
{{#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>
{{#if isSoins}}
<div class="form-group">
<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">
{{else if isRepos}}
<label>Points de repos</label>
{{else}}
<label>Puissance</label>
{{/if}}
<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}}
{{>'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/partial-item-description.html"}}
</div>

View File

@ -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>

View File

@ -4,7 +4,6 @@
<div class="header-fields">
<h1 class="charname">Astrologie {{#if isActor}}: {{actorAstrologie.actor.name}}{{/if}}</h1>
</div>
{{log 'astrologie' this}}
{{#if isActor}}
{{> 'systems/foundryvtt-reve-de-dragon/templates/sommeil/astrologie-joueur.hbs'}}
{{else}}