RA special infantry all in mod dll now
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Traits;
|
||||
|
||||
namespace OpenRa.Effects
|
||||
{
|
||||
class DelayedAction : IEffect
|
||||
public class DelayedAction : IEffect
|
||||
{
|
||||
Action a;
|
||||
int delay;
|
||||
|
||||
@@ -5,7 +5,7 @@ using OpenRa.Traits;
|
||||
|
||||
namespace OpenRa
|
||||
{
|
||||
static class Exts
|
||||
public static class Exts
|
||||
{
|
||||
public static bool HasModifier(this Modifiers k, Modifiers mod)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ using System;
|
||||
|
||||
namespace OpenRa.Graphics
|
||||
{
|
||||
class Animation
|
||||
public class Animation
|
||||
{
|
||||
string name;
|
||||
public Sequence CurrentSequence { get; private set; }
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System.Xml;
|
||||
using Ijw.DirectX;
|
||||
|
||||
namespace OpenRa.Graphics
|
||||
{
|
||||
class Sequence
|
||||
public class Sequence
|
||||
{
|
||||
readonly Sprite[] sprites;
|
||||
readonly int start, length;
|
||||
|
||||
@@ -134,8 +134,6 @@
|
||||
<Compile Include="Sync.cs" />
|
||||
<Compile Include="Traits\AcceptsOre.cs" />
|
||||
<Compile Include="Traits\Activities\Attack.cs" />
|
||||
<Compile Include="Traits\Activities\CaptureBuilding.cs" />
|
||||
<Compile Include="Traits\Activities\Demolish.cs" />
|
||||
<Compile Include="Traits\Activities\EnterTransport.cs" />
|
||||
<Compile Include="Traits\Activities\Fly.cs" />
|
||||
<Compile Include="Traits\Activities\FlyAttack.cs" />
|
||||
@@ -166,7 +164,6 @@
|
||||
<Compile Include="Graphics\OverlayRenderer.cs" />
|
||||
<Compile Include="Graphics\WorldRenderer.cs" />
|
||||
<Compile Include="Traits\Activities\Idle.cs" />
|
||||
<Compile Include="Traits\Activities\Infiltrate.cs" />
|
||||
<Compile Include="Traits\Activities\Land.cs" />
|
||||
<Compile Include="Traits\Activities\Rearm.cs" />
|
||||
<Compile Include="Traits\Activities\Repair.cs" />
|
||||
@@ -216,12 +213,10 @@
|
||||
<Compile Include="Traits\BelowUnits.cs" />
|
||||
<Compile Include="Traits\Buildable.cs" />
|
||||
<Compile Include="Traits\Building.cs" />
|
||||
<Compile Include="Traits\C4Demolition.cs" />
|
||||
<Compile Include="Traits\Cargo.cs" />
|
||||
<Compile Include="Traits\Chronoshiftable.cs" />
|
||||
<Compile Include="Traits\ChronoshiftPaletteEffect.cs" />
|
||||
<Compile Include="Traits\Chronosphere.cs" />
|
||||
<Compile Include="Traits\EngineerCapture.cs" />
|
||||
<Compile Include="Traits\Explodes.cs" />
|
||||
<Compile Include="Traits\Fake.cs" />
|
||||
<Compile Include="Traits\GeneratesGap.cs" />
|
||||
@@ -236,12 +231,10 @@
|
||||
<Compile Include="Traits\LimitedAmmo.cs" />
|
||||
<Compile Include="Traits\Passenger.cs" />
|
||||
<Compile Include="Traits\ProvidesRadar.cs" />
|
||||
<Compile Include="Traits\RenderSpy.cs" />
|
||||
<Compile Include="Traits\Repairable.cs" />
|
||||
<Compile Include="Traits\Reservable.cs" />
|
||||
<Compile Include="Traits\Selectable.cs" />
|
||||
<Compile Include="Traits\SelfHealing.cs" />
|
||||
<Compile Include="Traits\Spy.cs" />
|
||||
<Compile Include="Traits\SquishByTank.cs" />
|
||||
<Compile Include="Traits\Plane.cs" />
|
||||
<Compile Include="Traits\ProductionQueue.cs" />
|
||||
@@ -268,7 +261,6 @@
|
||||
<Compile Include="Traits\StoresOre.cs" />
|
||||
<Compile Include="Traits\Submarine.cs" />
|
||||
<Compile Include="Traits\TakeCover.cs" />
|
||||
<Compile Include="Traits\Thief.cs" />
|
||||
<Compile Include="Traits\TraitsInterfaces.cs" />
|
||||
<Compile Include="Traits\Turreted.cs" />
|
||||
<Compile Include="Traits\Unit.cs" />
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRa.Traits.Activities
|
||||
{
|
||||
class CaptureBuilding : IActivity
|
||||
{
|
||||
Actor target;
|
||||
|
||||
public CaptureBuilding(Actor target) { this.target = target; }
|
||||
|
||||
public IActivity NextActivity { get; set; }
|
||||
|
||||
public IActivity Tick(Actor self)
|
||||
{
|
||||
if (target == null || target.IsDead) return NextActivity;
|
||||
|
||||
if (target.Owner == self.Owner)
|
||||
{
|
||||
if (target.Health == target.Info.Traits.Get<OwnedActorInfo>().HP)
|
||||
return NextActivity;
|
||||
target.InflictDamage(self, -EngineerCapture.EngineerDamage, Rules.WarheadInfo["Super"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target.Health - EngineerCapture.EngineerDamage <= 0)
|
||||
{
|
||||
target.Owner = self.Owner;
|
||||
target.InflictDamage(self, target.Health - EngineerCapture.EngineerDamage, Rules.WarheadInfo["Super"]);
|
||||
}
|
||||
else
|
||||
target.InflictDamage(self, EngineerCapture.EngineerDamage, Rules.WarheadInfo["Super"]);
|
||||
}
|
||||
|
||||
// the engineer is sacrificed.
|
||||
Game.world.AddFrameEndTask(w => w.Remove(self));
|
||||
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
public void Cancel(Actor self) { target = null; NextActivity = null; }
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Effects;
|
||||
|
||||
namespace OpenRa.Traits.Activities
|
||||
{
|
||||
class Demolish : IActivity
|
||||
{
|
||||
Actor target;
|
||||
public IActivity NextActivity { get; set; }
|
||||
|
||||
public Demolish( Actor target )
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public IActivity Tick(Actor self)
|
||||
{
|
||||
if (target == null || target.IsDead) return NextActivity;
|
||||
Game.world.AddFrameEndTask(w => w.Add(new DelayedAction(25*2,
|
||||
() => target.InflictDamage(self, target.Health, Rules.WarheadInfo["DemolishWarhead"]))));
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
public void Cancel(Actor self) { target = null; NextActivity = null; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
|
||||
namespace OpenRa.Traits.Activities
|
||||
{
|
||||
class Infiltrate : IActivity
|
||||
{
|
||||
Actor target;
|
||||
public Infiltrate(Actor target) { this.target = target; }
|
||||
public IActivity NextActivity { get; set; }
|
||||
|
||||
public IActivity Tick(Actor self)
|
||||
{
|
||||
if (target == null || target.IsDead) return NextActivity;
|
||||
if (target.Owner == self.Owner) return NextActivity;
|
||||
|
||||
foreach (var t in target.traits.WithInterface<IAcceptSpy>())
|
||||
t.OnInfiltrate(target, self);
|
||||
|
||||
Game.world.AddFrameEndTask(w => w.Remove(self));
|
||||
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
public void Cancel(Actor self) { target = null; NextActivity = null; }
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using OpenRa.GameRules;
|
||||
|
||||
namespace OpenRa.Traits.Activities
|
||||
{
|
||||
class Move : IActivity
|
||||
public class Move : IActivity
|
||||
{
|
||||
public IActivity NextActivity { get; set; }
|
||||
|
||||
|
||||
@@ -1,27 +1,5 @@
|
||||
|
||||
namespace OpenRa.Traits.Activities
|
||||
{
|
||||
class Steal : IActivity
|
||||
{
|
||||
Actor target;
|
||||
|
||||
public Steal(Actor target) { this.target = target; }
|
||||
|
||||
public IActivity NextActivity { get; set; }
|
||||
|
||||
public IActivity Tick(Actor self)
|
||||
{
|
||||
if (target == null || target.IsDead) return NextActivity;
|
||||
if (target.Owner == self.Owner) return NextActivity;
|
||||
|
||||
foreach (var t in target.traits.WithInterface<IAcceptThief>())
|
||||
t.OnSteal(target, self);
|
||||
|
||||
Game.world.AddFrameEndTask(w => w.Remove(self));
|
||||
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
public void Cancel(Actor self) { target = null; NextActivity = null; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace OpenRa.Traits
|
||||
public object Create(Actor self) { return new Building(self); }
|
||||
}
|
||||
|
||||
class Building : INotifyDamage, IResolveOrder, ITick
|
||||
public class Building : INotifyDamage, IResolveOrder, ITick
|
||||
{
|
||||
readonly Actor self;
|
||||
public readonly BuildingInfo Info;
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using OpenRa.Traits.Activities;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class C4DemolitionInfo : StatelessTraitInfo<C4Demolition> { }
|
||||
|
||||
class C4Demolition : IIssueOrder, IResolveOrder
|
||||
{
|
||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||
{
|
||||
if (mi.Button != MouseButton.Right) return null;
|
||||
if (underCursor == null) return null;
|
||||
if (underCursor.Owner == self.Owner && !mi.Modifiers.HasModifier(Modifiers.Ctrl)) return null;
|
||||
if (!underCursor.traits.Contains<Building>()) return null;
|
||||
|
||||
return new Order("C4", self, underCursor, int2.Zero, null);
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "C4")
|
||||
{
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new Move(order.TargetActor, 2));
|
||||
self.QueueActivity(new Demolish(order.TargetActor));
|
||||
self.QueueActivity(new Move(self.Location, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.GameRules;
|
||||
using System.Collections.Generic;
|
||||
using OpenRa.Traits.Activities;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
@@ -81,8 +77,8 @@ namespace OpenRa.Traits
|
||||
return PipType.Yellow;
|
||||
if (!a.traits.Contains<AttackBase>())
|
||||
return PipType.Yellow; // noncombat [E6,SPY,THF]
|
||||
if (a.traits.Contains<C4Demolition>())
|
||||
return PipType.Red; // E7
|
||||
|
||||
// todo: fix E7 color again.
|
||||
|
||||
return PipType.Green;
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
using OpenRa.Traits.Activities;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class EngineerCaptureInfo : StatelessTraitInfo<EngineerCapture> { }
|
||||
|
||||
class EngineerCapture : IIssueOrder, IResolveOrder
|
||||
{
|
||||
public const int EngineerDamage = 300; // todo: push into rules, as a weapon
|
||||
|
||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||
{
|
||||
if (mi.Button != MouseButton.Right) return null;
|
||||
if (underCursor == null) return null;
|
||||
if (!underCursor.traits.Contains<Building>()) return null;
|
||||
|
||||
// todo: other bits
|
||||
|
||||
return new Order(underCursor.Health <= EngineerDamage ? "Capture" : "Infiltrate",
|
||||
self, underCursor, int2.Zero, null);
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "Infiltrate" || order.OrderString == "Capture")
|
||||
{
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new Move(order.TargetActor, 1));
|
||||
self.QueueActivity(new CaptureBuilding(order.TargetActor));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class RenderInfantryInfo : RenderSimpleInfo
|
||||
public class RenderInfantryInfo : RenderSimpleInfo
|
||||
{
|
||||
public override object Create(Actor self) { return new RenderInfantry(self); }
|
||||
}
|
||||
|
||||
class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage
|
||||
public class RenderInfantry : RenderSimple, INotifyAttack, INotifyDamage
|
||||
{
|
||||
public RenderInfantry(Actor self)
|
||||
: base(self)
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRa.Graphics;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
abstract class RenderSimpleInfo : ITraitInfo
|
||||
public abstract class RenderSimpleInfo : ITraitInfo
|
||||
{
|
||||
public readonly string Image = null;
|
||||
|
||||
public abstract object Create(Actor self);
|
||||
}
|
||||
|
||||
abstract class RenderSimple : IRender, ITick
|
||||
public abstract class RenderSimple : IRender, ITick
|
||||
{
|
||||
public Dictionary<string, AnimationWithOffset> anims = new Dictionary<string, AnimationWithOffset>();
|
||||
public Animation anim { get { return anims[""].Animation; } protected set { anims[""].Animation = value; } }
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Graphics;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class RenderSpyInfo : RenderInfantryInfo
|
||||
{
|
||||
public override object Create(Actor self) { return new RenderSpy(self); }
|
||||
}
|
||||
|
||||
class RenderSpy : RenderInfantry, IRenderModifier
|
||||
{
|
||||
public RenderSpy(Actor self)
|
||||
: base(self)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||
{
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
return r;
|
||||
|
||||
return r.Select(a => a.WithPalette(Game.LocalPlayer.Palette));
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
{
|
||||
anim.ChangeImage(self.Owner == Game.LocalPlayer ? GetImage(self) : "e1");
|
||||
base.Tick(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Traits.Activities;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class SpyInfo : StatelessTraitInfo<Spy> { }
|
||||
|
||||
class Spy : IIssueOrder, IResolveOrder
|
||||
{
|
||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||
{
|
||||
if (mi.Button != MouseButton.Right) return null;
|
||||
if (underCursor == null) return null;
|
||||
if (underCursor.Owner == self.Owner) return null;
|
||||
if (!underCursor.traits.Contains<IAcceptSpy>()) return null;
|
||||
|
||||
return new Order("Infiltrate", self, underCursor, int2.Zero, null);
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "Infiltrate")
|
||||
{
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new Move(order.TargetActor, 1));
|
||||
self.QueueActivity(new Infiltrate(order.TargetActor));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using OpenRa.Traits.Activities;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class ThiefInfo : StatelessTraitInfo<Thief> { }
|
||||
|
||||
class Thief : IIssueOrder, IResolveOrder
|
||||
{
|
||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||
{
|
||||
if (mi.Button != MouseButton.Right) return null;
|
||||
if (underCursor == null) return null;
|
||||
if (!underCursor.traits.Contains<IAcceptThief>()) return null;
|
||||
|
||||
return new Order("Steal", self, underCursor, int2.Zero, null);
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "Steal")
|
||||
{
|
||||
self.CancelActivity();
|
||||
self.QueueActivity(new Move(order.TargetActor, 1));
|
||||
self.QueueActivity(new Steal(order.TargetActor));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user