mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
direct damage (#873)
This commit is contained in:
parent
6e747e67ee
commit
06184773b9
9 changed files with 37 additions and 14 deletions
20
lang/en.json
20
lang/en.json
|
|
@ -846,6 +846,11 @@
|
||||||
"magical": {
|
"magical": {
|
||||||
"name": "Magical",
|
"name": "Magical",
|
||||||
"abbreviation": "Mag"
|
"abbreviation": "Mag"
|
||||||
|
},
|
||||||
|
"direct": {
|
||||||
|
"name": "Direct Damage",
|
||||||
|
"short": "Direct",
|
||||||
|
"abbreviation": "Dir"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DeathMoves": {
|
"DeathMoves": {
|
||||||
|
|
@ -895,23 +900,28 @@
|
||||||
"HealingType": {
|
"HealingType": {
|
||||||
"hitPoints": {
|
"hitPoints": {
|
||||||
"name": "Hit Points",
|
"name": "Hit Points",
|
||||||
"abbreviation": "HP"
|
"abbreviation": "HP",
|
||||||
|
"inChatRoll": "Damage"
|
||||||
},
|
},
|
||||||
"stress": {
|
"stress": {
|
||||||
"name": "Stress",
|
"name": "Stress",
|
||||||
"abbreviation": "STR"
|
"abbreviation": "STR",
|
||||||
|
"inChatRoll": "Stress"
|
||||||
},
|
},
|
||||||
"hope": {
|
"hope": {
|
||||||
"name": "Hope",
|
"name": "Hope",
|
||||||
"abbreviation": "HO"
|
"abbreviation": "HO",
|
||||||
|
"inChatRoll": "Hope"
|
||||||
},
|
},
|
||||||
"armor": {
|
"armor": {
|
||||||
"name": "Armor Slot",
|
"name": "Armor Slot",
|
||||||
"abbreviation": "AS"
|
"abbreviation": "AS",
|
||||||
|
"inChatRoll": "Armor Slot"
|
||||||
},
|
},
|
||||||
"fear": {
|
"fear": {
|
||||||
"name": "Fear",
|
"name": "Fear",
|
||||||
"abbreviation": "FR"
|
"abbreviation": "FR",
|
||||||
|
"inChatRoll": "Fear"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ItemResourceProgression": {
|
"ItemResourceProgression": {
|
||||||
|
|
|
||||||
|
|
@ -177,6 +177,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
hasDamage: this.damage?.parts?.length && this.type !== 'healing',
|
hasDamage: this.damage?.parts?.length && this.type !== 'healing',
|
||||||
hasHealing: this.damage?.parts?.length && this.type === 'healing',
|
hasHealing: this.damage?.parts?.length && this.type === 'healing',
|
||||||
hasEffect: !!this.effects?.length,
|
hasEffect: !!this.effects?.length,
|
||||||
|
isDirect: !!this.damage?.direct,
|
||||||
hasSave: this.hasSave,
|
hasSave: this.hasSave,
|
||||||
selectedRollMode: game.settings.get('core', 'rollMode'),
|
selectedRollMode: game.settings.get('core', 'rollMode'),
|
||||||
isFastForward: event.shiftKey,
|
isFastForward: event.shiftKey,
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ export default class DHActorRoll extends foundry.abstract.TypeDataModel {
|
||||||
hasEffect: new fields.BooleanField({ initial: false }),
|
hasEffect: new fields.BooleanField({ initial: false }),
|
||||||
hasSave: new fields.BooleanField({ initial: false }),
|
hasSave: new fields.BooleanField({ initial: false }),
|
||||||
hasTarget: new fields.BooleanField({ initial: false }),
|
hasTarget: new fields.BooleanField({ initial: false }),
|
||||||
|
isDirect: new fields.BooleanField({ initial: false }),
|
||||||
isCritical: new fields.BooleanField({ initial: false }),
|
isCritical: new fields.BooleanField({ initial: false }),
|
||||||
onSave: new fields.StringField(),
|
onSave: new fields.StringField(),
|
||||||
source: new fields.SchemaField({
|
source: new fields.SchemaField({
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ export default class DamageField extends fields.SchemaField {
|
||||||
includeBase: new fields.BooleanField({
|
includeBase: new fields.BooleanField({
|
||||||
initial: false,
|
initial: false,
|
||||||
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
|
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
|
||||||
})
|
}),
|
||||||
|
direct: new fields.BooleanField({ initial: false, label: "DAGGERHEART.CONFIG.DamageType.direct.name" })
|
||||||
};
|
};
|
||||||
super(damageFields, options, context);
|
super(damageFields, options, context);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -517,7 +517,7 @@ export default class DhpActor extends Actor {
|
||||||
return canUseArmor || canUseStress;
|
return canUseArmor || canUseStress;
|
||||||
}
|
}
|
||||||
|
|
||||||
async takeDamage(damages) {
|
async takeDamage(damages, isDirect = false) {
|
||||||
if (Hooks.call(`${CONFIG.DH.id}.preTakeDamage`, this, damages) === false) return null;
|
if (Hooks.call(`${CONFIG.DH.id}.preTakeDamage`, this, damages) === false) return null;
|
||||||
|
|
||||||
if (this.type === 'companion') {
|
if (this.type === 'companion') {
|
||||||
|
|
@ -548,6 +548,7 @@ export default class DhpActor extends Actor {
|
||||||
hpDamage.value = this.convertDamageToThreshold(hpDamage.value);
|
hpDamage.value = this.convertDamageToThreshold(hpDamage.value);
|
||||||
if (
|
if (
|
||||||
this.type === 'character' &&
|
this.type === 'character' &&
|
||||||
|
!isDirect &&
|
||||||
this.system.armor &&
|
this.system.armor &&
|
||||||
this.#canReduceDamage(hpDamage.value, hpDamage.damageTypes)
|
this.#canReduceDamage(hpDamage.value, hpDamage.damageTypes)
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
||||||
|
|
||||||
this.consumeOnSuccess();
|
this.consumeOnSuccess();
|
||||||
if (this.system.hasHealing) target.actor.takeHealing(damages);
|
if (this.system.hasHealing) target.actor.takeHealing(damages);
|
||||||
else target.actor.takeDamage(damages);
|
else target.actor.takeDamage(damages, this.system.isDirect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -344,6 +344,10 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
|
|
||||||
|
&.space-between {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,14 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#unless (eq path 'system.attack.')}}<a><i class="fa-solid fa-plus icon-button" data-action="addDamage"></i></a>{{/unless}}
|
{{#unless (eq path 'system.attack.')}}<a><i class="fa-solid fa-plus icon-button" data-action="addDamage"></i></a>{{/unless}}
|
||||||
</legend>
|
</legend>
|
||||||
|
<div class="nest-inputs space-between">
|
||||||
{{#if @root.hasBaseDamage}}
|
{{#if @root.hasBaseDamage}}
|
||||||
{{formField @root.fields.damage.fields.includeBase value=@root.source.damage.includeBase name="damage.includeBase" classes="checkbox" localize=true }}
|
{{formField @root.fields.damage.fields.includeBase value=@root.source.damage.includeBase name="damage.includeBase" classes="checkbox" localize=true }}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#unless (eq @root.source.type 'healing')}}
|
||||||
|
{{formField @root.fields.damage.fields.direct value=@root.source.damage.direct name="damage.direct" localize=true classes="checkbox"}}
|
||||||
|
{{/unless}}
|
||||||
|
</div>
|
||||||
{{#each source.parts as |dmg index|}}
|
{{#each source.parts as |dmg index|}}
|
||||||
{{#if (and @root.hasBaseDamage @root.source.damage.includeBase)}}
|
{{#if (and @root.hasBaseDamage @root.source.damage.includeBase)}}
|
||||||
{{setVar 'realIndex' (add index -1)}}
|
{{setVar 'realIndex' (add index -1)}}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="roll-part-extra on-reduced">
|
<div class="roll-part-extra on-reduced">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
{{#each damage as | roll index | }}
|
{{#each damage as | roll index | }}
|
||||||
<div class="roll-formula">{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')}}: {{total}}</div>
|
<div class="roll-formula">{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')}}: {{total}}</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -12,8 +12,8 @@
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
{{#each damage as | roll index | }}
|
{{#each damage as | roll index | }}
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>
|
<legend>{{log @root}}
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')}} <div class="roll-formula">{{localize "DAGGERHEART.GENERAL.total"}}: {{roll.total}}</div>
|
{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')}} <div class="roll-formula">{{localize "DAGGERHEART.GENERAL.total"}}: {{roll.total}}</div>{{#if (and (eq index "hitPoints")../isDirect)}} <div class="roll-formula">{{localize "DAGGERHEART.CONFIG.DamageType.direct.short"}}</div>{{/if}}
|
||||||
</legend>
|
</legend>
|
||||||
{{#each roll.parts}}
|
{{#each roll.parts}}
|
||||||
{{#if damageTypes.length}}
|
{{#if damageTypes.length}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue