Utiliser perception/reve pour les créatures
Ces caractéristiques remplacent toutes les autres
This commit is contained in:
parent
1b75decb18
commit
57c41a0218
@ -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')) {
|
||||||
|
@ -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':
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,18 +24,16 @@ class TextRollCaracCompetence {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async onRollText(event, actor) {
|
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) {
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user