presence of the trait is enough; don't need to check a legacy flag too.

This commit is contained in:
Chris Forbes
2009-12-28 13:31:08 +13:00
parent 650a0c333a
commit c5c1ec79ab
4 changed files with 12 additions and 15 deletions

View File

@@ -68,7 +68,6 @@ namespace OpenRa.Game.GameRules
public class InfantryInfo : MobileInfo public class InfantryInfo : MobileInfo
{ {
public readonly bool Crushable = true; // also on VehicleInfo, but with a different default
public readonly bool C4 = false; public readonly bool C4 = false;
public readonly bool FraidyCat = false; public readonly bool FraidyCat = false;
public readonly bool Infiltrate = false; public readonly bool Infiltrate = false;
@@ -80,7 +79,6 @@ namespace OpenRa.Game.GameRules
public class VehicleInfo : MobileInfo public class VehicleInfo : MobileInfo
{ {
public readonly bool Crushable = false;
public readonly bool Tracked = false; public readonly bool Tracked = false;
public VehicleInfo(string name) : base(name) { } public VehicleInfo(string name) : base(name) { }

View File

@@ -181,7 +181,7 @@
<Compile Include="Traits\Fake.cs" /> <Compile Include="Traits\Fake.cs" />
<Compile Include="Traits\Harvester.cs" /> <Compile Include="Traits\Harvester.cs" />
<Compile Include="Traits\Helicopter.cs" /> <Compile Include="Traits\Helicopter.cs" />
<Compile Include="Traits\Infantry.cs" /> <Compile Include="Traits\SquishByTank.cs" />
<Compile Include="Traits\Plane.cs" /> <Compile Include="Traits\Plane.cs" />
<Compile Include="Traits\ProductionQueue.cs" /> <Compile Include="Traits\ProductionQueue.cs" />
<Compile Include="Traits\ProductionSurround.cs" /> <Compile Include="Traits\ProductionSurround.cs" />

View File

@@ -5,10 +5,10 @@ using OpenRa.Game.GameRules;
namespace OpenRa.Game.Traits namespace OpenRa.Game.Traits
{ {
class Infantry : ICrushable class SquishByTank : ICrushable
{ {
readonly Actor self; readonly Actor self;
public Infantry(Actor self) public SquishByTank(Actor self)
{ {
this.self = self; this.self = self;
} }
@@ -26,7 +26,6 @@ namespace OpenRa.Game.Traits
public bool IsCrushableBy(UnitMovementType umt, Player player) public bool IsCrushableBy(UnitMovementType umt, Player player)
{ {
if (player == Game.LocalPlayer) return false; if (player == Game.LocalPlayer) return false;
if (!(self.Info as InfantryInfo).Crushable) return false;
switch (umt) switch (umt)
{ {
case UnitMovementType.Track: return true; case UnitMovementType.Track: return true;

View File

@@ -528,48 +528,48 @@ Traits=Unit, Mobile, RenderInfantry, Infantry, AutoTarget
LongDesc=Anti-infantry unit. Not fooled by the \nSpy's disguise.\n Strong vs Infantry\n Weak vs Vehicles LongDesc=Anti-infantry unit. Not fooled by the \nSpy's disguise.\n Strong vs Infantry\n Weak vs Vehicles
[E1] [E1]
Description=Rifle Infantry Description=Rifle Infantry
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry, AutoTarget Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget
LongDesc=General-purpose infantry. Strong vs Infantry\n Weak vs Vehicles LongDesc=General-purpose infantry. Strong vs Infantry\n Weak vs Vehicles
[E2] [E2]
Description=Grenadier Description=Grenadier
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry, AutoTarget Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget
FireDelay=15 FireDelay=15
PrimaryOffset=0,0,0,-13 PrimaryOffset=0,0,0,-13
LongDesc=Infantry armed with grenades. \n Strong vs Buildings, Infantry\n Weak vs Vehicles LongDesc=Infantry armed with grenades. \n Strong vs Buildings, Infantry\n Weak vs Vehicles
[E3] [E3]
Description=Rocket Soldier Description=Rocket Soldier
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry, AutoTarget Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget
PrimaryOffset=0,0,0,-13 PrimaryOffset=0,0,0,-13
LongDesc=Anti-tank/Anti-aircraft infantry.\n Strong vs Tanks, Aircraft\n Weak vs Infantry LongDesc=Anti-tank/Anti-aircraft infantry.\n Strong vs Tanks, Aircraft\n Weak vs Infantry
[E4] [E4]
Description=Flamethrower Description=Flamethrower
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry, AutoTarget Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget
FireDelay=8 FireDelay=8
LongDesc=Advanced Anti-infantry unit.\n Strong vs Infantry, Buildings\n Weak vs Vehicles LongDesc=Advanced Anti-infantry unit.\n Strong vs Infantry, Buildings\n Weak vs Vehicles
[E6] [E6]
Description=Engineer Description=Engineer
Traits=Unit, Mobile, RenderInfantry, TakeCover, Infantry Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank
Voice=EngineerVoice Voice=EngineerVoice
LongDesc=Infiltrates and captures enemy structures.\n Strong vs Nothing\n Weak vs Everything LongDesc=Infiltrates and captures enemy structures.\n Strong vs Nothing\n Weak vs Everything
[SPY] [SPY]
Description=Spy Description=Spy
Voice=SpyVoice Voice=SpyVoice
Traits=Unit, Mobile, RenderInfantry, TakeCover, Infantry Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank
LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
[THF] [THF]
Description=Thief Description=Thief
Voice=ThiefVoice Voice=ThiefVoice
Traits=Unit, Mobile, RenderInfantry, TakeCover, Infantry Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank
LongDesc=Infiltrates enemy refineries & \nsilos, and steals money stored there.\n Unarmed LongDesc=Infiltrates enemy refineries & \nsilos, and steals money stored there.\n Unarmed
[E7] [E7]
Description=Tanya Description=Tanya
Voice=TanyaVoice Voice=TanyaVoice
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry, AutoTarget Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget
LongDesc=Elite commando infantry, armed with \ndual pistols and C4.\n Strong vs Infantry, Buildings\n Weak vs Vehicles\n Special Ability: Destroy Building with C4 LongDesc=Elite commando infantry, armed with \ndual pistols and C4.\n Strong vs Infantry, Buildings\n Weak vs Vehicles\n Special Ability: Destroy Building with C4
[MEDI] [MEDI]
Description=Medic Description=Medic
Voice=MedicVoice Voice=MedicVoice
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, Infantry, AutoHeal Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoHeal
LongDesc=Heals nearby infantry.\n Strong vs Nothing\n Weak vs Everything LongDesc=Heals nearby infantry.\n Strong vs Nothing\n Weak vs Everything