12.0.36 - L'alchimie d'Astrobazzarh #740

Merged
uberwald merged 16 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2025-01-19 09:50:20 +01:00
59 changed files with 363 additions and 188 deletions
Showing only changes of commit a8dc07b4db - Show all commits

View File

@ -167,28 +167,23 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */ /* -------------------------------------------- */
async $perteRevePotionsEnchantees() { async $perteRevePotionsEnchantees() {
let potions = this.itemTypes[ITEM_TYPES.potion] const potionUpdates = this.itemTypes[ITEM_TYPES.potion].map(
.filter(it => Grammar.includesLowerCaseNoAccent(it.system.categorie, 'enchanté') && !it.system.prpermanent) it.perteRevePotion())
.filter(it => it != undefined)
const potionUpdates = await Promise.all(potions.map(async it => { if (potionUpdates.length > 0) {
const nouveauReve = Math.max(it.system.pr - 1, 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
})))
ChatMessage.create({ ChatMessage.create({
whisper: ChatUtility.getOwners(this), whisper: ChatUtility.getOwners(this),
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, { content: messageUpdates.reduce(Misc.joining('<br>'))
pr: nouveauReve,
alias: this.getAlias(),
potionName: it.name,
potionImg: it.img
})
}) })
return { await this.updateEmbeddedDocuments('Item', potionUpdates);
_id: it._id, }
'system.pr': nouveauReve,
'system.quantite': nouveauReve > 0 ? it.system.quantite : 0
}
}))
await this.updateEmbeddedDocuments('Item', potionUpdates);
} }
/** -------------------------------------------- /** --------------------------------------------

View File

@ -1,7 +1,6 @@
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 { RdDHerbes } from "./rdd-herbes.js";
import { RdDGemme } from "./rdd-gemme.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";
@ -26,8 +25,8 @@ export class RdDItemSheet extends ItemSheet {
static defaultTemplate(type) { static defaultTemplate(type) {
return type ? return type ?
`systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html` : `systems/foundryvtt-reve-de-dragon/templates/item/${type}-sheet.hbs` :
"systems/foundryvtt-reve-de-dragon/templates/item-sheet.html"; "systems/foundryvtt-reve-de-dragon/templates/item/item-sheet.hbs";
} }
static register(sheetClass) { static register(sheetClass) {
@ -136,9 +135,7 @@ export class RdDItemSheet extends ItemSheet {
formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList(); formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList();
RdDGemme.calculDataDerivees(this.item) RdDGemme.calculDataDerivees(this.item)
} }
if (this.item.type == ITEM_TYPES.potion) {
RdDHerbes.calculFormData(formData, 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)) {
formData.isIngredientPotionBase = true; formData.isIngredientPotionBase = true;
@ -193,14 +190,6 @@ export class RdDItemSheet extends ItemSheet {
this.supprimerBonusCase(event.currentTarget.attributes['data-deleteCoord'].value) this.supprimerBonusCase(event.currentTarget.attributes['data-deleteCoord'].value)
}) })
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}`)
});
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('.consommer-potion').click((event) => this._getEventActor(event).consommerPotion(this.item, this.getActionRenderItem())); this.html.find('.consommer-potion').click((event) => this._getEventActor(event).consommerPotion(this.item, this.getActionRenderItem()));
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).actionHerbe(this.item));

View File

@ -1,7 +1,6 @@
import { DialogItemVente } from "./achat-vente/dialog-item-vente.js"; import { DialogItemVente } from "./achat-vente/dialog-item-vente.js";
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDHerbes } from "./rdd-herbes.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js"; import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
import { SystemCompendiums } from "./settings/system-compendiums.js"; import { SystemCompendiums } from "./settings/system-compendiums.js";
@ -356,13 +355,6 @@ export class RdDItem extends Item {
getUtilisation() { getUtilisation() {
switch (this.type) { switch (this.type) {
case ITEM_TYPES.potion:
switch (this.system.categorie) {
case 'Alchimie': case 'AlchimieEnchante': case 'AlchimieAutre': return 'alchimie'
case 'Cuisine': return 'cuisine'
case 'Remede': case 'Repos': case 'ReposEnchante': case 'Soin': case 'SoinEnchante': return 'soins'
}
return '';
case ITEM_TYPES.nourritureboisson: return 'cuisine'; case ITEM_TYPES.nourritureboisson: return 'cuisine';
case ITEM_TYPES.herbe: case ITEM_TYPES.faune: case ITEM_TYPES.ingredient: case ITEM_TYPES.plante: case ITEM_TYPES.herbe: case ITEM_TYPES.faune: case ITEM_TYPES.ingredient: case ITEM_TYPES.plante:
switch (this.system.categorie) { switch (this.system.categorie) {
@ -478,25 +470,11 @@ export class RdDItem extends Item {
super.prepareDerivedData(); super.prepareDerivedData();
if (this.isInventaire()) { if (this.isInventaire()) {
this.system.encTotal = this.getEncTotal(); this.system.encTotal = this.getEncTotal();
if (this.isPotion()) {
this.prepareDataPotion()
}
this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false }); this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
} }
this.equipable = this.isEquipable(); this.equipable = this.isEquipable();
} }
prepareDataPotion() {
const categorie = Grammar.toLowerCaseNoAccent(this.system.categorie);
this.system.magique = categorie.includes('enchante');
if (this.system.magique) {
if (categorie.includes('soin') || categorie.includes('repos')) {
// TODO: utiliser calculPointsRepos / calculPointsGuerison
this.system.puissance = RdDHerbes.calculPuissancePotion(this);
}
}
}
getActionPrincipale(options = { warnIfNot: true }) { getActionPrincipale(options = { warnIfNot: true }) {
switch (this.type) { switch (this.type) {
case ITEM_TYPES.conteneur: return 'Ouvrir'; case ITEM_TYPES.conteneur: return 'Ouvrir';
@ -514,7 +492,7 @@ export class RdDItem extends Item {
case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return this.system.refoulement > 0 ? 'Refouler' : undefined; case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return this.system.refoulement > 0 ? 'Refouler' : undefined;
} }
} }
return undefined; return undefined
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -805,14 +783,6 @@ export class RdDItem extends Item {
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_potionChatData() {
return [
`<b>Rareté</b>: ${this.system.rarete}`,
`<b>Catégorie</b>: ${this.system.categorie}`,
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
_queueChatData() { _queueChatData() {
function label(categorie) { function label(categorie) {
switch (categorie) { switch (categorie) {

150
module/item/potion.js Normal file
View File

@ -0,0 +1,150 @@
import { Grammar } from "../grammar.js";
import { RdDItem } from "../item.js";
import { SystemCompendiums } from "../settings/system-compendiums.js";
import { RdDTimestamp } from "../time/rdd-timestamp.js";
import { DialogEnchanter } from "./potion/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' }]
export class RdDItemPotion extends RdDItem {
static async herbesSoins() {
return await RdDItemPotion.$listHerbes(it => Grammar.equalsInsensitive(it.system.categorie, 'Soin') && it.system.niveau > 0)
}
static async herbesRepos() {
return await RdDItemPotion.$listHerbes(it => Grammar.equalsInsensitive(it.system.categorie, 'Repos') && it.system.niveau > 0)
}
static async $listHerbes(filter) {
const herbes = await SystemCompendiums.getWorldOrCompendiumItems('herbe', 'faune-flore-mineraux');
return herbes.filter(filter)
}
static get defaultIcon() {
return "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp"
}
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) }
getActions(options = { warnIfNot: true }) {
const actionConsommer = this.prepareAction('Consommer', options.warnIfNot);
if (this.isEnchantable()) {
return [
actionConsommer,
this.prepareAction('Enchanter', options.warnIfNot)
]
}
return [
actionConsommer
]
}
getUtilisation() {
switch (this.system.categorie) {
case 'Alchimie': case 'AlchimieEnchante':
case 'AlchimieAutre':
return 'alchimie'
case 'Cuisine': return 'cuisine'
case 'Remede': case 'Repos': case 'ReposEnchante': case 'Soin': case 'SoinEnchante':
return 'soins'
}
return ''
}
_potionChatData() {
return [
`<b>Rareté</b>: ${this.system.rarete}`,
`<b>Catégorie</b>: ${this.system.categorie}`,
...this._inventaireTemplateChatData()
]
}
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() {
if (this.system.magique && !this.system.prpermanent && this.system.pr > 0) {
const nouveauReve = Math.max(this.system.pr - 1, 0)
return {
_id: it._id,
name: this.name,
img: this.img,
'system.pr': nouveauReve,
'system.quantite': nouveauReve > 0 ? it.system.quantite : 0,
'system.magique': nouveauReve > 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 {
const updates = {
'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.update(updates)
}
}
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()
}
static buildHerbesList(listeHerbes, max) {
let list = {}
for (let herbe of listeHerbes) {
let brins = max - herbe.system.niveau;
list[herbe.name] = `${herbe.name} (Bonus: ${herbe.system.niveau}, Brins: ${brins})`;
}
list['Autre'] = 'Autre (Bonus: variable, Brins: variable)'
return list;
}
}

View File

@ -0,0 +1,46 @@
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,57 @@
import { ITEM_TYPES } from "../item.js";
import { RdDTimestamp } from "../time/rdd-timestamp.js";
import { RdDItemPotion } from "./potion.js";
import { RdDItemInventaireSheet } from "./sheet-base-inventaire.js";
export class RdDPotionItemSheet extends RdDItemInventaireSheet {
static get ITEM_TYPE() { return ITEM_TYPES.potion };
static $calculBonusHerbe(formData, herbesList, max) {
if (Number(formData.system.herbebrins)) {
let herbe = herbesList.find(h => h.name.toLowerCase() == formData.system.herbe.toLowerCase());
if (herbe) {
const brinsRequis = max - herbe.system.niveau;
const brinsManquants = Math.max(brinsRequis - formData.system.herbebrins, 0);
formData.system.herbebonus = Math.max(herbe.system.niveau - brinsManquants, 0);
}
}
}
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'
if (formData.isSoins) {
const herbesSoins = await RdDItemPotion.herbesSoins()
RdDPotionItemSheet.$calculBonusHerbe(formData, herbesSoins, 12);
formData.herbesSoins = RdDItemPotion.buildHerbesList(herbesSoins, 12)
}
if (formData.isRepos) {
const herbesRepos = await RdDItemPotion.herbesRepos()
RdDPotionItemSheet.$calculBonusHerbe(formData, herbesRepos, 7);
formData.herbesRepos = RdDItemPotion.buildHerbesList(herbesRepos, 7)
}
formData.dateActuelle = game.system.rdd.calendrier.dateCourante()
formData.enchantement = RdDTimestamp.splitIndexDate(this.potion.system.prdate)
return formData
}
activateListeners(html) {
super.activateListeners(html);
this.html.find('.enchanter-potion').click((event) => this.potion.enchanterPotion())
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 })
console.warn(`Date d'enchantement modifiée ${jour}/${mois.heure}: ${indexDate}`)
});
}
}

View File

@ -1,73 +0,0 @@
import { Grammar } from "./grammar.js";
import { SystemCompendiums } from "./settings/system-compendiums.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js";
/* -------------------------------------------- */
export class RdDHerbes extends Item {
/* -------------------------------------------- */
static async onReady() {
this.herbesSoins = await RdDHerbes.listCategorieHerbes('Soin');
this.herbesRepos = await RdDHerbes.listCategorieHerbes('Repos');
}
static async listCategorieHerbes(categorie) {
const herbes = await SystemCompendiums.getWorldOrCompendiumItems('herbe', 'faune-flore-mineraux');
return herbes.filter(it => Grammar.equalsInsensitive(it.system.categorie, categorie));
}
/* -------------------------------------------- */
static buildHerbesList(listeHerbes, max) {
let list = {}
for (let herbe of listeHerbes) {
let brins = max - herbe.system.niveau;
list[herbe.name] = `${herbe.name} (Bonus: ${herbe.system.niveau}, Brins: ${brins})`;
}
list['Autre'] = 'Autre (Bonus: variable, Brins: variable)'
return list;
}
/* -------------------------------------------- */
static calculFormData(formData, item) {
formData.isSoins = item.system.categorie.includes('Soin');
formData.isRepos = item.system.categorie.includes('Repos');
if (formData.isSoins) {
RdDHerbes.calculBonusHerbe(formData, this.herbesSoins, 12);
}
if (formData.isRepos) {
RdDHerbes.calculBonusHerbe(formData, this.herbesRepos, 7);
}
formData.herbesSoins = RdDHerbes.buildHerbesList(this.herbesSoins, 12);
formData.herbesRepos = RdDHerbes.buildHerbesList(this.herbesRepos, 7);
formData.dateActuelle = game.system.rdd.calendrier.dateCourante();
formData.enchantement = RdDTimestamp.splitIndexDate(item.system.prdate);
}
/* -------------------------------------------- */
static calculPuissancePotion(potion) {
return potion.system.herbebonus * potion.system.pr;
}
/* -------------------------------------------- */
static calculPointsRepos(potion) {
return potion.system.herbebonus * potion.system.pr;
}
/* -------------------------------------------- */
static calculPointsGuerison(potion) {
return potion.system.herbebonus * potion.system.pr;
}
/* -------------------------------------------- */
static calculBonusHerbe(formData, herbesList, max) {
if (Number(formData.system.herbebrins)) {
let herbe = herbesList.find(item => item.name.toLowerCase() == formData.system.herbe.toLowerCase());
if (herbe) {
const brinsRequis = max - herbe.system.niveau;
const brinsManquants = Math.max(brinsRequis - formData.system.herbebrins, 0);
formData.system.herbebonus = Math.max(herbe.system.niveau - brinsManquants, 0);
}
}
}
}

