Fix Include Item Damage error in v14 damage system

- Change behavior from 'Include Item Damage' to 'Use Item Damage'
- Replace action damage with weapon base damage instead of unshift
- Fixes error where unshift fails due to v14 single damage instance limit
- Update label to reflect new behavior

Fixes Foundryborne/daggerheart#1794

Signed-off-by: codebytaki <codebytaki@users.noreply.github.com>
This commit is contained in:
codebytaki 2026-04-14 17:20:17 +06:00
parent 94f1fbdd9b
commit 6afc5d625a
4 changed files with 87 additions and 22 deletions

View file

@ -1,34 +1,49 @@
---
name: Bug report
about: Create a bug report to help us identify issues and resolve them
title: "[Bug] <Insert Title here> "
labels: bug
type: bug
name: 🐛 Bug Report
about: Create a report to help us improve
title: '[BUG] '
labels: 'bug'
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
## Bug Description
<!-- A clear and concise description of what the bug is -->
## Steps To Reproduce
<!-- Steps to reproduce the behavior -->
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
## Expected Behavior
**Screenshots**
If applicable, add screenshots to help explain your problem.
<!-- A clear and concise description of what you expected to happen -->
**Setup Information:**
- OS: [e.g. iOS, Windows]
- Browser [e.g. chrome, safari]
- Foundry Version [e.g. v13 b342]
- System Version [e.g. v.1.0, v.1.0.1]
## Actual Behavior
<!-- What actually happened -->
**Additional context**
Add any other context about the problem here.
## Screenshots
<!-- If applicable, add screenshots to help explain your problem -->
## Environment
<!-- Please complete the following information -->
- Foundry VTT Version: [e.g. 12.331]
- Daggerheart System Version: [e.g. 1.0.0]
- Browser: [e.g. Chrome, Firefox, Edge]
- OS: [e.g. Windows, macOS, Linux]
## Additional Context
<!-- Add any other context about the problem here -->
## Possible Solution
<!-- Optional: If you have suggestions on how to fix the bug -->

46
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,46 @@
## Description
<!-- Provide a brief description of what this PR does -->
## Type of Change
<!-- Check all that apply -->
- [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] 📝 Documentation update
- [ ] 🎨 UI/UX improvement
- [ ] 🔧 Code refactoring
- [ ] ⚡ Performance improvement
## Testing
<!-- Describe the tests you ran and how to reproduce them -->
- [ ] I have tested this locally in Foundry VTT
- [ ] All existing tests pass
- [ ] I have added tests that prove my fix is effective or that my feature works
## Screenshots (if applicable)
<!-- Add screenshots or GIFs to demonstrate UI/UX changes -->
## Checklist
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] Any dependent changes have been merged and published
## Related Issues
<!-- Link any related issues using #issue-number -->
Fixes #
## Additional Notes
<!-- Add any other context about the PR here -->

View file

@ -11,9 +11,13 @@ export default class DHAttackAction extends DHDamageAction {
prepareData() {
super.prepareData();
if (!!this.item?.system?.attack) {
// In v14, we only allow a single instance of damage
// If includeBase is checked, use the weapon's damage instead of the action's damage
if (this.damage.includeBase) {
const baseDamage = this.getParentDamage();
this.damage.parts.unshift(new DHDamageData(baseDamage));
// Replace the action damage with the weapon's base damage
this.damage.parts = new Map();
this.damage.parts.set('hitPoints', new DHDamageData(baseDamage));
}
if (this.roll.useDefault) {
this.roll.trait = this.item.system.attack.roll.trait;

View file

@ -16,7 +16,7 @@ export default class DamageField extends fields.SchemaField {
parts: new IterableTypedObjectField(DHDamageData),
includeBase: new fields.BooleanField({
initial: false,
label: 'DAGGERHEART.ACTIONS.Settings.includeBase.label'
label: 'DAGGERHEART.ACTIONS.Settings.useItemDamage.label'
}),
direct: new fields.BooleanField({ initial: false, label: 'DAGGERHEART.CONFIG.DamageType.direct.name' }),
groupAttack: new fields.StringField({