v10.6.3 #613

Merged
uberwald merged 8 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2023-01-19 10:50:28 +01:00
12 changed files with 106 additions and 43 deletions

View File

@ -151,6 +151,15 @@ export class RdDActorSheet extends RdDBaseActorSheet {
this.html.find('.creer-tache').click(async event => { this.html.find('.creer-tache').click(async event => {
this.createEmptyTache(); this.createEmptyTache();
}); });
this.html.find('.creer-tache-blessure-legere').click(async event => {
this.actor.createTacheBlessure('legere');
});
this.html.find('.creer-tache-blessure-grave').click(async event => {
this.actor.createTacheBlessure('grave');
});
this.html.find('.creer-tache-blessure-critique').click(async event => {
this.actor.createTacheBlessure('critique');
});
this.html.find('.creer-une-oeuvre').click(async event => { this.html.find('.creer-une-oeuvre').click(async event => {
this.selectTypeOeuvreToCreate(); this.selectTypeOeuvreToCreate();
}); });
@ -249,7 +258,7 @@ export class RdDActorSheet extends RdDBaseActorSheet {
// Points de reve actuel // Points de reve actuel
this.html.find('.ptreve-actuel a').click(async event => { this.html.find('.ptreve-actuel a').click(async event => {
this.actor.rollCarac('reve-actuel'); this.actor.rollCarac('reve-actuel', true);
}); });
// Roll Weapon1 // Roll Weapon1
@ -477,7 +486,6 @@ export class RdDActorSheet extends RdDBaseActorSheet {
async createEmptyTache() { async createEmptyTache() {
await this.actor.createItem('tache', 'Nouvelle tache'); await this.actor.createItem('tache', 'Nouvelle tache');
} }
_optionRecherche(target) { _optionRecherche(target) {
if (!target.value?.length) { if (!target.value?.length) {
return undefined; return undefined;

View File

@ -35,6 +35,7 @@ import { Targets } from "./targets.js";
import { DialogRepos } from "./dialog-repos.js"; import { DialogRepos } from "./dialog-repos.js";
import { RdDBaseActor } from "./actor/base-actor.js"; import { RdDBaseActor } from "./actor/base-actor.js";
import { RdDTimestamp } from "./rdd-timestamp.js"; import { RdDTimestamp } from "./rdd-timestamp.js";
import { RdDItemTache } from "./item-tache.js";
const POSSESSION_SANS_DRACONIC = { const POSSESSION_SANS_DRACONIC = {
img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp', img: 'systems/foundryvtt-reve-de-dragon/icons/entites/possession.webp',
@ -46,7 +47,6 @@ const POSSESSION_SANS_DRACONIC = {
}; };
const PAS_DE_BLESSURE = { "active": false, "psdone": false, "scdone": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": "" }; const PAS_DE_BLESSURE = { "active": false, "psdone": false, "scdone": false, "premiers_soins": 0, "soins_complets": 0, "jours": 0, "loc": "" };
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre'] export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -859,7 +859,7 @@ export class RdDActor extends RdDBaseActor {
return undefined return undefined
} }
const path = getPath(fieldName); const path = getPath(fieldName);
if (path){ if (path) {
await this.updateEmbeddedDocuments('Item', [{ _id: competence.id, [path]: value }]); // updates one EmbeddedEntity await this.updateEmbeddedDocuments('Item', [{ _id: competence.id, [path]: value }]); // updates one EmbeddedEntity
} }
} }
@ -1284,12 +1284,7 @@ export class RdDActor extends RdDBaseActor {
async finDeRound(options = { terminer: false }) { async finDeRound(options = { terminer: false }) {
for (let effect of this.getEffects()) { for (let effect of this.getEffects()) {
if (effect.duration.type !== 'none' && (effect.duration.remaining <= 0 || options.terminer)) { if (effect.duration.type !== 'none' && (effect.duration.remaining <= 0 || options.terminer)) {
if (effect.system.origin) {
await effect.update({ 'disabled': true });
}
else {
await effect.delete(); await effect.delete();
}
ChatMessage.create({ content: `${this.name} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.system.label))} !` }); ChatMessage.create({ content: `${this.name} n'est plus ${Misc.lowerFirst(game.i18n.localize(effect.system.label))} !` });
} }
} }
@ -1764,6 +1759,7 @@ export class RdDActor extends RdDBaseActor {
forceAlcool: forceAlcool, forceAlcool: forceAlcool,
nbDoses: nbDoses, nbDoses: nbDoses,
selectedCarac: this.system.sante.vie, selectedCarac: this.system.sante.vie,
jetResistance: 'ethylisme',
carac: this.system.carac, carac: this.system.carac,
caracValue: this.system.sante.vie.max, caracValue: this.system.sante.vie.max,
finalLevel: etat + forceAlcool - nbDoses finalLevel: etat + forceAlcool - nbDoses
@ -1972,7 +1968,7 @@ export class RdDActor extends RdDBaseActor {
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
if (!this.isPersonnage()) return; if (!this.isPersonnage()) return;
hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM) hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM)
let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence); let xpData = await this._appliquerExperience(rollData.rolled, rollData.selectedCarac.label, rollData.competence, rollData.jetResistance);
if (xpData) { if (xpData) {
const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData); const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData);
if (hideChatMessage) { if (hideChatMessage) {
@ -2197,10 +2193,11 @@ export class RdDActor extends RdDBaseActor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollCarac(caracName) { async rollCarac(caracName, jetResistance = undefined) {
let rollData = { let rollData = {
selectedCarac: this.getCaracByName(caracName), selectedCarac: this.getCaracByName(caracName),
competences: this.itemTypes['competence'] competences: this.itemTypes['competence'],
jetResistance: jetResistance ? caracName : undefined
}; };
const dialog = await RdDRoll.create(this, rollData, const dialog = await RdDRoll.create(this, rollData,
@ -2328,6 +2325,13 @@ export class RdDActor extends RdDBaseActor {
return tachesExistantes.length > 0 ? tachesExistantes[0] : undefined; return tachesExistantes.length > 0 ? tachesExistantes[0] : undefined;
} }
async createTacheBlessure(gravite) {
const tache = RdDItemTache.prepareTacheSoin(gravite)
if (tache) {
await this.createEmbeddedDocuments('Item', [tache], { renderSheet: false });
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollTache(id) { async rollTache(id) {
const tacheData = this.getTache(id) const tacheData = this.getTache(id)
@ -2754,7 +2758,7 @@ export class RdDActor extends RdDBaseActor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async _appliquerExperience(rolled, caracName, competence) { async _appliquerExperience(rolled, caracName, competence, jetResistance) {
if (!this.isPersonnage()) return; if (!this.isPersonnage()) return;
// Pas d'XP // Pas d'XP
if (!rolled.isPart || rolled.finalLevel >= 0) { if (!rolled.isPart || rolled.finalLevel >= 0) {
@ -2771,16 +2775,19 @@ export class RdDActor extends RdDBaseActor {
if (caracName == 'Vie') caracName = 'constitution'; if (caracName == 'Vie') caracName = 'constitution';
if (caracName == 'derobee') caracName = 'agilite'; if (caracName == 'derobee') caracName = 'agilite';
if (caracName == 'reve-actuel') caracName = 'reve'; if (caracName == 'reve-actuel') caracName = 'reve';
let xp = Math.abs(rolled.finalLevel); let xp = Math.abs(rolled.finalLevel);
// impair: arrondi inférieur en carac // impair: arrondi inférieur en carac
let xpCarac = competence ? Math.floor(xp / 2) : Math.max(Math.floor(xp / 2), 1); let xpCarac = competence ? Math.floor(xp / 2) : Math.max(Math.floor(xp / 2), 1);
let xpData = { const xpCompetence = competence ? xp - xpCarac : 0;
alias: this.name, if (jetResistance) {
caracName: caracName, xpCarac: xpCarac, const message = `Jet de résistance ${jetResistance}, l'expérience est limitée à 1`;
competence: competence, xpCompetence: competence ? xp - xpCarac : 0 ui.notifications.info(message);
}; console.log(message)
// max 1 xp sur jets de résistance
xpCarac = Math.min(1, xpCarac);
}
let xpData = { alias: this.name, caracName, xpCarac, competence, xpCompetence };
await this._xpCompetence(xpData); await this._xpCompetence(xpData);
await this._xpCarac(xpData); await this._xpCarac(xpData);

View File

@ -1,4 +1,18 @@
const BASE_TACHE_SOIN_BLESSURE = { type: "tache", img: 'systems/foundryvtt-reve-de-dragon/icons/competence_chirurgie.webp', system: { carac: "dexterite", competence: "Chirurgie", periodicite: "1 round", fatigue: 0, } }
const TACHES_SOIN_BLESSURE = {
'critique': { name: 'Blessure critique', system: { difficulte: -6, points_de_tache: 6 } },
'grave': { name: 'Blessure grave', system: { difficulte: -4, points_de_tache: 4 } },
'legere': { name: 'Blessure légère', system: { difficulte: -2, points_de_tache: 2 } },
}
export class RdDItemTache extends Item { export class RdDItemTache extends Item {
static prepareTacheSoin(gravite) {
const blessure = TACHES_SOIN_BLESSURE[gravite]
if (blessure) {
return mergeObject(duplicate(BASE_TACHE_SOIN_BLESSURE), blessure)
}
ui.notifications.warn(`Pas de tâche de soins pour une blessure ${gravite}`)
return undefined;
}
} }

View File

@ -1,6 +1,5 @@
import { ChatUtility } from "./chat-utility.js"; import { ChatUtility } from "./chat-utility.js";
import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js"; import { ENTITE_BLURETTE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
import { DialogSelectTarget } from "./dialog-select-target.js";
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { RdDItemArme } from "./item-arme.js"; import { RdDItemArme } from "./item-arme.js";
import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
@ -111,10 +110,10 @@ export class RdDCombatManager extends Combat {
if (!roll.total) { if (!roll.total) {
roll.evaluate({ async: false }); roll.evaluate({ async: false });
} }
if (roll.total <= 0) roll.total = 0.00; const total = Math.max(roll.total, 0.00);
console.log("Compute init for", rollFormula, roll.total, combatant); console.log("Compute init for", rollFormula, roll, total, combatant);
let id = combatant._id || combatant.id; let id = combatant._id || combatant.id;
await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: roll.total }]); await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: total }]);
// Send a chat message // Send a chat message
let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode"); let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode");

View File

@ -73,6 +73,9 @@ export class RdDTimestamp {
* @returns L'entrée de DEFINITION_HEURES correspondant au signe * @returns L'entrée de DEFINITION_HEURES correspondant au signe
*/ */
static definition(signe) { static definition(signe) {
if (signe == undefined) {
signe = 0;
}
if (Number.isInteger(signe)) { if (Number.isInteger(signe)) {
return DEFINITION_HEURES[signe % RDD_HEURES_PAR_JOUR]; return DEFINITION_HEURES[signe % RDD_HEURES_PAR_JOUR];
} }
@ -96,7 +99,7 @@ export class RdDTimestamp {
} }
static imgSigne(signe) { static imgSigne(signe) {
return `<img class="img-signe-heure" src="${signe.webp}" alt="${signe.label}"/>` return signe == undefined ? '' : `<img class="img-signe-heure" src="${signe.webp}" alt="${signe.label}"/>`
} }
static handleTimestampEditor(html, path, consumeTimestamp = async (path, timestamp) => { }) { static handleTimestampEditor(html, path, consumeTimestamp = async (path, timestamp) => { }) {

View File

@ -285,7 +285,12 @@ export class RdDTMRDialog extends Dialog {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async onActionRencontre(action, tmr) { async onActionRencontre(action, tmr, rencontre) {
if (!this.currentRencontre){
ui.notifications.warn("#612 Rencontre perdue, récupération en cours. Vous pouvez contacter l'équipe avec les logs pour aider à résoudre ce problème")
console.error("#612 Rencontre perdue", action, tmr, rencontre, this);
this.currentRencontre = rencontre;
}
switch (action) { switch (action) {
case 'derober': case 'derober':
await this.derober(); await this.derober();
@ -589,6 +594,7 @@ export class RdDTMRDialog extends Dialog {
return await game.system.rdd.rencontresTMR.getRencontreAleatoire(tmr, this.actor.isMauvaiseRencontre()) return await game.system.rdd.rencontresTMR.getRencontreAleatoire(tmr, this.actor.isMauvaiseRencontre())
} else { } else {
this._tellToUser(myRoll + ": Pas de rencontre en " + locTMR); this._tellToUser(myRoll + ": Pas de rencontre en " + locTMR);
return undefined;
} }
} }

View File

@ -29,12 +29,13 @@ export class RdDTMRRencontreDialog extends Dialog {
this.toClose = false; this.toClose = false;
this.tmr = tmr; this.tmr = tmr;
this.tmrApp = tmrApp; this.tmrApp = tmrApp;
this.rencontre = rencontre;
this.tmrApp.minimize(); this.tmrApp.minimize();
} }
async onButtonAction(action) { async onButtonAction(action) {
this.toClose = true; this.toClose = true;
this.tmrApp.onActionRencontre(action, this.tmr) this.tmrApp.onActionRencontre(action, this.tmr, this.rencontre)
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -149,6 +149,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/actor/jeux.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/jeux.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/alchimie.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/astrologie.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/non-haut-revant.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/haut-revant.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html', 'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html',

View File

@ -1,8 +1,8 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "10.6.2", "version": "10.6.3",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.2.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.3.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",

View File

@ -89,6 +89,7 @@
{{#if options.isObserver}}{{!-- Combat Tab --}} {{#if options.isObserver}}{{!-- Combat Tab --}}
<div class="tab combat" data-group="primary" data-tab="combat"> <div class="tab combat" data-group="primary" data-tab="combat">
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/combat.html"}}<hr> {{> "systems/foundryvtt-reve-de-dragon/templates/actor/combat.html"}}<hr>
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/chirurgie.html"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/blessures.html"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html"}}
{{> "systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html"}} {{> "systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html"}}

View File

@ -0,0 +1,21 @@
<h4>Soins</h4>
<a class="chat-card-button creer-tache-blessure-legere">Blessure légère</a>
<a class="chat-card-button creer-tache-blessure-grave">Blessure grave</a>
<a class="chat-card-button creer-tache-blessure-critique">Blessure critique</a>
<ul class="item-list alterne-list">
{{#each taches as |tache id|}}
{{#if (eq tache.system.competence 'Chirurgie')}}
<li class="item flexrow list-item" data-item-id="{{tache._id}}">
<img class="sheet-competence-img" src="{{tache.img}}" />
<span class="competence-title tache-label"><a>{{tache.name}}
({{tache.system.points_de_tache_courant}}{{#if
(or @root.options.isGM (not tache.system.cacher_points_de_tache))
}}/{{tache.system.points_de_tache}}{{/if}})</a></span>
<div class="item-controls flex-shrink">
<a class="item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/if}}
{{/each}}
</ul>

View File

@ -1,6 +1,7 @@
<h3>Tâches</h3><a class="chat-card-button creer-tache">Nouvelle Tâche</a> <h3>Tâches</h3><a class="chat-card-button creer-tache">Nouvelle Tâche</a>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each taches as |tache id|}} {{#each taches as |tache id|}}
{{#unless (eq tache.system.competence 'Chirurgie')}}
<li class="item flexrow list-item" data-item-id="{{tache._id}}"> <li class="item flexrow list-item" data-item-id="{{tache._id}}">
<img class="sheet-competence-img" src="{{tache.img}}" /> <img class="sheet-competence-img" src="{{tache.img}}" />
<span class="competence-title tache-label"><a>{{tache.name}} <span class="competence-title tache-label"><a>{{tache.name}}
@ -12,5 +13,6 @@
<a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a> <a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>
</li> </li>
{{/unless}}
{{/each}} {{/each}}
</ul> </ul>