Merge pull request '12.0.42' (#751) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
All checks were successful
Release Creation / build (release) Successful in 1m39s

Reviewed-on: #751
This commit is contained in:
uberwald 2025-02-10 07:58:31 +01:00
commit 0009876a6d
8 changed files with 67 additions and 66 deletions

View File

@ -1,4 +1,8 @@
# 12.0
## 12.0.42 - Les errements d'Astrobazzarh
- Correction de différentes automatisations de combat incorrectes
- Correction des jets `@roll[vue/-2]` qui tentaient de chercher une compétence -2 (à cause des armes à 1/2 mains)
## 12.0.41 - La loupe d'Astrobazzarh
- On peut de nouveau effectuer des tirages cachés
- Le stress transformé est bien diminué lorsqu'on met le stress dans une compétence

View File

@ -2643,12 +2643,13 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async incDecItemUse(itemId, inc = 1) {
const currentItemUse = this.getFlag(SYSTEM_RDD, 'itemUse');
let itemUse = currentItemUse ? foundry.utils.duplicate(currentItemUse) : {};
itemUse[itemId] = (itemUse[itemId] ?? 0) + inc;
await this.setFlag(SYSTEM_RDD, 'itemUse', itemUse);
console.log("ITEM USE INC", inc, itemUse);
async incDecItemUse(itemId, shouldIncrease = true) {
if (shouldIncrease) {
const currentItemUse = this.getFlag(SYSTEM_RDD, 'itemUse');
let itemUse = currentItemUse ? foundry.utils.duplicate(currentItemUse) : {};
itemUse[itemId] = (itemUse[itemId] ?? 0) + 1;
await this.setFlag(SYSTEM_RDD, 'itemUse', itemUse);
}
}
/* -------------------------------------------- */

View File

@ -277,14 +277,9 @@ export class RdDBaseActorReve extends RdDBaseActor {
return dialog
}
createEmptyCallback() {
return {
condition: r => false,
action: r => { }
};
}
createCallbackExperience() { return this.createEmptyCallback(); }
createCallbackAppelAuMoral() { return this.createEmptyCallback(); }
createCallbackExperience() { return { action: r => { } } }
createCallbackAppelAuMoral() { return { action: r => { } } }
async _onCloseRollDialog(html) { }
async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {

View File

@ -747,7 +747,7 @@ export class RdDBaseActor extends Actor {
async jetDeMoral() { this.actionImpossible("jet de moral") }
async resetItemUse() { }
async incDecItemUse(itemId, inc = 1) { }
async incDecItemUse(itemId, shouldIncrease = true) { }
getItemUse(itemId) { return 0; }
async finDeRound(options = { terminer: false }) { }

View File

@ -5,7 +5,7 @@ import { RdDUtility } from "../../rdd-utility.js";
import { TextRollManager } from "./text-roll-formatter.js";
const REGECP_CARAC = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)"
const REGEXP_COMP = "(\\/(?<competence>[A-Za-z0-9À-ÖØ-öø-ÿ -]+))?"
const REGEXP_COMP = "(\\/(?<competence>[A-Za-zÀ-ÖØ-öø-ÿ ]+([1-2]?[A-Za-zÀ-ÖØ-öø-ÿ ]+)?))?"
const REGEXP_DIFF = "(/(?<diff>[\\+\\-]?\\d+(d\\d+)?))?"
const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF
const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu')

View File

@ -743,23 +743,13 @@ export class RdDCombat {
this.attacker.createCallbackExperience(),
this.attacker.createCallbackAppelAuMoral(),
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
{ action: r => this._increaseItemUse(r, arme) },
{ action: r => this._onAttaqueNormale(r) },
{ action: r => this._onAttaqueParticuliere(r) },
{ action: r => this._onAttaqueEchec(r) },
{ action: r => this._onAttaqueEchecTotal(r) },
{ action: async r => await this.attacker.incDecItemUse(arme._id, arme && !RdDCombat.isParticuliere(r)) },
{ action: r => this._onAttaque(r) },
]
});
dialog.render(true);
}
_increaseItemUse(rollData, arme) {
if (!arme || RdDCombat.isParticuliere(rollData)) {
return
}
this.attacker.incDecItemUse(arme._id)
}
/* -------------------------------------------- */
_prepareAttaque(competence, arme) {
let rollData = {
@ -790,11 +780,23 @@ export class RdDCombat {
return rollData;
}
async _onAttaque(attackerRoll) {
if (RdDCombat.isParticuliere(attackerRoll)) {
return await this._onAttaqueParticuliere(attackerRoll)
}
if (RdDCombat.isReussite(attackerRoll)) {
return await this._onAttaqueNormale(attackerRoll)
}
// if (RdDCombat.isParticuliere(attackerRoll) && attackerRoll.particuliere == undefined) {
// return
// }
if (RdDCombat.isEchecTotal(attackerRoll)) {
return await this._onAttaqueEchecTotal(attackerRoll)
}
return await this._onAttaqueEchec(attackerRoll)
}
/* -------------------------------------------- */
async _onAttaqueParticuliere(rollData) {
if (!RdDCombat.isParticuliere(rollData)) {
return
}
const isMeleeDiffNegative = (rollData.competence.type == 'competencecreature' || rollData.selectedCarac.label == "Mêlée") && rollData.diffLibre < 0;
// force toujours, sauf empoignade
// finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum
@ -832,12 +834,6 @@ export class RdDCombat {
/* -------------------------------------------- */
async _onAttaqueNormale(attackerRoll) {
if (!RdDCombat.isReussite(attackerRoll)) {
return
}
if (RdDCombat.isParticuliere(attackerRoll) && attackerRoll.particuliere == undefined) {
return
}
console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll);
attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker, this.defender.isEntite());
@ -954,9 +950,6 @@ export class RdDCombat {
/* -------------------------------------------- */
async _onAttaqueEchecTotal(attackerRoll) {
if (!RdDCombat.isEchecTotal(attackerRoll)) {
return
}
const choixEchecTotal = await ChatMessage.create({
whisper: ChatUtility.getOwners(this.attacker),
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.hbs', {
@ -983,22 +976,16 @@ export class RdDCombat {
}
/* -------------------------------------------- */
async _onAttaqueEchec(rollData) {
if (!RdDCombat.isEchec(rollData)) {
return
}
console.log("RdDCombat.onAttaqueEchec >>>", rollData);
await RdDRollResult.displayRollData(rollData, this.attacker, 'chat-resultat-attaque.hbs');
async _onAttaqueEchec(attackerRoll) {
console.log("RdDCombat.onAttaqueEchec >>>", attackerRoll);
await RdDRollResult.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.hbs');
}
/* -------------------------------------------- */
async choixParticuliere(rollData, choix) {
console.log("RdDCombat.choixParticuliere >>>", rollData, choix);
if (choix != "rapidite") {
this.attacker.incDecItemUse(rollData.arme.id);
}
await this.attacker.incDecItemUse(rollData.arme.id, choix != "rapidite")
this.removeChatMessageActionsPasseArme(rollData.passeArme);
rollData.particuliere = choix;
@ -1026,10 +1013,8 @@ export class RdDCombat {
this.defender.createCallbackExperience(),
this.defender.createCallbackAppelAuMoral(),
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
{ condition: r => !RdDCombat.isParticuliere(r), action: r => this.defender.incDecItemUse(armeParadeId) },
{ condition: RdDCombat.isReussite, action: r => this._onParadeNormale(r) },
{ condition: RdDCombat.isParticuliere, action: r => this._onParadeParticuliere(r) },
{ condition: RdDCombat.isEchec, action: r => this._onParadeEchec(r) },
{ action: async r => await this.defender.incDecItemUse(armeParadeId, !RdDCombat.isParticuliere(r)) },
{ action: r => this._onParade(r) },
]
});
dialog.render(true);
@ -1060,8 +1045,19 @@ export class RdDCombat {
return defenderRoll;
}
async _onParade(defenderRoll) {
if (RdDCombat.isParticuliere(defenderRoll)) {
return await this._onParadeParticuliere(defenderRoll)
}
if (RdDCombat.isReussite(defenderRoll)) {
return await this._onParadeNormale(defenderRoll)
}
await this._onParadeEchec(defenderRoll)
}
/* -------------------------------------------- */
_onParadeParticuliere(defenderRoll) {
async _onParadeParticuliere(defenderRoll) {
console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll);
if (!defenderRoll.attackerRoll.isPart) {
// TODO: attaquant doit jouer résistance et peut être désarmé p132
@ -1070,7 +1066,6 @@ export class RdDCombat {
this.defender)
}
}
/* -------------------------------------------- */
async _onParadeNormale(defenderRoll) {
console.log("RdDCombat._onParadeNormale >>>", defenderRoll);
@ -1109,11 +1104,9 @@ export class RdDCombat {
callbacks: [
this.defender.createCallbackExperience(),
this.defender.createCallbackAppelAuMoral(),
{ condition: r => !RdDCombat.isParticuliere(r), action: r => this.defender.incDecItemUse(esquive._id) },
{ action: async r => await this.defender.incDecItemUse(esquive._id, !RdDCombat.isParticuliere(r)) },
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
{ condition: RdDCombat.isReussite, action: r => this._onEsquiveNormale(r) },
{ condition: RdDCombat.isParticuliere, action: r => this._onEsquiveParticuliere(r) },
{ condition: RdDCombat.isEchec, action: r => this._onEsquiveEchec(r) },
{ action: r => this._onEsquive(r) },
]
});
dialog.render(true);
@ -1141,9 +1134,18 @@ export class RdDCombat {
return rollData;
}
async _onEsquive(defenderRoll) {
if (RdDCombat.isParticuliere(defenderRoll)) {
return await this._onEsquiveParticuliere(defenderRoll)
}
if (RdDCombat.isReussite(defenderRoll)) {
return await this._onEsquiveNormale(defenderRoll)
}
return await this._onEsquiveEchec(defenderRoll)
}
/* -------------------------------------------- */
_onEsquiveParticuliere(rollData) {
console.log("RdDCombat._onEsquiveParticuliere >>>", rollData);
async _onEsquiveParticuliere(defenderRoll) {
console.log("RdDCombat._onEsquiveParticuliere >>>", defenderRoll);
ChatUtility.createChatWithRollMode(
{ content: "<strong>Vous pouvez esquiver une deuxième fois!</strong>" },
this.defender);

View File

@ -1,4 +1,3 @@
import { ChatUtility } from "./chat-utility.js";
import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js";
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";

View File

@ -1,9 +1,9 @@
{
"id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"version": "12.0.38",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.38/rddsystem.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.38/system.json",
"version": "12.0.42",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.42/rddsystem.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.42/system.json",
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
"compatibility": {
"minimum": "11",