Ajout de méthode getConjurations
Pour lister les compétences de possession/conjuration de manière homogène (tout actor doué de rêve)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { renderTemplate, SHOW_DICE, SYSTEM_RDD } from "../constants.js";
|
||||
import { RDD_CONFIG, renderTemplate, SHOW_DICE, SYSTEM_RDD } from "../constants.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDResolutionTable } from "../rdd-resolution-table.js";
|
||||
@@ -22,13 +22,15 @@ import { DialogValidationEncaissement } from "../dialog-validation-encaissement.
|
||||
import { RdDCombat } from "../rdd-combat.js";
|
||||
import { RdDEmpoignade } from "../rdd-empoignade.js";
|
||||
import { RdDPossession } from "../rdd-possession.js";
|
||||
import { BASE_CORPS_A_CORPS, BASE_ESQUIVE, POSSESSION_SANS_DRACONIC } from "../item/base-items.js";
|
||||
import { BASE_CORPS_A_CORPS, BASE_ESQUIVE, CATEGORIES_COMPETENCES_CREATURES } from "../item/base-items.js";
|
||||
import { RollDataAjustements } from "../rolldata-ajustements-v1.js";
|
||||
import { MappingCreatureArme } from "../item/mapping-creature-arme.mjs";
|
||||
import RollDialog from "../roll/roll-dialog.mjs";
|
||||
import { ATTAQUE_ROLL_TYPES, DEFAULT_ROLL_TYPES, DIFF, DIFFS, ROLL_TYPE_ATTAQUE, ROLL_TYPE_COMP, ROLL_TYPE_JEU, ROLL_TYPE_MEDITATION, ROLL_TYPE_OEUVRE, ROLL_TYPE_TACHE } from "../roll/roll-constants.mjs";
|
||||
import { OptionsAvancees, ROLL_DIALOG_V2 } from "../settings/options-avancees.js";
|
||||
import { PART_COMP } from "../roll/roll-part-comp.mjs";
|
||||
import { RdDInitiative } from "../initiative.mjs";
|
||||
import { RdDItemCompetenceCreature } from "../item-competencecreature.js";
|
||||
|
||||
/**
|
||||
* Classe de base pour les acteurs disposant de rêve (donc, pas des objets)
|
||||
@@ -114,6 +116,49 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
return this.system.carac[competence.system.defaut_carac].value;
|
||||
}
|
||||
|
||||
getDraconics() { return [] }
|
||||
getDraconicOuPossession() {
|
||||
return [
|
||||
...this.getDraconics(),
|
||||
...this.itemTypes[ITEM_TYPES.competencecreature].filter(it => it.system.ispossession || it.system.categorie == CATEGORIES_COMPETENCES_CREATURES.possession.key),
|
||||
this.getConjurationNaturelle()
|
||||
].sort(Misc.descending(it => it.system.niveau));
|
||||
}
|
||||
|
||||
getConjurations() {
|
||||
return this.getDraconicOuPossession()
|
||||
.map(it => this.toActionConjuration(it))
|
||||
}
|
||||
|
||||
getConjurationNaturelle() {
|
||||
return new RdDItemCompetenceCreature({
|
||||
name: 'Sans compétence',
|
||||
type: ITEM_TYPES.competencecreature,
|
||||
img: RDD_CONFIG.icons.possession,
|
||||
system: {
|
||||
carac_value: this.getReveActuel(),
|
||||
niveau: 0,
|
||||
default_diffLibre: 0,
|
||||
categorie: CATEGORIES_COMPETENCES_CREATURES.possession.key,
|
||||
ispossession: true,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
toActionConjuration(comp) {
|
||||
const caracCode = this.isPersonnage() ? CARACS.REVE_ACTUEL : CARACS.REVE
|
||||
const caracValue = this.getReveActuel()
|
||||
const ajustement = this.getEtatGeneral()
|
||||
return {
|
||||
label: `Conjuration (${comp.name})`,
|
||||
action: 'possession',
|
||||
initOnly: false,
|
||||
comp: comp,
|
||||
carac: { key: caracCode, value: caracValue },
|
||||
initiative: RdDInitiative.getRollInitiative(caracValue, comp.system.niveau, ajustement)
|
||||
}
|
||||
}
|
||||
|
||||
listActions({ isAttaque = false, isEquipe = false }) {
|
||||
return this.itemTypes[ITEM_TYPES.competencecreature]
|
||||
.filter(it => it.isAttaque())
|
||||
@@ -198,8 +243,6 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
return false
|
||||
}
|
||||
|
||||
getDraconicOuPossession() { return POSSESSION_SANS_DRACONIC }
|
||||
|
||||
getPossession(possessionId) {
|
||||
return this.itemTypes[ITEM_TYPES.possession].find(it => it.system.possessionid == possessionId);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { RdDDice } from "../rdd-dice.js";
|
||||
import { RdDItemBlessure } from "../item/blessure.js";
|
||||
import { ChatUtility } from "../chat-utility.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { CARACS } from "../rdd-carac.js";
|
||||
|
||||
/**
|
||||
* Classe de base pour les acteurs qui peuvent subir des blessures
|
||||
|
||||
@@ -41,13 +41,6 @@ export class RdDEntite extends RdDBaseActorReve {
|
||||
getChance() { return this.getReve() }
|
||||
getEnduranceMax() { return Math.max(1, this.getTaille() + this.getReve()) }
|
||||
|
||||
getDraconicOuPossession() {
|
||||
return this.itemTypes[ITEM_TYPES.competencecreature]
|
||||
.filter(it => it.system.categorie == 'possession')
|
||||
.sort(Misc.descending(it => it.system.niveau))
|
||||
.find(it => true);
|
||||
}
|
||||
|
||||
async remiseANeuf() {
|
||||
if (!this.isEntiteNonIncarnee()) {
|
||||
await this.update({
|
||||
|
||||
Reference in New Issue
Block a user