
- Unit formulas are replaced by inline MicroAIs or candidate actions placed in the unit's [ai] tag. - The stationed_guardian MicroAI was chosen as the closest match to the guardian FormulaAI. It's not a perfect fit, but it's pretty close. - The goto and patrol MicroAIs are fairly obvious substitutes for the respective unit formulas. - The priority test in unit formulas is replaced by fairly basic inline non-external CAs with differing scores. - The side formulas (opening.fai) have been converted to a separate Lua stage using a new opening.lua. However, that's only a partial conversion. The move and attack functionalities of opening.fai are missing from opening.lua; instead the built-in move, move leader to keep, and combat CAs are used. - The scouting FormulaAI CA has been ported to Lua. It remains a very basic AI, probably not well-suited to genera use. - The level up attack FormulaAI CA has been ported to Lua. Like the new scouting CA, this is mostly intended to serve as an example.
31 lines
1 KiB
Lua
31 lines
1 KiB
Lua
-- An extremely simplistic example of an AI that does certain fixed moves
|
|
-- It's meant to be used as a custom stage preceding the RCA stage
|
|
-- This is a highly specific example and probably not suitable to be directly used in other places
|
|
|
|
if wesnoth.current.turn == 1 then
|
|
ai.recruit('Skeleton Archer', 11,21)
|
|
ai.recruit('Dark Adept', 11,22)
|
|
ai.recruit('Dark Adept', 10,22)
|
|
ai.recruit('Skeleton Archer', 9,22)
|
|
ai.recruit('Ghost', 11,24)
|
|
ai.move(11,23, 14,22)
|
|
elseif wesnoth.current.turn == 2 then
|
|
ai.move(11,21, 13,17)
|
|
ai.move(11,22, 13,18)
|
|
ai.move(10,22, 7,19)
|
|
ai.move(9,22, 4,22)
|
|
ai.move(11,24, 18,24)
|
|
ai.move(14,22, 11,23)
|
|
ai.recruit('Dark Adept', 11,21)
|
|
ai.recruit('Dark Adept', 11,22)
|
|
elseif wesnoth.current.turn == 3 then
|
|
ai.move(18,24, 20,22)
|
|
ai.move(15,19, 17,17)
|
|
ai.move(4,22, 5,18)
|
|
ai.recruit('Skeleton Archer', 11,21)
|
|
elseif wesnoth.current.turn == 4 then
|
|
ai.recruit('Skeleton Archer', 11,21)
|
|
else
|
|
ai.recruit('Skeleton Archer', 11,21)
|
|
ai.recruit('Dark Adept', 11,22)
|
|
end
|