From 52a2e4a61e94894975287aad8043df8d8e4bd988 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:44:28 -0700 Subject: [PATCH 1/6] Make shields absorb tree damage fully prevents knocking down/igniting trees under the shield --- lua/shield.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/shield.lua b/lua/shield.lua index 84fd60bc46..46bf1cdc1a 100644 --- a/lua/shield.lua +++ b/lua/shield.lua @@ -461,7 +461,7 @@ Shield = ClassShield(moho.shield_methods, Entity) { ---@return number damageAbsorbed If not all damage is absorbed, the remainder passes to targets under the shield. OnGetDamageAbsorption = function(self, instigator, amount, type) if type == "TreeForce" or type == "TreeFire" then - return + return amount end -- Allow decoupling the shield from the owner's armor multiplier local absorptionMulti = self.AbsorptionTypeDamageTypeToMulti[type] or self.Owner:GetArmorMult(type) From aaa6270f0a8e40812effa0d20f5aa51c98a692b7 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:45:35 -0700 Subject: [PATCH 2/6] Apply anti-shield area damage before normal damage Better order allows normal damage to overkill under the shield if the anti-shield damage takes out the shield --- lua/sim/Projectile.lua | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lua/sim/Projectile.lua b/lua/sim/Projectile.lua index c481e8aca9..2c3f1290df 100644 --- a/lua/sim/Projectile.lua +++ b/lua/sim/Projectile.lua @@ -653,16 +653,7 @@ Projectile = ClassProjectile(ProjectileMethods, DebugProjectileComponent) { local DoTTime = DamageData.DoTTime if DoTTime <= 0 then -- no damage over time, do radius-based damage - DamageArea( - instigator, - cachedPosition, - radius, - damage, - damageType, - damageFriendly, - damageSelf - ) - + -- anti-shield damage first so that the remaining damage can overkill under the shield local damageToShields = DamageData.DamageToShields if damageToShields then DamageArea( @@ -675,6 +666,16 @@ Projectile = ClassProjectile(ProjectileMethods, DebugProjectileComponent) { damageSelf ) end + + DamageArea( + instigator, + cachedPosition, + radius, + damage, + damageType, + damageFriendly, + damageSelf + ) else -- check for initial damage local initialDmg = DamageData.InitialDamageAmount @@ -708,7 +709,7 @@ Projectile = ClassProjectile(ProjectileMethods, DebugProjectileComponent) { -- damage a single entity elseif targetEntity then local damageType = DamageData.DamageType - + -- anti-shield damage first so remainder can overkill under the shield local damageToShields = DamageData.DamageToShields if damageToShields then Damage( From b07e9b422e84500dc5bf9d7451cd56443db805fe Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Thu, 12 Sep 2024 03:43:43 -0700 Subject: [PATCH 3/6] Fix overcharge dealing half damage to shields --- lua/shield.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lua/shield.lua b/lua/shield.lua index 46bf1cdc1a..b2209f7e67 100644 --- a/lua/shield.lua +++ b/lua/shield.lua @@ -516,13 +516,16 @@ Shield = ClassShield(moho.shield_methods, Entity) { local tick = GetGameTick() -- damage correction for overcharge - -- These preset damages deal `2 * dmg * absorbMult or armorMult`, currently absorption multiplier is 1x so we need to divide by 2 + -- If the absorption multi is less than 1, then the shield will get hit by two instances of area damage, one of which is the remainder. + -- This means that the following code requires a multiplier to correct the total damage amount since both instances will be overriden. + -- In the past it used to be 0.25 absorption for static shields (due to structure armor) and needed a 2x multiplier. + -- Currently the absorption multi is 1, so it doesn't need a multiplier. if dmgType == 'Overcharge' then local wep = instigator:GetWeaponByLabel('OverCharge') - if self.StaticShield then -- fixed damage for static shields - amount = wep:GetBlueprint().Overcharge.structureDamage / 2 - elseif self.CommandShield then -- fixed damage for UEF bubble shield - amount = wep:GetBlueprint().Overcharge.commandDamage / 2 + if self.StaticShield then + amount = wep:GetBlueprint().Overcharge.structureDamage + elseif self.CommandShield then + amount = wep:GetBlueprint().Overcharge.commandDamage end end From 6a98f0191c4c51dbe08f26f4139ec7ec5dbf9997 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Thu, 12 Sep 2024 03:56:26 -0700 Subject: [PATCH 4/6] Create fix.6445.md --- changelog/snippets/fix.6445.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/snippets/fix.6445.md diff --git a/changelog/snippets/fix.6445.md b/changelog/snippets/fix.6445.md new file mode 100644 index 0000000000..4e3535bda3 --- /dev/null +++ b/changelog/snippets/fix.6445.md @@ -0,0 +1,5 @@ +- (#6445) Fix overcharge dealing half damage to static shields. + +- (#6445) Shields now block damage from knocking down/setting fire to trees. + +- (#6445) Fix normal damage being applied before anti-shield damage, which didn't let the normal damage overkill under a shield. From 79dc0f79c87c722efcadae36e81ad3f1586e5df1 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Thu, 12 Sep 2024 03:56:48 -0700 Subject: [PATCH 5/6] Update fix.6445.md --- changelog/snippets/fix.6445.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/snippets/fix.6445.md b/changelog/snippets/fix.6445.md index 4e3535bda3..50eccb253d 100644 --- a/changelog/snippets/fix.6445.md +++ b/changelog/snippets/fix.6445.md @@ -1,4 +1,4 @@ -- (#6445) Fix overcharge dealing half damage to static shields. +- (#6445) Fix overcharge dealing half damage to static and ACU shields. - (#6445) Shields now block damage from knocking down/setting fire to trees. From b54b7d2c50749a7eeb9cb66a8761c685af5103d6 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:56:37 -0700 Subject: [PATCH 6/6] Update the OC damage comment in `shield` --- lua/shield.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/shield.lua b/lua/shield.lua index b2209f7e67..8a6d344f4f 100644 --- a/lua/shield.lua +++ b/lua/shield.lua @@ -516,10 +516,13 @@ Shield = ClassShield(moho.shield_methods, Entity) { local tick = GetGameTick() -- damage correction for overcharge - -- If the absorption multi is less than 1, then the shield will get hit by two instances of area damage, one of which is the remainder. - -- This means that the following code requires a multiplier to correct the total damage amount since both instances will be overriden. - -- In the past it used to be 0.25 absorption for static shields (due to structure armor) and needed a 2x multiplier. - -- Currently the absorption multi is 1, so it doesn't need a multiplier. + + -- If the absorption multiplier is less than 1, then the shield will get hit by two instances of area damage, the absorbed amount and the remainder. + -- This means that the following code then requires a multiplier to correct the total damage amount since both instances will be overriden. + -- For example with 0.25 absorption we would have a 0.25 damage and 0.75 damage instance hitting the shield. Both get set to 800 OC structure damage, + -- but then 0.25x armor is applied again (second OnGetDamageAbsorption call), reducing it to 2x200 damage, which requires a 2x multiplication to bring it to the expected 800. + -- Currently the absorption multiplier is 1, so we don't need a multiplier on the damage to balance it out. + if dmgType == 'Overcharge' then local wep = instigator:GetWeaponByLabel('OverCharge') if self.StaticShield then