Skip to content

Commit

Permalink
Merge pull request dmdorman#583 from phBalance/phBalance/_onStartTurn…
Browse files Browse the repository at this point in the history
…_crash

Fix on turn start crash for endurance powers with no modifiers
  • Loading branch information
phBalance authored Jan 3, 2024
2 parents 667455f + 9dd296f commit 582cf88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Add explosions for 5e.
- Movement power improvements for 5e (pointing, description, and added gliding).
- Description improvements for invisibility and darkness. [#573](https://github.com/dmdorman/hero6e-foundryvtt/issues/573)
- Correct a crash during the start of each segment for characters that have endurance powers active but with no power modifiers. Consequently, automatic endurance tracking should be be better.
- Improvements to adjustment powers (although we suggest still only using them for characteristics):
- Adjustment powers should now respect uploaded multi sources and targets when triggering. They should also respect maximum amounts for absorption, aid, and transfer for 5e and 6e.
- No adjustment powers should be killing attacks that are enhanced by strength.
Expand Down Expand Up @@ -417,13 +418,13 @@

- Initial DRAIN support.
- Changing PC/NPC actor type moved to sheet header. Also can be changed in the context menu of the actor sidebar. Fixes [#170](https://github.com/dmdorman/hero6e-foundryvtt/issues/170).
- Combat Tracker Improvments. Reworked underlying code so that _onEndRound and _onStartTurn are called as expected. This should lead to future automation improvments. For example Post-Segment-12 activities and Endurance use at the beginning of turn for continuous powers. Also changed tooltips for PREV/NEXT to align with Hero terminology. [#175](https://github.com/dmdorman/hero6e-foundryvtt/issues/175)
- Combat Tracker Improvements. Reworked underlying code so that _onEndRound and _onStartTurn are called as expected. This should lead to future automation improvements. For example Post-Segment-12 activities and Endurance use at the beginning of turn for continuous powers. Also changed tooltips for PREV/NEXT to align with Hero terminology. [#175](https://github.com/dmdorman/hero6e-foundryvtt/issues/175)
- Minor improvements to framework support.
- Fixed issue where Reduced Endurance was not included in END calculations. [#132](https://github.com/dmdorman/hero6e-foundryvtt/issues/132)

## Version 3.0.4

- Reworked Active Effects such that the effects on items remain with items. They are no longered
- Reworked Active Effects such that the effects on items remain with items. They are no longer
transferred from the item to the actor. This is following [FoundryVtt v11 ActiveEffect Transferral](https://foundryvtt.com/article/v11-active-effects/) recommendations.
- Fixed Custom martial attacks, they now show on attack tab. Also fixed the Set & Brace martial manuevers.
- Fixed a bug where an attack using charges would set END=0.
Expand Down
14 changes: 7 additions & 7 deletions module/combat.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,23 +499,23 @@ export class HeroSystem6eCombat extends Combat {
let spentEnd = 0;

for (let powerUsingEnd of combatant.actor.items.filter(
(o) =>
o.system.active === true &&
parseInt(o.system?.end || 0) > 0 &&
(o.system.subType || o.type) != "attack",
(item) =>
item.system.active === true &&
parseInt(item.system?.end || 0) > 0 &&
(item.system.subType || item.type) != "attack",
)) {
const costEndOnlyToActivate = powerUsingEnd.system.MODIFIER.find(
const costEndOnlyToActivate = powerUsingEnd.system.MODIFIER?.find(
(o) => o.XMLID === "COSTSEND" && o.OPTION === "ACTIVATE",
);
if (!costEndOnlyToActivate) {
let end = parseInt(powerUsingEnd.system.end);
const end = parseInt(powerUsingEnd.system.end);
spentEnd += end;
content += `<li>${powerUsingEnd.name} (${end})</li>`;
}
}

const encumbered = combatant.actor.effects.find(
(o) => o.flags.encumbrance,
(effect) => effect.flags.encumbrance,
);
if (encumbered) {
const endCostPerTurn =
Expand Down

0 comments on commit 582cf88

Please sign in to comment.