Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Onslaught.ONSSquadAI


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
class ONSSquadAI extends SquadAI;

var bool bDefendingSquad;
var float LastFailedNodeTeleportTime;
var float MaxObjectiveGetOutDist; //cached highest ObjectiveGetOutDist of all the vehicles available on this level

function Reset()
{
	Super.Reset();
	bDefendingSquad = false;
}

function name GetOrders()
{
	local name NewOrders;

	if ( PlayerController(SquadLeader) != None )
		NewOrders = 'Human';
	else if ( bFreelance && !bFreelanceAttack && !bFreelanceDefend )
		NewOrders = 'Freelance';
	else if ( bDefendingSquad || bFreelanceDefend || (SquadObjective != None && SquadObjective.DefenseSquad == self) )
		NewOrders = 'Defend';
	else
		NewOrders = 'Attack';
	if ( NewOrders != CurrentOrders )
	{
		CurrentOrders = NewOrders;
		NetUpdateTime = Level.Timeseconds - 1;
	}
	return CurrentOrders;
}

function byte PriorityObjective(Bot B)
{
	local ONSPowerCore Core;

	if (GetOrders() == 'Defend')
	{
		Core = ONSPowerCore(SquadObjective);
		if (Core != None && (Core.DefenderTeamIndex == Team.TeamIndex) && Core.bUnderAttack)
			return 1;
	}
	else if (CurrentOrders == 'Attack')
	{
		Core = ONSPowerCore(SquadObjective);
		if (Core != None)
		{
			if (Core.bFinalCore)
			{
				if (B.Enemy != None && Core.BotNearObjective(B))
					return 1;
			}
			else if (VSize(B.Pawn.Location - Core.Location) < 1000)
				return 1;
		}
	}
	return 0;
}

function SetDefenseScriptFor(Bot B)
{
	local ONSPowerCore Core;

	//don't look for defense scripts when heading for neutral node
	Core = ONSPowerCore(SquadObjective);
	if (Core == None || (Core.DefenderTeamIndex == Team.TeamIndex && (Core.CoreStage == 2 || Core.CoreStage == 0)) )
	{
		Super.SetDefenseScriptFor(B);
		return;
	}

	if (B.GoalScript != None)
		B.FreeScript();
}

function float MaxVehicleDist(Pawn P)
{
	if ( GetOrders() != 'Attack' || SquadObjective == None )
		return 3000;
	return FMin(3000, VSize(P.Location - SquadObjective.Location));
}

/* FindPathToObjective()
Returns path a bot should use moving toward a base
*/
function bool FindPathToObjective(Bot B, Actor O)
{
	local vehicle OldVehicle;

	if ( B.Pawn.bStationary )
		return false;

	if ( O == None )
	{
		O = SquadObjective;
		if ( O == None )
		{
			B.GoalString = "No SquadObjective";
			return false;
		}
	}

	if ( ONSPowerNode(O) != None && (ONSPowerNode(O).CoreStage != 0 || ONSPowerCore(O).DefenderTeamIndex == Team.TeamIndex) )
	{
		B.MoveTarget = None;
		if ( (Vehicle(B.Pawn) != None) && (B.Pawn.Location.Z - O.Location.Z < 500)
		     && (VSize(B.Pawn.Location - O.Location) < Vehicle(B.Pawn).ObjectiveGetOutDist) && B.LineOfSightTo(O) )
		{
			if ( Vehicle(B.Pawn).bKeyVehicle )
				return false;
			OldVehicle = Vehicle(B.Pawn);
			B.DirectionHint = Normal(O.Location - OldVehicle.Location);
			Vehicle(B.Pawn).KDriverLeave(false);
			if (  Vehicle(B.Pawn) == None )
			{
				if ( ONSChopperCraft(OldVehicle) != None )
				{
					OldVehicle.KAddImpulse( ONSChopperCraft(OldVehicle).PushForce*Vector(OldVehicle.Rotation), OldVehicle.Location );
				}
				if ( (B.Pawn.Physics == PHYS_Falling) && B.DoWaitForLanding() )
				{
					B.Pawn.Velocity.Z = 0;
					return true;
				}
			}
		}

		if ( B.ActorReachable(O) )
		{
			if ( (Vehicle(B.Pawn) != None) && Vehicle(B.Pawn).bKeyVehicle )
				return false;
			if ( (Vehicle(B.Pawn) != None) && (B.Pawn.Location.Z - O.Location.Z < 500) )
			{
				B.DirectionHint = Normal(O.Location - B.Pawn.Location);
				Vehicle(B.Pawn).KDriverLeave(false);
			}
			if ( B.Pawn.ReachedDestination(O) )
			{
				//log(B.GetHumanReadableName()$" Force touch for reached objective");
				O.Touch(B.Pawn);
				return false;
			}
			if ( OldVehicle != None )
				OldVehicle.TeamUseTime = Level.TimeSeconds + 6;
			B.RouteGoal = O;
			B.RouteCache[0] = None;
			B.GoalString = "almost at "$O;
			B.MoveTarget = O;
			B.SetAttractionState();
			return true;
		}
		if ( OldVehicle != None )
			OldVehicle.UsedBy(B.Pawn);
	}

	if ( Super.FindPathToObjective(B,O) )
		return true;

	if ( Vehicle(B.Pawn) != None && !Vehicle(B.Pawn).bKeyVehicle && (B.Enemy == None || !B.EnemyVisible()) )
	{
		if (B.Pawn.HasWeapon() && Vehicle(B.Pawn).MaxDesireability > 0.5)
			Vehicle(B.Pawn).bDefensive = true; //have bots use it as a turret instead
		else
			Vehicle(B.Pawn).VehicleLostTime = Level.TimeSeconds + 20;
		//log(B.PlayerReplicationInfo.PlayerName$" Abandoning "$Vehicle(B.Pawn)$" because can't reach "$O);
		B.DirectionHint = Normal(O.Location - B.Pawn.Location);
		Vehicle(B.Pawn).KDriverLeave(false);
	}
	return false;
}

