Liens jets de dés #737

Merged
uberwald merged 9 commits from VincentVk/foundryvtt-reve-de-dragon:v11 into v11 2025-01-12 16:15:34 +01:00
5 changed files with 28 additions and 8 deletions
Showing only changes of commit 57c41a0218 - Show all commits

View File

@ -346,7 +346,6 @@ export class RdDBaseActorReve extends RdDBaseActor {
callbackAction: r => this.$onRollCaracResult(r) callbackAction: r => this.$onRollCaracResult(r)
}) })
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollCarac(caracName, options = {}) { async rollCarac(caracName, options = {}) {
if (Grammar.equalsInsensitive(caracName, 'taille')) { if (Grammar.equalsInsensitive(caracName, 'taille')) {

View File

@ -81,7 +81,6 @@ export class RdDBaseActor extends Actor {
} }
} }
static getRealActor(actorId, tokenId) { static getRealActor(actorId, tokenId) {
if (tokenId) { if (tokenId) {
let token = canvas.tokens.get(tokenId) let token = canvas.tokens.get(tokenId)
@ -161,8 +160,11 @@ export class RdDBaseActor extends Actor {
return RdDBaseActor.$findCaracByName(carac, name); return RdDBaseActor.$findCaracByName(carac, name);
} }
mapCarac(caracCode) { return caracCode }
getCaracByName(name) { getCaracByName(name) {
switch (Grammar.toLowerCaseNoAccent(name)) { name = this.mapCarac(Grammar.toLowerCaseNoAccent(name))
switch (name) {
case 'reve-actuel': case 'reve actuel': case 'reve-actuel': case 'reve actuel':
return this.getCaracReveActuel(); return this.getCaracReveActuel();
case 'chance-actuelle': case 'chance-actuelle': case 'chance-actuelle': case 'chance-actuelle':

View File

@ -1,4 +1,6 @@
import { Grammar } from "../grammar.js";
import { ITEM_TYPES } from "../item.js"; import { ITEM_TYPES } from "../item.js";
import { LIST_CARAC_AUTRES } from "../rdd-carac.js";
import { RdDBaseActorSang } from "./base-actor-sang.js"; import { RdDBaseActorSang } from "./base-actor-sang.js";
export class RdDCreature extends RdDBaseActorSang { export class RdDCreature extends RdDBaseActorSang {
@ -32,4 +34,14 @@ export class RdDCreature extends RdDBaseActorSang {
} }
} }
mapCarac(caracCode) {
switch (caracCode) {
case 'vue': case 'ouie':
case 'odoratgout':
case 'empathie':
return 'perception'
}
return caracCode
}
} }

View File

@ -117,4 +117,13 @@ export class RdDEntite extends RdDBaseActorReve {
super.setEntiteReveAccordee(actor) super.setEntiteReveAccordee(actor)
} }
} }
mapCarac(caracCode) {
switch (caracCode) {
case 'taille':
return caracCode
}
return 'reve'
}
} }

View File

@ -28,14 +28,12 @@ class TextRollCaracCompetence {
if (caracCode) { if (caracCode) {
const competence = event.currentTarget.attributes['data-competence']?.value const competence = event.currentTarget.attributes['data-competence']?.value
const diff = event.currentTarget.attributes['data-diff']?.value const diff = event.currentTarget.attributes['data-diff']?.value
const path = RdDCarac.caracDetails(caracCode)?.path
const actors = TextRollCaracCompetence.getSelectedActors(actor) const actors = TextRollCaracCompetence.getSelectedActors(actor)
actors.filter(it => foundry.utils.getProperty(it, path) != undefined) actors.forEach(it => TextRollCaracCompetence.doRoll(it, caracCode, competence, diff))
.forEach(it => TextRollCaracCompetence.doRoll(it, caracCode, competence, diff))
} }
} }
static async doRoll(actor, caracCode, competence, diff) { static async doRoll(actor, caracCode, competence, diff) {
caracCode = actor.mapCarac(caracCode)
if (competence) { if (competence) {
if (actor.type == ACTOR_TYPES.personnage) { if (actor.type == ACTOR_TYPES.personnage) {
actor.rollCaracCompetence(caracCode, competence, diff) actor.rollCaracCompetence(caracCode, competence, diff)