Skip DamageWarhead armor lookups if no Versus defined

- directly return 100 when no Versus values are defined (meaning the warhead would have 100% efficiency vs. all armor types anyway)
This commit is contained in:
reaperrr
2018-09-20 16:04:02 +02:00
committed by Paul Chote
parent 1f7edf9f0b
commit ade85f8977

View File

@@ -38,6 +38,10 @@ namespace OpenRA.Mods.Common.Warheads
public int DamageVersus(Actor victim)
{
// If no Versus values are defined, DamageVersus would return 100 anyway, so we might as well do that early.
if (Versus.Count == 0)
return 100;
var armor = victim.TraitsImplementing<Armor>()
.Where(a => !a.IsTraitDisabled && a.Info.Type != null && Versus.ContainsKey(a.Info.Type))
.Select(a => Versus[a.Info.Type]);