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..81751858b81b8 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,143 @@ )} #undef FILTER_ABILITY_TEST + +## +# Common code for the tests in this file. +## +# Actions: +# Give both Alice and Bob 100% chance to hit. +# Give Alice a drains ability which is only active during liminal times of day and to value 25(defined in hardcoding by default). +# During Alice's turn, move Alice next to Bob, and have Alice attack Bob. +# During Bob's turn, have Bob attack Alice. +## +#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] +## +# Actions: +# Use the common setup from FILTER_ABILITY_TEST_WITHOUT_VALUE. +# Add an event with a filter matching Alice's drains ability who had value between 10 and 45. +# Alice attacks Bob and then Bob attacks Alice, as defined in FILTER_ABILITY_TEST_WITHOUT_VALUE. +## +# 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 with a different value what 25. +# 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