did tesla instakill via damagemodifier instead

This commit is contained in:
Bob
2010-05-13 18:06:20 +12:00
parent 8aad7f8350
commit 823d7d44a9
7 changed files with 16 additions and 14 deletions

View File

@@ -18,6 +18,7 @@
*/
#endregion
using OpenRA.GameRules;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
@@ -49,6 +50,6 @@ namespace OpenRA.Mods.RA
{
float multiplier;
public ArmorUpgrade(float multiplier) { this.multiplier = 1/multiplier; }
public float GetDamageModifier() { return multiplier; }
public float GetDamageModifier( WarheadInfo warhead ) { return multiplier; }
}
}

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Mods.RA.Effects
public void Tick( World world )
{
if (a.IsDead || b.GetDamageModifier() > 0)
if (a.IsDead || b.GetDamageModifier(null) > 0)
world.AddFrameEndTask(w => w.Remove(this));
}

View File

@@ -18,6 +18,7 @@
*/
#endregion
using OpenRA.GameRules;
using OpenRA.Mods.RA.Effects;
using OpenRA.Traits;
@@ -39,7 +40,7 @@ namespace OpenRA.Mods.RA
RemainingTicks--;
}
public float GetDamageModifier()
public float GetDamageModifier( WarheadInfo warhead )
{
return (RemainingTicks > 0) ? 0.0f : 1.0f;
}

View File

@@ -1,17 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRA.GameRules;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
class TeslaInstantKills : INotifyDamage
class TeslaInstantKills : IDamageModifier
{
public void Damaged( Actor self, AttackInfo e )
public float GetDamageModifier( WarheadInfo warhead )
{
if( e.Warhead.InfDeath == 5 )
self.Health = 0;
if( warhead.InfDeath == 5 )
return 1000f;
return 1f;
}
}
}