Corrections compétences créatures
This commit is contained in:
parent
7ed9a4a12b
commit
70e3e63001
@ -269,7 +269,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async openRollDialog({ name, label, template, rollData, callbacks}) {
|
async openRollDialog({ name, label, template, rollData, callbacks }) {
|
||||||
const dialog = await RdDRoll.create(this, rollData,
|
const dialog = await RdDRoll.create(this, rollData,
|
||||||
{ html: template, close: async html => await this._onCloseRollDialog(html) },
|
{ html: template, close: async html => await this._onCloseRollDialog(html) },
|
||||||
{ name: name, label: label, callbacks: [this.createCallbackExperience(), this.createCallbackAppelAuMoral()].concat(callbacks) })
|
{ name: name, label: label, callbacks: [this.createCallbackExperience(), this.createCallbackAppelAuMoral()].concat(callbacks) })
|
||||||
@ -303,7 +303,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|||||||
competence: competence,
|
competence: competence,
|
||||||
show: { title: options?.title ?? '' }
|
show: { title: options?.title ?? '' }
|
||||||
},
|
},
|
||||||
callbacks:[async r => this.$onRollCompetence(r, options)]
|
callbacks: [async r => this.$onRollCompetence(r, options)]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -411,7 +411,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Transformer la competence de créature
|
// Transformer la competence de créature
|
||||||
RdDItemCompetenceCreature.setRollDataCreature(this, rollData, competence)
|
RdDItemCompetenceCreature.setRollDataCreature(rollData)
|
||||||
}
|
}
|
||||||
const dialogLabel = 'Jet ' + Grammar.apostrophe('de', competence.name);
|
const dialogLabel = 'Jet ' + Grammar.apostrophe('de', competence.name);
|
||||||
await this.openRollDialog({
|
await this.openRollDialog({
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
import { ITEM_TYPES } from "./constants.js";
|
import { ITEM_TYPES } from "./constants.js";
|
||||||
|
import { Grammar } from "./grammar.js";
|
||||||
import { RdDCombatManager } from "./rdd-combat.js";
|
import { RdDCombatManager } from "./rdd-combat.js";
|
||||||
|
|
||||||
export const CATEGORIES_COMPETENCES_CREATURES = {
|
export const CATEGORIES_COMPETENCES_CREATURES = {
|
||||||
@ -17,9 +18,11 @@ export class RdDItemCompetenceCreature extends Item {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static setRollDataCreature(rollData) {
|
static setRollDataCreature(rollData) {
|
||||||
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.system.carac_value } }
|
const code = Grammar.toLowerCaseNoAccentNoSpace(rollData.competence.name);
|
||||||
rollData.competence.system.defaut_carac = "carac_creature"
|
const selectedCarac = { code: code, label: rollData.competence.name, value: rollData.competence.system.carac_value };
|
||||||
rollData.selectedCarac = rollData.carac.carac_creature
|
rollData.carac = { [code]: selectedCarac }
|
||||||
|
rollData.competence.system.defaut_carac = code
|
||||||
|
rollData.selectedCarac = selectedCarac
|
||||||
rollData.arme = RdDItemCompetenceCreature.armeCreature(rollData.competence);
|
rollData.arme = RdDItemCompetenceCreature.armeCreature(rollData.competence);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,20 +32,20 @@ export class RdDItemCompetenceCreature extends Item {
|
|||||||
if (categorieAttaque != undefined) {
|
if (categorieAttaque != undefined) {
|
||||||
// cloner pour ne pas modifier la compétence
|
// cloner pour ne pas modifier la compétence
|
||||||
return foundry.utils.mergeObject(item, {
|
return foundry.utils.mergeObject(item, {
|
||||||
action: item.isCompetencePossession() ? 'possession' : 'attaque',
|
action: item.isCompetencePossession() ? 'possession' : 'attaque',
|
||||||
system: {
|
system: {
|
||||||
competence: item.name,
|
competence: item.name,
|
||||||
cac: categorieAttaque == "naturelle" ? "naturelle" : "",
|
cac: categorieAttaque == "naturelle" ? "naturelle" : "",
|
||||||
niveau: item.system.niveau,
|
niveau: item.system.niveau,
|
||||||
initiative: RdDCombatManager.calculInitiative(item.system.niveau, item.system.carac_value),
|
initiative: RdDCombatManager.calculInitiative(item.system.niveau, item.system.carac_value),
|
||||||
equipe: true,
|
equipe: true,
|
||||||
resistance: 100,
|
resistance: 100,
|
||||||
dommagesReels: item.system.dommages,
|
dommagesReels: item.system.dommages,
|
||||||
penetration: 0,
|
penetration: 0,
|
||||||
force: 0,
|
force: 0,
|
||||||
rapide: true,
|
rapide: true,
|
||||||
}
|
}
|
||||||
}, { inplace: false, });
|
}, { inplace: false, });
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ export const LIST_CARAC_PERSONNAGE = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const LIST_CARAC_AUTRES = {
|
export const LIST_CARAC_AUTRES = {
|
||||||
'perception': { code: 'perception', label: 'Perception', path: 'system.carac.perception.value' },
|
'perception': { code: 'perception', label: 'Perception', path: 'system.carac.perception.value' },
|
||||||
}
|
}
|
||||||
|
|
||||||
const LIST_CARAC_DERIVEE = {
|
const LIST_CARAC_DERIVEE = {
|
||||||
@ -75,12 +75,12 @@ const LIST_CARAC_ROLL = Object.values(LIST_CARAC_PERSONNAGE).filter(it => it.isC
|
|||||||
|
|
||||||
export class RdDCarac {
|
export class RdDCarac {
|
||||||
|
|
||||||
static caracDetails(name) {
|
static caracDetails(name, options = { onMessage: undefined }) {
|
||||||
let entry = Misc.findFirstLike(name, LIST_CARAC_ROLL, { mapper: it => it.code, description: 'caractéristique', onMessage: m => { } })
|
let entry = Misc.findFirstLike(name, LIST_CARAC_ROLL, { mapper: it => it.code, description: 'caractéristique', onMessage: m => { } })
|
||||||
if (entry) {
|
if (entry) {
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
return Misc.findFirstLike(name, LIST_CARAC_ROLL, { mapper: it => it.label, description: 'caractéristique' })
|
return Misc.findFirstLike(name, LIST_CARAC_ROLL, { mapper: it => it.label, description: 'caractéristique', onMessage: options.onMessage })
|
||||||
}
|
}
|
||||||
|
|
||||||
static carac(code) {
|
static carac(code) {
|
||||||
|
@ -3,6 +3,7 @@ import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
|||||||
import { Targets } from "./targets.js";
|
import { Targets } from "./targets.js";
|
||||||
import { ITEM_TYPES } from "./constants.js";
|
import { ITEM_TYPES } from "./constants.js";
|
||||||
import { RdDRollResult } from "./rdd-roll-result.js";
|
import { RdDRollResult } from "./rdd-roll-result.js";
|
||||||
|
import { Grammar } from "./grammar.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* On part du principe qu'une entité démarre tjs
|
/* On part du principe qu'une entité démarre tjs
|
||||||
@ -90,14 +91,17 @@ export class RdDPossession {
|
|||||||
}
|
}
|
||||||
RdDPossession.selectCompetenceDraconicOuPossession(rollData, defender)
|
RdDPossession.selectCompetenceDraconicOuPossession(rollData, defender)
|
||||||
rollData.diffLibre = RdDPossession.getInfoAttaque(rollData).diffLibre
|
rollData.diffLibre = RdDPossession.getInfoAttaque(rollData).diffLibre
|
||||||
|
|
||||||
await RdDPossession.$rollDefensePossession(defender, rollData);
|
await RdDPossession.$rollDefensePossession(defender, rollData);
|
||||||
}
|
}
|
||||||
|
|
||||||
static selectCompetenceDraconicOuPossession(rollData, rollingActor) {
|
static selectCompetenceDraconicOuPossession(rollData, rollingActor) {
|
||||||
rollData.competence = rollingActor.getDraconicOuPossession();
|
rollData.competence = rollingActor.getDraconicOuPossession();
|
||||||
if (rollingActor.isCreatureEntite()) {
|
if (rollingActor.isCreatureEntite()) {
|
||||||
RdDItemCompetenceCreature.setRollDataCreature(rollData)
|
const carac = rollingActor.system.carac
|
||||||
|
rollData.carac = carac
|
||||||
|
rollData.competence.system.defaut_carac = 'reve'
|
||||||
|
rollData.selectedCarac = carac.reve
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rollData.selectedCarac = rollingActor.system.carac.reve
|
rollData.selectedCarac = rollingActor.system.carac.reve
|
||||||
|
@ -138,9 +138,9 @@ export class RdDRoll extends Dialog {
|
|||||||
}
|
}
|
||||||
if (this.rollData.selectedCarac) {
|
if (this.rollData.selectedCarac) {
|
||||||
this.html.find("[name='carac']").val(
|
this.html.find("[name='carac']").val(
|
||||||
this.actor?.type == ACTOR_TYPES.personnage
|
RdDCarac.caracDetails(this.rollData.selectedCarac.label, { onMessage: m => { } })?.code
|
||||||
? RdDCarac.caracDetails(this.rollData.selectedCarac.label).code
|
?? this.rollData.selectedCarac.code
|
||||||
: this.rollData.selectedCarac.label
|
?? Grammar.toLowerCaseNoAccentNoSpace(this.rollData.selectedCarac.label)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (this.rollData.selectedSort) {
|
if (this.rollData.selectedSort) {
|
||||||
@ -259,7 +259,7 @@ export class RdDRoll extends Dialog {
|
|||||||
this.updateRollResult(html);
|
this.updateRollResult(html);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
close() {
|
close() {
|
||||||
if (this.rollData.canClose) {
|
if (this.rollData.canClose) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user