invuln moved to mod
This commit is contained in:
35
OpenRa.Mods.RA/IronCurtainable.cs
Normal file
35
OpenRa.Mods.RA/IronCurtainable.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Linq;
|
||||
using OpenRa.Effects;
|
||||
using OpenRa.Traits;
|
||||
using OpenRa.Mods.RA.Effects;
|
||||
|
||||
namespace OpenRa.Mods.RA
|
||||
{
|
||||
class IronCurtainableInfo : ITraitInfo
|
||||
{
|
||||
public object Create(Actor self) { return new IronCurtainable(); }
|
||||
}
|
||||
|
||||
class IronCurtainable : IDamageModifier, ITick
|
||||
{
|
||||
[Sync]
|
||||
int RemainingTicks = 0;
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (RemainingTicks > 0)
|
||||
RemainingTicks--;
|
||||
}
|
||||
|
||||
public float GetDamageModifier()
|
||||
{
|
||||
return (RemainingTicks > 0) ? 0.0f : 1.0f;
|
||||
}
|
||||
|
||||
public void Activate(Actor self, int duration)
|
||||
{
|
||||
self.World.AddFrameEndTask(w => w.Add(new InvulnEffect(self)));
|
||||
RemainingTicks = duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user