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. */
var modifier = (float)traits.WithInterface<IDamageModifier>()
.Select(t => t.GetDamageModifier()).Product();
.Select(t => t.GetDamageModifier(warhead)).Product();
damage = (int)(damage * modifier);

View File

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

View File

@@ -61,7 +61,7 @@ namespace OpenRA.Traits
public interface IOccupySpace { IEnumerable<int2> OccupiedCells(); }
public interface INotifyAttack { void Attacking(Actor self); }
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 IPowerModifier { float GetPowerModifier(); }
public interface IFirepowerModifier { float GetFirepowerModifier(); }

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;
}
}
}