Compare commits

..

No commits in common. "276aee4747005a83fc3909fc08dc8036ac05e9ef" and "e6d5a2f7d39656442315a8a074433fa61b619e32" have entirely different histories.

6 changed files with 88 additions and 149 deletions

View file

@ -119,7 +119,8 @@
"deleteTriggerContent": "Are you sure you want to delete the {trigger} trigger?",
"advantageState": "Advantage State",
"damageOnSave": "Damage on Save",
"useDefaultItemValues": "Use default Item values"
"useDefaultItemValues": "Use default Item values",
"itemDamageIsUsed": "Item Damage Is Used"
},
"RollField": {
"diceRolling": {
@ -134,7 +135,7 @@
"attackModifier": "Attack Modifier",
"attackName": "Attack Name",
"criticalThreshold": "Critical Threshold",
"includeBase": { "label": "Include Item Damage" },
"includeBase": { "label": "Use Item Damage" },
"groupAttack": { "label": "Group Attack" },
"multiplier": "Multiplier",
"saveHint": "Set a default Trait to enable Reaction Roll. It can be changed later in Reaction Roll Dialog.",

View file

@ -72,8 +72,8 @@ export default class ActionSelectionDialog extends HandlebarsApplicationMixin(Ap
static async #onChooseAction(event, button) {
const { actionId } = button.dataset;
this.#action = this.item.system.actionsList.find(a => a._id === actionId);
Object.defineProperty(this.#event, 'shiftKey', {
this.action = this.item.system.actionsList.find(a => a._id === actionId);
Object.defineProperty(this.event, 'shiftKey', {
get() {
return event.shiftKey;
}

View file

@ -156,7 +156,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
context.openSection = this.openSection;
context.tabs = this._getTabs(this.constructor.TABS);
context.config = CONFIG.DH;
if (this.action.damage) {
if (this.action.hasDamage) {
context.allDamageTypesUsed = !getUnusedDamageTypes(this.action.damage.parts).length;
if (this.action.damage.hasOwnProperty('includeBase') && this.action.type === 'attack')
@ -302,7 +302,7 @@ export default class DHActionBaseConfig extends DaggerheartSheet(ApplicationV2)
static addDamage(_event) {
if (!this.action.damage.parts) return;
const choices = getUnusedDamageTypes(this.action._source.damage.parts);
const choices = getUnusedDamageTypes(this.action.damage.parts);
const content = new foundry.data.fields.StringField({
label: game.i18n.localize('Damage Type'),
choices,

View file

@ -1,3 +1,4 @@
import { DHDamageData } from '../fields/action/damageField.mjs';
import DHDamageAction from './damageAction.mjs';
export default class DHAttackAction extends DHDamageAction {
@ -11,19 +12,8 @@ export default class DHAttackAction extends DHDamageAction {
super.prepareData();
if (!!this.item?.system?.attack) {
if (this.damage.includeBase) {
const baseDamage = this.getParentHitPointDamage();
if (baseDamage) {
if (!this.damage.parts.hitPoints) {
this.damage.parts.hitPoints = baseDamage;
} else {
for (const type of baseDamage.type) this.damage.parts.hitPoints.type.add(type);
this.damage.parts.hitPoints.value.custom = {
enabled: true,
formula: `${baseDamage.value.getFormula()} + ${this.damage.parts.hitPoints.value.getFormula()}`
};
}
}
const baseDamage = this.getParentDamage();
this.damage.parts.hitPoints = new DHDamageData(baseDamage);
}
if (this.roll.useDefault) {
this.roll.trait = this.item.system.attack.roll.trait;
@ -32,8 +22,16 @@ export default class DHAttackAction extends DHDamageAction {
}
}
getParentHitPointDamage() {
return this.item?.system?.attack.damage.parts.hitPoints;
getParentDamage() {
return {
value: {
multiplier: 'prof',
dice: this.item?.system?.attack.damage.parts.hitPoints.value.dice,
bonus: this.item?.system?.attack.damage.parts.hitPoints.value.bonus ?? 0
},
type: this.item?.system?.attack.damage.parts.hitPoints.type,
base: true
};
}
get damageFormula() {

View file

@ -91,7 +91,7 @@
"type": "attack",
"_id": "GI2VkIcGDOjFRxpT",
"systemPath": "actions",
"description": "<p class=\"Card-Feature\">Make a <strong>Spellcast Roll</strong> against a target within Very Far range. On a success, hurl a sphere of fire toward them that explodes on impact.</p>",
"description": "<p class=\"Card-Feature\">Make a <strong>Spellcast Roll</strong> against a target within Very Far range. On a success, hurl a sphere of fire toward them that explodes on impact. The target and all creatures within Very Close range of them must make a Reaction Roll (13). Targets who fail take<strong> d20+5</strong> magic damage using your Proficiency. Targets who succeed take half damage.</p><p>@Template[type:emanation|range:vc]</p>",
"chatDisplay": true,
"actionType": "action",
"cost": [],
@ -101,7 +101,34 @@
"recovery": null
},
"damage": {
"parts": {},
"parts": {
"hitPoints": {
"resultBased": false,
"value": {
"custom": {
"enabled": false
},
"multiplier": "prof",
"dice": "d20",
"bonus": 5,
"flatMultiplier": 1
},
"applyTo": "hitPoints",
"type": [
"magical"
],
"base": false,
"valueAlt": {
"multiplier": "prof",
"flatMultiplier": 1,
"dice": "d6",
"bonus": null,
"custom": {
"enabled": false
}
}
}
},
"includeBase": false
},
"target": {
@ -124,105 +151,14 @@
},
"useDefault": false
},
"save": {
"trait": null,
"difficulty": 13,
"damageMod": "half"
},
"name": "Fireball - Cast",
"img": "icons/magic/fire/explosion-fireball-large-red-orange.webp",
"range": "veryFar"
},
"HJ749c2a8WTjkSHY": {
"type": "attack",
"_id": "HJ749c2a8WTjkSHY",
"systemPath": "actions",
"baseAction": false,
"description": "<p>The target and all creatures within Very Close range of them must make a Reaction Roll (13). Targets who fail take<strong> d20+5</strong> magic damage using your Proficiency. Targets who succeed take half damage.</p>",
"chatDisplay": true,
"originItem": {
"type": "itemCollection"
},
"actionType": "action",
"triggers": [],
"areas": [
{
"name": "Fireball",
"type": "placed",
"shape": "emanation",
"size": "veryClose",
"effects": []
}
],
"cost": [],
"uses": {
"value": null,
"max": "",
"recovery": null,
"consumeOnSuccess": false
},
"damage": {
"parts": {
"hitPoints": {
"applyTo": "hitPoints",
"resultBased": false,
"value": {
"multiplier": "prof",
"flatMultiplier": 1,
"dice": "d20",
"bonus": 5,
"custom": {
"enabled": false,
"formula": ""
}
},
"valueAlt": {
"multiplier": "flat",
"flatMultiplier": 1,
"dice": "d6",
"bonus": null,
"custom": {
"enabled": false,
"formula": ""
}
},
"base": false,
"type": [
"magical"
]
}
},
"includeBase": false,
"direct": false
},
"target": {
"type": "any",
"amount": null
},
"effects": [],
"roll": {
"type": null,
"trait": null,
"difficulty": null,
"bonus": null,
"advState": "neutral",
"diceRolling": {
"multiplier": "prof",
"flatMultiplier": 1,
"dice": "d6",
"compare": null,
"treshold": null
},
"useDefault": false
},
"save": {
"trait": "agility",
"difficulty": 13,
"damageMod": "half"
},
"name": "Fireball - Explosion",
"range": "",
"img": "icons/magic/fire/explosion-fireball-large-red-orange.webp"
"name": "Fireball",
"img": "icons/magic/fire/explosion-fireball-large-red-orange.webp",
"range": "veryFar"
}
},
"attribution": {

View file

@ -31,40 +31,44 @@
{{/unless}}
</legend>
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base))}}
{{formField ../fields.resultBased value=dmg.resultBased name=(concat "damage.parts." dmg.applyTo ".resultBased") localize=true classes="checkbox"}}
{{/if}}
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base) dmg.resultBased)}}
<div class="nest-inputs">
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}</legend>
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
</fieldset>
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}</legend>
{{> formula fields=../fields.valueAlt.fields type=../fields.type dmg=dmg source=dmg.valueAlt target="valueAlt" key=dmg.applyTo path=../path}}
</fieldset>
</div>
{{else}}
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
{{/if}}
{{#if (and (eq dmg.applyTo 'hitPoints') (ne @root.source.type 'healing'))}}
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." dmg.applyTo ".type") localize=true}}
{{/if}}
{{#if ../horde}}
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend>
{{#unless (and @root.source.damage.includeBase (eq key 'hitPoints'))}}
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base))}}
{{formField ../fields.resultBased value=dmg.resultBased name=(concat "damage.parts." dmg.applyTo ".resultBased") localize=true classes="checkbox"}}
{{/if}}
{{#if (and (not @root.isNPC) @root.hasRoll (not dmg.base) dmg.resultBased)}}
<div class="nest-inputs">
<input type="hidden" name="{{../path}}damage.parts.{{dmg.applyTo}}.valueAlt.multiplier" value="flat">
{{formField ../fields.valueAlt.fields.flatMultiplier value=dmg.valueAlt.flatMultiplier name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.flatMultiplier") label="DAGGERHEART.ACTIONS.Settings.multiplier" classes="inline-child" localize=true }}
{{formField ../fields.valueAlt.fields.dice value=dmg.valueAlt.dice name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.dice") classes="inline-child" localize=true}}
{{formField ../fields.valueAlt.fields.bonus value=dmg.valueAlt.bonus name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.bonus") localize=true classes="inline-child"}}
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.hope")}}</legend>
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
</fieldset>
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.withThing" thing=(localize "DAGGERHEART.GENERAL.fear")}}</legend>
{{> formula fields=../fields.valueAlt.fields type=../fields.type dmg=dmg source=dmg.valueAlt target="valueAlt" key=dmg.applyTo path=../path}}
</fieldset>
</div>
</fieldset>
{{/if}}
<input type="hidden" name="{{concat ../path "damage.parts." dmg.applyTo ".base"}}" value="{{dmg.base}}">
{{else}}
{{> formula fields=../fields.value.fields type=../fields.type dmg=dmg source=dmg.value target="value" key=dmg.applyTo path=../path}}
{{/if}}
{{#if (and (eq dmg.applyTo 'hitPoints') (ne @root.source.type 'healing'))}}
{{formField ../fields.type value=dmg.type name=(concat ../path "damage.parts." dmg.applyTo ".type") localize=true}}
{{/if}}
{{#if ../horde}}
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.ACTORS.Adversary.hordeDamage"}}</legend>
<div class="nest-inputs">
<input type="hidden" name="{{../path}}damage.parts.{{dmg.applyTo}}.valueAlt.multiplier" value="flat">
{{formField ../fields.valueAlt.fields.flatMultiplier value=dmg.valueAlt.flatMultiplier name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.flatMultiplier") label="DAGGERHEART.ACTIONS.Settings.multiplier" classes="inline-child" localize=true }}
{{formField ../fields.valueAlt.fields.dice value=dmg.valueAlt.dice name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.dice") classes="inline-child" localize=true}}
{{formField ../fields.valueAlt.fields.bonus value=dmg.valueAlt.bonus name=(concat ../path "damage.parts." dmg.applyTo ".valueAlt.bonus") localize=true classes="inline-child"}}
</div>
</fieldset>
{{/if}}
<input type="hidden" name="{{concat ../path "damage.parts." dmg.applyTo ".base"}}" value="{{dmg.base}}">
{{else}}
<span class="hint">{{localize "DAGGERHEART.ACTIONS.Config.itemDamageIsUsed"}}</span>
{{/unless}}
</fieldset>
</div>
{{/each}}