SotBE S6: reduce randomness of unit types unloading from galleons

This is done to keep the difficulty of the scenario more consistent. We
now always unload one level 2 unit and two level 1 units (assuming that
at least 3 landing hexes are available).
This commit is contained in:
mattsc 2014-11-28 12:27:13 -08:00
parent 6651371679
commit 721fda8fcf
2 changed files with 23 additions and 9 deletions

View file

@ -3,6 +3,9 @@ Version 1.12.0+dev:
* Big Animals Micro AI: bug fix for units not attacking when [avoid_unit] is
not set
* Lurkers MAI: bug fix for attack error when lurker runs into ambush
* Campaigns
* Son of the Black Eye:
* S6 Black Flag: reduce randomness of unit types unloading from galleons
* Editor:
* Fixed falcon race missing an icon due to having incorrectly-named image
files.

View file

@ -110,16 +110,27 @@ function ca_transport:execution(ai)
-- Also unload units
table.sort(best_adj_tiles, function(a, b) return a[3] > b[3] end)
for i = 1, math.min(#best_adj_tiles, 3) do
local command = "local H = wesnoth.require 'lua/helper.lua' "
.. "wesnoth.put_unit(".. best_adj_tiles[i][1] .. "," .. best_adj_tiles[i][2]
local command = "local unit = wesnoth.get_unit(x1, y1) "
.. "unit.variables.landed = 'yes' "
.. "unit.variables.destination_x = 1 "
.. "unit.variables.destination_y = 30"
ai.synced_command(command, best_unit.x, best_unit.y)
-- Unload 1 level 2 unit
local l2_type = H.rand('Swordsman,Javelineer,Pikeman')
local command = "wesnoth.put_unit(".. best_adj_tiles[1][1] .. "," .. best_adj_tiles[1][2]
.. ", { side = " .. wesnoth.current.side
.. ", type = '" .. l2_type
.. "', moves = 2 })"
ai.synced_command(command, best_unit.x, best_unit.y)
-- Unload up to 2 level 1 units
for i = 2, math.min(#best_adj_tiles, 3) do
local l1_type = H.rand('Fencer,Mage,Cavalryman,Bowman,Spearman')
local command = "wesnoth.put_unit(".. best_adj_tiles[i][1] .. "," .. best_adj_tiles[i][2]
.. ", { side = " .. wesnoth.current.side
.. ", type = H.rand('Fencer,Swordsman,Mage,Cavalryman,Javelineer,Bowman,Pikeman,Bowman,Fencer')"
.. ", moves = 2 }) "
.. "local unit = wesnoth.get_unit(x1, y1) "
.. "unit.variables.landed = 'yes' "
.. "unit.variables.destination_x = 1 "
.. "unit.variables.destination_y = 30"
.. ", type = '" .. l1_type
.. "', moves = 2 })"
ai.synced_command(command, best_unit.x, best_unit.y)
end