#textdomain wesnoth-ai # This is AI test scenario which is not visible to casual player. [test] id=ai_arena_small name= _ "AI Arena - small" description= _ "Small ai arena" map_data="{ai/maps/scenario-AI_Arena_small.map}" random_start_time="no" turns=-1 {DEFAULT_SCHEDULE} {DEFAULT_MUSIC_PLAYLIST} {PLACE_IMAGE items/burial.png 15 13} {PLACE_IMAGE items/burial.png 26 16} {PLACE_IMAGE items/burial.png 4 9} [event] name=preload first_time_only=no [lua] code = << H = wesnoth.dofile("lua/helper.lua") W = H.set_wml_action_metatable({}) H.set_wml_var_metatable(_G) local tests_table = {} function register_test(_name, _description) tests_table[_name] = _description end function get_tests_table() return tests_table end >> [/lua] [/event] [event] name=preload first_time_only=no [set_variable] name=test_path_to_idle_ai value=ai/dev/idle_ai.cfg [/set_variable] [set_variable] name=test_path_to_formula_ai value=ai/ais/formula_ai.cfg [/set_variable] [set_variable] name=test_path_to_testing_ai_default value=ai/dev/testing_ai_default.cfg [/set_variable] [set_variable] name=test_path_to_akihara_recruitment value=ai/dev/akihara_recruitment.cfg [/set_variable] [set_variable] name=test_id value=0005-recruitment_test [/set_variable] [set_menu_item] id=repeat_test description= _ "Repeat last test" [command] [fire_event] name="_clean_arena" [/fire_event] [fire_event] name="_replace_ai_2" [/fire_event] [lua] code= << W.fire_event {name=wesnoth.get_variable("test_id") } >> [/lua] [/command] [/set_menu_item] [set_menu_item] id=select_another_ai description= _ "Select another ai" [command] [fire_event] name=_select_challenger_ai [/fire_event] [/command] [/set_menu_item] [set_menu_item] id=select_test description= _ "Select another test" [command] [fire_event] name=_select_test [/fire_event] [/command] [/set_menu_item] [/event] {ai/scenarios/ai_arena_small/} [side] side=1 name= _ "AI Developer" type=Nightgaunt canrecruit=yes controller=human team_name=master user_team_name= _ "team_name^AI Developer" fog=no [modifications] {TRAIT_INTELLIGENT} {TRAIT_QUICK} {TRAIT_LOYAL} [/modifications] [/side] [side] side=2 id=chall-ai name= _ "Challenger AI" type=White Mage canrecruit=yes controller=ai team_name=north user_team_name= _ "North" fog=yes recruit="Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Thunderer,Thief,Poacher,Footpad" [/side] [side] side=3 id=champ-ai name= _ "Champion AI" type=Dark Adept canrecruit=yes controller=ai team_name=south user_team_name= _ "South" fog=yes recruit="Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Thunderer,Thief,Poacher,Footpad" [/side] [event] name=_select_test first_time_only=no [command] [fire_event] name="_clean_arena" [/fire_event] [/command] [lua] code= << local opts = {} for k,v in pairs(get_tests_table()) do local cmd = { "command", {{ "set_variable", {name="test_id", value= k } } } } table.insert(opts, { "option", { message = v, cmd } } ) end W.message { speaker="narrator", message="Which test do you wish to run, O Mighty AI Developer?", table.unpack(opts) } >> [/lua] [command] [fire_event] name="_replace_ai_2" [/fire_event] [/command] [lua] code= << W.fire_event {name=wesnoth.get_variable("test_id") } >> [/lua] [/event] [event] name=_select_challenger_ai first_time_only=no [message] speaker=narrator message= _ "Which AI do you wish to use, O Mighty AI Developer?" [option] message= _ "I am happy with the current AI of team 2, [$test_path_to_ai]" # wmllint: no spellcheck [/option] [option] message= _ "Akihara's ai will be awesome, won't it?" # wmllint: no spellcheck [command] [set_variable] name=test_path_to_ai value=$test_path_to_akihara_recruitment [/set_variable] [/command] [/option] [option] message= _ "My AI is TESTING AI DEFAULT, implemented as ai_composite." # wmllint: no spellcheck [command] [set_variable] name=test_path_to_ai value=$test_path_to_testing_ai_default [/set_variable] [/command] [/option] [option] message= _ "I am the king of FORMULA AI, and I will use its vast powers for world domination." [command] [set_variable] name=test_path_to_ai value=$test_path_to_formula_ai [/set_variable] [/command] [/option] [option] message= _ "I've come with my own AI, and I am ready to test its strength" [command] [message] speaker=narrator image=wesnoth-icon.png message= _ "and where is it located (path follows the usual WML convention)" [text_input] label=_"AI Location:" variable="test_path_to_ai" [/text_input] [/message] [/command] [/option] [option] message= _ "I want to test formulaAI-based poisoning improvements" # wmllint: no spellcheck [command] [set_variable] name=test_path_to_ai value=ai/dev/formula_ai_poisoning.cfg [/set_variable] [/command] [/option] [/message] [command] [fire_event] name="_replace_ai_2" [/fire_event] [/command] [command] {TELEPORT_TILE 6 21 5 22} [/command] [/event] [event] name=_clean_arena first_time_only=no [kill] animate=no fire_event=no canrecruit=no [/kill] [capture_village] x,y=5,9 [/capture_village] [capture_village] x,y=6,19 [/capture_village] [capture_village] x,y=9,17 [/capture_village] [capture_village] x,y=10,20 [/capture_village] [capture_village] x,y=11,4 [/capture_village] [capture_village] x,y=14,8 [/capture_village] [capture_village] x,y=16,17 [/capture_village] [capture_village] x,y=19,22 [/capture_village] [capture_village] x,y=20,5 [/capture_village] [capture_village] x,y=21,9 [/capture_village] [capture_village] x,y=24,6 [/capture_village] [capture_village] x,y=25,17 [/capture_village] [label] x="9" y="17" [/label] [label] x="19" y="6" [/label] [label] x="25" y="19" [/label] [label] x="26" y="14" [/label] [modify_side] side=1 gold=10000 [/modify_side] [modify_side] side=2 gold=10000 [/modify_side] [modify_side] side=3 gold=10000 [/modify_side] [/event] [event] name=_replace_ai_2 first_time_only=no [modify_side] side=2 switch_ai=$test_path_to_ai [/modify_side] [message] speaker=narrator image=wesnoth-icon.png message= _ "and so, the AI for team 2 was redeployed from file '$test_path_to_ai'" [/message] [/event] [/test]