Made Armor upgradable
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -34,13 +35,13 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
: new Dictionary<string, int>();
|
||||
}
|
||||
|
||||
public int DamageVersus(ActorInfo victim)
|
||||
public int DamageVersus(Actor victim)
|
||||
{
|
||||
var armor = victim.Traits.GetOrDefault<ArmorInfo>();
|
||||
if (armor != null && armor.Type != null)
|
||||
var armor = victim.TraitsImplementing<Armor>().Where(a => !a.IsTraitDisabled && a.Info.Type != null);
|
||||
foreach (var a in armor)
|
||||
{
|
||||
int versus;
|
||||
if (Versus.TryGetValue(armor.Type, out versus))
|
||||
if (Versus.TryGetValue(a.Info.Type, out versus))
|
||||
return versus;
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
|
||||
public virtual void DoImpact(Actor victim, Actor firedBy, IEnumerable<int> damageModifiers)
|
||||
{
|
||||
var damage = Util.ApplyPercentageModifiers(Damage, damageModifiers.Append(DamageVersus(victim.Info)));
|
||||
var damage = Util.ApplyPercentageModifiers(Damage, damageModifiers.Append(DamageVersus(victim)));
|
||||
victim.InflictDamage(firedBy, damage, this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user