-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfleetScript.lua
More file actions
41 lines (37 loc) · 1.27 KB
/
fleetScript.lua
File metadata and controls
41 lines (37 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
taille_flottes = nil
my_fleet = nil
autre_flotte = nil
planete_locale = nil
taille_flottes2 = 10
function AI_do_gather(my_fleet2, autre_flotte2)
return true
end
function AI_do_fight(myself, other_player)
return true
end
function AI_action(my_fleet2, planete_locale2)
if planete_locale2 then
if planete_locale2:isFree() then
if(my_fleet2.shipList[Ship.Queen] > 0) then
if(math.random(2) == 1) then return FleetAction(FleetAction.Colonize) end
end
if(planete_locale2.ressourceSet:at(Ressource.Metal) > 0) then
return FleetAction(FleetAction.Harvest)
end
elseif my_fleet2.coord == my_fleet2.origin then
if(my_fleet2.ressourceSet:at(Ressource.Metal) > 0) then
return FleetAction(FleetAction.Drop)
end
if(my_fleet2.shipList[Ship.Queen] < 1) then
return FleetAction(FleetAction.Nothing)
end
end
end
if(my_fleet2.ressourceSet:at(Ressource.Metal) > (10000)) then
return FleetAction(FleetAction.Move,directionFromTo(my_fleet2.coord, my_fleet2.origin))
end
return FleetAction(FleetAction.Move,directionRandom())
end
function AI_do_escape(ma_flotte, planete_locale, autres_flottes)
return simulates(ma_flotte,planete_locale,autres_flottes) < 50
end