From eb81076bce36a41babde20c229e5ca9b6debb7f4 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 19 Jan 2010 11:54:10 +1300 Subject: [PATCH] require force-fire to attack bridges --- OpenRa.Game/Traits/AttackBase.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/OpenRa.Game/Traits/AttackBase.cs b/OpenRa.Game/Traits/AttackBase.cs index 4eae9534da..d43434412c 100644 --- a/OpenRa.Game/Traits/AttackBase.cs +++ b/OpenRa.Game/Traits/AttackBase.cs @@ -180,9 +180,19 @@ namespace OpenRa.Traits if (self == underCursor) return null; var isHeal = self.GetPrimaryWeapon().Damage < 0; - if (((underCursor.Owner == self.Owner) ^ isHeal) - && !mi.Modifiers.HasModifier( Modifiers.Ctrl )) return null; + var forceFire = mi.Modifiers.HasModifier(Modifiers.Ctrl); + if (isHeal) + { + if (underCursor.Owner == null) + return null; + if (underCursor.Owner != self.Owner && !forceFire) + return null; + } + else + if ((underCursor.Owner == self.Owner || underCursor.Owner == null) && !forceFire) + return null; + if (!Combat.HasAnyValidWeapons(self, underCursor)) return null; return new Order(isHeal ? "Heal" : "Attack", self, underCursor, int2.Zero, null);