Core: Added the attacker to IDamageModifier' GetDamageModifier
This commit is contained in:
@@ -82,7 +82,7 @@ namespace OpenRA.Traits
|
||||
|
||||
/* apply the damage modifiers, if we have any. */
|
||||
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);
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public interface INotifyAttack { void Attacking(Actor self); }
|
||||
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 IFirepowerModifier { float GetFirepowerModifier(); }
|
||||
public interface IPalette { void InitPalette( WorldRenderer wr ); }
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
class Invulnerable : IDamageModifier
|
||||
{
|
||||
public float GetDamageModifier( WarheadInfo warhead )
|
||||
public float GetDamageModifier( Actor attacker, WarheadInfo warhead )
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
||||
RemainingTicks--;
|
||||
}
|
||||
|
||||
public float GetDamageModifier( WarheadInfo warhead )
|
||||
public float GetDamageModifier(Actor attacker, WarheadInfo warhead)
|
||||
{
|
||||
return (RemainingTicks > 0) ? 0.0f : 1.0f;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA
|
||||
--remainingProneTime;
|
||||
}
|
||||
|
||||
public float GetDamageModifier( WarheadInfo warhead )
|
||||
public float GetDamageModifier(Actor attacker, WarheadInfo warhead )
|
||||
{
|
||||
return IsProne ? proneDamage : 1f;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
class TeslaInstantKills : IDamageModifier
|
||||
{
|
||||
public float GetDamageModifier( WarheadInfo warhead )
|
||||
public float GetDamageModifier(Actor attacker, WarheadInfo warhead )
|
||||
{
|
||||
if( warhead != null && warhead.InfDeath == 5 )
|
||||
return 1000f;
|
||||
|
||||
Reference in New Issue
Block a user