diff --git a/OpenRA.Mods.RA/Activities/Attack.cs b/OpenRA.Mods.RA/Activities/Attack.cs index 6d67f75f7c..ae256f8ee2 100755 --- a/OpenRA.Mods.RA/Activities/Attack.cs +++ b/OpenRA.Mods.RA/Activities/Attack.cs @@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Activities /* non-turreted attack */ public class Attack : CancelableActivity { - Target Target; + protected Target Target; ITargetable targetable; int Range; bool AllowMovement; @@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA.Activities return ret; } - IActivity InnerTick( Actor self, AttackBase attack ) + protected virtual IActivity InnerTick( Actor self, AttackBase attack ) { if (IsCanceled) return NextActivity; var facing = self.Trait(); diff --git a/OpenRA.Mods.RA/Activities/Heal.cs b/OpenRA.Mods.RA/Activities/Heal.cs new file mode 100755 index 0000000000..6775f8dd68 --- /dev/null +++ b/OpenRA.Mods.RA/Activities/Heal.cs @@ -0,0 +1,32 @@ +#region Copyright & License Information +/* + * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see LICENSE. + */ +#endregion + +using OpenRA.Mods.RA.Render; +using OpenRA.Traits; +using OpenRA.Traits.Activities; +using OpenRA.Mods.RA.Move; + +namespace OpenRA.Mods.RA.Activities +{ + /* non-turreted attack */ + public class Heal : Attack + { + public Heal(Target target, int range, bool allowMovement) + : base(target, range, allowMovement) {} + + protected override IActivity InnerTick( Actor self, AttackBase attack ) + { + if (Target.IsActor && Target.Actor.GetDamageState() == DamageState.Undamaged) + return NextActivity; + + return base.InnerTick(self, attack); + } + } +} diff --git a/OpenRA.Mods.RA/AttackMedic.cs b/OpenRA.Mods.RA/AttackMedic.cs new file mode 100644 index 0000000000..a77b65c317 --- /dev/null +++ b/OpenRA.Mods.RA/AttackMedic.cs @@ -0,0 +1,34 @@ +#region Copyright & License Information +/* + * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see LICENSE. + */ +#endregion + +using System; +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + public class AttackMedicInfo : AttackFrontalInfo + { + public override object Create( ActorInitializer init ) { return new AttackMedic( init.self, this ); } + } + + public class AttackMedic : AttackFrontal + { + public AttackMedic(Actor self, AttackMedicInfo info) + : base( self, info ) {} + + public override IActivity GetAttackActivity(Actor self, Target newTarget, bool allowMove) + { + var weapon = ChooseWeaponForTarget(newTarget); + if( weapon == null ) + return null; + return new Activities.Heal(newTarget, Math.Max(0, (int)weapon.Info.Range), allowMove); + } + } +} diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index f8bef4d330..e189fd837b 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -323,6 +323,8 @@ + + diff --git a/mods/ra/rules/infantry.yaml b/mods/ra/rules/infantry.yaml index 2458ce03e3..70f6db6da5 100644 --- a/mods/ra/rules/infantry.yaml +++ b/mods/ra/rules/infantry.yaml @@ -253,14 +253,14 @@ MEDI: Passenger: PipType: Yellow AutoHeal: - AttackFrontal: + AttackMedic: PrimaryWeapon: Heal TakeCover: -AutoTarget: AttackMove: JustMove: true -# IdleAnimation: -# Animations: idle1,idle2 + IdleAnimation: + Animations: idle1,idle2 C1: Inherits: ^Infantry