diff --git a/OpenRA.Mods.RA/Activities/CaptureActor.cs b/OpenRA.Mods.RA/Activities/CaptureActor.cs index a95facf9b2..aa5d910a95 100644 --- a/OpenRA.Mods.RA/Activities/CaptureActor.cs +++ b/OpenRA.Mods.RA/Activities/CaptureActor.cs @@ -22,9 +22,16 @@ namespace OpenRA.Mods.RA.Activities public override Activity Tick(Actor self) { - if (IsCanceled) return NextActivity; - if (target == null || !target.IsInWorld || target.IsDead()) return NextActivity; - if (target.Owner == self.Owner) return NextActivity; + var capturesInfo = self.Info.Traits.Get(); + var health = target.Trait(); + int damage = (int)(0.25 * health.MaxHP); + + if (IsCanceled) + return NextActivity; + if (target == null || !target.IsInWorld || target.IsDead()) + return NextActivity; + if (target.Owner == self.Owner) + return NextActivity; // Need to be next to building, TODO: stop capture when going away var mobile = self.Trait(); @@ -32,10 +39,14 @@ namespace OpenRA.Mods.RA.Activities if ((nearest - mobile.toCell).LengthSquared > 2) return Util.SequenceActivities(new MoveAdjacentTo(Target.FromActor(target)), this); - if (!target.Trait().BeginCapture(target, self)) - return NextActivity; + if (!capturesInfo.Sabotage || (capturesInfo.Sabotage && health.DamageState == DamageState.Heavy)) + { + if (!target.Trait().BeginCapture(target, self)) + return NextActivity; + } + else + target.InflictDamage(self, damage, null); - var capturesInfo = self.Info.Traits.Get(); if (capturesInfo != null && capturesInfo.WastedAfterwards) self.World.AddFrameEndTask(w => self.Destroy()); diff --git a/OpenRA.Mods.RA/Captures.cs b/OpenRA.Mods.RA/Captures.cs index 2320f3331a..8f3700b4ef 100644 --- a/OpenRA.Mods.RA/Captures.cs +++ b/OpenRA.Mods.RA/Captures.cs @@ -23,6 +23,7 @@ namespace OpenRA.Mods.RA { public string[] CaptureTypes = {"building"}; public bool WastedAfterwards = true; + public bool Sabotage = false; public object Create(ActorInitializer init) { return new Captures(init.self, this); } } diff --git a/mods/cnc-classic/rules/defaults.yaml b/mods/cnc-classic/rules/defaults.yaml index 834e019f0f..4ebb977b74 100644 --- a/mods/cnc-classic/rules/defaults.yaml +++ b/mods/cnc-classic/rules/defaults.yaml @@ -233,6 +233,7 @@ ShakeOnDeath: Sellable: Capturable: + CaptureCompleteTime: 0 CapturableBar: ^CivBuilding: @@ -268,6 +269,7 @@ ^TechBuilding: Inherits: ^CivBuilding Capturable: + CaptureCompleteTime: 0 CapturableBar: RepairableBuilding: RevealsShroud: diff --git a/mods/ra-classic/rules/defaults.yaml b/mods/ra-classic/rules/defaults.yaml index ead5f7c66f..276be7078a 100644 --- a/mods/ra-classic/rules/defaults.yaml +++ b/mods/ra-classic/rules/defaults.yaml @@ -166,6 +166,7 @@ TerrainTypes: Clear,Road GivesBuildableArea: Capturable: + CaptureCompleteTime: 0 CapturableBar: SoundOnDamageTransition: DamagedSound: kaboom1.aud diff --git a/mods/ra-classic/rules/infantry.yaml b/mods/ra-classic/rules/infantry.yaml index 97376a3355..f49f01978e 100644 --- a/mods/ra-classic/rules/infantry.yaml +++ b/mods/ra-classic/rules/infantry.yaml @@ -156,6 +156,7 @@ E6: PipType: Yellow EngineerRepair: Captures: + Sabotage: yes TakeCover: -AutoTarget: AttackMove: