Weapon doesn't check warheads in IsValidAgainst

This commit is contained in:
dnqbob
2022-10-20 19:24:39 +08:00
committed by Matthias Mailänder
parent e8d9e2dfa9
commit a25558b550

View File

@@ -99,7 +99,7 @@ namespace OpenRA.GameRules
[Desc("Number of shots in a single ammo magazine.")]
public readonly int Burst = 1;
[Desc("Can this weapon target attacker itself.")]
[Desc("Can this weapon target the attacker itself?")]
public readonly bool CanTargetSelf = false;
[Desc("What types of targets are affected.")]
@@ -214,15 +214,7 @@ namespace OpenRA.GameRules
var targetTypes = victim.GetEnabledTargetTypes();
if (!IsValidTarget(targetTypes))
return false;
// PERF: Avoid LINQ.
foreach (var warhead in Warheads)
if (warhead.IsValidAgainst(victim, firedBy))
return true;
return false;
return IsValidTarget(targetTypes);
}
/// <summary>Checks if the weapon is valid against (can target) the frozen actor.</summary>
@@ -231,13 +223,7 @@ namespace OpenRA.GameRules
if (!CanTargetSelf && victim.Actor == firedBy)
return false;
if (!IsValidTarget(victim.TargetTypes))
return false;
if (!Warheads.Any(w => w.IsValidAgainst(victim, firedBy)))
return false;
return true;
return IsValidTarget(victim.TargetTypes);
}
/// <summary>Applies all the weapon's warheads to the target.</summary>