Skip to content

Commit

Permalink
SotBE S6: reduce randomness of unit types unloading from galleons
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
mattsc committed Nov 28, 2014
1 parent 6651371 commit 721fda8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
3 changes: 3 additions & 0 deletions changelog
Expand Up @@ -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.
Expand Down
29 changes: 20 additions & 9 deletions data/campaigns/Son_Of_The_Black_Eye/ai/ca_transport_S6.lua
Expand Up @@ -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

Expand Down

0 comments on commit 721fda8

Please sign in to comment.