husks are invalid targets

This commit is contained in:
Matthias Mailänder
2013-03-06 11:35:21 +01:00
parent 5d2b704608
commit f6d4b860ee
2 changed files with 8 additions and 6 deletions

View File

@@ -150,7 +150,8 @@ namespace OpenRA.Mods.RA.AI
public bool TargetIsValid public bool TargetIsValid
{ {
get { return (target != null && !target.IsDead() && !target.Destroyed && target.IsInWorld); } get { return (target != null && !target.IsDead() && !target.Destroyed
&& target.IsInWorld && !target.HasTrait<Husk>()); }
} }
//********************************************************************************** //**********************************************************************************
@@ -508,7 +509,8 @@ namespace OpenRA.Mods.RA.AI
var enemyUnits = owner.world.FindUnitsInCircle(owner.Target.CenterLocation, Game.CellSize * 10) var enemyUnits = owner.world.FindUnitsInCircle(owner.Target.CenterLocation, Game.CellSize * 10)
.Where(unit => owner.bot.p.Stances[unit.Owner] == Stance.Enemy).ToList(); .Where(unit => owner.bot.p.Stances[unit.Owner] == Stance.Enemy).ToList();
if (enemyUnits.Any()) if (enemyUnits.Any())
{
{
owner.attackOrFleeFuzzy.CalculateFuzzy(owner.units, enemyUnits); owner.attackOrFleeFuzzy.CalculateFuzzy(owner.units, enemyUnits);
if (owner.attackOrFleeFuzzy.CanAttack) if (owner.attackOrFleeFuzzy.CanAttack)
{ {
@@ -1178,8 +1180,8 @@ namespace OpenRA.Mods.RA.AI
foreach (var a in unitsHangingAroundTheBase) foreach (var a in unitsHangingAroundTheBase)
if (!a.HasTrait<Aircraft>()) if (!a.HasTrait<Aircraft>())
attackForce.units.Add(a); attackForce.units.Add(a);
unitsHangingAroundTheBase.Clear(); unitsHangingAroundTheBase.Clear();
} }
} }
void TryToRushAttack() void TryToRushAttack()

View File

@@ -27,8 +27,8 @@ namespace OpenRA.Mods.RA.AI
"and ((EnemyHealth is NearDead) or (EnemyHealth is Injured) or (EnemyHealth is Normal)) " + "and ((EnemyHealth is NearDead) or (EnemyHealth is Injured) or (EnemyHealth is Normal)) " +
"and (RelativeAttackPower is Strong) " + "and (RelativeAttackPower is Strong) " +
"and ((RelativeSpeed is Slow) or (RelativeSpeed is Equal) or (RelativeSpeed is Fast))) " + "and ((RelativeSpeed is Slow) or (RelativeSpeed is Equal) or (RelativeSpeed is Fast))) " +
"then AttackOrFlee is Attack")); "then AttackOrFlee is Attack"));
fuzzyEngine.Rules.Add(fuzzyEngine.ParseRule("if ((OwnHealth is Normal) " + fuzzyEngine.Rules.Add(fuzzyEngine.ParseRule("if ((OwnHealth is Normal) " +
"and ((EnemyHealth is NearDead) or (EnemyHealth is Injured) or (EnemyHealth is Normal)) " + "and ((EnemyHealth is NearDead) or (EnemyHealth is Injured) or (EnemyHealth is Normal)) " +
"and ((RelativeAttackPower is Weak) or (RelativeAttackPower is Equal)) " + "and ((RelativeAttackPower is Weak) or (RelativeAttackPower is Equal)) " +