function bool CheckVehicle(Bot B)
{
	local ONSPowerCore Nearest, Best, Core;
	local GameObjective O;
	local float NewRating, BestRating;
	local byte SourceDist;
	local weapon SuperWeap;
	local int i;
	local Vehicle V;

	if ( (ONSVehicle(B.Pawn) != None) && ((B.Skill + B.Tactics >= 3) || ONSVehicle(B.Pawn).bKeyVehicle) && ONSVehicle(B.Pawn).IsArtillery() )
	{
		if ( ONSVehicle(B.Pawn).IsDeployed() )
		{
			// if possible, just target and fire at nodes or important enemies
			if ( (SquadObjective != None) && (SquadObjective.DefenderTeamIndex != Team.TeamIndex) && (ONSPowerCore(SquadObjective) != None)
				&& ONSPowerCore(SquadObjective).LegitimateTargetOf(B) && B.Pawn.CanAttack(SquadObjective) )
			{
				B.DoRangedAttackOn(SquadObjective);
				B.GoalString = "Artillery Attack Objective";
				return true;
			}
			if ( (B.Enemy != None) && B.Pawn.CanAttack(B.Enemy) )
			{
				B.DoRangedAttackOn(B.Enemy);
				B.GoalString = "Artillery Attack Enemy";
				return true;
			}
			// check squad enemies
			for ( i=0; i<8; i++ )
			{
				if ( (Enemies[i] != None) && (Enemies[i] != B.Enemy) && B.Pawn.CanAttack(Enemies[i]) ) 
				{
					B.DoRangedAttackOn(Enemies[i]);
					B.GoalString = "Artillery Attack Squad Enemy";
					return true;
				}
			}
			// check other nodes
			for ( O=Team.AI.Objectives; O!=None; O=O.NextObjective )
			{
				Core = ONSPowerCore(O);
				if ( (Core != None) && Core.PoweredBy(Team.TeamIndex) && (Core.DefenderTeamIndex != Team.TeamIndex) && Core.LegitimateTargetOf(B) && B.Pawn.CanAttack(Core) )
				{
					B.DoRangedAttackOn(Core);
					B.GoalString = "Artillery Attack Other Node";
					return true;
				}
			}

			// check important enemies
			for ( V=Level.Game.VehicleList; V!=None; V=V.NextVehicle )
			{
				if ( (V.Controller != None) && !V.bCanFly && (V.ImportantVehicle() || V.IsArtillery()) && !V.Controller.SameTeamAs(B) && B.Pawn.CanAttack(V) )
				{
					B.DoRangedAttackOn(V);
					B.GoalString = "Artillery Attack important vehicle";
					return true;
				}
			}
			if ( (VSize(B.Pawn.Location - SquadObjective.Location) > Vehicle(B.Pawn).ObjectiveGetOutDist) || !B.Pawn.CanAttack(SquadObjective) )
				ONSVehicle(B.Pawn).MayUndeploy();
		}
		else if ( !B.Pawn.IsFiring() && (B.Enemy != None) && B.Pawn.CanAttack(B.Enemy) )
		{
			B.Focus = B.Enemy;
			B.FireWeaponAt(B.Enemy);
		}
	}

	if ( SquadObjective != None )
	{
		if ( GetOrders() == 'Attack' )
		{
			if ( (ONSPowerCore(SquadObjective) != None) && ONSPowerCore(SquadObjective).PoweredBy(1 - Team.TeamIndex)
				&& ((Vehicle(B.Pawn) == None) || !Vehicle(B.Pawn).bKeyVehicle) )
			{
				SuperWeap = B.HasSuperWeapon();
				if ( (SuperWeap != None) &&  B.LineOfSightTo(SquadObjective) )
				{
					if ( Vehicle(B.Pawn) != None )
					{
						B.DirectionHint = Normal(SquadObjective.Location - B.Pawn.Location);
	     				Vehicle(B.Pawn).KDriverLeave(false);
					}
	     			return SquadObjective.TellBotHowToDisable(B);
				}
			}			
		}
		else if ( Vehicle(B.Pawn) != None && GetOrders() == 'Defend' && !Vehicle(B.Pawn).bDefensive
			&& VSize(B.Pawn.Location - SquadObjective.Location) < 1600 && !Vehicle(B.Pawn).bKeyVehicle 
			&& ((B.Enemy == None) || (Level.TimeSeconds - B.LastSeenTime > 4) || (!Vehicle(B.Pawn).ImportantVehicle() && !B.EnemyVisible())) )
		{
				B.DirectionHint = Normal(SquadObjective.Location - B.Pawn.Location);
	     		Vehicle(B.Pawn).KDriverLeave(false);
	     		return false;
		}
	}	
	if (Vehicle(B.Pawn) == None && ONSPowerCore(SquadObjective) != None)
	{
		if (ONSPowerCore(SquadObjective).CoreStage == 0)
		{
			if ( GetOrders() == 'Defend' && (B.Enemy == None || (!B.EnemyVisible() && Level.TimeSeconds - B.LastSeenTime > 3))
			     && VSize(B.Pawn.Location - SquadObjective.Location) < GetMaxObjectiveGetOutDist()
			     && ONSPowerCore(SquadObjective).Health < ONSPowerCore(SquadObjective).DamageCapacity
			     && ((B.Pawn.Weapon != None && B.Pawn.Weapon.CanHeal(SquadObjective)) || (B.Pawn.PendingWeapon != None && B.Pawn.PendingWeapon.CanHeal(SquadObjective))) )
				return false;
		}
		if (ONSPowerCore(SquadObjective).CoreStage == 2)
		{
			if ( (B.Enemy == None || !B.EnemyVisible()) && VSize(B.Pawn.Location - SquadObjective.Location) < GetMaxObjectiveGetOutDist() )
				return false;
		}
		if ((ONSPowerCore(SquadObjective).CoreStage == 4 || ONSPowerCore(SquadObjective).CoreStage == 1) && VSize(B.Pawn.Location - SquadObjective.Location) < GetMaxObjectiveGetOutDist())
			return false;
	}

	if (Super.CheckVehicle(B))
		return true;
	if ( Vehicle(B.Pawn) != None || (B.Enemy != None && B.EnemyVisible()) || LastFailedNodeTeleportTime > Level.TimeSeconds - 20 || ONSPowerCore(SquadObjective) == None
	     || ONSPlayerReplicationInfo(B.PlayerReplicationInfo) == None || ONSPowerCore(SquadObjective).HasUsefulVehicles(B) || B.Skill + B.Tactics < 2 + FRand() )
		return false;

	//no vehicles around
	if (VSize(B.Pawn.Location - SquadObjective.Location) > 5000 && !B.LineOfSightTo(SquadObjective))
	{
		//really want a vehicle to get to SquadObjective, so teleport to a different node to find one
		if (ONSPowerCore(B.RouteGoal) != None && ONSPlayerReplicationInfo(B.PlayerReplicationInfo).GetCurrentNode() == B.RouteGoal)
		{
			SourceDist = ONSPowerCore(B.RouteGoal).FinalCoreDistance[Abs(1 - Team.TeamIndex)];
			for (O = Team.AI.Objectives; O != None; O = O.NextObjective)
				if (O != B.RouteGoal && ONSOnslaughtGame(Level.Game).ValidSpawnPoint(ONSPowerCore(O), Team.TeamIndex))
				{
					NewRating = ONSPowerCore(O).TeleportRating(B, Team.TeamIndex, SourceDist);
					if (NewRating > BestRating || (NewRating == BestRating && FRand() < 0.5))
					{
						Best = ONSPowerCore(O);
						BestRating = NewRating;
					}
				}

			if (Best != None)
				ONSPlayerReplicationInfo(B.PlayerReplicationInfo).TeleportTo(Best);
			else
				LastFailedNodeTeleportTime = Level.TimeSeconds;

			return false;
		}

		Nearest = ONSPowerCore(SquadObjective).ClosestTo(B.Pawn);
		if ( Nearest == None || Nearest.CoreStage != 0 || Nearest.DefenderTeamIndex != Team.TeamIndex
		     || VSize(Nearest.Location - B.Pawn.Location) > 2000 )
			return false;

		B.MoveTarget = B.FindPathToward(Nearest, false);
		if (B.MoveTarget != None)
		{
			B.RouteGoal = Nearest;
			B.GoalString = "Node teleport from "$B.RouteGoal;
			B.SetAttractionState();
			return true;
		}
	}

	return false;
}

function BotEnteredVehicle(Bot B)
{
	local bot SquadMate, Best;
	local float BestDist, NewDist;

	Super.BotEnteredVehicle(B);

	if ( !Level.Game.JustStarted(20) || (ONSVehicle(B.Pawn) == None) || !ONSVehicle(B.Pawn).FastVehicle()
		|| (self == Team.AI.FreelanceSquad) || (Team.AI.FreelanceSquad == None) )
		return;

	// don't do on teams with humans, since this might contradict their orders
	if ( Level.NetMode == NM_Standalone )
	{
		if ( Level.GetLocalPlayerController().PlayerReplicationInfo.Team == Team )
			return;
	}
	else if ( !UnrealMPGameInfo(Level.Game).bPlayersVsBots )
		return;

	// if in fast vehicle, and freelance squad doesn't have one, switch
	for ( SquadMate=Team.AI.FreelanceSquad.SquadMembers; SquadMate!=None; SquadMate=SquadMate.NextSquadMember )
	{
		if ( (ONSVehicle(SquadMate.Pawn) != None) && ONSVehicle(SquadMate.Pawn).FastVehicle() )
			return;
		else if ( Best == None )
		{
			Best = SquadMate;
			if ( Best.Pawn != None )
				BestDist = VSize(B.Pawn.Location - SquadObjective.Location);
			else
				BestDist = 1000000;
		}
		else if (SquadMate.Pawn != None )
		{
			NewDist = VSize(SquadMate.Pawn.Location - SquadObjective.Location);
			if ( NewDist < BestDist )
			{
				Best = SquadMate;
				BestDist = NewDist;
			}
		}
	}

	// make the switch
	SwitchBots(B,Best);
}

