slows tests (#9401)

This commit is contained in:
Pentarctagon 2024-10-01 17:54:36 -05:00 committed by GitHub
parent d2f6b171c0
commit ede10ca10c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 757 additions and 0 deletions

View File

@ -97,6 +97,7 @@
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/regenerate}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/skirmisher}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/slow}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/teleport}
{test/scenarios/wml_tests/UnitsWML/Attacks}
{test/scenarios/wml_tests/WesnothFormulaLanguage}

View File

@ -0,0 +1,145 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [slow]
##
# Actions:
# Give the leaders a slow ability
# Have side 1's leader attack side 2's leader with their first weapon
# Unslow side 2's leader
# Have side 1's leader attack side 2's leader with their second weapon
##
# Expected end state:
# Both weapons slow side 2's leader
#####
{COMMON_KEEP_A_B_UNIT_TEST "slow_ability" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE slow () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
id=alice,bob
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[attacks]
value=1
[/attacks]
[damage]
value=2
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
[test_do_attack_by_id]
attacker=alice
defender=bob
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 2
status = "slowed"
[/have_unit]
)}
{ASSERT (
[have_unit]
side = 1
status = "slowed"
[/have_unit]
)}
[heal_unit]
[filter]
[/filter]
[/heal_unit]
{ASSERT (
[not]
[have_unit]
status = "slowed"
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=alice
defender=bob
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 2
status = "slowed"
[/have_unit]
)}
{ASSERT (
[have_unit]
side = 1
status = "slowed"
[/have_unit]
)}
# check that slowing halved damage
[store_unit]
[filter]
id=alice
[/filter]
variable=alice
[/store_unit]
[store_unit]
[filter]
id=bob
[/filter]
variable=bob
[/store_unit]
{ASSERT {VARIABLE_CONDITIONAL alice.hitpoints numerical_equals "$($alice.max_hitpoints-1)"}}
{ASSERT {VARIABLE_CONDITIONAL bob.hitpoints numerical_equals "$($bob.max_hitpoints-2)"}}
{CLEAR_VARIABLE alice}
{CLEAR_VARIABLE bob}
[end_turn][/end_turn]
[/event]
[event]
name = side 2 turn 1
[end_turn][/end_turn]
[/event]
[event]
name = turn 2
{ASSERT (
[not]
[have_unit]
status = "slowed"
[/have_unit]
[/not]
)}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,167 @@
# wmllint: no translatables
#####
# API(s) being tested: [slow]affect_allies=
##
# Actions:
# Give the side 1 leader a slow ability that only affects adjacent allies' weapons
# 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:
# Both of side 2's weapons slow side 3's leader
# Neither of side 1's weapons slow side 4's leader
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "slow_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 slow ([affect_adjacent][/affect_adjacent]) ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[attacks]
value=1
[/attacks]
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
# side 2 attacks side 3
[test_do_attack_by_id]
attacker=bob
defender=charlie
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 3
status = "slowed"
[/have_unit]
)}
{ASSERT (
[not]
[have_unit]
side = 2
status = "slowed"
[/have_unit]
[/not]
)}
[heal_unit]
[filter]
side = 3
[/filter]
[/heal_unit]
{ASSERT (
[not]
[have_unit]
side = 3
status = "slowed"
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=bob
defender=charlie
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 3
status = "slowed"
[/have_unit]
)}
{ASSERT (
[not]
[have_unit]
side = 2
status = "slowed"
[/have_unit]
[/not]
)}
# side 1 attacks side 4
[test_do_attack_by_id]
attacker=alice
defender=dave
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[not]
[have_unit]
side = 4
status = "slowed"
[/have_unit]
[/not]
)}
{ASSERT (
[not]
[have_unit]
side = 1
status = "slowed"
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=alice
defender=dave
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[not]
[have_unit]
side = 4
status = "slowed"
[/have_unit]
[/not]
)}
{ASSERT (
[not]
[have_unit]
side = 1
status = "slowed"
[/have_unit]
[/not]
)}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View File

@ -0,0 +1,111 @@
# wmllint: no translatables
#####
# API(s) being tested: [slow]affect_enemies=
##
# Actions:
# Give the side 1 leader a slow ability that only affects adjacent enemies
# Have the side 2 leader attack the side 1 leader with both its weapons
##
# Expected end state:
# Both of side 2's weapons slow side 1's leader
#####
{COMMON_KEEP_A_B_UNIT_TEST "slow_affect_enemies" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE slow ([affect_adjacent][/affect_adjacent]) ENEMIES=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[attacks]
value=1
[/attacks]
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
# side 2 attacks side 1
[test_do_attack_by_id]
attacker=alice
defender=bob
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
status = "slowed"
[/have_unit]
)}
{ASSERT (
[not]
[have_unit]
side = 2
status = "slowed"
[/have_unit]
[/not]
)}
[heal_unit]
[filter]
side = 1
[/filter]
[/heal_unit]
{ASSERT (
[not]
[have_unit]
side = 1
status = "slowed"
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=alice
defender=bob
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
status = "slowed"
[/have_unit]
)}
{ASSERT (
[not]
[have_unit]
side = 2
status = "slowed"
[/have_unit]
[/not]
)}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,229 @@
# wmllint: no translatables
#####
# API(s) being tested: [slow]affect_allies=
##
# Actions:
# Give the side 1 leader a slow 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 slow the side 3 leader
# The side 2 leader has 2 weapons each of which slow the side 4 leader
# The side 4 leader has 2 weapons each of which slow the side 1 leader
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "slow_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 slow ([affect_adjacent][/affect_adjacent]) ENEMIES=yes SELF=yes ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[attacks]
value=1
[/attacks]
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
# side 1 attacks side 3
[test_do_attack_by_id]
attacker=alice
defender=charlie
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 3
status = "slowed"
[/have_unit]
)}
{ASSERT (
[have_unit]
side = 1
status = "slowed"
[/have_unit]
)}
[heal_unit]
[filter]
[/filter]
[/heal_unit]
{ASSERT (
[not]
[have_unit]
status = "slowed"
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=alice
defender=charlie
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 3
status = "slowed"
[/have_unit]
)}
{ASSERT (
[have_unit]
side = 1
status = "slowed"
[/have_unit]
)}
# side 2 attacks side 4
[test_do_attack_by_id]
attacker=bob
defender=dave
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 4
status = "slowed"
[/have_unit]
)}
{ASSERT (
[have_unit]
side = 2
status = "slowed"
[/have_unit]
)}
[heal_unit]
[filter]
[/filter]
[/heal_unit]
{ASSERT (
[not]
[have_unit]
status = "slowed"
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=bob
defender=dave
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 4
status = "slowed"
[/have_unit]
)}
{ASSERT (
[have_unit]
side = 2
status = "slowed"
[/have_unit]
)}
[heal_unit]
[filter]
[/filter]
[/heal_unit]
# side 4 attacks side 1
[test_do_attack_by_id]
attacker=dave
defender=alice
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
status = "slowed"
[/have_unit]
)}
{ASSERT (
[have_unit]
side = 4
status = "slowed"
[/have_unit]
)}
[heal_unit]
[filter]
[/filter]
[/heal_unit]
{ASSERT (
[not]
[have_unit]
side = 1
status = "slowed"
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=dave
defender=alice
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
status = "slowed"
[/have_unit]
)}
{ASSERT (
[have_unit]
side = 4
status = "slowed"
[/have_unit]
)}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View File

@ -0,0 +1,98 @@
# wmllint: no translatables
#####
# API(s) being tested: [slow]affect_self=
##
# Actions:
# Give the leaders a slow ability that doesn't affect themselves.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# Neither leader is slowed
#####
{COMMON_KEEP_A_B_UNIT_TEST "slow_affect_self_no" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE slow ()}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[attacks]
value=1
[/attacks]
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
[test_do_attack_by_id]
attacker=alice
defender=bob
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[not]
[have_unit]
side = 1
status = "slowed"
[/have_unit]
[/not]
)}
{ASSERT (
[not]
[have_unit]
side = 2
status = "slowed"
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=alice
defender=bob
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[not]
[have_unit]
side = 1
status = "slowed"
[/have_unit]
[/not]
)}
{ASSERT (
[not]
[have_unit]
side = 2
status = "slowed"
[/have_unit]
[/not]
)}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -999,6 +999,12 @@
0 poison_affect_self_no
0 poison_affect_enemies
0 poison_affect_everybody
# slow tests
0 slow_ability
0 slow_affect_allies
0 slow_affect_self_no
0 slow_affect_enemies
0 slow_affect_everybody
# Warnings about WML
0 unknown_scenario_false_positives
0 unknown_scenario_interpolated