spy behavior
This commit is contained in:
@@ -166,6 +166,7 @@
|
|||||||
<Compile Include="Graphics\OverlayRenderer.cs" />
|
<Compile Include="Graphics\OverlayRenderer.cs" />
|
||||||
<Compile Include="Graphics\WorldRenderer.cs" />
|
<Compile Include="Graphics\WorldRenderer.cs" />
|
||||||
<Compile Include="Traits\Activities\Idle.cs" />
|
<Compile Include="Traits\Activities\Idle.cs" />
|
||||||
|
<Compile Include="Traits\Activities\Infiltrate.cs" />
|
||||||
<Compile Include="Traits\Activities\Land.cs" />
|
<Compile Include="Traits\Activities\Land.cs" />
|
||||||
<Compile Include="Traits\Activities\Rearm.cs" />
|
<Compile Include="Traits\Activities\Rearm.cs" />
|
||||||
<Compile Include="Traits\Activities\Repair.cs" />
|
<Compile Include="Traits\Activities\Repair.cs" />
|
||||||
@@ -244,6 +245,7 @@
|
|||||||
<Compile Include="Traits\Repairable.cs" />
|
<Compile Include="Traits\Repairable.cs" />
|
||||||
<Compile Include="Traits\Reservable.cs" />
|
<Compile Include="Traits\Reservable.cs" />
|
||||||
<Compile Include="Traits\Selectable.cs" />
|
<Compile Include="Traits\Selectable.cs" />
|
||||||
|
<Compile Include="Traits\Spy.cs" />
|
||||||
<Compile Include="Traits\SquishByTank.cs" />
|
<Compile Include="Traits\SquishByTank.cs" />
|
||||||
<Compile Include="Traits\Plane.cs" />
|
<Compile Include="Traits\Plane.cs" />
|
||||||
<Compile Include="Traits\ProductionQueue.cs" />
|
<Compile Include="Traits\ProductionQueue.cs" />
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ namespace OpenRa.Game.Traits.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// the engineer is sacrificed.
|
// the engineer is sacrificed.
|
||||||
self.Health = 0;
|
|
||||||
Game.world.AddFrameEndTask(w => w.Remove(self));
|
Game.world.AddFrameEndTask(w => w.Remove(self));
|
||||||
|
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|||||||
25
OpenRa.Game/Traits/Activities/Infiltrate.cs
Normal file
25
OpenRa.Game/Traits/Activities/Infiltrate.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
namespace OpenRa.Game.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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace OpenRa.Game.Traits.Activities
|
namespace OpenRa.Game.Traits.Activities
|
||||||
{
|
{
|
||||||
class Steal : IActivity
|
class Steal : IActivity
|
||||||
@@ -21,6 +17,8 @@ namespace OpenRa.Game.Traits.Activities
|
|||||||
foreach (var t in target.traits.WithInterface<IAcceptThief>())
|
foreach (var t in target.traits.WithInterface<IAcceptThief>())
|
||||||
t.OnSteal(target, self);
|
t.OnSteal(target, self);
|
||||||
|
|
||||||
|
Game.world.AddFrameEndTask(w => w.Remove(self));
|
||||||
|
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
32
OpenRa.Game/Traits/Spy.cs
Normal file
32
OpenRa.Game/Traits/Spy.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using OpenRa.Game.Traits.Activities;
|
||||||
|
|
||||||
|
namespace OpenRa.Game.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.traits.WithInterface<IAcceptSpy>().Any()) 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,10 +20,6 @@ namespace OpenRa.Game.Traits
|
|||||||
|
|
||||||
if (Game.LocalPlayer == thief.Owner)
|
if (Game.LocalPlayer == thief.Owner)
|
||||||
Sound.Play("credit1.aud");
|
Sound.Play("credit1.aud");
|
||||||
|
|
||||||
// the thief is sacrificed.
|
|
||||||
thief.Health = 0;
|
|
||||||
Game.world.AddFrameEndTask(w => w.Remove(thief));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<PipType> GetPips(Actor self)
|
public IEnumerable<PipType> GetPips(Actor self)
|
||||||
@@ -33,7 +29,6 @@ namespace OpenRa.Game.Traits
|
|||||||
return Graphics.Util.MakeArray( numPips,
|
return Graphics.Util.MakeArray( numPips,
|
||||||
i => (Game.LocalPlayer.GetSiloFullness() > i * 1.0f / numPips)
|
i => (Game.LocalPlayer.GetSiloFullness() > i * 1.0f / numPips)
|
||||||
? PipType.Yellow : PipType.Transparent );
|
? PipType.Yellow : PipType.Transparent );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using IjwFramework.Types;
|
||||||
using OpenRa.Game.GameRules;
|
using OpenRa.Game.GameRules;
|
||||||
using OpenRa.Game.Graphics;
|
using OpenRa.Game.Graphics;
|
||||||
using IjwFramework.Types;
|
|
||||||
|
|
||||||
namespace OpenRa.Game.Traits
|
namespace OpenRa.Game.Traits
|
||||||
{
|
{
|
||||||
@@ -21,7 +21,9 @@ namespace OpenRa.Game.Traits
|
|||||||
interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||||
interface INotifyBuildComplete { void BuildingComplete (Actor self); }
|
interface INotifyBuildComplete { void BuildingComplete (Actor self); }
|
||||||
interface INotifyProduction { void UnitProduced(Actor self, Actor other); }
|
interface INotifyProduction { void UnitProduced(Actor self, Actor other); }
|
||||||
|
|
||||||
interface IAcceptThief { void OnSteal(Actor self, Actor thief); }
|
interface IAcceptThief { void OnSteal(Actor self, Actor thief); }
|
||||||
|
interface IAcceptSpy { void OnInfiltrate(Actor self, Actor spy); }
|
||||||
|
|
||||||
interface IProducer
|
interface IProducer
|
||||||
{
|
{
|
||||||
|
|||||||
1
ra.yaml
1
ra.yaml
@@ -2130,6 +2130,7 @@ SPY:
|
|||||||
Sight: 5
|
Sight: 5
|
||||||
Speed: 4
|
Speed: 4
|
||||||
TakeCover:
|
TakeCover:
|
||||||
|
Spy:
|
||||||
-AutoTarget:
|
-AutoTarget:
|
||||||
|
|
||||||
THF:
|
THF:
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ SelectionSize=12,17,0,-9
|
|||||||
[SPY]
|
[SPY]
|
||||||
Description=Spy
|
Description=Spy
|
||||||
Voice=SpyVoice
|
Voice=SpyVoice
|
||||||
Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank, Passenger
|
Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank, Passenger, Spy
|
||||||
LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
|
LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
|
||||||
SelectionSize=12,17,0,-9
|
SelectionSize=12,17,0,-9
|
||||||
[THF]
|
[THF]
|
||||||
|
|||||||
Reference in New Issue
Block a user