{ Fights on all frontiers } const LAND = 0; const AIR = 1; const SEA = 2; NbrZones := GetZoneCount(); NbrNations := getnationcount(); NbrUnits := GetUnitCount(); CurrentPlayer := GetCurrentPlayer(); Version( 4.0 ); UK := -1; Germany := -1; France := -1; Italy := -1; For i := 0 to getnationcount() - 1 do begin name := getnationname(i); If name = 'Germany' then Germany := i; If name = 'Japan' then Japan := i; If name = 'United Kingdom' then UK := i; If name = 'Italy' then Italy := i; If name = 'France' then France := 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) then begin friend := i; points := npoints; like := getnationstance(CurrentPlayer, i); end; end; If getnationdiplomaticactions(CurrentPlayer) > 0 then If friend <> -1 then orderdiplomatic(friend, 3); MyCap := FindZoneName( 'Northeastern USA' ); tNormandy := FindZoneName('Normandy'); tGermany := FindZoneName('Germany'); tJapan := FindZoneName('Japan'); tSouthernUSA := FindZoneName('Southern USA'); tItaly := FindZoneName('Southern Italy'); tAlgeria := FindZoneName('Algeria'); For i := 0 to getzoneneighborcount(tAlgeria) - 1 do If (NOT isZoneland(getzoneneighbor(tAlgeria, i))) then SeaZone := getzoneneighbor(tAlgeria, i); For i := 0 to getzoneneighborcount(tItaly) - 1 do If (NOT isZoneland(getzoneneighbor(tItaly, i))) then dZone := getzoneneighbor(tItaly, i); For i := 0 to NbrZones - 1 do If (getzoneowner(i) = CurrentPlayer) AND (isZoneport(i)) then begin orderGlobalRouteresources(i, 20); orderautorouteresources(i, tSouthernUSA); end; OrderGlobalRouteresources(MyCap, 20); if (getzoneresources(MyCap) > 40) AND (getzonefactories(MyCap) < getzonevalue(MyCap)) then orderbuildfactory(MyCap); transports := 0; for i := 0 to NbrUnits - 1 do If (getunitclass(i) = SEA) AND (getunitowner(i) = CurrentPlayer) then transports := transports + getunittransportroom(i); for i := 0 to getzoneunitcount(MyCap) - 1 do transports := transports - getunittransportweight(getzoneunit(MyCap, i)); tb := (0 - transports) div 2; If getzoneresources(MyCap) div 4 < tb then tb := getzoneresources(MyCap) div 4; if tb = 0 then tb := 1; Troops := getzoneresources(MyCap) div 2; f := 5 * getzonefactories(MyCap); If Troops > f then Troops := f; If transports < 0 then orderbuildnavy(MyCap, 0, tb, 0, 0, 0, 0, 0) else orderbuildarmy(MyCap, Troops, 0, 0, 0); SetArray(Unit, NbrZones); For i := 0 to NbrZones - 1 do Unit[i] := -1; Artillery := 0; If iszonevisible(SeaZone) then For i := 0 to Getzoneunitcount(SeaZone) - 1 do begin tunit := getzoneunit(SeaZone, i); Artillery := Artillery + getunitforcecounttype(tunit, 1); end; Attack := Artillery >= 25; If Attack then Attack := isnationactive(Italy); If getzoneforcecount(tItaly, True, false, false, true, false, false) > 0 then attack := true; 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 Unit[uZone] = -1 then Unit[uZone] := i else OrderUnitMerge( Unit[uZone], i ); if (isnationactive(Italy)) AND (uZone = tItaly) then begin end else begin nTarget := FindClosestEnemyZone( GetUnitZone( i ), 20 ); if ( nTarget >= 0 ) then begin if IsZoneNeighbor( GetUnitZone( i ), nTarget ) then OrderUnitInvade( i, nTarget ) else OrderUnitMove( i, nTarget ); end; end; end else if ( uc = AIR ) then begin returntobase := NOT iszoneland(uZone); If NOT returntobase then returntobase := (GetZoneOwner( GetUnitZone( i ) ) <> CurrentPlayer) AND (NOT isnationalliedwith(getzoneowner(uZone), CurrentPlayer)); if returntobase 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 {distance(findzonename('Midwestern USA'), uZone) < distance(uZone, findzonename('England'))} false then begin { If isnationalliedwith(UK, CurrentPlayer) then orderunitrebase(i, findzonename('England')) else orderunitrebase(i, MyCap); } end else begin dist := 9999999; targzone := -1; For j := 0 to NbrZones - 1 do begin zfriend := iszoneland(j); if zfriend then zfriend := (getzoneowner(j) = CurrentPlayer) OR (isnationalliedwith(CurrentPlayer, getzoneowner(j))); if zfriend then rmod := 3 else rmod := 1; If distance(uZone, j) < dist then If iszoneembattled(j) then if getzoneforcecount(j, true, false, false, true, true, true) > 0 then If truedistance(uZone, j) <= getunitrange(i) * rmod then begin targzone := j; dist := distance(uZone, j); end; end; If targzone <> -1 then begin rebasethere := iszoneland(targzone); if rebasethere then rebasethere := (getzoneowner(targzone) = CurrentPlayer) OR (isnationalliedwith(CurrentPlayer, getzoneowner(targzone))); if rebasethere then orderunitrebase(i, targzone) else orderunitairstrike(i, targzone); end else begin If isnationactive(Italy) then targzone := tItaly else if isnationactive(Japan) then targzone := tJapan else targzone := tGermany; rzone := -1; dist := 999999; For j := 0 to NbrZones - 1 do if iszoneland(j) then If (getzoneowner(j) = CurrentPlayer) OR (isnationalliedwith(CurrentPlayer, getzoneowner(j))) then If distance(j, targzone) < dist then if truedistance(uZone, j) <= getunitrange(i) * 3 then begin rzone := j; dist := distance(j, targzone); end; If rzone <> -1 then orderunitrebase(i, rzone); end; end; end; end end else if ( uc = SEA ) then begin orderunitlaunch(i); If getunitforcecounttype(i, 9) > 0 then begin If getunitboardedcount(i) > 0 then begin if (isnationactive(Italy)) then begin If uZone = dZone then orderunitdisembarkall(i , tItaly) else if (Attack) OR (distance(uZone, tItaly) < distance(SeaZone, tItaly)) then orderunitmove(i, dZone) else orderunitmove(i, SeaZone) end else begin targzone := findclosestenemyzone(uZone, 20); If targzone <> -1 then begin If iszoneneighbor(uZone, targzone) then orderunitdisembarkall(i, targzone) else For j := 0 to getzoneneighborcount(targzone) - 1 do If NOT iszoneland(getzoneneighbor(targzone, j)) then orderunitmove(i, getzoneneighbor(targzone, j)); end; end; end else begin If iszoneneighbor(uZone, MyCap) then begin orderunitembarkall(i, MyCap) end else begin ezone := -1; dist := 999999; for j := 0 to getzoneneighborcount(MyCap) - 1 do begin tzone := getzoneneighbor(MyCap, j); ndist := distance(tzone, uzone); If (NOT iszoneland(tzone)) AND (ndist < dist) then begin ezone := tzone; dist := ndist; end; end; orderunitmove(i, ezone); end; end; end; end else begin If getunitforcecounttype(i, 0) = 0 then begin japan := findzonename('Japan'); If japan <> -1 then orderunitbombard(i, japan); end; end; end; end;