//return a value indicating how useful this vehicle is to the bot
function float VehicleDesireability(Vehicle V, Bot B)
{
	local float Rating;

	if (CurrentOrders == 'Defend')
	{
		if ((SquadObjective == None || VSize(SquadObjective.Location - B.Pawn.Location) < 2000) && Super.VehicleDesireability(V, B) <= 0)
			return 0;
		if (V.Health < V.HealthMax * 0.125 && B.Enemy != None && B.EnemyVisible())
			return 0;
		Rating = V.BotDesireability(self, Team.TeamIndex, SquadObjective);
		if (Rating <= 0)
			return 0;

		if (V.bDefensive)
		{
			if (ONSPowerCore(SquadObjective) != None)
			{
				//turret can't hit priority enemy
				if ( V.bStationary && B.Enemy != None && ONSPowerCore(SquadObjective).LastDamagedBy == B.Enemy.PlayerReplicationInfo
				     && !FastTrace(B.Enemy.Location + B.Enemy.CollisionHeight * vect(0,0,1), V.Location) )
					return 0;
				if (ONSPowerCore(SquadObjective).ClosestTo(V) != SquadObjective)
					return 0;
			}
			if (ONSStationaryWeaponPawn(V) != None && !ONSStationaryWeaponPawn(V).bPowered)
				return 0;
		}
		if ( V.SpokenFor(B) )
			return Rating * V.NewReservationCostMultiplier(B.Pawn);
		return Rating;
	}

	return Super.VehicleDesireability(V, B);
}

