{ Designed. } const LAND = 0; const AIR = 1; const SEA = 2; NbrZones := GetZoneCount(); NbrUnits := GetUnitCount(); NbrNations := GetNationCount(); CurrentPlayer := GetCurrentPlayer(); Version( 4.0 ); US := -1; Germany := -1; France := -1; Spain := -1; Italy := -1; Mexico := -1; UK := -1; For i := 0 to NbrNations - 1 do begin name := getnationname(i); If name = 'Germany' then Germany := i; If name = 'Italy' then Italy := i; If name = 'United States' then US := i; If name = 'Spain' then Spain := i; If name = 'France' then France := i; If name = 'Mexico' then Mexico := i; If name = 'United Kingdom' then UK := i; end; MyCap := FindZoneName( 'Northeastern USA' ); OurCap := MyCap; zBrit := FindZoneName( 'England'); rzone := OurCap; zSI := FindZoneName('Southern Italy'); tNormandy := FindZoneName('Normandy'); tGermany := FindZoneName('Germany'); zJapan := findzonename('Japan'); SetArray(NeedTransport, NbrZones + 1); {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) OR (npoints > points) ) AND (stance < 100) 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 (isnationactive(UK)) AND (getnationstance(CurrentPlayer, UK) < 100) AND (getnationstance(CurrentPlayer, UK) > -100) then orderdiplomatic(UK, 7) else if (isnationactive(France)) AND (getnationstance(CurrentPlayer, France) < 100) AND (getnationstance(CurrentPlayer, France) > -100) then orderdiplomatic(France, 7) else if (isnationactive(Mexico)) AND (getnationstance(CurrentPlayer, Mexico) < 100) AND (getnationstance(CurrentPlayer, Mexico) > -100) then orderdiplomatic(Mexico, 7); for i := 1 to getnationdiplomaticactions(CurrentPlayer) + 1 do If friend <> -1 then orderdiplomatic(friend, 3); transports := 10; 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; SetArray( Routing, NbrZones); SetArray( RoutScore, NbrZones); for i := 0 to NbrZones - 1 do begin Routing[i] := -1; RoutScore[i] := 0; NeedTransport[i] := false; end; OrderChangeFormations( 10, 20, 100, 100, 100, 10, 10, 10, 10, 80, 70, 100, 100, 50, 100 ); emergency := false; if OurCap <> -1 then begin attackunits := 0; for i := 0 to getzoneneighborcount(OurCap) - 1 do attackunits := attackunits + getzoneforcecount(getzoneneighbor(OurCap, i), false, true, false, true, true, false ); attackunits := attackunits + getzoneforcecount(OurCap, false, true, false, true, true, false ); attackunits := attackunits - (getzoneforcecount(OurCap, true, false, false, true, true, false ) div 3); If attackunits >= 0 then emergency := true; end; for i := 0 to NbrZones - 1 do if ( GetZoneOwner( i ) = CurrentPlayer ) then begin if (findclosestenemyzone(i, 4) = -1) AND (getzoneforcecount(i, true, false, false, true, false, false) > 5) AND (iszoneport(i)) then NeedTransport[i] := true; nFact := GetZoneFactories( i ); if ( (nFact < 100) and ( (GetZoneResources( i ) > 30) OR ( (Getzoneresources(i) > 24) AND (nFact = 0) ) ) and ( nFact < GetZoneValue( i ) ) ) then OrderBuildFactory( i ) else if ( nFact > 0 ) then begin if (transports < 0) AND (rzone = OurCap) AND (iszoneport(i)) then orderbuildnavy(i, 0, tb, 0, 0, 0, 0, 0) else begin f := 5 * getzonefactories(i); Artillery := getzoneresources(i) div 2; If Artillery > f then Artillery := f; orderBuildArmy(i, Artillery / 2, 0, Artillery / 2, 0 ); end; end; rscore := nFact * 3 + getzonevalue(i); if (emergency) AND (OurCap = i) then rscore := rscore + 100; targ := i; for n := 0 to GetZoneNeighborCount( i ) - 1 do begin neighbor := GetZoneNeighbor( i, n ); owner := getzoneowner(neighbor); okay := true; if (owner = -1) then begin owner := getcurrentplayer(); okay := false; end; nrscore := getzonefactories(neighbor) * 3 + getzonevalue(neighbor); if (emergency) AND (neighbor = OurCap) then nrscore := nrscore + 100; if RoutScore[neighbor] > 0 then nrscore := RoutScore[neighbor]; if (nrscore >= rscore) and (Routing[neighbor] <> i) AND ( (getcurrentplayer() = owner) OR (getnationstance(getcurrentplayer(), owner) = 100) ) AND (okay) then begin rscore := nrscore; targ := neighbor; end; end; island := true; for j := 0 to getzoneneighborcount(i) - 1 do if iszoneland(getzoneneighbor(i, j)) then island := false; if (findclosestenemyzone(i, 15) = -1) AND (island) AND (rscore < 90) then begin Routing[i] := rzone; RoutScore[i] := 100; orderautorouteresources(i, rzone); end else begin Routing[i] := targ; RoutScore[i] := rscore; orderautorouteresources(i, targ); end; end; 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 nSize := GetUnitForceCount( i ); bHasEnemy := FALSE; nUnitZone := GetUnitZone( i ); for n := 0 to GetZoneNeighborCount( nUnitZone ) - 1 do if GetZoneForceCount( GetZoneNeighbor( nUnitZone, n ), FALSE, TRUE, FALSE, TRUE, FALSE, FALSE ) > 0 then bHasEnemy := TRUE; if IsZoneCapital( nUnitZone ) then bHasEnemy := true; if ( nSize > 10 ) AND bHasEnemy AND (NOT emergency) then begin SetBrainData( sCode, 'D' ); OrderUnitDividePct( i, 50 ); end else begin If iszonecapital( nUnitZone) then capbonus := 200 else capbonus := 0; if (GetBrainData( sCode ) = 'D') and ( (getzoneforcecount( nUnitZone, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE) <= 30 + capbonus )) then begin {Just defend here} end else begin {Attack closest target} if Random( 1, 100 ) > 20 then 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 else begin if NOT (iszoneport(uZone)) then orderunitmove(i, getzoneneighbor(uZone, 0)); end; end; end; if emergency then if (iszoneneighbor(uZone, OurCap)) OR (uZone = OurCap) then orderunitmove(i, OurCap); end; end else if ( uc = AIR ) then begin okay := iszoneland(uZone); if okay then okay := getnationstance(getzoneowner(uZone), Currentplayer) = 100; if (GetZoneOwner(uZone) <> CurrentPlayer) AND (NOT okay) then begin if GetZoneForceCount( GetUnitZone( i ), false, true, true, true, true, true ) = 0 then OrderUnitReturnToBase( i ); end else begin if ((GetZoneOwner( GetUnitZone( i ) ) <> CurrentPlayer) AND (NOT iszoneallied(uZone))) AND (getunitbasezone(i) <> -1) then begin if GetZoneForceCount( GetUnitZone( i ), false, true, true, true, true, true ) = 0 then begin OrderUnitReturnToBase( i ); end; end else begin If getunitorder(i) <> 0 then begin orderunitreturntobase(i); end else begin If emergency then begin orderunitrebase(i, MyCap); end else if (getunitbasezone(i) <> MyCap) AND (uZone <> zBrit) then begin orderunitrebase(i, MyCap); end else if (getunitbasezone(i) = MyCap) then begin orderunitrebase(i, zBrit); end else begin if isnationactive(Italy) then bigtarg := zSI else if isnationactive(Germany) then bigtarg := tGermany else bigtarg := zJapan; hitrussia := iszoneembattled(bigtarg); if hitrussia then hitrussia := getunitrange(i) >= truedistance(uZone, bigtarg); If hitrussia then begin orderunitairstrike(i, bigtarg) end else begin dist := 999999; nTarget := -1; for j := 0 to NbrZones - 1 do begin ndist := distance(j,zBrit); if j <> bigtarg then if ndist < dist then if (getzoneforcecount(j, false, true, false, true, false, false) > 0) AND ( (getzoneforcecount(j, false, true, false, true, false, false) < 15) OR iszoneembattled(j) ) then if getzoneowner(j) <> -1 then if isnationmajorpower(getzoneowner(j)) then if truedistance(uZone, j) <= getunitrange(i) then begin nTarget := j; dist := ndist; end; end; If (nTarget <> -1) then begin orderunitairstrike(i, nTarget); end else begin nBase := zBrit; if truedistance(zBrit, uZone) > getunitrange(i) * 3 then begin dist := 999999; nBase := -1; for j := 0 to NbrZones - 1 do if iszoneland(j) then if ((getzoneowner(j) = CurrentPlayer) OR (getnationstance(CurrentPlayer, getzoneowner(j)) = 100)) AND (distance(j, zBrit) < dist) then if truedistance(j, uZone) <= getunitrange(i) * 3 then begin dist := distance(j, zBrit); nBase := j; end; end; If nBase <> -1 then begin orderunitrebase(i, nBase); end; end; end; end; end; end; end; end else if ( uc = SEA ) then begin if iszoneland(uZone) then orderunitlaunch(i); if (getunitboardedcount(i) = 0) then begin targ := -1; dist := 999999; for j := 0 to NbrZones - 1 do begin ndist := distance(uZone, j); if (NeedTransport[j]) AND (ndist < dist) then begin targ := j; dist := ndist; end; end; if targ <> - 1 then begin nzone := -1; dist := 999999; for j := 0 to getzoneneighborcount(targ) - 1 do begin n := getzoneneighbor(targ, j); ndist := distance(uZone, n); if (Not iszoneland(n)) AND (ndist < dist) then begin nzone := n; dist := ndist; end; end; if uZone <> nzone then orderunitmove(i, nzone) else orderunitembarkall(i, targ); end; end else begin targ := findclosestenemyzone(uZone, 25); if targ <> -1 then begin if iszoneneighbor(uZone, targ) then orderunitdisembarkall(i, targ) else orderunitmove(i, targ); end; end; if getunitforcecounttype(i, 0) > 0 then orderunitdock(i, rzone); end; end; end;