{ The latest Axis Ai for Germany and Italy- features more efficient building, better defense, and better troop use. } const LAND = 0; const AIR = 1; const SEA = 2; const TRANSPORT = 9; NbrZones := GetZoneCount(); NbrUnits := GetUnitCount(); NbrNations := GetNationCount(); CurrentPlayer := GetCurrentPlayer(); Version( 4.0 ); If getnationname(CurrentPlayer) = 'Germany' then MyCap := findzonename('Germany') else MyCap := findzonename('Southern Italy'); US := -1; France := -1; USSR := -1; For i := 0 to getnationcount() - 1 do begin name := getnationname(i); If name = 'United States' then US := i; If name = 'France' then France := i; If name = 'USSR' then USSR := i; end; {Diplomatics} like := - 100; friend := -1; points := 0; For i := 0 to NbrNations - 1 do begin stance := getnationstance(CurrentPlayer, i); npoints := 0; If isnationmajorpower(i) then npoints := 1; If (stance > like) AND (stance < 100) AND (npoints >= points) AND ( isnationactive(i) ) AND (i <> CurrentPlayer) AND (i <> USSR) then begin friend := i; points := npoints; like := getnationstance(CurrentPlayer, i); end; end; If getnationdiplomaticactions(CurrentPlayer) > 0 then If friend <> -1 then orderdiplomatic(friend, 7); OrderChangeResearchSpending(20); OrderChangeResearchLevel(0, 100); f := 5 * getzonefactories(MyCap); NumInfantry := 0; For i := 0 to NbrUnits - 1 do If (getunitzone(i) = MyCap) AND (getunitowner(i) = CurrentPlayer) then NumInfantry := NumInfantry + getunitforcecounttype(i, 3); i := NumInfantry; if getnationname(CurrentPlayer) = 'Germany' then in := 50 else if isnationactive(USSR) then in := 10 else in := 40; Artillery := getzoneresources(MyCap) div 2; If Artillery > f then Artillery := f; safe := true; {For i := 0 to getzoneneighborcount(MyCap) - 1 do If getzoneowner(getzoneneighbor(MyCap, i)) <> -1 then If getnationalliance(getzoneowner(getzoneneighbor(MyCap, i))) = 'The Allies' then safe := false;} For i := 0 to getzoneneighborcount(MyCap) - 1 do NumInfantry := NumInfantry - getzoneforcecount(getzoneneighbor(MyCap, i), false, true, false, true, false, false); NumInfantry := NumInfantry - getzoneforcecount(MyCap, false, true, false, true, false, false); Infbuild := in - NumInfantry; If Infbuild > getzoneresources(MyCap) div 2 then Infbuild := getzoneresources(MyCap) div 2; If Infbuild > f then Infbuild := f; For i := 0 to NbrZones - 1 do If (getzoneowner(i) = CurrentPlayer) AND (iszoneport(i)) then begin OrderGlobalRouteResources( i, 20 ); OrderAutoRouteResources( i, MyCap ); end; OrderGlobalRouteResources( MyCap, 20 ); If (Infbuild > 0) AND (NOT isnationactive(France)) AND (safe) then orderbuildarmy(MyCap, 0, 0, Infbuild, 0) else orderBuildArmy( MyCap, Artillery, 0, 0, 0 ); setarray( AttackTroops, NbrZones ); For i := 0 to NbrZones - 1 do AttackTroops[i] := -1; zSyria := findzonename('Syria'); zSouthAfrica := findzonename('South Africa'); zMorocco := findzonename('Morocco'); zR := findzonename('Inner Russia'); for i := 0 to NbrUnits - 1 do begin if ( GetUnitOwner( i ) = CurrentPlayer ) then begin uc := GetUnitClass( i ); nCode := GetUnitID( i ); sCode := IntToStr( nCode ); uZone := getunitzone(i); if ( uc = LAND ) then begin If (getunitforcecounttype(i, 1) > 0) OR (uZone <> MyCap) then begin If getzonename(uZone) = 'Sicily' then setbraindata(IntToStr(getunitid(i)), '1'); If getzonename(uZone) = 'Inner Russia' then setbraindata(IntToStr(getunitid(i)), ''); If getbraindata(IntToStr(getunitid(i)) + 'o') = '' then If random(1, 100) > 50 then setbraindata(IntToStr(getunitid(i)) + 'o', '1') else setbraindata(IntToStr(getunitid(i)) + 'o', '2'); If AttackTroops[uZone] = -1 then AttackTroops[uZone] := i else orderunitmerge(i, AttackTroops[uZone]); If isnationactive(France) then nTarget := findzonename('Northern France') else if (isnationactive(USSR)) AND (getzoneforcecountattack(uZone, true, false, false, true, true, true) < getzoneforcecountdefense(zR, false, true, true, true, true, true)) then begin nTarget := -1; dist := 9999999; for j := 0 to getzoneneighborcount(zR) - 1 do begin tzone := getzoneneighbor(zR, j); ndist := distance(uZone, tzone); If (getzoneowner(getzoneneighbor(zR, j)) = USSR) AND (ndist < dist) then begin nTarget := tzone; dist := ndist; end; end; If nTarget = -1 then nTarget := findzonename('Lower Urals'); end else if (isnationactive(USSR)) AND (distance(findzonename('Tunisia'), uZone) > distance(uZone, MyCap)) then nTarget := findzonename('Inner Russia') else if getbraindata(IntToStr(getunitid(i)) + 'o') = '1' then nTarget := findclosestenemyzone(uZone, 20) else if getbraindata(IntToStr(getunitid(i))) = '1' then nTarget := zR else if getnationalliance(getzoneowner(zSyria)) = 'The Allies' then nTarget := zSyria else if getnationalliance(getzoneowner(zSouthAfrica)) = 'The Allies' then nTarget := zSouthAfrica else if getnationalliance(getzoneowner(zMorocco)) = 'The Allies' then nTarget := zMorocco else nTarget := FindClosestEnemyZone( GetUnitZone( i ), 20 ); neighbor := -1; dist := 9999999; If nTarget >= 0 then begin For j := 0 to getzoneneighborcount(uZone) - 1 do begin tZone := getzoneneighbor(uZone, j); ndist := distance(tZone, nTarget); If (iszoneland(tZone)) AND (ndist < dist) AND ((tZone <> zR) OR (nTarget = zR)) then begin neighbor := tZone; dist := ndist; end; end; end; if ( nTarget >= 0 ) AND (neighbor >= 0) then begin if ((getzoneowner(neighbor) = CurrentPlayer) OR (isnationalliedwith(CurrentPlayer, getzoneowner(neighbor)))) OR (getzoneowner(nTarget) = CurrentPlayer) then OrderUnitMove( i, nTarget ) else OrderUnitInvade( i, neighbor ); end; end; end else if ( uc = AIR ) then begin if (GetZoneOwner( GetUnitZone( i ) ) <> CurrentPlayer) AND (getunitbasezone(i) <> -1) then begin if GetZoneForceCount( GetUnitZone( i ), false, true, true, true, true, true ) = 0 then OrderUnitReturnToBase( i ); end else begin If getunitorder(i) <> 0 then begin orderunitreturntobase(i); end else begin If isnationactive(France) then begin orderunitairstrike(i, findzonename('Northern France')); end else begin If isnationactive(USSR) then nTarget := findzonename('Inner Russia') else if getnationalliance(getzoneowner(zSyria)) = 'The Allies' then nTarget := zSyria else if getnationalliance(getzoneowner(zSouthAfrica)) = 'The Allies' then nTarget := zSouthAfrica else if getnationalliance(getzoneowner(zMorocco)) = 'The Allies' then nTarget := zMorocco else nTarget := findclosestenemyzone(uZone, 20); If nTarget <> -1 then begin hittarg := iszoneembattled(nTarget); If hittarg then hittarg := getunitrange(i) >= truedistance(uZone, nTarget); If hittarg then begin orderunitairstrike(i, nTarget) end else begin dist := 999999; nT := -1; for j := 0 to NbrZones - 1 do begin ndist := distance(j, MyCap); If j <> nTarget then if ndist < dist then if getzoneforcecount(j, false, true, false, true, false, false) > 0 then if getzoneowner(j) <> -1 then if isnationmajorpower(getzoneowner(j)) then if truedistance(uZone, j) <= getunitrange(i) then begin nT := j; dist := ndist; end; end; If nT <> -1 then begin orderunitairstrike(i, nT) end else begin dist := 999999; nBase := -1; for j := 0 to NbrZones - 1 do if (getzoneowner(j) = CurrentPlayer) AND (distance(j, nTarget) < dist) then begin dist := distance(j, nTarget); nBase := j; end; If nBase <> -1 then orderunitrebase(i, nBase); end; end; end; end; end; end; end else if ( uc = SEA ) then begin e := findzonename('England'); If e <> -1 then orderunitbombard(i, e); end; end; end;