function bool CheckSpecialVehicleObjectives(Bot B)
{
	local ONSPowerCore Core;
	local SquadAI S;

	if ( ONSTeamAI(Team.AI).OverrideCheckSpecialVehicleObjectives(B) )
		return false;

	if (Size > 1)
		return Super.CheckSpecialVehicleObjectives(B);

	//if bot is the only bot headed to a neutral (unclaimed) node, that's more important, so don't head to any SpecialVehicleObjectives
	Core = ONSPowerCore(SquadObjective);
	if (Core == None || Core.CoreStage != 4 || !Core.PoweredBy(Team.TeamIndex))
		return Super.CheckSpecialVehicleObjectives(B);

	for (S = Team.AI.Squads; S != None; S = S.NextSquad)
		if (S != self && S.SquadObjective == Core)
			return Super.CheckSpecialVehicleObjectives(B);

	return false;
}

function float GetMaxObjectiveGetOutDist()
{
	local SVehicleFactory F;

	if (MaxObjectiveGetOutDist == 0.0)
		foreach DynamicActors(class'SVehicleFactory', F)
			if (F.VehicleClass != None)
				MaxObjectiveGetOutDist = FMax(MaxObjectiveGetOutDist, F.VehicleClass.default.ObjectiveGetOutDist);

	return MaxObjectiveGetOutDist;
}

function bool CheckSquadObjectives(Bot B)
{
	local bool bResult;

	if ( (B.Enemy != None) && (B.Enemy == ONSTeamAI(Team.AI).FinalCore.LastAttacker) )
	{
		if ( B.NeedWeapon() && B.FindInventoryGoal(0) )
		{
			B.GoalString = "Need weapon or ammo";
			B.SetAttractionState();
			return true;
		}
		return false;
	}

	if ( !ONSTeamAI(Team.AI).bAllNodesTaken && (self == Team.AI.FreelanceSquad) )
	{
		// keep moving to any unpowered nodes if current objective is constructing
		if ( ONSPowerCore(SquadObjective).DefenderTeamIndex == Team.TeamIndex )
			Team.AI.ReAssessStrategy();
	}
	bResult = Super.CheckSquadObjectives(B);

	if (!bResult && CurrentOrders == 'Freelance' && B.Enemy == None && ONSPowerCore(SquadObjective) != None)
	{
		if (ONSPowerCore(SquadObjective).PoweredBy(Team.TeamIndex))
		{
			B.GoalString = "Disable Objective "$SquadObjective;
			return SquadObjective.TellBotHowToDisable(B);
		}
		else if (!B.LineOfSightTo(SquadObjective))
		{
			B.GoalString = "Harass enemy at "$SquadObjective;
			return FindPathToObjective(B, SquadObjective);
		}
	}

	return bResult;
}

function float ModifyThreat(float current, Pawn NewThreat, bool bThreatVisible, Bot B)
{
	if ( NewThreat.PlayerReplicationInfo != None && ONSPowerCore(SquadObjective) != None
	     && ONSPowerCore(SquadObjective).LastDamagedBy == NewThreat.PlayerReplicationInfo
	     && ONSPowerCore(SquadObjective).bUnderAttack )
	{
		if ( NewThreat == ONSTeamAI(Team.AI).FinalCore.LastAttacker )
			return current + 6;
		if (!bThreatVisible)
			return current + 0.5;
		if ( (VSize(B.Pawn.Location - NewThreat.Location) < 2000) || B.Pawn.IsA('Vehicle') || B.Pawn.Weapon.bSniping
			|| ONSPowerCore(SquadObjective).Health < ONSPowerCore(SquadObjective).DamageCapacity * 0.5 )
			return current + 6;
		else
			return current + 1.5;
	}
	else
		return current;
}

function bool MustKeepEnemy(Pawn E)
{
	if ( (E.PlayerReplicationInfo != None) && (ONSPowerCore(SquadObjective) != None) )
	{
		if ( ONSPowerCore(SquadObjective).bUnderAttack && (ONSPowerCore(SquadObjective).LastDamagedBy == E.PlayerReplicationInfo) )
			return true;
		if ( E == ONSTeamAI(Team.AI).FinalCore.LastAttacker )
			return true;
	}
	return false;
}

//don't actually merge squads, because they could be two defending squads from different teams going to same neutral powernode
function MergeWith(SquadAI S)
{
	if ( SquadObjective != S.SquadObjective )
	{
		SquadObjective = S.SquadObjective;
		NetUpdateTime = Level.Timeseconds - 1;
	}
}

defaultproperties
{
	GatherThreshold=+0.0
	MaxSquadSize=3
	bAddTransientCosts=true
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Di 5.9.2006 22:31:50.000 - Creation time: Do 14.8.2014 09:58:47.511 - Created with UnCodeX