Merge pull request 'v10.6.3' (#613) from VincentVk/foundryvtt-reve-de-dragon:v10 into v10
Reviewed-on: #613
This commit is contained in:
commit
c448f32bb8
@ -151,6 +151,15 @@ export class RdDActorSheet extends RdDBaseActorSheet {
|
||||
this.html.find('.creer-tache').click(async event => {
|
||||
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.selectTypeOeuvreToCreate();
|
||||
});
|
||||
@ -249,7 +258,7 @@ export class RdDActorSheet extends RdDBaseActorSheet {
|
||||
|
||||
// Points de reve actuel
|
||||
this.html.find('.ptreve-actuel a').click(async event => {
|
||||
this.actor.rollCarac('reve-actuel');
|
||||
this.actor.rollCarac('reve-actuel', true);
|
||||
});
|
||||
|
||||
// Roll Weapon1
|
||||
@ -477,7 +486,6 @@ export class RdDActorSheet extends RdDBaseActorSheet {
|
||||
async createEmptyTache() {
|
||||
await this.actor.createItem('tache', 'Nouvelle tache');
|
||||
}
|
||||
|
||||
_optionRecherche(target) {
|
||||
if (!target.value?.length) {
|
||||
return undefined;
|
||||
|
@ -35,6 +35,7 @@ import { Targets } from "./targets.js";
|
||||
import { DialogRepos } from "./dialog-repos.js";
|
||||
import { RdDBaseActor } from "./actor/base-actor.js";
|
||||
import { RdDTimestamp } from "./rdd-timestamp.js";
|
||||
import { RdDItemTache } from "./item-tache.js";
|
||||
|
||||
const POSSESSION_SANS_DRACONIC = {
|
||||
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": "" };
|
||||
|
||||
export const MAINS_DIRECTRICES = ['Droitier', 'Gaucher', 'Ambidextre']
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -859,7 +859,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
return undefined
|
||||
}
|
||||
const path = getPath(fieldName);
|
||||
if (path){
|
||||
if (path) {
|
||||
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 }) {
|
||||
for (let effect of this.getEffects()) {
|
||||
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))} !` });
|
||||
}
|
||||
}
|
||||
@ -1764,6 +1759,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
forceAlcool: forceAlcool,
|
||||
nbDoses: nbDoses,
|
||||
selectedCarac: this.system.sante.vie,
|
||||
jetResistance: 'ethylisme',
|
||||
carac: this.system.carac,
|
||||
caracValue: this.system.sante.vie.max,
|
||||
finalLevel: etat + forceAlcool - nbDoses
|
||||
@ -1972,7 +1968,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') {
|
||||
if (!this.isPersonnage()) return;
|
||||
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) {
|
||||
const content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-gain-xp.html`, xpData);
|
||||
if (hideChatMessage) {
|
||||
@ -2197,10 +2193,11 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCarac(caracName) {
|
||||
async rollCarac(caracName, jetResistance = undefined) {
|
||||
let rollData = {
|
||||
selectedCarac: this.getCaracByName(caracName),
|
||||
competences: this.itemTypes['competence']
|
||||
competences: this.itemTypes['competence'],
|
||||
jetResistance: jetResistance ? caracName : undefined
|
||||
};
|
||||
|
||||
const dialog = await RdDRoll.create(this, rollData,
|
||||
@ -2328,6 +2325,13 @@ export class RdDActor extends RdDBaseActor {
|
||||
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) {
|
||||
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;
|
||||
// Pas d'XP
|
||||
if (!rolled.isPart || rolled.finalLevel >= 0) {
|
||||
@ -2771,16 +2775,19 @@ export class RdDActor extends RdDBaseActor {
|
||||
if (caracName == 'Vie') caracName = 'constitution';
|
||||
if (caracName == 'derobee') caracName = 'agilite';
|
||||
if (caracName == 'reve-actuel') caracName = 'reve';
|
||||
|
||||
let xp = Math.abs(rolled.finalLevel);
|
||||
// impair: arrondi inférieur en carac
|
||||
let xpCarac = competence ? Math.floor(xp / 2) : Math.max(Math.floor(xp / 2), 1);
|
||||
|
||||
let xpData = {
|
||||
alias: this.name,
|
||||
caracName: caracName, xpCarac: xpCarac,
|
||||
competence: competence, xpCompetence: competence ? xp - xpCarac : 0
|
||||
};
|
||||
const xpCompetence = competence ? xp - xpCarac : 0;
|
||||
if (jetResistance) {
|
||||
const message = `Jet de résistance ${jetResistance}, l'expérience est limitée à 1`;
|
||||
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._xpCarac(xpData);
|
||||
|
@ -1,4 +1,18 @@
|
||||
export class RdDItemTache extends Item {
|
||||
|
||||
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 {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
import { ChatUtility } from "./chat-utility.js";
|
||||
import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { DialogSelectTarget } from "./dialog-select-target.js";
|
||||
import { ENTITE_BLURETTE, HIDE_DICE, SYSTEM_RDD, SYSTEM_SOCKET_ID } from "./constants.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { RdDItemArme } from "./item-arme.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
@ -111,10 +110,10 @@ export class RdDCombatManager extends Combat {
|
||||
if (!roll.total) {
|
||||
roll.evaluate({ async: false });
|
||||
}
|
||||
if (roll.total <= 0) roll.total = 0.00;
|
||||
console.log("Compute init for", rollFormula, roll.total, combatant);
|
||||
const total = Math.max(roll.total, 0.00);
|
||||
console.log("Compute init for", rollFormula, roll, total, combatant);
|
||||
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
|
||||
let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode");
|
||||
|
@ -73,6 +73,9 @@ export class RdDTimestamp {
|
||||
* @returns L'entrée de DEFINITION_HEURES correspondant au signe
|
||||
*/
|
||||
static definition(signe) {
|
||||
if (signe == undefined) {
|
||||
signe = 0;
|
||||
}
|
||||
if (Number.isInteger(signe)) {
|
||||
return DEFINITION_HEURES[signe % RDD_HEURES_PAR_JOUR];
|
||||
}
|
||||
@ -96,7 +99,7 @@ export class RdDTimestamp {
|
||||
}
|
||||
|
||||
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) => { }) {
|
||||
|
@ -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) {
|
||||
case 'derober':
|
||||
await this.derober();
|
||||
@ -589,6 +594,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
return await game.system.rdd.rencontresTMR.getRencontreAleatoire(tmr, this.actor.isMauvaiseRencontre())
|
||||
} else {
|
||||
this._tellToUser(myRoll + ": Pas de rencontre en " + locTMR);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,12 +29,13 @@ export class RdDTMRRencontreDialog extends Dialog {
|
||||
this.toClose = false;
|
||||
this.tmr = tmr;
|
||||
this.tmrApp = tmrApp;
|
||||
this.rencontre = rencontre;
|
||||
this.tmrApp.minimize();
|
||||
}
|
||||
|
||||
async onButtonAction(action) {
|
||||
this.toClose = true;
|
||||
this.tmrApp.onActionRencontre(action, this.tmr)
|
||||
this.tmrApp.onActionRencontre(action, this.tmr, this.rencontre)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -149,6 +149,7 @@ export class RdDUtility {
|
||||
'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/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/haut-revant.html',
|
||||
'systems/foundryvtt-reve-de-dragon/templates/actor/dragon-queues.html',
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"id": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"version": "10.6.2",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.6.2.zip",
|
||||
"version": "10.6.3",
|
||||
"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",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
|
@ -89,6 +89,7 @@
|
||||
{{#if options.isObserver}}{{!-- Combat Tab --}}
|
||||
<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/chirurgie.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/possessions.html"}}
|
||||
|
21
templates/actor/chirurgie.html
Normal file
21
templates/actor/chirurgie.html
Normal 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>
|
@ -1,16 +1,18 @@
|
||||
<h3>Tâches</h3><a class="chat-card-button creer-tache">Nouvelle Tâche</a>
|
||||
<ul class="item-list alterne-list">
|
||||
{{#each taches as |tache id|}}
|
||||
<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>
|
||||
{{#unless (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>
|
||||
{{/unless}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user