Merge pull request 'feature/v13-corrections' (#794) from feature/v13-corrections into v13
All checks were successful
Release Creation / build (release) Successful in 2m45s
All checks were successful
Release Creation / build (release) Successful in 2m45s
Reviewed-on: https, #794
This commit was merged in pull request #794.
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
# 13.0
|
||||
|
||||
## 13.0.29 - Le tricorne d'Illysis
|
||||
|
||||
- gestion des attaques avec jets V2 depuis l'onglet de combat
|
||||
- les jets de résistance en mode V2 fonctionnent sans sélection de compétence
|
||||
- affichage de l'expérience correspondant aux sorts pour aider à la création
|
||||
- affichage de l'équivallent d'expérience des caractéristiques
|
||||
|
||||
## 13.0.28 - La quadrature d'Illysis
|
||||
|
||||
- Les ajustements de portée sont calculés pour les attaques à distance
|
||||
|
||||
@@ -893,7 +893,7 @@ body {
|
||||
max-width: 1.4rem;
|
||||
max-height: 1.4rem;
|
||||
border: 1px;
|
||||
background: center / contain no-repeat url("../../icons/templates/icone_parchement_vierge.webp");
|
||||
background: center / contain no-repeat url("../icons/templates/icone_parchement_vierge.webp");
|
||||
}
|
||||
.system-foundryvtt-reve-de-dragon .sheet-header .header-compteurs {
|
||||
width: calc(60% - 110px - 1rem);
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
max-height: 1.4rem;
|
||||
border: 1px;
|
||||
background: center / contain no-repeat
|
||||
url("../../icons/templates/icone_parchement_vierge.webp");
|
||||
url("../icons/templates/icone_parchement_vierge.webp");
|
||||
}
|
||||
|
||||
.sheet-header .header-compteurs {
|
||||
|
||||
@@ -19,6 +19,7 @@ import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { MORAL } from "./moral/apprecier.mjs";
|
||||
import { RdDItemSort } from "./item-sort.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
@@ -52,6 +53,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
surprise: RdDBonus.find(this.actor.getSurprise(false)).label,
|
||||
resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
|
||||
caracTotal: RdDCarac.computeTotal(this.actor.system.carac, this.actor.system.beaute),
|
||||
caracTotalXp: RdDCarac.computeTotalXp(this.actor.system.carac, this.actor.system.beaute),
|
||||
surEncombrementMessage: this.actor.isSurenc() ? "Sur-Encombrement!" : "",
|
||||
malusArmure: this.actor.getMalusArmure()
|
||||
})
|
||||
@@ -61,9 +63,13 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
if (formData.type == ACTOR_TYPES.personnage) {
|
||||
formData.options.mainsDirectrices = MAINS_DIRECTRICES;
|
||||
formData.byCateg = Misc.classify(formData.competences, it => it.system.categorie)
|
||||
formData.calc.comptageArchetype = RdDItemCompetence.computeResumeArchetype(formData.competences);
|
||||
formData.calc.competenceXPTotal = RdDItemCompetence.computeTotalXP(formData.competences);
|
||||
formData.calc.fatigue = RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max);
|
||||
foundry.utils.mergeObject(formData.calc, {
|
||||
comptageArchetype: RdDItemCompetence.computeResumeArchetype(formData.competences),
|
||||
competenceXPTotal: RdDItemCompetence.computeTotalXP(formData.competences),
|
||||
sortsXPTotal: RdDItemSort.computeTotalXP(this.actor.itemTypes[ITEM_TYPES.sort]),
|
||||
fatigue: RdDUtility.calculFatigueHtml(formData.system.sante.fatigue.value, formData.system.sante.endurance.max)
|
||||
|
||||
})
|
||||
|
||||
formData.competences.forEach(item => {
|
||||
item.system.isHidden = this.options.recherche
|
||||
|
||||
@@ -56,8 +56,6 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
|
||||
getTaille() { return Misc.toInt(this.system.carac.taille?.value) }
|
||||
getConstitution() { return this.getReve() }
|
||||
getVie() { return this.getReve() }
|
||||
getCaracVie() { return { [CARACS.VIE]: { label: "Vie", value: this.getVieMax(), type: "number" } } }
|
||||
|
||||
getForce() { return this.getReve() }
|
||||
getAgilite() { return this.getForce() }
|
||||
@@ -484,17 +482,15 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
|
||||
async rollCompetence(idOrName, options = { tryTarget: true, arme: undefined }) {
|
||||
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||
|
||||
const competence = this.getCompetence(idOrName);
|
||||
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
|
||||
const rollData = {
|
||||
ids: { actorId: this.id },
|
||||
type: { allowed: options.arme ? ATTAQUE_ROLL_TYPES : DEFAULT_ROLL_TYPES },
|
||||
type: { allowed: DEFAULT_ROLL_TYPES },
|
||||
selected: {
|
||||
carac: competence.type == ITEM_TYPES.competencecreature ? { key: competence.name } : undefined,
|
||||
comp: { key: competence.name },
|
||||
diff: { type: options.arme ? DIFF.ATTAQUE : DIFF.LIBRE, value: competence.system.default_diffLibre ?? 0 },
|
||||
attaque: options.arme ? { arme: { key: options.arme.id } } : undefined
|
||||
diff: { type: DIFF.LIBRE, value: competence.system.default_diffLibre ?? 0 },
|
||||
}
|
||||
}
|
||||
return await RollDialog.create(rollData)
|
||||
@@ -566,7 +562,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
type: {
|
||||
allowed: [ROLL_TYPE_ATTAQUE], current: ROLL_TYPE_ATTAQUE
|
||||
}
|
||||
};
|
||||
}
|
||||
return await RollDialog.create(rollData, { onRollDone: RollDialog.onRollDoneClose })
|
||||
}
|
||||
})
|
||||
@@ -575,16 +571,18 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
|
||||
/** --------------------------------------------
|
||||
* @param {*} arme item d'arme/compétence de créature
|
||||
* @param {*} categorieArme catégorie d'attaque à utiliser: competence (== melee), lancer, tir; naturelle, possession
|
||||
* @param {*} maniement catégorie d'attaque à utiliser: competence (== melee), lancer, tir; naturelle, possession
|
||||
* @returns
|
||||
*/
|
||||
rollArme(arme, categorieArme = 'competence', token = undefined) {
|
||||
async rollArme(arme, maniement = 'competence', token = undefined) {
|
||||
token = token ?? RdDUtility.getSelectedToken(this)
|
||||
const compToUse = RdDItemArme.getCompetenceArme(arme, categorieArme)
|
||||
const compToUse = RdDItemArme.getCompetenceArme(arme, maniement)
|
||||
|
||||
if (!RdDItemArme.isUtilisable(arme)) {
|
||||
ui.notifications.warn(`Arme inutilisable: ${arme.name} non équipée ou avec une résistance de 0 ou moins`)
|
||||
return
|
||||
}
|
||||
|
||||
if (!Targets.hasTargets()) {
|
||||
RdDConfirm.confirmer({
|
||||
settingConfirmer: "confirmer-combat-sans-cible",
|
||||
@@ -596,7 +594,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
onAction: async () => {
|
||||
this.rollCompetence(compToUse, { tryTarget: false, arme: arme })
|
||||
}
|
||||
});
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -606,11 +604,12 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
return
|
||||
}
|
||||
|
||||
const competence = this.getCompetence(compToUse)
|
||||
if (competence.isCompetencePossession()) {
|
||||
return RdDPossession.onAttaquePossession(target, this, competence);
|
||||
const comp = this.getCompetence(compToUse)
|
||||
if (comp.isCompetencePossession()) {
|
||||
// TODO: vérifier si c'est possible, sinon simplifier
|
||||
return RdDPossession.onAttaquePossession(target, this, comp);
|
||||
}
|
||||
RdDCombat.rddCombatTarget(target, this, token).attaque(competence, arme);
|
||||
RdDCombat.rddCombatTarget(target, this, token).attaque(comp, arme, maniement)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { RdDItemBlessure } from "../item/blessure.js";
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDBaseActor } from "./base-actor.js";
|
||||
import { CARACS } from "../rdd-carac.js";
|
||||
|
||||
/**
|
||||
* Classe de base pour les acteurs qui peuvent subir des blessures
|
||||
|
||||
@@ -136,7 +136,7 @@ export class RdDItemCompetence extends RdDItem {
|
||||
return troncList;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
return []
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
@@ -41,6 +41,11 @@ export class RdDItemSort extends RdDItem {
|
||||
return value ? value.replace('variable', 'var') : ''
|
||||
}
|
||||
|
||||
static computeTotalXP(sorts) {
|
||||
return sorts.map(sort => RdDItemSort.isDifficulteVariable(sort) ? 70 : -10 * Misc.toInt(sort.system.difficulte))
|
||||
.reduce(Misc.sum(), 0)
|
||||
}
|
||||
|
||||
static isSortOnCoord(sort, coord) {
|
||||
let tmr = TMRUtility.getTMR(coord)
|
||||
const caseTMR = sort.system.caseTMR.toLowerCase();
|
||||
|
||||
@@ -168,10 +168,18 @@ export class RdDCarac {
|
||||
const total = Object.values(carac ?? {}).filter(c => !c.derivee)
|
||||
.map(it => parseInt(it.value))
|
||||
.reduce(Misc.sum(), 0);
|
||||
const beauteSuperieur10 = Math.max((beaute ?? 10) - 10, 0);
|
||||
const beauteSuperieur10 = Math.max((beaute ?? 10) - 10, 0)
|
||||
return total + beauteSuperieur10;
|
||||
}
|
||||
|
||||
static computeTotalXp(carac, beaute = undefined) {
|
||||
const totalXp = Object.values(carac ?? {}).filter(c => !c.derivee)
|
||||
.map(it => RdDCarac.getCaracXp(0, Misc.toInt(it.value)) + Misc.toInt(it.xp))
|
||||
.reduce(Misc.sum(), 0);
|
||||
const beauteXp = beaute > 10 ? RdDCarac.getCaracXp(10, beaute) : 0
|
||||
return totalXp + beauteXp;
|
||||
}
|
||||
|
||||
static levelUp(it) {
|
||||
it.xpNext = RdDCarac.getCaracNextXp(it.value);
|
||||
it.isLevelUp = (it.xp >= it.xpNext);
|
||||
@@ -184,12 +192,16 @@ export class RdDCarac {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getCaracNextXp(value) {
|
||||
const nextValue = Number(value) + 1;
|
||||
value = Number(value);
|
||||
const nextValue = value + 1;
|
||||
// xp est le coût pour atteindre cette valeur, on regarde donc le coût de la valeur+1
|
||||
return RdDCarac.getCaracXp(nextValue);
|
||||
return RdDCarac.getCaracXp(value, nextValue)
|
||||
}
|
||||
|
||||
static getCaracXp(targetValue) {
|
||||
return RdDCarac.getCaracDerivee(targetValue)?.xp ?? 200;
|
||||
static getCaracXp(from, to) {
|
||||
return Array.from({ length: to - from },
|
||||
(_, i) => from + i + 1)
|
||||
.map(it => RdDCarac.getCaracDerivee(it)?.xp ?? 200)
|
||||
.reduce(Misc.sum(), 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,8 +518,8 @@ export class RdDCombat {
|
||||
/* -------------------------------------------- */
|
||||
attaqueChanceuse(attackerRoll) {
|
||||
ui.notifications.info("L'attaque est rejouée grâce à la chance")
|
||||
attackerRoll.essais.attaqueChance = true;
|
||||
this.attaque(attackerRoll, attackerRoll.arme);
|
||||
attackerRoll.essais.attaqueChance = true
|
||||
this.attaque(attackerRoll, attackerRoll.arme)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -646,11 +646,11 @@ export class RdDCombat {
|
||||
}
|
||||
}
|
||||
|
||||
async attaqueV2() {
|
||||
async attaqueV2(options = undefined) {
|
||||
if (!await this.attacker.accorder(this.defender, 'avant-attaque')) {
|
||||
return
|
||||
}
|
||||
await this.doRollAttaque({
|
||||
const rollData = {
|
||||
ids: {
|
||||
actorId: this.attackerId,
|
||||
actorTokenId: this.attackerTokenId,
|
||||
@@ -658,8 +658,19 @@ export class RdDCombat {
|
||||
opponentTokenId: this.defenderTokenId,
|
||||
},
|
||||
type: { allowed: ['attaque'], current: 'attaque' },
|
||||
selected: {},
|
||||
passeArme: foundry.utils.randomID(16),
|
||||
})
|
||||
}
|
||||
if (options) {
|
||||
rollData.selected = {
|
||||
attaque: {
|
||||
comp: { id: options.comp.id },
|
||||
arme: { id: options.arme.id },
|
||||
main: options.main
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.doRollAttaque(rollData)
|
||||
}
|
||||
|
||||
async doRollAttaque(rollData, callbacks = []) {
|
||||
@@ -740,12 +751,14 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async attaque(competence, arme) {
|
||||
async attaque(competence, arme, main) {
|
||||
if (!await this.attacker.accorder(this.defender, 'avant-attaque')) {
|
||||
return
|
||||
}
|
||||
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
|
||||
return this.attacker.rollCompetence(competence.name, { arme: arme })
|
||||
return this.attaqueV2(
|
||||
{ comp: competence, arme: arme, main: main }
|
||||
)
|
||||
}
|
||||
if (arme.system.cac == EMPOIGNADE) {
|
||||
RdDEmpoignade.onAttaqueEmpoignade(this.attacker, this.defender)
|
||||
@@ -754,7 +767,7 @@ export class RdDCombat {
|
||||
RdDEmpoignade.checkEmpoignadeEnCours(this.attacker)
|
||||
|
||||
let rollData = this._prepareAttaque(competence, arme)
|
||||
console.log("RdDCombat.attaque >>>", rollData);
|
||||
console.log("RdDCombat.attaque >>>", rollData)
|
||||
if (arme) {
|
||||
this.attacker.verifierForceMin(arme);
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ export class RdDCommands {
|
||||
this.registerCommand({
|
||||
path: ["/xp", "carac"], func: (content, msg, params) => this.getCoutXpCarac(msg, params),
|
||||
descr: `Détermine le coût d'expérience pour augmenter une caractéristique. Exemples:
|
||||
<br>/xp carac 12 15: coût pour passer de 12 15
|
||||
<br>/xp carac 15: coût pour atteindre 15 (depuis 14)`
|
||||
});
|
||||
|
||||
@@ -440,13 +441,18 @@ export class RdDCommands {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCoutXpCarac(msg, params) {
|
||||
if (params && params.length == 1) {
|
||||
let to = Number(params[0]);
|
||||
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDCarac.getCaracXp(to)}`);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
if (params) {
|
||||
if (params.length == 1) {
|
||||
const to = Number(params[0])
|
||||
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${to - 1} à ${to}: ${RdDCarac.getCaracXp(to - 1, to)}`);
|
||||
}
|
||||
if (params.length == 2) {
|
||||
const from = Number(params[0]);
|
||||
const to = Number(params[1]);
|
||||
return RdDCommands._chatAnswer(msg, `Coût pour passer une caractéristique de ${from} à ${to}: ${RdDCarac.getCaracXp(from, to)}`);
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
async creerSignesDraconiques() {
|
||||
|
||||
@@ -101,7 +101,7 @@ export class RdDHotbar {
|
||||
}
|
||||
|
||||
/** Roll macro */
|
||||
static rollMacro(itemName, itemType, categorieArme = 'competence') {
|
||||
static rollMacro(itemName, itemType, maniement = 'competence') {
|
||||
const speaker = ChatMessage.getSpeaker();
|
||||
let actor;
|
||||
if (speaker.token) actor = game.actors.tokens[speaker.token];
|
||||
@@ -117,10 +117,10 @@ export class RdDHotbar {
|
||||
// Trigger the item roll
|
||||
switch (item.type) {
|
||||
case ITEM_TYPES.arme:
|
||||
return actor.rollArme(item, categorieArme);
|
||||
return actor.rollArme(item, maniement);
|
||||
case ITEM_TYPES.competence:
|
||||
if (item.isCorpsACorps()) {
|
||||
switch (categorieArme) {
|
||||
switch (maniement) {
|
||||
case PUGILAT:
|
||||
return actor.rollArme(RdDItemArme.pugilat(actor));
|
||||
case EMPOIGNADE:
|
||||
@@ -130,7 +130,7 @@ export class RdDHotbar {
|
||||
return actor.rollCompetence(item);
|
||||
case ITEM_TYPES.competencecreature:
|
||||
return item.system.iscombat
|
||||
? actor.rollArme(item, categorieArme)
|
||||
? actor.rollArme(item, maniement)
|
||||
: actor.rollCompetence(item);
|
||||
|
||||
}
|
||||
|
||||
@@ -52,11 +52,13 @@ export class RollPartAttaque extends RollPartSelect {
|
||||
|
||||
restore(rollData) {
|
||||
const saved = this.getSaved(rollData) ?? {}
|
||||
this.setCurrent(rollData, {
|
||||
key: saved.key,
|
||||
tactique: saved.tactique,
|
||||
dmg: saved.dmg
|
||||
})
|
||||
if (saved.key) {
|
||||
this.setCurrent(rollData, {
|
||||
key: saved.key,
|
||||
tactique: saved.tactique,
|
||||
dmg: saved.dmg
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
store(rollData, targetData) {
|
||||
@@ -70,8 +72,10 @@ export class RollPartAttaque extends RollPartSelect {
|
||||
|
||||
|
||||
findAttaque(attaques, saved) {
|
||||
return attaques.find(at => at.arme.id == saved?.arme?.id &&
|
||||
at.comp.id == saved?.comp?.id
|
||||
return attaques.find(at => at.arme.id == (saved?.arme?.id ?? at.arme.id)
|
||||
&& at.comp.id == (saved?.comp?.id ?? at.comp.id)
|
||||
&& at.main == (saved?.main ?? at.main)
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ export class RollPartComp extends RollPartSelect {
|
||||
if (selected.forced) {
|
||||
refs.all = all.filter(comp => Grammar.equalsInsensitive(comp.label, selected.key))
|
||||
if (refs.all.length == 0) {
|
||||
if (selected.key.length > 0) {
|
||||
if (selected.key && selected.key.length > 0) {
|
||||
refs.all = all.filter(comp => Grammar.includesLowerCaseNoAccent(comp.label, selected.key))
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -3,4 +3,10 @@
|
||||
<span class="carac-label" name="carac-total">Total Caractéristiques</span>
|
||||
<span class="competence-value" name="carac-total-value">{{calc.caracTotal}} </span>
|
||||
</li>
|
||||
{{#if @root.options.isGM}}
|
||||
<li class="caracteristique flexrow">
|
||||
<span class="carac-label" name="carac-total">Total XP Caractéristiques</span>
|
||||
<span class="competence-value" name="carac-total-xp">{{calc.caracTotalXp}} </span>
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
<span class="generic-label">Total XP compétences</span>
|
||||
<span class="competence-value">{{calc.competenceXPTotal}}</span>
|
||||
</li>
|
||||
<li class="flexrow">
|
||||
<span class="generic-label">Total XP sorts</span>
|
||||
<span class="competence-value">{{calc.sortsXPTotal}}</span>
|
||||
</li>
|
||||
{{/if}}
|
||||
<li> </li>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user