Core: Added the attacker to IDamageModifier' GetDamageModifier

This commit is contained in:
geckosoft
2010-10-25 15:06:36 +02:00
committed by Chris Forbes
parent 2640603f6c
commit e7c61fac5c
8 changed files with 8 additions and 8 deletions

View File

@@ -82,7 +82,7 @@ namespace OpenRA.Traits
/* apply the damage modifiers, if we have any. */ /* apply the damage modifiers, if we have any. */
var modifier = (float)self.TraitsImplementing<IDamageModifier>().Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>()) var modifier = (float)self.TraitsImplementing<IDamageModifier>().Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>())
.Select(t => t.GetDamageModifier(warhead)).Product(); .Select(t => t.GetDamageModifier(attacker, warhead)).Product();
damage = (int)(damage * modifier); damage = (int)(damage * modifier);

View File

@@ -106,7 +106,7 @@ namespace OpenRA.Traits
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( WarheadInfo warhead ); } public interface IDamageModifier { float GetDamageModifier(Actor attacker, WarheadInfo warhead); }
public interface ISpeedModifier { float GetSpeedModifier(); } public interface ISpeedModifier { float GetSpeedModifier(); }
public interface IFirepowerModifier { float GetFirepowerModifier(); } public interface IFirepowerModifier { float GetFirepowerModifier(); }
public interface IPalette { void InitPalette( WorldRenderer wr ); } public interface IPalette { void InitPalette( WorldRenderer wr ); }

View File

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

View File

@@ -69,7 +69,7 @@ namespace OpenRA.Mods.RA
} }
} }
public float GetDamageModifier(WarheadInfo warhead) public float GetDamageModifier(Actor attacker, WarheadInfo warhead)
{ {
return Level > 0 ? 1 / Info.ArmorModifier[Level - 1] : 1; return Level > 0 ? 1 / Info.ArmorModifier[Level - 1] : 1;
} }

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
class Invulnerable : IDamageModifier class Invulnerable : IDamageModifier
{ {
public float GetDamageModifier( WarheadInfo warhead ) public float GetDamageModifier( Actor attacker, WarheadInfo warhead )
{ {
return 0.0f; return 0.0f;
} }

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
RemainingTicks--; RemainingTicks--;
} }
public float GetDamageModifier( WarheadInfo warhead ) public float GetDamageModifier(Actor attacker, WarheadInfo warhead)
{ {
return (RemainingTicks > 0) ? 0.0f : 1.0f; return (RemainingTicks > 0) ? 0.0f : 1.0f;
} }

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA
--remainingProneTime; --remainingProneTime;
} }
public float GetDamageModifier( WarheadInfo warhead ) public float GetDamageModifier(Actor attacker, WarheadInfo warhead )
{ {
return IsProne ? proneDamage : 1f; return IsProne ? proneDamage : 1f;
} }

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
class TeslaInstantKills : IDamageModifier class TeslaInstantKills : IDamageModifier
{ {
public float GetDamageModifier( WarheadInfo warhead ) public float GetDamageModifier(Actor attacker, WarheadInfo warhead )
{ {
if( warhead != null && warhead.InfDeath == 5 ) if( warhead != null && warhead.InfDeath == 5 )
return 1000f; return 1000f;