Merge pull request #8768 from matija-hustic/attackbase_refactor

Some work on Attack*
This commit is contained in:
Oliver Brakmann
2015-10-08 21:56:22 +02:00
26 changed files with 253 additions and 216 deletions

View File

@@ -8,6 +8,8 @@
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.D2k.Activities;
using OpenRA.Traits;
@@ -24,6 +26,7 @@ namespace OpenRA.Mods.D2k.Traits
public readonly int AttackTime = 30;
public readonly string WormAttackSound = "Worm.wav";
public readonly string WormAttackNotification = "WormAttack";
public override object Create(ActorInitializer init) { return new AttackSwallow(init.Self, this); }
@@ -39,7 +42,7 @@ namespace OpenRA.Mods.D2k.Traits
Info = info;
}
public override void DoAttack(Actor self, Target target)
public override void DoAttack(Actor self, Target target, IEnumerable<Armament> armaments = null)
{
// This is so that the worm does not launch an attack against a target that has reached solid rock
if (target.Type != TargetType.Actor || !CanAttack(self, target))
@@ -48,7 +51,7 @@ namespace OpenRA.Mods.D2k.Traits
return;
}
var a = ChooseArmamentForTarget(target);
var a = ChooseArmamentsForTarget(target, true).FirstOrDefault();
if (a == null)
return;