mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
Fixed logic
This commit is contained in:
parent
f33dc8c4af
commit
ea708e85e2
7 changed files with 20 additions and 11 deletions
|
|
@ -1362,9 +1362,9 @@
|
||||||
"label": "Action Points",
|
"label": "Action Points",
|
||||||
"hint": "Automatically give and take Action Points as combatants take their turns."
|
"hint": "Automatically give and take Action Points as combatants take their turns."
|
||||||
},
|
},
|
||||||
"countdowns": {
|
"hordeDamage": {
|
||||||
"label": "Countdowns",
|
"label": "Automatic Horde Damage",
|
||||||
"hint": "Automatically progress non-custom countdowns"
|
"hint": "Automatically active horde effect to lower damage when reaching half or lower HP."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token {
|
||||||
this.effects.overlay = null;
|
this.effects.overlay = null;
|
||||||
|
|
||||||
// Categorize effects
|
// Categorize effects
|
||||||
const activeEffects = Array.from(this.actor.effects);
|
const activeEffects = this.actor ? Array.from(this.actor.effects).filter(x => !x.disabled) : [];
|
||||||
const overlayEffect = activeEffects.findLast(e => e.img && e.getFlag('core', 'overlay'));
|
const overlayEffect = activeEffects.findLast(e => e.img && e.getFlag('core', 'overlay'));
|
||||||
|
|
||||||
// Draw effects
|
// Draw effects
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,10 @@ export default class DHDamageAction extends DHBaseAction {
|
||||||
|
|
||||||
const isAdversary = this.actor.type === 'adversary';
|
const isAdversary = this.actor.type === 'adversary';
|
||||||
if (isAdversary && this.actor.system.type === CONFIG.DH.ACTOR.adversaryTypes.horde.id) {
|
if (isAdversary && this.actor.system.type === CONFIG.DH.ACTOR.adversaryTypes.horde.id) {
|
||||||
const halfHP = Math.ceil(this.actor.system.resources.hitPoints.max / 2);
|
const hasHordeDamage = this.actor.effects.find(
|
||||||
if (this.actor.system.resources.hitPoints.value >= halfHP) return part.valueAlt;
|
x => x.name === game.i18n.localize('DAGGERHEART.CONFIG.AdversaryType.horde.label')
|
||||||
|
);
|
||||||
|
if (hasHordeDamage) return part.valueAlt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return formulaValue;
|
return formulaValue;
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,9 @@ export default class DhpAdversary extends BaseDataActor {
|
||||||
await this.parent.createEmbeddedDocuments('ActiveEffect', [
|
await this.parent.createEmbeddedDocuments('ActiveEffect', [
|
||||||
{
|
{
|
||||||
name: game.i18n.localize('DAGGERHEART.CONFIG.AdversaryType.horde.label'),
|
name: game.i18n.localize('DAGGERHEART.CONFIG.AdversaryType.horde.label'),
|
||||||
img: 'icons/magic/movement/chevrons-down-yellow.webp'
|
img: 'icons/magic/movement/chevrons-down-yellow.webp',
|
||||||
|
disabled: !game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation)
|
||||||
|
.hordeDamage
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
} else if (raisedAboveHalf) {
|
} else if (raisedAboveHalf) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
export default class DhAutomation extends foundry.abstract.DataModel {
|
export default class DhAutomation extends foundry.abstract.DataModel {
|
||||||
static LOCALIZATION_PREFIXES = ['DAGGERHEART.SETTINGS.Automation']; // Doesn't work for some reason
|
|
||||||
|
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
return {
|
return {
|
||||||
|
|
@ -20,6 +18,11 @@ export default class DhAutomation extends foundry.abstract.DataModel {
|
||||||
required: true,
|
required: true,
|
||||||
initial: false,
|
initial: false,
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.actionPoints.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.actionPoints.label'
|
||||||
|
}),
|
||||||
|
hordeDamage: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: true,
|
||||||
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.hordeDamage.label'
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{formGroup settingFields.schema.fields.actionPoints value=settingFields._source.actionPoints localize=true}}
|
{{formGroup settingFields.schema.fields.actionPoints value=settingFields._source.actionPoints localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.countdowns value=settingFields._source.countdowns localize=true}}
|
{{formGroup settingFields.schema.fields.hordeDamage value=settingFields._source.hordeDamage localize=true}}
|
||||||
|
|
||||||
<footer class="form-footer">
|
<footer class="form-footer">
|
||||||
<button data-action="reset">
|
<button data-action="reset">
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=systemFields.attack.fields.damage.fields.parts.element.fields source=document.system.attack.damage path="system.attack." horde=true}}
|
{{#if (eq document.system.type 'horde')}}
|
||||||
|
{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=systemFields.attack.fields.damage.fields.parts.element.fields source=document.system.attack.damage path="system.attack." horde=true}}
|
||||||
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue