add disable ability tests

This commit is contained in:
pentarctagon 2024-08-11 23:09:54 -05:00 committed by Pentarctagon
parent 89f99f70ca
commit 32063bfc7c
7 changed files with 187 additions and 0 deletions

View file

@ -83,6 +83,7 @@
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/chance_to_hit}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/damage}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/damage_type}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/disable}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/heals}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/hides}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/illuminates}

View file

@ -0,0 +1,30 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [disable]
##
# Actions:
# Give the leaders a disables ability
##
# Expected end state:
# Nothing is disabled
#####
{COMMON_KEEP_A_B_UNIT_TEST "disable_ability" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE disable () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 0 WEAPON_COUNT=2}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,40 @@
# wmllint: no translatables
#####
# API(s) being tested: [attacks]affect_allies=
##
# Actions:
# Give the side 1 leader a disable ability that only affects adjacent allies
# Have the side 2 leader attack the side 3 leader with both its weapons
# Have the side 1 leader attack the side 4 leader with both its weapons
##
# Expected end state:
# The side 2 leader has 2 weapons both of which are disabled
# The side 1 leader has two weapons neither of which has been disabled
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "disable_affect_allies" (
[event]
name = start
[modify_side]
side=1,2
team_name=allies
[/modify_side]
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE disable ([affect_adjacent][/affect_adjacent]) ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 100 DAMAGE2=100 WEAPON_COUNT=2 ID1=alice ID2=dave}
{ATTACK_AND_VALIDATE 0 DAMAGE2=0 WEAPON_COUNT=2 ID1=bob ID2=charlie}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View file

@ -0,0 +1,35 @@
# wmllint: no translatables
#####
# API(s) being tested: [attacks]affect_enemies=
##
# Actions:
# Give the side 1 leader a disable ability that only affects adjacent enemies
# Have the side 2 leader attack the side 1 leader with both its weapons
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 2 leader has 2 weapons each of which now disabled
# The side 1 leader has two weapons neither of which is disabled
#####
{COMMON_KEEP_A_B_UNIT_TEST "disable_affect_enemies" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE disable ([affect_adjacent][/affect_adjacent]) ENEMIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 0 DAMAGE2=100 WEAPON_COUNT=2}
{ATTACK_AND_VALIDATE 0 DAMAGE2=0 ID1=bob ID2=alice WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,44 @@
# wmllint: no translatables
#####
# API(s) being tested: [attacks]affect_allies=
##
# Actions:
# Give the side 1 leader a disable ability with affect_allies, affect_enemies, and affect_self
# Make side 1 and side 2 allies
# Have the side 1 leader attack the side 3 leader with both its weapons
# Have the side 2 leader attack the side 4 leader with both its weapons
# Have the side 4 leader attack the side 1 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons each of which is disabled
# The side 2 leader has 2 weapons each of which is disabled
# The side 4 leader has 2 weapons each of which is disabled
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "disable_affect_everybody" (
[event]
name = start
[modify_side]
side=1,2
team_name=allies
[/modify_side]
[modify_unit]
[filter]
side = 1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE disable ([affect_adjacent][/affect_adjacent]) ENEMIES=yes SELF=yes ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 0 WEAPON_COUNT=2 ID1=alice ID2=charlie}
{ATTACK_AND_VALIDATE 0 WEAPON_COUNT=2 ID1=bob ID2=dave}
{ATTACK_AND_VALIDATE 0 WEAPON_COUNT=2 ID1=dave ID2=alice}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [attacks]affect_self=
##
# Actions:
# Give the leaders an attacks ability that doesn't affect themselves.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons neither of which has 5 strikes
#####
{COMMON_KEEP_A_B_UNIT_TEST "disable_affect_self_no" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE disable ()}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 100 WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -873,6 +873,12 @@
0 damage_type_both_same_replacement_best
0 damage_type_both_same_alternative_best
0 damage_type_many
# disable tests
0 disable_ability
0 disable_affect_allies
0 disable_affect_self_no
0 disable_affect_enemies
0 disable_affect_everybody
# Warnings about WML
0 unknown_scenario_false_positives
0 unknown_scenario_interpolated