|
|
|
@@ -8,7 +8,7 @@ import { RdDUtility } from "../rdd-utility.js";
|
|
|
|
|
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
|
|
|
|
import { RdDBaseActor } from "./base-actor.js";
|
|
|
|
|
import { ITEM_TYPES } from "../constants.js";
|
|
|
|
|
import { StatusEffects } from "../settings/status-effects.js";
|
|
|
|
|
import { StatusEffects, STATUSES } from "../settings/status-effects.js";
|
|
|
|
|
import { Targets } from "../targets.js";
|
|
|
|
|
import { RdDConfirm } from "../rdd-confirm.js";
|
|
|
|
|
import { RdDCarac } from "../rdd-carac.js";
|
|
|
|
@@ -172,8 +172,11 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|
|
|
|
idOrName, options)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCompetences(name, options = { onMessage: message => { } }) {
|
|
|
|
|
return RdDItemCompetence.findCompetences(this.items, name, options)
|
|
|
|
|
getCompetences(name = undefined, options = { onMessage: message => { } }) {
|
|
|
|
|
if (name == undefined) {
|
|
|
|
|
return this.itemTypes[ITEM_TYPES.competence]
|
|
|
|
|
}
|
|
|
|
|
return RdDItemCompetence.findCompetences(this.itemTypes[ITEM_TYPES.competence], name, options)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCompetenceCorpsACorps(options = { onMessage: message => { } }) {
|
|
|
|
@@ -223,27 +226,24 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|
|
|
|
return this.getEmbeddedCollection("ActiveEffect").filter(filter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getEffect(effectId) {
|
|
|
|
|
return this.getEmbeddedCollection("ActiveEffect").find(it => it.statuses?.has(effectId));
|
|
|
|
|
getEffectByStatus(statusId) {
|
|
|
|
|
return this.getEffects().find(it => it.statuses.has(statusId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async setEffect(effectId, status) {
|
|
|
|
|
if (this.isEffectAllowed(effectId)) {
|
|
|
|
|
const effect = this.getEffect(effectId);
|
|
|
|
|
async setEffect(statusId, status) {
|
|
|
|
|
if (this.isEffectAllowed(statusId)) {
|
|
|
|
|
const effect = this.getEffectByStatus(statusId);
|
|
|
|
|
if (!status && effect) {
|
|
|
|
|
await this.deleteEmbeddedDocuments('ActiveEffect', [effect.id]);
|
|
|
|
|
}
|
|
|
|
|
if (status && !effect) {
|
|
|
|
|
await this.createEmbeddedDocuments("ActiveEffect", [StatusEffects.prepareActiveEffect(effectId)]);
|
|
|
|
|
await this.createEmbeddedDocuments("ActiveEffect", [StatusEffects.prepareActiveEffect(statusId)]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async removeEffect(id) {
|
|
|
|
|
const effect = this.getEmbeddedCollection("ActiveEffect").find(it => it.id == id);
|
|
|
|
|
if (effect) {
|
|
|
|
|
await this.deleteEmbeddedDocuments('ActiveEffect', [id]);
|
|
|
|
|
}
|
|
|
|
|
this.removeEffects(it => it.id == id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async removeEffects(filter = e => true) {
|
|
|
|
@@ -254,17 +254,16 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
isDemiReve() {
|
|
|
|
|
return this.getEffectByStatus(STATUSES.StatusDemiReve) != undefined
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getSurprise(isCombat = undefined) {
|
|
|
|
|
let niveauSurprise = this.getEffects()
|
|
|
|
|
.map(effect => StatusEffects.valeurSurprise(effect, isCombat))
|
|
|
|
|
.reduce(Misc.sum(), 0);
|
|
|
|
|
if (niveauSurprise > 1) {
|
|
|
|
|
return 'totale';
|
|
|
|
|
}
|
|
|
|
|
if (niveauSurprise == 1) {
|
|
|
|
|
return 'demi';
|
|
|
|
|
}
|
|
|
|
|
return '';
|
|
|
|
|
return StatusEffects.typeSurprise(
|
|
|
|
|
this.getEffects()
|
|
|
|
|
.map(it => StatusEffects.niveauSurprise(it, isCombat))
|
|
|
|
|
.reduce(Misc.sum(), 0)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
@@ -282,8 +281,20 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
|
|
|
|
return dialog
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
createCallbackExperience() { return { action: r => { } } }
|
|
|
|
|
createCallbackAppelAuMoral() { return { action: r => { } } }
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
createCallbackExperience() {
|
|
|
|
|
return { action: r => this.appliquerAjoutExperience(r) }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
|
createCallbackAppelAuMoral() {
|
|
|
|
|
/* Si l'appel au moral est utilisé, on l'affiche dans le chat et on diminue éventuellement le moral */
|
|
|
|
|
return { action: r => this.appliquerAppelMoral(r) }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { }
|
|
|
|
|
async appliquerAppelMoral(rollData) { }
|
|
|
|
|
|
|
|
|
|
async _onCloseRollDialog(html) { }
|
|
|
|
|
|
|
|
|
|