diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance/resistance_no_max_value.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance/resistance_no_max_value.cfg new file mode 100644 index 000000000000..56b44ed73c1f --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance/resistance_no_max_value.cfg @@ -0,0 +1,32 @@ +# wmllint: no translatables + +##### +# API(s) being tested: [resistance]max_value +## +# Actions: +# Give all units resistance to all damage types with a value of 50 +# Attack each other +## +# Expected end state: +# The damage from the attack is reduced by 50% +##### + +{COMMON_KEEP_A_B_UNIT_TEST "resistance_no_max_value" ( + [event] + name = start + + [modify_unit] + [filter] + [/filter] + [effect] + apply_to = new_ability + [abilities] + {TEST_ABILITY resistance 50 () SELF=yes} + [/abilities] + [/effect] + [/modify_unit] + + {ATTACK_AND_VALIDATE 50} + {SUCCEED} + [/event] +)} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance/resistance_no_value_no_max_value.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance/resistance_no_value_no_max_value.cfg new file mode 100644 index 000000000000..dbdde3a403fd --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance/resistance_no_value_no_max_value.cfg @@ -0,0 +1,38 @@ +#textdomain wesnoth-test + +##### +# API(s) being tested: [resistance]max_value +## +# Actions: +# Give all units resistance to all damage types no value or max_value specified +# Attack each other +## +# Expected end state: +# The damage from the attack is not reduced +##### + +{COMMON_KEEP_A_B_UNIT_TEST "resistance_no_value_no_max_value" ( + [event] + name = start + + [modify_unit] + [filter] + [/filter] + [effect] + apply_to = new_ability + [abilities] + [resistance] + id = resistance1 + name = _"test-resistance_1" + affect_self = yes + affect_allies = no + affect_enemies = no + [/resistance] + [/abilities] + [/effect] + [/modify_unit] + + {ATTACK_AND_VALIDATE 100} + {SUCCEED} + [/event] +)} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance/resistance_no_value_no_max_value_add.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance/resistance_no_value_no_max_value_add.cfg new file mode 100644 index 000000000000..35ad0299fa25 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance/resistance_no_value_no_max_value_add.cfg @@ -0,0 +1,39 @@ +#textdomain wesnoth-test + +##### +# API(s) being tested: [resistance]max_value +## +# Actions: +# Give all units resistance to all damage types no value or max_value specified, but with add=20 +# Attack each other +## +# Expected end state: +# The damage from the attack is reduced by 20% +##### + +{COMMON_KEEP_A_B_UNIT_TEST "resistance_no_value_no_max_value_add" ( + [event] + name = start + + [modify_unit] + [filter] + [/filter] + [effect] + apply_to = new_ability + [abilities] + [resistance] + id = resistance1 + name = _"test-resistance_1" + affect_self = yes + affect_allies = no + affect_enemies = no + add=20 + [/resistance] + [/abilities] + [/effect] + [/modify_unit] + + {ATTACK_AND_VALIDATE 80} + {SUCCEED} + [/event] +)} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance_value.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance_value.cfg deleted file mode 100644 index 682df73daa67..000000000000 --- a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance_value.cfg +++ /dev/null @@ -1,144 +0,0 @@ -# wmllint: no translatables - -##### -# API(s) being tested: [resistance]abilitie witout max_value specified -## -# Actions: -# Give both Alice and Bob 100% chance to hit. -# Give Bob and Alice [resistance]add=20 without max_value attribute and give damage=10 -# Move Alice next to Bob, and have Alice attack Bob. -## -# Expected end state: -# Alice and Bob fight with damage 10-(10*20/100)=8. -##### - -{GENERIC_UNIT_TEST "resistance_value_test" ( - [event] - name=start - [modify_unit] - [filter] - [/filter] - max_hitpoints=100 - hitpoints=100 - attacks_left=1 - [/modify_unit] - [object] - silent=yes - [effect] - apply_to = new_ability - [abilities] - [resistance] - id=steadfast1 - add=20 - affect_self=yes - #max_value=90 - [/resistance] - [/abilities] - [/effect] - [effect] - apply_to=attack - [set_specials] - mode=append - [attacks] - value=1 - [/attacks] - [damage] - value=10 - [/damage] - [chance_to_hit] - value=100 - [/chance_to_hit] - [/set_specials] - [/effect] - [filter] - id=bob - [/filter] - [/object] - [object] - silent=yes - [effect] - apply_to = new_ability - [abilities] - [resistance] - id=steadfast1 - add=20 - affect_self=yes - #max_value=90 - [/resistance] - [/abilities] - [/effect] - [effect] - apply_to=attack - [set_specials] - mode=append - [attacks] - value=1 - [/attacks] - [damage] - value=10 - [/damage] - [chance_to_hit] - value=100 - [/chance_to_hit] - [/set_specials] - [/effect] - [filter] - id=alice - [/filter] - [/object] - - [store_unit] - [filter] - id=alice - [/filter] - variable=a - kill=yes - [/store_unit] - [store_unit] - [filter] - id=bob - [/filter] - variable=b - [/store_unit] - [unstore_unit] - variable=a - find_vacant=yes - x,y=$b.x,$b.y - [/unstore_unit] - [store_unit] - [filter] - id=alice - [/filter] - variable=a - [/store_unit] - - [do_command] - [attack] - weapon=0 - defender_weapon=0 - [source] - x,y=$a.x,$a.y - [/source] - [destination] - x,y=$b.x,$b.y - [/destination] - [/attack] - [/do_command] - [store_unit] - [filter] - id=alice - [/filter] - variable=a - [/store_unit] - [store_unit] - [filter] - id=bob - [/filter] - variable=b - [/store_unit] - #damage without modification are 10 and 8 with resistance added to 20%, if test fail hitpoints !=92 - {ASSERT ({VARIABLE_CONDITIONAL a.hitpoints equals 92})} - {ASSERT ({VARIABLE_CONDITIONAL b.hitpoints equals 92})} - {SUCCEED} - [/event] -)} diff --git a/wml_test_schedule b/wml_test_schedule index cf10909aa5fb..cd6e6977f3cb 100644 --- a/wml_test_schedule +++ b/wml_test_schedule @@ -340,7 +340,6 @@ 0 damage_secondary_type_test 0 swarms_filter_student_by_type 0 swarms_effects_not_checkable -0 resistance_value_test 0 filter_special_id_active 0 filter_ability_special_id_active 0 filter_special_id_not_exists @@ -570,6 +569,9 @@ 0 resistance_active_on_offense 0 resistance_active_on_defense 0 resistance_active_on_both +0 resistance_no_max_value +0 resistance_no_value_no_max_value +0 resistance_no_value_no_max_value_add # Warnings about WML 0 unknown_scenario_false_positives 0 unknown_scenario_interpolated