mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-21 17:14:40 +01:00
[Feature] DeathMove Condition Improvement (#1562)
* Added DeathMove condition and automated changing to the correct condition depending on the result of death moves * . * Update module/data/settings/Automation.mjs Co-authored-by: Chris Ryan <73275196+chrisryan10@users.noreply.github.com> * Update lang/en.json Co-authored-by: Chris Ryan <73275196+chrisryan10@users.noreply.github.com> * Fixed DefeatedCondition localizations --------- Co-authored-by: Chris Ryan <73275196+chrisryan10@users.noreply.github.com>
This commit is contained in:
parent
77bac647a8
commit
cc998bffa7
7 changed files with 60 additions and 15 deletions
10
lang/en.json
10
lang/en.json
|
|
@ -973,6 +973,10 @@
|
||||||
"outsideRange": "Outside Range"
|
"outsideRange": "Outside Range"
|
||||||
},
|
},
|
||||||
"Condition": {
|
"Condition": {
|
||||||
|
"deathMove": {
|
||||||
|
"name": "Death Move",
|
||||||
|
"description": "The character is about to make a Death Move"
|
||||||
|
},
|
||||||
"dead": {
|
"dead": {
|
||||||
"name": "Dead",
|
"name": "Dead",
|
||||||
"description": "The character is dead"
|
"description": "The character is dead"
|
||||||
|
|
@ -2435,7 +2439,11 @@
|
||||||
"overlay": { "label": "Overlay Effect" },
|
"overlay": { "label": "Overlay Effect" },
|
||||||
"characterDefault": { "label": "Character Default Defeated Status" },
|
"characterDefault": { "label": "Character Default Defeated Status" },
|
||||||
"adversaryDefault": { "label": "Adversary Default Defeated Status" },
|
"adversaryDefault": { "label": "Adversary Default Defeated Status" },
|
||||||
"companionDefault": { "label": "Companion Default Defeated Status" }
|
"companionDefault": { "label": "Companion Default Defeated Status" },
|
||||||
|
"deathMove": { "label": "Death Move" },
|
||||||
|
"dead": { "label": "Dead" },
|
||||||
|
"defeated": { "label": "Defeated" },
|
||||||
|
"unconscious": { "label": "Unconscious" }
|
||||||
},
|
},
|
||||||
"hopeFear": {
|
"hopeFear": {
|
||||||
"label": "Hope & Fear",
|
"label": "Hope & Fear",
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,9 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
|
|
||||||
if (!config.roll.fate) return;
|
if (!config.roll.fate) return;
|
||||||
|
|
||||||
|
let returnMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.avoidScar');
|
||||||
if (config.roll.fate.value <= this.actor.system.levelData.level.current) {
|
if (config.roll.fate.value <= this.actor.system.levelData.level.current) {
|
||||||
// apply scarring - for now directly apply - later add a button.
|
|
||||||
const newScarAmount = this.actor.system.scars + 1;
|
const newScarAmount = this.actor.system.scars + 1;
|
||||||
|
|
||||||
await this.actor.update({
|
await this.actor.update({
|
||||||
system: {
|
system: {
|
||||||
scars: newScarAmount
|
scars: newScarAmount
|
||||||
|
|
@ -65,13 +64,15 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
});
|
});
|
||||||
|
|
||||||
if (newScarAmount >= this.actor.system.resources.hope.max) {
|
if (newScarAmount >= this.actor.system.resources.hope.max) {
|
||||||
|
await this.actor.setDeathMoveDefeated(CONFIG.DH.GENERAL.defeatedConditionChoices.dead.id);
|
||||||
return game.i18n.format('DAGGERHEART.UI.Chat.deathMove.journeysEnd', { scars: newScarAmount });
|
return game.i18n.format('DAGGERHEART.UI.Chat.deathMove.journeysEnd', { scars: newScarAmount });
|
||||||
}
|
}
|
||||||
|
|
||||||
return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.gainScar');
|
returnMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.gainScar');
|
||||||
}
|
}
|
||||||
|
|
||||||
return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.avoidScar');
|
await this.actor.setDeathMoveDefeated(CONFIG.DH.GENERAL.defeatedConditionChoices.unconscious.id);
|
||||||
|
return returnMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleRiskItAll() {
|
async handleRiskItAll() {
|
||||||
|
|
@ -118,6 +119,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.roll.result.duality == -1) {
|
if (config.roll.result.duality == -1) {
|
||||||
|
await this.actor.setDeathMoveDefeated(CONFIG.DH.GENERAL.defeatedConditionChoices.dead.id);
|
||||||
chatMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.riskItAllFailure');
|
chatMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.riskItAllFailure');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,6 +143,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
await this.actor.setDeathMoveDefeated(CONFIG.DH.GENERAL.defeatedConditionChoices.dead.id);
|
||||||
return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.blazeOfGlory');
|
return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.blazeOfGlory');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ export const defeatedConditions = () => {
|
||||||
acc[key] = {
|
acc[key] = {
|
||||||
...choice,
|
...choice,
|
||||||
img: defeated[`${choice.id}Icon`],
|
img: defeated[`${choice.id}Icon`],
|
||||||
description: `DAGGERHEART.CONFIG.Condition.${choice.id}.description`
|
description: game.i18n.localize(`DAGGERHEART.CONFIG.Condition.${choice.id}.description`)
|
||||||
};
|
};
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
|
@ -179,6 +179,10 @@ export const defeatedConditions = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const defeatedConditionChoices = {
|
export const defeatedConditionChoices = {
|
||||||
|
deathMove: {
|
||||||
|
id: 'deathMove',
|
||||||
|
name: 'DAGGERHEART.CONFIG.Condition.deathMove.name'
|
||||||
|
},
|
||||||
defeated: {
|
defeated: {
|
||||||
id: 'defeated',
|
id: 'defeated',
|
||||||
name: 'DAGGERHEART.CONFIG.Condition.defeated.name'
|
name: 'DAGGERHEART.CONFIG.Condition.defeated.name'
|
||||||
|
|
|
||||||
|
|
@ -549,7 +549,18 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
}
|
}
|
||||||
|
|
||||||
get deathMoveViable() {
|
get deathMoveViable() {
|
||||||
return this.resources.hitPoints.max > 0 && this.resources.hitPoints.value >= this.resources.hitPoints.max;
|
const { characterDefault } = game.settings.get(
|
||||||
|
CONFIG.DH.id,
|
||||||
|
CONFIG.DH.SETTINGS.gameSettings.Automation
|
||||||
|
).defeated;
|
||||||
|
const deathMoveOutcomeStatuses = Object.keys(CONFIG.DH.GENERAL.defeatedConditionChoices).filter(
|
||||||
|
key => key !== characterDefault
|
||||||
|
);
|
||||||
|
const deathMoveNotResolved = this.parent.statuses.every(status => !deathMoveOutcomeStatuses.includes(status));
|
||||||
|
|
||||||
|
const allHitPointsMarked =
|
||||||
|
this.resources.hitPoints.max > 0 && this.resources.hitPoints.value >= this.resources.hitPoints.max;
|
||||||
|
return deathMoveNotResolved && allHitPointsMarked;
|
||||||
}
|
}
|
||||||
|
|
||||||
get armorApplicableDamageTypes() {
|
get armorApplicableDamageTypes() {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export default class DhAutomation extends foundry.abstract.DataModel {
|
||||||
defeated: new fields.SchemaField({
|
defeated: new fields.SchemaField({
|
||||||
enabled: new fields.BooleanField({
|
enabled: new fields.BooleanField({
|
||||||
required: true,
|
required: true,
|
||||||
initial: false,
|
initial: true,
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.enabled.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.enabled.label'
|
||||||
}),
|
}),
|
||||||
overlay: new fields.BooleanField({
|
overlay: new fields.BooleanField({
|
||||||
|
|
@ -69,7 +69,7 @@ export default class DhAutomation extends foundry.abstract.DataModel {
|
||||||
characterDefault: new fields.StringField({
|
characterDefault: new fields.StringField({
|
||||||
required: true,
|
required: true,
|
||||||
choices: CONFIG.DH.GENERAL.defeatedConditionChoices,
|
choices: CONFIG.DH.GENERAL.defeatedConditionChoices,
|
||||||
initial: CONFIG.DH.GENERAL.defeatedConditionChoices.unconscious.id,
|
initial: CONFIG.DH.GENERAL.defeatedConditionChoices.deathMove.id,
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.characterDefault.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.characterDefault.label'
|
||||||
}),
|
}),
|
||||||
adversaryDefault: new fields.StringField({
|
adversaryDefault: new fields.StringField({
|
||||||
|
|
@ -84,23 +84,29 @@ export default class DhAutomation extends foundry.abstract.DataModel {
|
||||||
initial: CONFIG.DH.GENERAL.defeatedConditionChoices.defeated.id,
|
initial: CONFIG.DH.GENERAL.defeatedConditionChoices.defeated.id,
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.companionDefault.label'
|
||||||
}),
|
}),
|
||||||
|
deathMoveIcon: new fields.FilePathField({
|
||||||
|
initial: 'icons/magic/life/heart-cross-purple-orange.webp',
|
||||||
|
categories: ['IMAGE'],
|
||||||
|
base64: false,
|
||||||
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.deathMove.label'
|
||||||
|
}),
|
||||||
deadIcon: new fields.FilePathField({
|
deadIcon: new fields.FilePathField({
|
||||||
initial: 'icons/magic/death/grave-tombstone-glow-teal.webp',
|
initial: 'icons/magic/death/grave-tombstone-glow-teal.webp',
|
||||||
categories: ['IMAGE'],
|
categories: ['IMAGE'],
|
||||||
base64: false,
|
base64: false,
|
||||||
label: 'Dead'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.dead.label'
|
||||||
}),
|
}),
|
||||||
defeatedIcon: new fields.FilePathField({
|
defeatedIcon: new fields.FilePathField({
|
||||||
initial: 'icons/magic/control/fear-fright-mask-orange.webp',
|
initial: 'icons/magic/control/fear-fright-mask-orange.webp',
|
||||||
categories: ['IMAGE'],
|
categories: ['IMAGE'],
|
||||||
base64: false,
|
base64: false,
|
||||||
label: 'Defeated'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.defeated.label'
|
||||||
}),
|
}),
|
||||||
unconsciousIcon: new fields.FilePathField({
|
unconsciousIcon: new fields.FilePathField({
|
||||||
initial: 'icons/magic/control/sleep-bubble-purple.webp',
|
initial: 'icons/magic/control/sleep-bubble-purple.webp',
|
||||||
categories: ['IMAGE'],
|
categories: ['IMAGE'],
|
||||||
base64: false,
|
base64: false,
|
||||||
label: 'Unconcious'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.defeated.unconscious.label'
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
roll: new fields.SchemaField({
|
roll: new fields.SchemaField({
|
||||||
|
|
|
||||||
|
|
@ -849,8 +849,8 @@ export default class DhpActor extends Actor {
|
||||||
|
|
||||||
async toggleDefeated(defeatedState) {
|
async toggleDefeated(defeatedState) {
|
||||||
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated;
|
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated;
|
||||||
const { unconscious, defeated, dead } = CONFIG.DH.GENERAL.conditions();
|
const { deathMove, unconscious, defeated, dead } = CONFIG.DH.GENERAL.conditions();
|
||||||
const defeatedConditions = new Set([unconscious.id, defeated.id, dead.id]);
|
const defeatedConditions = new Set([deathMove.id, unconscious.id, defeated.id, dead.id]);
|
||||||
if (!defeatedState) {
|
if (!defeatedState) {
|
||||||
for (let defeatedId of defeatedConditions) {
|
for (let defeatedId of defeatedConditions) {
|
||||||
await this.toggleStatusEffect(defeatedId, { overlay: settings.overlay, active: defeatedState });
|
await this.toggleStatusEffect(defeatedId, { overlay: settings.overlay, active: defeatedState });
|
||||||
|
|
@ -864,6 +864,18 @@ export default class DhpActor extends Actor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async setDeathMoveDefeated(defeatedIconId) {
|
||||||
|
const settings = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Automation).defeated;
|
||||||
|
const actorDefault = settings[`${this.type}Default`];
|
||||||
|
if (!settings.enabled || !settings.enabled || !actorDefault || actorDefault === defeatedIconId) return;
|
||||||
|
|
||||||
|
for (let defeatedId of Object.keys(CONFIG.DH.GENERAL.defeatedConditionChoices)) {
|
||||||
|
await this.toggleStatusEffect(defeatedId, { overlay: settings.overlay, active: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defeatedIconId) await this.toggleStatusEffect(defeatedIconId, { overlay: settings.overlay, active: true });
|
||||||
|
}
|
||||||
|
|
||||||
queueScrollText(scrollingTextData) {
|
queueScrollText(scrollingTextData) {
|
||||||
this.#scrollTextQueue.push(...scrollingTextData.map(data => () => createScrollText(this, data)));
|
this.#scrollTextQueue.push(...scrollingTextData.map(data => () => createScrollText(this, data)));
|
||||||
if (!this.#scrollTextInterval) {
|
if (!this.#scrollTextInterval) {
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,12 @@
|
||||||
</legend>
|
</legend>
|
||||||
|
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.enabled value=settingFields._source.defeated.enabled localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.enabled value=settingFields._source.defeated.enabled localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.overlay value=settingFields._source.defeated.overlay localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.overlay value=settingFields._source.defeated.overlay localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.characterDefault value=settingFields._source.defeated.characterDefault labelAttr="name" localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.characterDefault value=settingFields._source.defeated.characterDefault labelAttr="name" localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.adversaryDefault value=settingFields._source.defeated.adversaryDefault labelAttr="name" localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.adversaryDefault value=settingFields._source.defeated.adversaryDefault labelAttr="name" localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.companionDefault value=settingFields._source.defeated.companionDefault labelAttr="name" localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.companionDefault value=settingFields._source.defeated.companionDefault labelAttr="name" localize=true}}
|
||||||
|
|
||||||
|
{{formGroup settingFields.schema.fields.defeated.fields.deathMoveIcon value=settingFields._source.defeated.deathMoveIcon localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.deadIcon value=settingFields._source.defeated.deadIcon localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.deadIcon value=settingFields._source.defeated.deadIcon localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.defeatedIcon value=settingFields._source.defeated.defeatedIcon localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.defeatedIcon value=settingFields._source.defeated.defeatedIcon localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.defeated.fields.unconsciousIcon value=settingFields._source.defeated.unconsciousIcon localize=true}}
|
{{formGroup settingFields.schema.fields.defeated.fields.unconsciousIcon value=settingFields._source.defeated.unconsciousIcon localize=true}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue