Equalized the DoImpact methods in damage warheads

This commit is contained in:
Pavel Penev
2020-05-03 01:33:33 +03:00
committed by abcdefg30
parent f0578a75f4
commit 78139413d7
2 changed files with 11 additions and 3 deletions

View File

@@ -59,10 +59,14 @@ namespace OpenRA.Mods.Common.Warheads
.Select(s => Pair.New(s, s.DistanceFromEdge(victim, pos)))
.MinByOrDefault(s => s.Second);
// Cannot be damaged without an active HitShape
// Cannot be damaged without an active HitShape.
if (closestActiveShape.First == null)
continue;
// Cannot be damaged if HitShape is outside Range.
if (closestActiveShape.Second > Range[Range.Length - 1])
continue;
var localModifiers = args.DamageModifiers.Append(GetDamageFalloff(closestActiveShape.Second.Length));
var updatedWarheadArgs = new WarheadArgs(args)
{

View File

@@ -41,8 +41,12 @@ namespace OpenRA.Mods.Common.Warheads
.Select(s => Pair.New(s, s.DistanceFromEdge(victim, pos)))
.MinByOrDefault(s => s.Second);
// Cannot be damaged without an active HitShape or if HitShape is outside Spread
if (closestActiveShape.First == null || closestActiveShape.Second > Spread)
// Cannot be damaged without an active HitShape.
if (closestActiveShape.First == null)
continue;
// Cannot be damaged if HitShape is outside Spread.
if (closestActiveShape.Second > Spread)
continue;
InflictDamage(victim, firedBy, closestActiveShape.First, args);