Drop targets when switching to a more restrictive stance.

This commit is contained in:
Paul Chote
2019-05-19 16:29:59 +01:00
committed by abcdefg30
parent 62b5d22e53
commit 3ca9d4b773
10 changed files with 233 additions and 18 deletions

View File

@@ -313,6 +313,25 @@ namespace OpenRA.Mods.Common.Traits
ab.AttackTarget(target, false, allowMove);
}
public bool HasValidTargetPriority(Actor self, Player owner, BitSet<TargetableType> targetTypes)
{
if (Stance <= UnitStance.ReturnFire)
return false;
return activeTargetPriorities.Any(ati =>
{
// Incompatible stances
if (!ati.ValidStances.HasStance(self.Owner.Stances[owner]))
return false;
// Incompatible target types
if (!ati.ValidTargets.Overlaps(targetTypes) || ati.InvalidTargets.Overlaps(targetTypes))
return false;
return true;
});
}
Target ChooseTarget(Actor self, AttackBase ab, Stance attackStances, WDist scanRange, bool allowMove, bool allowTurn)
{
var chosenTarget = Target.Invalid;