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

WVArtilleryTurretSupport.ONSSquadAIWithArtilleryTurretSupport


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
/**
Extended Onslaught Squad AI that takes artillery turrets into account.

Creation date: 2013-12-15 10:55
Copyright (c) 2013, Wormbo
*/

class ONSSquadAIWithArtilleryTurretSupport extends ONSSquadAI;


/** Reimplements the ONSVehicle artillery checks for artillery turrets as well. */
function bool CheckVehicle(Bot B)
{
	local ONSPowerCore Core;
	local GameObjective O;
	local int i;
	local Vehicle V;

	if ((ArtilleryWeaponPawn(B.Pawn) != None && ArtilleryWeaponPawn(B.Pawn).IsArtillery() || StationaryArtilleryWeaponPawn(B.Pawn) != None && StationaryArtilleryWeaponPawn(B.Pawn).IsArtillery()) && (B.Skill + B.Tactics >= 3 || ONSWeaponPawn(B.Pawn).bKeyVehicle))
	{
		if (ArtilleryWeaponPawn(B.Pawn) != None && ArtilleryWeaponPawn(B.Pawn).IsDeployed() || StationaryArtilleryWeaponPawn(B.Pawn) != None && StationaryArtilleryWeaponPawn(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;
				}
			}
		}
		else if (!B.Pawn.IsFiring() && (B.Enemy != None) && B.Pawn.CanAttack(B.Enemy))
		{
			B.Focus = B.Enemy;
			B.FireWeaponAt(B.Enemy);
		}
	}

	return Super.CheckVehicle(B);
}


//=============================================================================
// Default values
//=============================================================================

defaultproperties
{
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: So 15.12.2013 12:26:48.000 - Creation time: Do 14.8.2014 09:58:47.538 - Created with UnCodeX