Jets de masse
Quelques exemples: - `/rdd dexterite bricolage -2` - `/rdd vue survie en sous-sol -2` - `/rdd vue désert 0` - `/rdd vue vigi -3` - `/rdd vol vigi 0` : Volonté Vigilance - `/rdd chance-actuelle 0` - `/rdd reve-actuel -8` Attention: - `/rdd vue vig 0` => Navigation et Vigilance correspondent, c'est Navigation qui est pris (premier dans l'ordre alphabétique), avec un message.
This commit is contained in:
@ -171,8 +171,8 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getReveActuel() {
|
||||
const actorData = Misc.data(this);
|
||||
return Misc.toInt(actorData.data.reve?.reve?.value ?? actorData.data.carac.reve.value);
|
||||
const templateData = Misc.templateData(this);
|
||||
return Misc.toInt(templateData.reve?.reve?.value ?? templateData.carac.reve.value);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getChanceActuel() {
|
||||
@ -1613,6 +1613,12 @@ export class RdDActor extends Actor {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
appliquerExperience(rollData) {
|
||||
const callback = this.createCallbackExperience();
|
||||
if (callback.condition(rollData)) { callback.action(rollData); }
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
createCallbackExperience() {
|
||||
return {
|
||||
@ -1948,6 +1954,32 @@ export class RdDActor extends Actor {
|
||||
RdDResolutionTable.displayRollData(rollData, this, 'chat-resultat-general.html');
|
||||
}
|
||||
|
||||
async rollCaracCompetence(caracName, compName, diff) {
|
||||
const carac = this.getCaracByName(caracName);
|
||||
if (!carac) {
|
||||
ui.notifications.warn(`${this.name} n'a pas de caractéristique correspondant à ${caracName}`)
|
||||
return;
|
||||
}
|
||||
const competence = this.getCompetence(compName);
|
||||
if (compName && !competence) {
|
||||
ui.notifications.warn(`${this.name} n'a pas de compétence correspondant à ${compName}`)
|
||||
return;
|
||||
}
|
||||
let rollData = {
|
||||
alias: this.name,
|
||||
caracValue: Number(carac.value),
|
||||
selectedCarac: carac,
|
||||
competence: competence,
|
||||
finalLevel: (competence?.data.niveau??0) + diff,
|
||||
diffLibre: diff,
|
||||
showDice: true,
|
||||
show: { title: "Jets multiples" }
|
||||
};
|
||||
await RdDResolutionTable.rollData(rollData);
|
||||
this.appliquerExperience(rollData);
|
||||
RdDResolutionTable.displayRollData( rollData, this )
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCompetence(name) {
|
||||
let rollData = { competence: this.getCompetence(name) }
|
||||
@ -2380,19 +2412,29 @@ export class RdDActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _findCaracByName(carac, name) {
|
||||
name = name.toLowerCase();
|
||||
name = Grammar.toLowerCaseNoAccent(name);
|
||||
switch (name) {
|
||||
case 'reve-actuel': case 'rêve actuel':
|
||||
return carac.reve;
|
||||
case 'chance-actuelle': case 'chance actuelle':
|
||||
return carac.chance;
|
||||
}
|
||||
for (const [key, value] of Object.entries(carac)) {
|
||||
if (name == key || name == value.label.toLowerCase()) {
|
||||
return carac[key];
|
||||
}
|
||||
const keys = Object.entries(carac)
|
||||
.filter(it => it[0].includes(name) || Grammar.toLowerCaseNoAccent(it[1].label).includes(name))
|
||||
.map(it => it[0]);
|
||||
if (keys.length>1){
|
||||
const names = keys.reduce((a, b) => `${a}<br>${b}`);
|
||||
ui.notifications.info(`Plusieurs caractéristiques possibles:<br>${names}<br>La première sera choisie.`);
|
||||
}
|
||||
return carac[name]; // Per default
|
||||
if (keys.length>0){
|
||||
return carac[keys[0]];
|
||||
}
|
||||
// for (const [key, value] of Object.entries(carac)) {
|
||||
// if (key.includes(name) || Grammar.toLowerCaseNoAccent(value.label).includes('name')) {
|
||||
// return carac[key];
|
||||
// }
|
||||
// }
|
||||
return undefined; // Per default
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -3070,22 +3112,20 @@ export class RdDActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
_deleteStatusEffectsByIds(effectIds, options) {
|
||||
this.deleteEmbeddedEntity('ActiveEffect', effectIds, options);
|
||||
this.applyActiveEffects();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addStatusEffectById(id, options = { renderSheet: true }) {
|
||||
async addStatusEffectById(id, options = { renderSheet: false }) {
|
||||
const statusEffect = CONFIG.statusEffects.find(it => it.id == id);
|
||||
await this.addStatusEffect(statusEffect, options);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addStatusEffect(statusEffect, options = { renderSheet: true }) {
|
||||
async addStatusEffect(statusEffect, options = { renderSheet: false }) {
|
||||
this.deleteStatusEffectById(statusEffect.id, options);
|
||||
const effet = duplicate(statusEffect);
|
||||
effet["flags.core.statusId"] = effet.id;
|
||||
await this.createEmbeddedEntity('ActiveEffect', effet, options);
|
||||
this.applyActiveEffects();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user