Group bot AttackMove orders.
This commit is contained in:
@@ -53,8 +53,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
|
|
||||||
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
|
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
|
||||||
{
|
{
|
||||||
foreach (var u in owner.Units)
|
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||||
owner.Bot.QueueOrder(new Order("AttackMove", u, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
|
||||||
|
|
||||||
// We have gathered sufficient units. Attack the nearest enemy unit.
|
// We have gathered sufficient units. Attack the nearest enemy unit.
|
||||||
owner.FuzzyStateMachine.ChangeState(owner, new GroundUnitsAttackMoveState(), true);
|
owner.FuzzyStateMachine.ChangeState(owner, new GroundUnitsAttackMoveState(), true);
|
||||||
@@ -124,8 +123,9 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
// Since units have different movement speeds, they get separated while approaching the target.
|
// Since units have different movement speeds, they get separated while approaching the target.
|
||||||
// Let them regroup into tighter formation.
|
// Let them regroup into tighter formation.
|
||||||
owner.Bot.QueueOrder(new Order("Stop", leader, false));
|
owner.Bot.QueueOrder(new Order("Stop", leader, false));
|
||||||
foreach (var unit in owner.Units.Where(a => !ownUnits.Contains(a)))
|
|
||||||
owner.Bot.QueueOrder(new Order("AttackMove", unit, Target.FromCell(owner.World, leader.Location), false));
|
var units = owner.Units.Where(a => !ownUnits.Contains(a)).ToArray();
|
||||||
|
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, leader.Location), false, groupedActors: units));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -138,8 +138,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
owner.FuzzyStateMachine.ChangeState(owner, new GroundUnitsAttackState(), true);
|
owner.FuzzyStateMachine.ChangeState(owner, new GroundUnitsAttackState(), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
foreach (var a in owner.Units)
|
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||||
owner.Bot.QueueOrder(new Order("AttackMove", a, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldFlee(owner))
|
if (ShouldFlee(owner))
|
||||||
|
|||||||
@@ -78,8 +78,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
|
|
||||||
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
|
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
|
||||||
{
|
{
|
||||||
foreach (var u in owner.Units)
|
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||||
owner.Bot.QueueOrder(new Order("AttackMove", u, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
|
||||||
|
|
||||||
// We have gathered sufficient units. Attack the nearest enemy unit.
|
// We have gathered sufficient units. Attack the nearest enemy unit.
|
||||||
owner.FuzzyStateMachine.ChangeState(owner, new NavyUnitsAttackMoveState(), true);
|
owner.FuzzyStateMachine.ChangeState(owner, new NavyUnitsAttackMoveState(), true);
|
||||||
@@ -149,8 +148,9 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
// Since units have different movement speeds, they get separated while approaching the target.
|
// Since units have different movement speeds, they get separated while approaching the target.
|
||||||
// Let them regroup into tighter formation.
|
// Let them regroup into tighter formation.
|
||||||
owner.Bot.QueueOrder(new Order("Stop", leader, false));
|
owner.Bot.QueueOrder(new Order("Stop", leader, false));
|
||||||
foreach (var unit in owner.Units.Where(a => !ownUnits.Contains(a)))
|
|
||||||
owner.Bot.QueueOrder(new Order("AttackMove", unit, Target.FromCell(owner.World, leader.Location), false));
|
var units = owner.Units.Where(a => !ownUnits.Contains(a)).ToArray();
|
||||||
|
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, leader.Location), false, groupedActors: units));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -163,8 +163,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
owner.FuzzyStateMachine.ChangeState(owner, new NavyUnitsAttackState(), true);
|
owner.FuzzyStateMachine.ChangeState(owner, new NavyUnitsAttackState(), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
foreach (var a in owner.Units)
|
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||||
owner.Bot.QueueOrder(new Order("AttackMove", a, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldFlee(owner))
|
if (ShouldFlee(owner))
|
||||||
|
|||||||
@@ -55,10 +55,7 @@ namespace OpenRA.Mods.Common.Traits.BotModules.Squads
|
|||||||
Backoff--;
|
Backoff--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
owner.Bot.QueueOrder(new Order("AttackMove", null, Target.FromCell(owner.World, owner.TargetActor.Location), false, groupedActors: owner.Units.ToArray()));
|
||||||
foreach (var a in owner.Units)
|
|
||||||
owner.Bot.QueueOrder(new Order("AttackMove", a, Target.FromCell(owner.World, owner.TargetActor.Location), false));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate(Squad owner) { }
|
public void Deactivate(Squad owner) { }
|
||||||
|
|||||||
Reference in New Issue
Block a user