Merge branch 'dev' into 'dev'
Automatically add compromised condition when strife goes beyond max and remove... See merge request teaml5r/l5r5e!45
This commit is contained in:
@@ -125,6 +125,17 @@ export class ActorL5r5e extends Actor {
|
||||
});
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
async _preUpdate(changes, options, user) {
|
||||
if (this.isCharacterType) {
|
||||
// apply compromised condition if strife goes beyond max
|
||||
const strife = changes.system?.strife?.value ?? this.system.strife.value;
|
||||
const maxStrife = changes.system?.strife?.max ?? this.system.strife.max;
|
||||
const isCompromised = strife > maxStrife;
|
||||
await this.toggleStatusEffect('compromised', {active: isCompromised});
|
||||
}
|
||||
}
|
||||
|
||||
/** @override */
|
||||
prepareData() {
|
||||
super.prepareData();
|
||||
@@ -137,13 +148,16 @@ export class ActorL5r5e extends Actor {
|
||||
ActorL5r5e.computeDerivedAttributes(system);
|
||||
}
|
||||
|
||||
const isAfflicted = this.statuses.has("afflicted");
|
||||
const isCompromised = this.statuses.has("compromised");
|
||||
|
||||
// Attributes bars
|
||||
system.fatigue.max = system.endurance;
|
||||
system.strife.max = system.composure;
|
||||
system.void_points.max = system.rings.void;
|
||||
|
||||
// if compromise, vigilance = 1
|
||||
system.is_compromised = system.strife.value > system.strife.max;
|
||||
// if compromised or afflicted, vigilance = 1
|
||||
system.is_afflicted_or_compromised = isAfflicted || isCompromised;
|
||||
|
||||
// Make sure void points are never greater than max
|
||||
if (system.void_points.value > system.void_points.max) {
|
||||
|
||||
@@ -62,7 +62,7 @@ export class CombatL5r5e extends Combat {
|
||||
// If the character was unprepared (such as when surprised), their base initiative value is their vigilance attribute.
|
||||
// Minion NPCs can generate initiative value without a check, using their focus or vigilance attribute
|
||||
let initiative =
|
||||
isPrepared === "true" ? actorSystem.focus : actorSystem.is_compromised ? 1 : actorSystem.vigilance;
|
||||
isPrepared === "true" ? actorSystem.focus : actorSystem.is_afflicted_or_compromised ? 1 : actorSystem.vigilance;
|
||||
|
||||
// Roll only for PC and Adversary
|
||||
if (isPc || combatant.actor.isAdversary) {
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
</label>
|
||||
<p class="item-description"> {{localize 'l5r5e.attributes.focustip'}}</p>
|
||||
</li>
|
||||
<li class="vigilance-content {{#if data.system.is_compromised}}compromised{{/if}}">
|
||||
<li class="vigilance-content {{#if data.system.is_afflicted_or_compromised}}compromised{{/if}}">
|
||||
<label class="attribute-label">
|
||||
<strong>{{localize 'l5r5e.attributes.vigilance'}}</strong>
|
||||
{{#if data.system.is_compromised}}
|
||||
{{#if data.system.is_afflicted_or_compromised}}
|
||||
<input class="centered-input" type="number" value="1" disabled/>
|
||||
{{else}}
|
||||
<input class="centered-input" type="number" name="system.vigilance" value="{{data.system.vigilance}}" data-dtype="Number" disabled/>
|
||||
|
||||
@@ -36,10 +36,10 @@
|
||||
</label>
|
||||
<p class="item-description"> {{localize 'l5r5e.attributes.focustip'}}</p>
|
||||
</li>
|
||||
<li class="vigilance-content {{#if data.system.is_compromised}}compromised{{/if}}">
|
||||
<li class="vigilance-content {{#if data.system.is_afflicted_or_compromised}}compromised{{/if}}">
|
||||
<label class="attribute-label">
|
||||
<strong>{{localize 'l5r5e.attributes.vigilance'}}</strong>
|
||||
{{#if data.system.is_compromised}}
|
||||
{{#if data.system.is_afflicted_or_compromised}}
|
||||
<input class="centered-input" type="number" value="1" disabled/>
|
||||
{{else}}
|
||||
<input class="centered-input" type="number" name="system.vigilance" value="{{data.system.vigilance}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</td>
|
||||
<td>
|
||||
{{actor.system.focus}}
|
||||
/ {{#if actor.system.is_compromised}}<span class="badvalue">1</span>{{else}}{{actor.system.vigilance}}{{/if}}
|
||||
/ {{#if actor.system.is_afflicted_or_compromised}}<span class="badvalue">1</span>{{else}}{{actor.system.vigilance}}{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
<a title="{{localize 'l5r5e.gm.monitor.mouse_control'}}" data-actor-uuid="{{actor.uuid}}" data-type="void_points" class="actor-modify-control">
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
</td>
|
||||
<td>
|
||||
{{actor.system.focus}}
|
||||
/ {{#if actor.system.is_compromised}}<span class="badvalue">1</span>{{else}}{{actor.system.vigilance}}{{/if}}
|
||||
/ {{#if actor.system.is_afflicted_or_compromised}}<span class="badvalue">1</span>{{else}}{{actor.system.vigilance}}{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
<a title="{{localize 'l5r5e.gm.monitor.mouse_control'}}" data-actor-uuid="{{actor.uuid}}" data-action="modify_voidPoint" class="actor-modify-control">
|
||||
|
||||
Reference in New Issue
Block a user