presence of the trait is enough; don't need to check a legacy flag too.
This commit is contained in:
36
OpenRa.Game/Traits/SquishByTank.cs
Normal file
36
OpenRa.Game/Traits/SquishByTank.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRa.Game.GameRules;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class SquishByTank : ICrushable
|
||||
{
|
||||
readonly Actor self;
|
||||
public SquishByTank(Actor self)
|
||||
{
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
public void OnCrush(Actor crusher)
|
||||
{
|
||||
self.InflictDamage(crusher, self.Health, Rules.WarheadInfo["Crush"]);
|
||||
}
|
||||
|
||||
public bool IsPathableCrush(UnitMovementType umt, Player player)
|
||||
{
|
||||
return IsCrushableBy(umt, player);
|
||||
}
|
||||
|
||||
public bool IsCrushableBy(UnitMovementType umt, Player player)
|
||||
{
|
||||
if (player == Game.LocalPlayer) return false;
|
||||
switch (umt)
|
||||
{
|
||||
case UnitMovementType.Track: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user