From b97bdc6935b56e589558b3bc0606c59eaaf6cf3d Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Tue, 21 May 2024 05:37:23 -0700 Subject: [PATCH] Fix rounding in beam damage calculation (#6201) --- changelog/snippets/fix.6115.md | 2 +- lua/ui/game/unitviewDetail.lua | 2 +- units/DSLK004/DSLK004_unit.bp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog/snippets/fix.6115.md b/changelog/snippets/fix.6115.md index bc22f3f39a..01ffaff4b4 100644 --- a/changelog/snippets/fix.6115.md +++ b/changelog/snippets/fix.6115.md @@ -1 +1 @@ -- (#6115) Fix damage calculation in the unit view UI for beam weapons with a `BeamCollisionDelay` such as the Zapper's weapon. +- (#6115, #6201) Fix damage calculation in the unit view UI for beam weapons with a `BeamCollisionDelay` such as the Zapper's weapon. diff --git a/lua/ui/game/unitviewDetail.lua b/lua/ui/game/unitviewDetail.lua index d63a8dc77c..67a7947e65 100644 --- a/lua/ui/game/unitviewDetail.lua +++ b/lua/ui/game/unitviewDetail.lua @@ -567,7 +567,7 @@ function WrapAndPlaceText(bp, builder, descID, control) Damage = math.max(Damage, info.DamageToShields) end if info.BeamLifetime > 0 then - Damage = Damage * (1 + MathFloor(MATH_IRound(info.BeamLifetime)/(info.BeamCollisionDelay+0.1))) + Damage = Damage * (1 + MathFloor(MATH_IRound(info.BeamLifetime*10)/(MATH_IRound(info.BeamCollisionDelay*10)+1))) else Damage = Damage * (info.DoTPulses or 1) + (info.InitialDamage or 0) local ProjectilePhysics = __blueprints[info.ProjectileId].Physics diff --git a/units/DSLK004/DSLK004_unit.bp b/units/DSLK004/DSLK004_unit.bp index 127117fb2f..5d0338e24c 100644 --- a/units/DSLK004/DSLK004_unit.bp +++ b/units/DSLK004/DSLK004_unit.bp @@ -249,7 +249,7 @@ UnitBlueprint{ }, AutoInitiateAttackCommand = false, BallisticArc = "RULEUBA_None", - BeamCollisionDelay = 0.01, + BeamCollisionDelay = 0, BeamLifetime = 0.6, CannotAttackGround = true, CollideFriendly = false,