heal sortof works... except it kills the patient.

This commit is contained in:
Chris Forbes
2009-12-28 10:59:00 +13:00
parent b4008af0ca
commit 8202f2cdc4
5 changed files with 14 additions and 10 deletions

View File

@@ -32,7 +32,9 @@ namespace OpenRa.Game.Traits
{
var inRange = Game.FindUnitsInCircle(self.CenterLocation, Game.CellSize * range);
return inRange.Where(a => a.Owner != null && a.Owner != self.Owner) /* todo: one day deal with friendly players */
return inRange
.Where(a => a.Owner != null && a.Owner != self.Owner) /* todo: one day deal with friendly players */
.Where(a => Combat.HasAnyValidWeapons(self, a))
.OrderBy(a => (a.Location - self.Location).LengthSquared)
.FirstOrDefault();
}
@@ -46,6 +48,9 @@ namespace OpenRa.Game.Traits
if (e.Attacker.Owner == self.Owner)
return; // don't retaliate against own units force-firing on us. it's usually not what the player wanted.
if (e.Damage < 0)
return; // don't retaliate against healers
var attack = self.traits.WithInterface<AttackBase>().First();
if (attack.target != null) return;

View File

@@ -50,7 +50,10 @@ namespace OpenRa.Game.Traits
var prefix = IsProne(self) ? "prone-shoot-" : "shoot-";
anim.PlayThen(prefix + dir, () => inAttack = false);
if (anim.HasSequence(prefix + dir))
anim.PlayThen(prefix + dir, () => inAttack = false);
else if (anim.HasSequence("heal"))
anim.PlayThen("heal", () => inAttack = false);
}
public override void Tick(Actor self)