AI Arena test case...

...for filtering of allowed attackers/defenders via [filter_own] and
[filter_enemy]
This commit is contained in:
Iurii Chernyi 2009-09-30 01:03:24 +00:00
parent 1b4c43f39e
commit df4a5a3f25
2 changed files with 87 additions and 6 deletions

View file

@ -0,0 +1,81 @@
#textdomain wesnoth
[event]
name=preload
first_time_only=no
[lua]
code = << register_test('0004-filtered_combat','Filtered combat test'); >>
[/lua]
[/event]
[event]
name=0004-filtered_combat
first_time_only=no
[message]
speaker=narrator
image=wesnoth-icon.png
message=_ "This situation should test the ability of AI to obey own unit and enemy unit filters while making attacks. Only dwarves should attack. Dark Adepts are not to be attacked."
[/message]
[unit]
side=2
x,y=20,7
type="Dwarvish Berserker"
[/unit]
[unit]
side=3
x,y=20,5
type="Dark Adept"
random_traits="no"
[modifications]
{TRAIT_RESILIENT}
[/modifications]
[/unit]
[unit]
side=2
x,y=13,21
type="Elvish Sharpshooter"
[/unit]
[unit]
side=3
x,y=15,22
type="Peasant"
[/unit]
[unit]
side=2
x,y=23,14
type="Orcish Warlord"
[/unit]
[unit]
side=3
x,y=25,15
type="Dark Adept"
[/unit]
[unit]
side=2
x,y=4,11
type="Dwarvish Lord"
[/unit]
[unit]
side=3
x,y=5,13
type="Dark Sorcerer"
[/unit]
[modify_side]
side=3
switch_ai=$test_path_to_idle_ai
[/modify_side]
{MODIFY_AI_ADD_ASPECT 2 attacks (
[facet]
name=testing_ai_default::aspect_attacks
invalidate_on_gamestate_change=yes
[filter_own]
race=dwarf
[/filter_own]
[filter_enemy]
[not]
type="Dark Adept"
[/not]
[/filter_enemy]
[/facet]
)}
[/event]

View file

@ -70,12 +70,12 @@
[fire_event]
name="_clean_arena"
[/fire_event]
[lua]
code= << W.fire_event {name=wesnoth.get_variable("test_id") } >>
[/lua]
[fire_event]
name="_replace_ai_2"
[/fire_event]
[lua]
code= << W.fire_event {name=wesnoth.get_variable("test_id") } >>
[/lua]
[/command]
[/set_menu_item]
@ -156,14 +156,14 @@
W.message { speaker="narrator", message="Which test do you want to run, oh Mightly AI Developer?", unpack(opts) }
>>
[/lua]
[lua]
code= << W.fire_event {name=wesnoth.get_variable("test_id") } >>
[/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]