Merge pull request #9006 from reaperrr/remove-cantarget

Remove legacy 0% = not targetable assumption
This commit is contained in:
Pavel Penev
2015-08-25 20:03:31 +03:00
15 changed files with 54 additions and 111 deletions

View File

@@ -2238,6 +2238,17 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
if (engineVersion < 20150809)
{
// Removed 0% versus armor type = cannot target actor assumptions from warheads
if (depth == 3 && parentKey == "Versus" && node.Value.Value == "0")
{
Console.WriteLine("The '0% versus armor type = cannot target this actor' assumption has been removed.");
Console.WriteLine("If you want to reproduce its behavior, use ValidTargets/InvalidTargets in");
Console.WriteLine("conjunction with one of the Targetable* actor traits.");
}
}
UpgradeWeaponRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}

View File

@@ -47,17 +47,6 @@ namespace OpenRA.Mods.Common.Warheads
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)
{
// Used by traits that damage a single actor, rather than a position

View File

@@ -29,10 +29,6 @@ namespace OpenRA.Mods.Common.Warheads
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)
{
var actors = target.Type == TargetType.Actor ? new[] { target.Actor } :

View File

@@ -47,16 +47,9 @@ namespace OpenRA.Mods.Common.Warheads
/// <summary>Applies the warhead's effect against the target.</summary>
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>
public bool IsValidAgainst(Actor victim, Actor firedBy)
{
if (!CanTargetActor(victim.Info, firedBy))
return false;
if (!AffectsParent && victim == firedBy)
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>
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
var stance = firedBy.Owner.Stances[victim.Owner];
if (!ValidStances.HasStance(stance))