From 9b4db3468bd9ff94442a4c1a5569caa7160cd27d Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Tue, 11 Sep 2018 17:26:46 +0200 Subject: [PATCH] Fix CombatProperties not accounting for multiple AttackBase traits --- .../Scripting/Properties/CombatProperties.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs index 875720bec3..5448db344e 100644 --- a/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs +++ b/OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs @@ -78,12 +78,12 @@ namespace OpenRA.Mods.Common.Scripting [ScriptPropertyGroup("Combat")] public class GeneralCombatProperties : ScriptActorProperties, Requires { - readonly AttackBase attackBase; + readonly AttackBase[] attackBases; public GeneralCombatProperties(ScriptContext context, Actor self) : base(context, self) { - attackBase = self.Trait(); + attackBases = self.TraitsImplementing().ToArray(); } [Desc("Attack the target actor. The target actor needs to be visible.")] @@ -96,7 +96,8 @@ namespace OpenRA.Mods.Common.Scripting if (!targetActor.Info.HasTraitInfo() && !targetActor.CanBeViewedByPlayer(Self.Owner)) Log.Write("lua", "{1} is not revealed for player {0}!", Self.Owner, targetActor); - attackBase.AttackTarget(target, true, allowMove, forceAttack); + foreach (var attack in attackBases) + attack.AttackTarget(target, true, allowMove, forceAttack); } [Desc("Checks if the targeted actor is a valid target for this actor.")]