Skip to content

fix: damage reflection calculations for secondary combat type#671

Open
Sh3Ns wants to merge 1 commit intozimbadev:mainfrom
Sh3Ns:fix/damage-reflection-secondary
Open

fix: damage reflection calculations for secondary combat type#671
Sh3Ns wants to merge 1 commit intozimbadev:mainfrom
Sh3Ns:fix/damage-reflection-secondary

Conversation

@Sh3Ns
Copy link
Copy Markdown
Contributor

@Sh3Ns Sh3Ns commented Apr 7, 2026

Description

Fixes three bugs in the secondary damage reflection block inside Game::combatBlockHit.

Related to #653

Bugs Fixed

Bug 1 — Wrong source value in !canReflect branch

reflectPercent was computed using damage.primary.value instead of damage.secondary.value, causing the secondary reflect to be based on the wrong damage number.

Bug 2 — Wrong combatType in params (!canReflect branch)

damageReflectedParams.combatType was set to damage.primary.type instead of damage.secondary.type, dispatching the reflected secondary damage as the wrong combat type.

Bug 3 — Wrong target field and broken formula (canReflect branch)

The secondary reflected value was written to damageReflected.primary.value (overwriting the primary reflect) instead of damageReflected.secondary.value. The formula also used a broken nested std::max instead of applying flat + percent additively with the proper 1% health cap.

Credits

Thanks to @Jattartajjar and @iloveShaders for identifying and reporting these issues.

Fix three bugs in the secondary damage reflection block inside Game::combatBlockHit:

- Bug 1: reflectPercent used damage.primary.value instead of damage.secondary.value
- Bug 2: damageReflectedParams.combatType set to primary.type instead of secondary.type
- Bug 3: reflected value written to damageReflected.primary.value (overwriting primary reflect) instead of secondary.value, and formula used broken nested std::max instead of flat + percent with 1% health cap.

Co-Authored-By: Jattartajjar <207260357+jattartajjar@users.noreply.github.com>
Co-Authored-By: Kakeriel <73860497+iloveshaders@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant