Utiliser perception/reve pour les créatures

Ces caractéristiques remplacent toutes les autres
This commit is contained in:
Vincent Vandemeulebrouck 2025-01-11 19:45:58 +01:00
parent 1b75decb18
commit 57c41a0218
5 changed files with 28 additions and 8 deletions

View File

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

View File

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

View File

@ -1,4 +1,6 @@
import { Grammar } from "../grammar.js";
import { ITEM_TYPES } from "../item.js";
import { LIST_CARAC_AUTRES } from "../rdd-carac.js";
import { RdDBaseActorSang } from "./base-actor-sang.js";
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)
}
}
mapCarac(caracCode) {
switch (caracCode) {
case 'taille':
return caracCode
}
return 'reve'
}
}

View File

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