Merge pull request #5024 from ScottNZ/balance

Closes #3272
This commit is contained in:
Matthias Mailänder
2014-04-05 08:09:46 +02:00
10 changed files with 104 additions and 3 deletions

View File

@@ -9,8 +9,9 @@
#endregion
using System.Linq;
using OpenRA.Traits;
using OpenRA.FileFormats;
using OpenRA.Mods.RA.Activities;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
@@ -24,6 +25,7 @@ namespace OpenRA.Mods.RA
public readonly bool AllowEnemies = true;
[Desc("Health percentage the target must be at (or below) before it can be captured.")]
public readonly float CaptureThreshold = 0.5f;
public readonly bool CancelActivity = false;
public bool CanBeTargetedBy(Actor captor, Player owner)
{
@@ -48,5 +50,17 @@ namespace OpenRA.Mods.RA
}
}
class Capturable { }
class Capturable : INotifyCapture
{
public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
{
var info = self.Info.Traits.Get<CapturableInfo>();
if (info.CancelActivity)
{
var stop = new Order("Stop", self, false);
foreach (var t in self.TraitsImplementing<IResolveOrder>())
t.ResolveOrder(self, stop);
}
}
}
}

View File

@@ -166,7 +166,7 @@
<Compile Include="Bridge.cs" />
<Compile Include="BridgeLayer.cs" />
<Compile Include="Buildable.cs" />
<Compile Include="BuildingCaptureNotification.cs" />
<Compile Include="CaptureNotification.cs" />
<Compile Include="Buildings\Building.cs" />
<Compile Include="Buildings\BuildingInfluence.cs" />
<Compile Include="Buildings\CanPowerDown.cs" />