forked from github/server
require trees for new player regions
This commit is contained in:
parent
d9e7ff69eb
commit
51fc6680dd
|
@ -42,12 +42,13 @@ local function dump_selection(sel)
|
|||
end
|
||||
|
||||
players = read_players()
|
||||
local limit = 30000
|
||||
local peasants = 20000
|
||||
local trees = 1000
|
||||
local turn = get_turn()
|
||||
local sel
|
||||
if #players > 0 then
|
||||
eressea.read_game(("%d.dat"):format(turn))
|
||||
sel = p.select(regions(), limit)
|
||||
sel = p.select(regions(), peasants, trees)
|
||||
if #sel > 0 then
|
||||
local best = dump_selection(sel)
|
||||
print("finest region, " .. best.score .. " points: " .. tostring(best.r))
|
||||
|
|
|
@ -13,12 +13,11 @@ local function score(r, res)
|
|||
return peas
|
||||
end
|
||||
|
||||
local function select(regions, limit)
|
||||
local function select(regions, peasants, trees)
|
||||
local sel = {}
|
||||
for r in regions do
|
||||
if not r.plane and r.terrain~="ocean" and not r.units() then
|
||||
s = score(r)
|
||||
if s >= limit then
|
||||
if score(r, "peasant") >= peasants and score(r, "tree") >= trees then
|
||||
table.insert(sel, r)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue