diff --git a/data/test/scenarios/wml_tests/ScenarioWML/EventWML/events-test_filter_ability.cfg b/data/test/scenarios/wml_tests/ScenarioWML/EventWML/events-test_filter_ability.cfg index 18a5398d81995..c717f6c357bc4 100644 --- a/data/test/scenarios/wml_tests/ScenarioWML/EventWML/events-test_filter_ability.cfg +++ b/data/test/scenarios/wml_tests/ScenarioWML/EventWML/events-test_filter_ability.cfg @@ -296,3 +296,134 @@ )} #undef FILTER_ABILITY_TEST + +#define FILTER_ABILITY_TEST_WITHOUT_VALUE + [event] + name=start + # Make sure the attacks hit + {FORCE_CHANCE_TO_HIT (id=bob) (id=alice) 100 ()} + {FORCE_CHANCE_TO_HIT (id=alice) (id=bob) 100 ()} + [modify_unit] + [filter] + [/filter] + # Make sure they don't die during the attacks + [status] + invulnerable=yes + [/status] + [/modify_unit] + [object] + silent=yes + [effect] + apply_to=new_ability + [abilities] + [drains] + [filter] + [filter_location] + time_of_day=neutral + [/filter_location] + [/filter] + [/drains] + [/abilities] + [/effect] + [filter] + id=alice + [/filter] + [/object] + {VARIABLE triggers 0} + [/event] + + [event] + name=side 1 turn 1 + [do_command] + [move] + x=7,13 + y=3,4 + [/move] + [attack] + [source] + x,y=13,4 + [/source] + [destination] + x,y=13,3 + [/destination] + [/attack] + [/do_command] + [end_turn][/end_turn] + [/event] + + [event] + name=side 2 turn + [do_command] + [attack] + [source] + x,y=13,3 + [/source] + [destination] + x,y=13,4 + [/destination] + [/attack] + [/do_command] + [end_turn][/end_turn] + [/event] +#enddef + +##### +# API(s) being tested: [event][filter][filter_ability]default_value +## +# Actions: +# Use the common setup from FILTER_ABILITY_TEST_WITHOUT_VALUE. +# Add an event with a filter matching Alice's drains ability. +# Alice attacks Bob and then Bob attacks Alice, as defined in FILTER_ABILITY_TEST. +## +# Expected end state: +# The filtered event is triggered exactly once. +##### +{GENERIC_UNIT_TEST event_test_filter_ability_without_value ( + {FILTER_ABILITY_TEST_WITHOUT_VALUE} + [event] + name=attack + [filter] + [filter_ability] + tag_name=drains + value=10-45 + [/filter_ability] + [/filter] + {ASSERT ({VARIABLE_CONDITIONAL side_number equals 1})} + {VARIABLE_OP triggers add 1} + [/event] + [event] + name=turn 2 + {RETURN ({VARIABLE_CONDITIONAL triggers equals 1})} + [/event] +)} + +##### +# API(s) being tested: [event][filter][filter_ability] +## +# Actions: +# Use the common setup from FILTER_ABILITY_TEST_WITHOUT_VALUE. +# Add an event with a filter for a drains ability, but without different value. +# Alice attacks Bob and then Bob attacks Alice, as defined in FILTER_ABILITY_TEST_WITHOUT_VALUE. +## +# Expected end state: +# The filtered event is never triggered. +##### +{GENERIC_UNIT_TEST event_test_filter_ability_no_match_different_value ( + {FILTER_ABILITY_TEST_WITHOUT_VALUE} + [event] + name=attack + [filter] + [filter_ability] + tag_name=drains + value=33 + [/filter_ability] + [/filter] + {FAIL} + [/event] + [event] + name=turn 2 + {SUCCEED} + [/event] +)} + +#undef FILTER_ABILITY_TEST_WITHOUT_VALUE diff --git a/wml_test_schedule b/wml_test_schedule index d9befed6c9ecd..b88d74958b46c 100644 --- a/wml_test_schedule +++ b/wml_test_schedule @@ -149,6 +149,8 @@ 0 event_test_filter_ability_no_match_neg_prefix 0 event_test_filter_ability_active 0 event_test_filter_ability_active_inactive +0 event_test_filter_ability_without_value +0 event_test_filter_ability_no_match_different_value 0 test_ability_id_active 0 test_ability_id_not_active 0 event_test_filter_attack