Enchanter des Potions
This commit is contained in:
parent
40a47ee8a2
commit
a8dc07b4db
@ -167,29 +167,24 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $perteRevePotionsEnchantees() {
|
||||
let potions = this.itemTypes[ITEM_TYPES.potion]
|
||||
.filter(it => Grammar.includesLowerCaseNoAccent(it.system.categorie, 'enchanté') && !it.system.prpermanent)
|
||||
|
||||
const potionUpdates = await Promise.all(potions.map(async it => {
|
||||
const nouveauReve = Math.max(it.system.pr - 1, 0)
|
||||
const potionUpdates = this.itemTypes[ITEM_TYPES.potion].map(
|
||||
it.perteRevePotion())
|
||||
.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
|
||||
})))
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-potionenchantee-chateaudormant.html`, {
|
||||
pr: nouveauReve,
|
||||
alias: this.getAlias(),
|
||||
potionName: it.name,
|
||||
potionImg: it.img
|
||||
content: messageUpdates.reduce(Misc.joining('<br>'))
|
||||
})
|
||||
})
|
||||
return {
|
||||
_id: it._id,
|
||||
'system.pr': nouveauReve,
|
||||
'system.quantite': nouveauReve > 0 ? it.system.quantite : 0
|
||||
}
|
||||
}))
|
||||
|
||||
await this.updateEmbeddedDocuments('Item', potionUpdates);
|
||||
}
|
||||
}
|
||||
|
||||
/** --------------------------------------------
|
||||
* @returns true si l'acteur possède au moins 1 arme de mêlée équipée
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { RdDItemSort } from "./item-sort.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { RdDHerbes } from "./rdd-herbes.js";
|
||||
import { RdDGemme } from "./rdd-gemme.js";
|
||||
import { HtmlUtility } from "./html-utility.js";
|
||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
||||
@ -26,8 +25,8 @@ export class RdDItemSheet extends ItemSheet {
|
||||
|
||||
static defaultTemplate(type) {
|
||||
return type ?
|
||||
`systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html` :
|
||||
"systems/foundryvtt-reve-de-dragon/templates/item-sheet.html";
|
||||
`systems/foundryvtt-reve-de-dragon/templates/item/${type}-sheet.hbs` :
|
||||
"systems/foundryvtt-reve-de-dragon/templates/item/item-sheet.hbs";
|
||||
}
|
||||
|
||||
static register(sheetClass) {
|
||||
@ -136,9 +135,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList();
|
||||
RdDGemme.calculDataDerivees(this.item)
|
||||
}
|
||||
if (this.item.type == ITEM_TYPES.potion) {
|
||||
RdDHerbes.calculFormData(formData, this.item)
|
||||
}
|
||||
|
||||
if (this.item.type == ITEM_TYPES.herbe) {
|
||||
if (formData.options.isOwned && ['Soin', 'Repos'].includes(formData.system.categorie)) {
|
||||
formData.isIngredientPotionBase = true;
|
||||
@ -193,14 +190,6 @@ export class RdDItemSheet extends ItemSheet {
|
||||
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('.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));
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { DialogItemVente } from "./achat-vente/dialog-item-vente.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDHerbes } from "./rdd-herbes.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||
@ -356,13 +355,6 @@ export class RdDItem extends Item {
|
||||
|
||||
getUtilisation() {
|
||||
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.herbe: case ITEM_TYPES.faune: case ITEM_TYPES.ingredient: case ITEM_TYPES.plante:
|
||||
switch (this.system.categorie) {
|
||||
@ -478,25 +470,11 @@ export class RdDItem extends Item {
|
||||
super.prepareDerivedData();
|
||||
if (this.isInventaire()) {
|
||||
this.system.encTotal = this.getEncTotal();
|
||||
if (this.isPotion()) {
|
||||
this.prepareDataPotion()
|
||||
}
|
||||
this.system.actionPrincipale = this.getActionPrincipale({ warnIfNot: false });
|
||||
}
|
||||
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 }) {
|
||||
switch (this.type) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
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() {
|
||||
function label(categorie) {
|
||||
switch (categorie) {
|
||||
|
150
module/item/potion.js
Normal file
150
module/item/potion.js
Normal 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;
|
||||
}
|
||||
|
||||
}
|
46
module/item/potion/dialog-enchanter.js
Normal file
46
module/item/potion/dialog-enchanter.js
Normal 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);
|
||||
}
|
||||
|
||||
}
|
57
module/item/sheet-potion.js
Normal file
57
module/item/sheet-potion.js
Normal 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}`)
|
||||
});
|
||||
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -18,7 +18,6 @@ import { RdDCompendiumOrganiser } from "./rdd-compendium-organiser.js"
|
||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js"
|
||||
import { RdDHotbar } from "./rdd-hotbar-drop.js"
|
||||
import { EffetsDraconiques } from "./tmr/effets-draconiques.js"
|
||||
import { RdDHerbes } from "./rdd-herbes.js"
|
||||
import { RdDDice } from "./rdd-dice.js"
|
||||
import { RdDPossession } from "./rdd-possession.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 { RdDStatBlockParser } from "./apps/rdd-import-stats.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
|
||||
@ -105,6 +105,7 @@ export class SystemReveDeDragon {
|
||||
poison: RdDItemPoison,
|
||||
queue: RdDItemQueue,
|
||||
tete: RdDItemTete,
|
||||
potion: RdDItemPotion,
|
||||
race: RdDItemRace,
|
||||
rencontre: RdDRencontre,
|
||||
service: RdDItemService,
|
||||
@ -195,6 +196,7 @@ export class SystemReveDeDragon {
|
||||
RdDItemSheet.register(RdDHerbeItemSheet)
|
||||
RdDItemSheet.register(RdDFauneItemSheet)
|
||||
RdDItemSheet.register(RdDPlanteItemSheet)
|
||||
RdDItemSheet.register(RdDPotionItemSheet)
|
||||
RdDItemSheet.register(RdDIngredientItemSheet)
|
||||
RdDItemSheet.register(RdDServiceItemSheet)
|
||||
RdDItemSheet.register(RdDBlessureItemSheet)
|
||||
@ -202,9 +204,10 @@ export class SystemReveDeDragon {
|
||||
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
||||
types: [
|
||||
"objet", "arme", "armure", "livre", "potion", "munition",
|
||||
"objet", "arme", "armure", "livre", "munition",
|
||||
"monnaie", "nourritureboisson", "gemme",
|
||||
], makeDefault: true
|
||||
],
|
||||
makeDefault: true
|
||||
})
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
|
||||
types: [
|
||||
@ -214,7 +217,8 @@ export class SystemReveDeDragon {
|
||||
"queue", "ombre", "souffle", "tete", "casetmr", "sort", "sortreserve",
|
||||
"nombreastral", "tache", "maladie", "poison", "possession",
|
||||
"tarot", "extraitpoetique", "empoignade"
|
||||
], makeDefault: true
|
||||
],
|
||||
makeDefault: true
|
||||
})
|
||||
|
||||
// préparation des différents modules
|
||||
@ -316,7 +320,6 @@ export class SystemReveDeDragon {
|
||||
}
|
||||
|
||||
StatusEffects.onReady()
|
||||
RdDHerbes.onReady()
|
||||
RdDDice.onReady()
|
||||
|
||||
RdDStatBlockParser.parseStatBlock()
|
||||
|
@ -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-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/item/queue-sheet.hbs',
|
||||
// partial enums
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-aspect-tarot.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-categorie-ingredient.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-vehicule.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/enum-competence.html',
|
||||
|
@ -334,6 +334,12 @@ export class RdDTimestamp {
|
||||
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) {
|
||||
const formule = FORMULES_DUREE.find(it => it.code == duree) ?? FORMULES_DUREE.find(it => it.code == "");
|
||||
return await formule.calcul(this, actor);
|
||||
|
@ -802,7 +802,9 @@
|
||||
"herbebrins": 0,
|
||||
"herbebonus": 0,
|
||||
"reposalchimique": false,
|
||||
"magique": false,
|
||||
"pr": 0,
|
||||
"purifie": false,
|
||||
"prpermanent": false,
|
||||
"prdate": 0
|
||||
},
|
||||
|
@ -1 +0,0 @@
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item-queue-sheet.html"}}
|
1
templates/item/ombre-sheet.hbs
Normal file
1
templates/item/ombre-sheet.hbs
Normal file
@ -0,0 +1 @@
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/queue-sheet.hbs"}}
|
@ -1,12 +1,14 @@
|
||||
<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="Remede">Remède</option>
|
||||
<option value="Cuisine">Potion de Cuisine</option>
|
||||
<option value="Alchimie">Potion d'Alchimie</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="SoinEnchante">Potion de Soin Enchantée</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}}
|
@ -3,11 +3,14 @@
|
||||
<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 options.isOwned}}
|
||||
<div class="form-group">
|
||||
<span><a class="consommer-potion chat-card-button" data-actor-id="{{actorId}}">Consommer cette potion et appliquer ses effets</a></span>
|
||||
</div>
|
||||
<a class="consommer-potion chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Consommer cette potion et appliquer ses effets">Consommer</a>
|
||||
{{/if}}
|
||||
{{#if enchantable}}
|
||||
<a class="enchanter-potion chat-card-button" data-actor-id="{{actorId}}" data-tooltip="Enchanter cette potion">Enchanter</a>
|
||||
{{/if}}
|
||||
</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@ -30,7 +33,7 @@
|
||||
<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/enum-categorie-potion.html"}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/potion-enum-categorie.hbs" this}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
@ -61,6 +64,7 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if enchantable}}
|
||||
{{#if system.magique}}
|
||||
<div class="form-group">
|
||||
<label for="system.pr">Points de rêve</label>
|
||||
@ -94,6 +98,7 @@
|
||||
</select>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
|
22
templates/item/potion/dialog-enchanter.hbs
Normal file
22
templates/item/potion/dialog-enchanter.hbs
Normal 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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user