View File

@ -18,7 +18,6 @@ import { RdDCompendiumOrganiser } from "./rdd-compendium-organiser.js"
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js" import { ReglesOptionnelles } from "./settings/regles-optionnelles.js"
import { RdDHotbar } from "./rdd-hotbar-drop.js" import { RdDHotbar } from "./rdd-hotbar-drop.js"
import { EffetsDraconiques } from "./tmr/effets-draconiques.js" import { EffetsDraconiques } from "./tmr/effets-draconiques.js"
import { RdDHerbes } from "./rdd-herbes.js"
import { RdDDice } from "./rdd-dice.js" import { RdDDice } from "./rdd-dice.js"
import { RdDPossession } from "./rdd-possession.js" import { RdDPossession } from "./rdd-possession.js"
import { Misc } from "./misc.js" import { Misc } from "./misc.js"
@ -76,7 +75,8 @@ import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.
import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js" import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js"
import { RdDStatBlockParser } from "./apps/rdd-import-stats.js" import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
import { RdDJournalSheet } from "./journal/journal-sheet.js" import { RdDJournalSheet } from "./journal/journal-sheet.js"
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js" import { RdDPotionItemSheet } from "./item/sheet-potion.js"
import { RdDItemPotion } from "./item/potion.js"
/** /**
* RdD system * RdD system
@ -105,6 +105,7 @@ export class SystemReveDeDragon {
poison: RdDItemPoison, poison: RdDItemPoison,
queue: RdDItemQueue, queue: RdDItemQueue,
tete: RdDItemTete, tete: RdDItemTete,
potion: RdDItemPotion,
race: RdDItemRace, race: RdDItemRace,
rencontre: RdDRencontre, rencontre: RdDRencontre,
service: RdDItemService, service: RdDItemService,
@ -195,6 +196,7 @@ export class SystemReveDeDragon {
RdDItemSheet.register(RdDHerbeItemSheet) RdDItemSheet.register(RdDHerbeItemSheet)
RdDItemSheet.register(RdDFauneItemSheet) RdDItemSheet.register(RdDFauneItemSheet)
RdDItemSheet.register(RdDPlanteItemSheet) RdDItemSheet.register(RdDPlanteItemSheet)
RdDItemSheet.register(RdDPotionItemSheet)
RdDItemSheet.register(RdDIngredientItemSheet) RdDItemSheet.register(RdDIngredientItemSheet)
RdDItemSheet.register(RdDServiceItemSheet) RdDItemSheet.register(RdDServiceItemSheet)
RdDItemSheet.register(RdDBlessureItemSheet) RdDItemSheet.register(RdDBlessureItemSheet)
@ -202,9 +204,10 @@ export class SystemReveDeDragon {
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, { Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
types: [ types: [
"objet", "arme", "armure", "livre", "potion", "munition", "objet", "arme", "armure", "livre", "munition",
"monnaie", "nourritureboisson", "gemme", "monnaie", "nourritureboisson", "gemme",
], makeDefault: true ],
makeDefault: true
}) })
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, { Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
types: [ types: [
@ -214,7 +217,8 @@ export class SystemReveDeDragon {
"queue", "ombre", "souffle", "tete", "casetmr", "sort", "sortreserve", "queue", "ombre", "souffle", "tete", "casetmr", "sort", "sortreserve",
"nombreastral", "tache", "maladie", "poison", "possession", "nombreastral", "tache", "maladie", "poison", "possession",
"tarot", "extraitpoetique", "empoignade" "tarot", "extraitpoetique", "empoignade"
], makeDefault: true ],
makeDefault: true
}) })
// préparation des différents modules // préparation des différents modules
@ -316,7 +320,6 @@ export class SystemReveDeDragon {
} }
StatusEffects.onReady() StatusEffects.onReady()
RdDHerbes.onReady()
RdDDice.onReady() RdDDice.onReady()
RdDStatBlockParser.parseStatBlock() RdDStatBlockParser.parseStatBlock()

View File

@ -180,8 +180,9 @@ export class RdDUtility {
'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/item/partial-environnement.html', 'systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html',
'systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.html', 'systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.html',
'systems/foundryvtt-reve-de-dragon/templates/item-queue-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/header-item.html', 'systems/foundryvtt-reve-de-dragon/templates/header-item.html',
'systems/foundryvtt-reve-de-dragon/templates/item/queue-sheet.hbs',
// partial enums // partial enums
'systems/foundryvtt-reve-de-dragon/templates/enum-aspect-tarot.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-aspect-tarot.html',
'systems/foundryvtt-reve-de-dragon/templates/enum-base-competence.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-base-competence.html',
@ -189,7 +190,7 @@ 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/enum-categorie-potion.html', 'systems/foundryvtt-reve-de-dragon/templates/item/potion-enum-categorie.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',

View File

@ -334,6 +334,12 @@ export class RdDTimestamp {
return this.nouvelleHeure().addHeures((12 + heure - this.heure) % 12); return this.nouvelleHeure().addHeures((12 + heure - this.heure) % 12);
} }
debutJournee() {
return RdDTimestamp.timestamp(this.timestamp.annee,
this.timestamp.mois,
this.timestamp.jour)
}
async appliquerDuree(duree, actor) { async appliquerDuree(duree, actor) {
const formule = FORMULES_DUREE.find(it => it.code == duree) ?? FORMULES_DUREE.find(it => it.code == ""); const formule = FORMULES_DUREE.find(it => it.code == duree) ?? FORMULES_DUREE.find(it => it.code == "");
return await formule.calcul(this, actor); return await formule.calcul(this, actor);

View File

@ -802,7 +802,9 @@
"herbebrins": 0, "herbebrins": 0,
"herbebonus": 0, "herbebonus": 0,
"reposalchimique": false, "reposalchimique": false,
"magique": false,
"pr": 0, "pr": 0,
"purifie": false,
"prpermanent": false, "prpermanent": false,
"prdate": 0 "prdate": 0
}, },

View File

@ -1 +0,0 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/item-queue-sheet.html"}}

View File

@ -0,0 +1 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/item/queue-sheet.hbs"}}

View File

@ -1,12 +1,14 @@
<option value=""></option> <option value=""></option>
<option value="Alchimie">Potion d'Alchimie</option>
<option value="AlchimieEnchante">Potion d'Alchimie Enchantée</option>
<option value="AlchimieAutre">Composé alchimique</option> <option value="AlchimieAutre">Composé alchimique</option>
<option value="Remede">Remède</option> <option value="Remede">Remède</option>
<option value="Cuisine">Potion de Cuisine</option> <option value="Cuisine">Potion de Cuisine</option>
<option value="Alchimie">Potion d'Alchimie</option>
<option value="Repos">Potion de Repos</option> <option value="Repos">Potion de Repos</option>
<option value="ReposEnchante">Potion de Repos Enchantée</option>
<option value="Soin">Potion de Soin</option> <option value="Soin">Potion de Soin</option>
<option value="SoinEnchante">Potion de Soin Enchantée</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> <option value="AutreEnchante">Potion Autre Enchantée</option>
{{/if}}

View File

@ -3,11 +3,14 @@
<img class="profile-img" src="{{img}}" data-edit="img" data-tooltip="{{name}}" /> <img class="profile-img" src="{{img}}" data-edit="img" data-tooltip="{{name}}" />
<div class="header-fields"> <div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1> <h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
{{#if options.isOwned}} <span>
<div class="form-group"> {{#if options.isOwned}}
<span><a class="consommer-potion chat-card-button" data-actor-id="{{actorId}}">Consommer cette potion et appliquer ses effets</a></span> <a class="consommer-potion chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Consommer cette potion et appliquer ses effets">Consommer</a>
</div> {{/if}}
{{/if}} {{#if enchantable}}
<a class="enchanter-potion chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Enchanter cette potion">Enchanter</a>
{{/if}}
</span>
</div> </div>
</header> </header>
@ -30,7 +33,7 @@
<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/enum-categorie-potion.html"}} {{>"systems/foundryvtt-reve-de-dragon/templates/item/potion-enum-categorie.hbs" this}}
{{/select}} {{/select}}
</select> </select>
</div> </div>
@ -61,39 +64,41 @@
</div> </div>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if system.magique}} {{#if enchantable}}
<div class="form-group"> {{#if system.magique}}
<label for="system.pr">Points de rêve</label> <div class="form-group">
<input class="attribute-value" type="text" name="system.pr" value="{{system.pr}}" data-dtype="Number" /> <label for="system.pr">Points de rêve</label>
</div> <input class="attribute-value" type="text" name="system.pr" value="{{system.pr}}" data-dtype="Number" />
{{#if isSoins}} </div>
<div class="form-group"> {{#if isSoins}}
<label>Points de guérison</label> <div class="form-group">
<input class="attribute-value" type="text" name="system.puissance" value="{{system.puissance}}" disabled /> <label>Points de guérison</label>
</div> <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}}
{{#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}}
{{>"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"}}

View File

@ -0,0 +1,22 @@
<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>