Remove passing the warheads from DamageWarhead to AttackInfo.
Added a Damage class to pass damage value and damage(types) instead. This removes a great amount of overhead and longterm opens possibilities to have damagetypes without warheads.
This commit is contained in:
@@ -317,12 +317,12 @@ namespace OpenRA
|
||||
return (health == null) ? DamageState.Undamaged : health.DamageState;
|
||||
}
|
||||
|
||||
public void InflictDamage(Actor attacker, int damage, IWarhead warhead)
|
||||
public void InflictDamage(Actor attacker, Damage damage)
|
||||
{
|
||||
if (Disposed || health == null)
|
||||
return;
|
||||
|
||||
health.InflictDamage(this, attacker, damage, warhead, false);
|
||||
health.InflictDamage(this, attacker, damage, false);
|
||||
}
|
||||
|
||||
public void Kill(Actor attacker)
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Traits
|
||||
int DisplayHP { get; }
|
||||
bool IsDead { get; }
|
||||
|
||||
void InflictDamage(Actor self, Actor attacker, int damage, IWarhead warhead, bool ignoreModifiers);
|
||||
void InflictDamage(Actor self, Actor attacker, Damage damage, bool ignoreModifiers);
|
||||
void Kill(Actor self, Actor attacker);
|
||||
}
|
||||
|
||||
@@ -82,13 +82,30 @@ namespace OpenRA.Traits
|
||||
|
||||
public class AttackInfo
|
||||
{
|
||||
public int Damage;
|
||||
public Damage Damage;
|
||||
public Actor Attacker;
|
||||
public IWarhead Warhead;
|
||||
public DamageState DamageState;
|
||||
public DamageState PreviousDamageState;
|
||||
}
|
||||
|
||||
public class Damage
|
||||
{
|
||||
public readonly int Value;
|
||||
public readonly HashSet<string> DamageTypes;
|
||||
|
||||
public Damage(int damage, HashSet<string> damageTypes)
|
||||
{
|
||||
Value = damage;
|
||||
DamageTypes = damageTypes;
|
||||
}
|
||||
|
||||
public Damage(int damage)
|
||||
{
|
||||
Value = damage;
|
||||
DamageTypes = new HashSet<string>();
|
||||
}
|
||||
}
|
||||
|
||||
public interface ITick { void Tick(Actor self); }
|
||||
public interface ITickRender { void TickRender(WorldRenderer wr, Actor self); }
|
||||
public interface IRender { IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr); }
|
||||
@@ -249,7 +266,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
public interface IRenderModifier { IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r); }
|
||||
public interface IDamageModifier { int GetDamageModifier(Actor attacker, IWarhead warhead); }
|
||||
public interface IDamageModifier { int GetDamageModifier(Actor attacker, Damage damage); }
|
||||
public interface ISpeedModifier { int GetSpeedModifier(); }
|
||||
public interface IFirepowerModifier { int GetFirepowerModifier(); }
|
||||
public interface IReloadModifier { int GetReloadModifier(); }
|
||||
|
||||
Reference in New Issue
Block a user