Added props in actor object : isCharacter, isAdversary, isMinion, isArmy, canDoInitiativeRoll

Minion ignore now the DP in init roll
This commit is contained in:
Vlyan
2022-07-31 18:41:50 +02:00
parent 798b0fdf03
commit 40147ae8d3
9 changed files with 83 additions and 28 deletions

View File

@@ -403,7 +403,7 @@ export class DicePickerDialog extends FormApplication {
canUseVoidPoint:
this.object.difficulty.addVoidPoint ||
!this._actor ||
(this._actor.isCharacter && this._actor.system.void_points.value > 0),
(this._actor.isCharacterType && this._actor.system.void_points.value > 0),
disableSubmit: this.object.skill.value < 1 && this.object.ring.value < 1,
difficultyHiddenIsLock: this._difficultyHiddenIsLock.gm || this._difficultyHiddenIsLock.option,
};
@@ -536,8 +536,8 @@ export class DicePickerDialog extends FormApplication {
ui.notifications.warn(game.i18n.localize("COMBAT.NoneActive"));
return this.close();
}
const combatant = game.combat.combatants.find((c) => c.actor.id === this._actor.id && c.initiative > 0);
if (combatant) {
if (!this._actor.canDoInitiativeRoll) {
ui.notifications.error(game.i18n.localize("l5r5e.conflict.initiative.already_set"));
return this.close();
}
@@ -721,7 +721,7 @@ export class DicePickerDialog extends FormApplication {
const targetGrp = Array.from(game.user.targets).reduce(
(acc, tgt) => {
const targetActor = tgt.document.actor;
if (!targetActor.isCharacter) {
if (!targetActor.isCharacterType) {
return acc;
}

View File

@@ -250,7 +250,7 @@ export class RollnKeepDialog extends FormApplication {
...(await super.getData(options)),
isGM: game.user.isGM,
showChoices: options.editable && !rollData.rnkEnded,
showStrifeBt: options.editable && rollData.summary.strife > 0 && rollData.actor?.isCharacter,
showStrifeBt: options.editable && rollData.summary.strife > 0 && rollData.actor?.isCharacterType,
cssClass: this.options.classes.join(" "),
data: this.object,
l5r5e: rollData,
@@ -713,7 +713,7 @@ export class RollnKeepDialog extends FormApplication {
// Apply strife to actor
const strifeApplied = Math.min(this.roll.l5r5e.summary.strife, Math.max(0, formData.strifeApplied));
const actorMod = strifeApplied - this.roll.l5r5e.strifeApplied;
if (actorMod !== 0 && this.roll.l5r5e.actor?.isCharacter) {
if (actorMod !== 0 && this.roll.l5r5e.actor?.isCharacterType) {
await this.roll.l5r5e.actor.update({
system: {
strife: {