Weapon doesn't check warheads in IsValidAgainst
This commit is contained in:
committed by
Matthias Mailänder
parent
e8d9e2dfa9
commit
a25558b550
@@ -99,7 +99,7 @@ namespace OpenRA.GameRules
|
|||||||
[Desc("Number of shots in a single ammo magazine.")]
|
[Desc("Number of shots in a single ammo magazine.")]
|
||||||
public readonly int Burst = 1;
|
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;
|
public readonly bool CanTargetSelf = false;
|
||||||
|
|
||||||
[Desc("What types of targets are affected.")]
|
[Desc("What types of targets are affected.")]
|
||||||
@@ -214,15 +214,7 @@ namespace OpenRA.GameRules
|
|||||||
|
|
||||||
var targetTypes = victim.GetEnabledTargetTypes();
|
var targetTypes = victim.GetEnabledTargetTypes();
|
||||||
|
|
||||||
if (!IsValidTarget(targetTypes))
|
return IsValidTarget(targetTypes);
|
||||||
return false;
|
|
||||||
|
|
||||||
// PERF: Avoid LINQ.
|
|
||||||
foreach (var warhead in Warheads)
|
|
||||||
if (warhead.IsValidAgainst(victim, firedBy))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Checks if the weapon is valid against (can target) the frozen actor.</summary>
|
/// <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)
|
if (!CanTargetSelf && victim.Actor == firedBy)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!IsValidTarget(victim.TargetTypes))
|
return IsValidTarget(victim.TargetTypes);
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!Warheads.Any(w => w.IsValidAgainst(victim, firedBy)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Applies all the weapon's warheads to the target.</summary>
|
/// <summary>Applies all the weapon's warheads to the target.</summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user