[Feature] Countdown Actions (#1302)

* Added countdown actions

* Added a CountdownAutomation setting to enable/disable countdown automation

* Added Looping

* Added characterSpotlight automation

* Countdown max as formula to enable random countdowns

* Updated compendiums with countdowns

* .

* Fixed lightmode colouration

* Raised system version

* Added automation for ActionRolls on countdowns

* Added automation on fear to countdowns

* Corrected attackAction countdown automation

* Added initial countdown upon creating a CountdownAction

* Improved ActionCountdown initial name to be 'Start Countdown'
This commit is contained in:
WBHarry 2025-11-20 11:46:00 +01:00 committed by GitHub
parent 0233979a9f
commit 207220ff7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 1742 additions and 635 deletions

View file

@ -1,6 +1,7 @@
import AttackAction from './attackAction.mjs';
import BaseAction from './baseAction.mjs';
import BeastformAction from './beastformAction.mjs';
import CountdownAction from './countdownAction.mjs';
import DamageAction from './damageAction.mjs';
import EffectAction from './effectAction.mjs';
import HealingAction from './healingAction.mjs';
@ -10,6 +11,7 @@ import SummonAction from './summonAction.mjs';
export const actionsTypes = {
base: BaseAction,
attack: AttackAction,
countdown: CountdownAction,
damage: DamageAction,
healing: HealingAction,
summon: SummonAction,

View file

@ -37,8 +37,10 @@ export default class DHAttackAction extends DHDamageAction {
async use(event, options) {
const result = await super.use(event, options);
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
await updateCountdowns(CONFIG.DH.GENERAL.countdownTypes.characterAttack.id);
if (result.message.system.action.roll?.type === 'attack') {
const { updateCountdowns } = game.system.api.applications.ui.DhCountdowns;
await updateCountdowns(CONFIG.DH.GENERAL.countdownProgressionTypes.characterAttack.id);
}
return result;
}

View file

@ -43,6 +43,13 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
return schemaFields;
}
/**
* The default values to supply to schema fields when they are created in the actionConfig. Defined by implementing classes.
*/
get defaultValues() {
return {};
}
/**
* Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property.
*

View file

@ -0,0 +1,30 @@
import DHBaseAction from './baseAction.mjs';
export default class DhCountdownAction extends DHBaseAction {
static extraSchemas = [...super.extraSchemas, 'countdown'];
get defaultValues() {
return {
...super.defaultValues,
countdown: {
name: this.parent.parent.name,
img: this.img
}
};
}
/** @inheritdoc */
static getSourceConfig(parent) {
const updateSource = game.system.api.data.actions.actionsTypes.base.getSourceConfig(parent);
updateSource.name = game.i18n.localize('DAGGERHEART.ACTIONS.Config.countdown.startCountdown');
updateSource['countdown'] = [
{
...game.system.api.data.countdowns.DhCountdown.defaultCountdown(),
name: parent.parent.name,
img: parent.parent.img
}
];
return updateSource;
}
}