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

@@ -177,7 +177,7 @@ namespace OpenRA
/* apply the damage modifiers, if we have any. */ /* apply the damage modifiers, if we have any. */
var modifier = (float)traits.WithInterface<IDamageModifier>() var modifier = (float)traits.WithInterface<IDamageModifier>()
.Select(t => t.GetDamageModifier()).Product(); .Select(t => t.GetDamageModifier(warhead)).Product();
damage = (int)(damage * modifier); damage = (int)(damage * modifier);

View File

@@ -18,6 +18,8 @@
*/ */
#endregion #endregion
using OpenRA.GameRules;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
class TakeCoverInfo : ITraitInfo class TakeCoverInfo : ITraitInfo
@@ -51,7 +53,7 @@ namespace OpenRA.Traits
--remainingProneTime; --remainingProneTime;
} }
public float GetDamageModifier() public float GetDamageModifier( WarheadInfo warhead )
{ {
return IsProne ? proneDamage : 1f; return IsProne ? proneDamage : 1f;
} }

View File

@@ -61,7 +61,7 @@ namespace OpenRA.Traits
public interface IOccupySpace { IEnumerable<int2> OccupiedCells(); } public interface IOccupySpace { IEnumerable<int2> OccupiedCells(); }
public interface INotifyAttack { void Attacking(Actor self); } public interface INotifyAttack { void Attacking(Actor self); }
public interface IRenderModifier { IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r); } public interface IRenderModifier { IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r); }
public interface IDamageModifier { float GetDamageModifier(); } public interface IDamageModifier { float GetDamageModifier( WarheadInfo warhead ); }
public interface ISpeedModifier { float GetSpeedModifier(); } public interface ISpeedModifier { float GetSpeedModifier(); }
public interface IPowerModifier { float GetPowerModifier(); } public interface IPowerModifier { float GetPowerModifier(); }
public interface IFirepowerModifier { float GetFirepowerModifier(); } public interface IFirepowerModifier { float GetFirepowerModifier(); }

View File

@@ -18,6 +18,7 @@
*/ */
#endregion #endregion
using OpenRA.GameRules;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
@@ -49,6 +50,6 @@ namespace OpenRA.Mods.RA
{ {
float multiplier; float multiplier;
public ArmorUpgrade(float multiplier) { this.multiplier = 1/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 ) public void Tick( World world )
{ {
if (a.IsDead || b.GetDamageModifier() > 0) if (a.IsDead || b.GetDamageModifier(null) > 0)
world.AddFrameEndTask(w => w.Remove(this)); world.AddFrameEndTask(w => w.Remove(this));
} }

View File

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

View File

@@ -1,17 +1,15 @@
using System; using OpenRA.GameRules;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Mods.RA 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 ) if( warhead.InfDeath == 5 )
self.Health = 0; return 1000f;
return 1f;
} }
} }
} }