Remove legacy 0% = not targetable assumption
This commit is contained in:
@@ -47,17 +47,6 @@ namespace OpenRA.Mods.Common.Warheads
|
|||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This can be removed after the legacy and redundant 0% = not targetable
|
|
||||||
// assumption has been removed from the yaml definitions
|
|
||||||
public override bool CanTargetActor(ActorInfo victim, Actor firedBy)
|
|
||||||
{
|
|
||||||
var health = victim.Traits.GetOrDefault<HealthInfo>();
|
|
||||||
if (health == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return DamageVersus(victim) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
|
public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
|
||||||
{
|
{
|
||||||
// Used by traits that damage a single actor, rather than a position
|
// Used by traits that damage a single actor, rather than a position
|
||||||
|
|||||||
@@ -29,10 +29,6 @@ namespace OpenRA.Mods.Common.Warheads
|
|||||||
|
|
||||||
public readonly WDist Range = WDist.FromCells(1);
|
public readonly WDist Range = WDist.FromCells(1);
|
||||||
|
|
||||||
// TODO: This can be removed after the legacy and redundant 0% = not targetable
|
|
||||||
// assumption has been removed from the yaml definitions
|
|
||||||
public override bool CanTargetActor(ActorInfo victim, Actor firedBy) { return true; }
|
|
||||||
|
|
||||||
public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
|
public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
|
||||||
{
|
{
|
||||||
var actors = target.Type == TargetType.Actor ? new[] { target.Actor } :
|
var actors = target.Type == TargetType.Actor ? new[] { target.Actor } :
|
||||||
|
|||||||
@@ -47,16 +47,9 @@ namespace OpenRA.Mods.Common.Warheads
|
|||||||
/// <summary>Applies the warhead's effect against the target.</summary>
|
/// <summary>Applies the warhead's effect against the target.</summary>
|
||||||
public abstract void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers);
|
public abstract void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers);
|
||||||
|
|
||||||
// TODO: This can be removed after the legacy and redundant 0% = not targetable
|
|
||||||
// assumption has been removed from the yaml definitions
|
|
||||||
public virtual bool CanTargetActor(ActorInfo victim, Actor firedBy) { return false; }
|
|
||||||
|
|
||||||
/// <summary>Checks if the warhead is valid against (can do something to) the actor.</summary>
|
/// <summary>Checks if the warhead is valid against (can do something to) the actor.</summary>
|
||||||
public bool IsValidAgainst(Actor victim, Actor firedBy)
|
public bool IsValidAgainst(Actor victim, Actor firedBy)
|
||||||
{
|
{
|
||||||
if (!CanTargetActor(victim.Info, firedBy))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!AffectsParent && victim == firedBy)
|
if (!AffectsParent && victim == firedBy)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -75,9 +68,6 @@ namespace OpenRA.Mods.Common.Warheads
|
|||||||
/// <summary>Checks if the warhead is valid against (can do something to) the frozen actor.</summary>
|
/// <summary>Checks if the warhead is valid against (can do something to) the frozen actor.</summary>
|
||||||
public bool IsValidAgainst(FrozenActor victim, Actor firedBy)
|
public bool IsValidAgainst(FrozenActor victim, Actor firedBy)
|
||||||
{
|
{
|
||||||
if (!CanTargetActor(victim.Info, firedBy))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// AffectsParent checks do not make sense for FrozenActors, so skip to stance checks
|
// AffectsParent checks do not make sense for FrozenActors, so skip to stance checks
|
||||||
var stance = firedBy.Owner.Stances[victim.Owner];
|
var stance = firedBy.Owner.Stances[victim.Owner];
|
||||||
if (!ValidStances.HasStance(stance))
|
if (!ValidStances.HasStance(stance))
|
||||||
|
|||||||
Reference in New Issue
Block a user