plague tests

This commit is contained in:
pentarctagon 2024-09-09 23:33:49 -05:00 committed by Pentarctagon
parent aec9948c6d
commit d32a363ae8
9 changed files with 753 additions and 1 deletions

View file

@ -92,6 +92,7 @@
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/illuminates}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/leadership}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/petrifies}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/plague}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/regenerate}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/skirmisher}

View file

@ -0,0 +1,97 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [plague]
##
# Actions:
# Give the leaders a plague ability
# Spawn a side 2 unit
# Have side 1's leader attack the side 2 unit with their first weapon
# Spawn a side 2 unit
# Have side 1's leader attack the side 2 unit with their second weapon
##
# Expected end state:
# Both weapons cause a walking corpse to spawn
#####
{COMMON_KEEP_A_B_UNIT_TEST "plague_ability" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE plague (type="Walking Corpse") 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=100
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
[unit]
type = Mage
x,y = 4,2
side = 2
id = "z1"
[/unit]
[unit]
type = Mage
x,y = 5,4
side = 2
id = "z2"
[/unit]
[test_do_attack_by_id]
attacker=alice
defender=z1
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
type = "Walking Corpse"
x,y = 4,2
[/have_unit]
)}
[test_do_attack_by_id]
attacker=alice
defender=z2
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
type = "Walking Corpse"
x,y = 5,4
[/have_unit]
)}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,154 @@
# wmllint: no translatables
#####
# API(s) being tested: [plague]affect_allies=
##
# Actions:
# Give the side 1 leader a plague ability that only affects adjacent allies' weapons
# Spawn a side 3 unit
# Have side 2's leader attack the side 3 unit with their first weapon
# Spawn a side 3 unit
# Have side 2's leader attack the side 3 unit with their second weapon
# Spawn a side 4 unit
# Have side 1's leader attack the side 4 unit with their first weapon
# Spawn a side 4 unit
# Have side 1's leader attack the side 4 unit with their second weapon
##
# Expected end state:
# Both of side 2's weapons spawn walking corpses
# Neither of side 1's weapons spawn walking corpses
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "plague_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 plague ([affect_adjacent][/affect_adjacent]type="Walking Corpse") ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[attacks]
value=1
[/attacks]
[damage]
value=100
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
[unit]
type = Mage
x,y = 3,5
side = 3
id = "z1"
[/unit]
[unit]
type = Mage
x,y = 5,5
side = 3
id = "z2"
[/unit]
[unit]
type = Mage
x,y = 3,3
side = 4
id = "z3"
[/unit]
[unit]
type = Mage
x,y = 5,3
side = 4
id = "z4"
[/unit]
# side 2 attacks side 3
[test_do_attack_by_id]
attacker=bob
defender=z1
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 2
type = "Walking Corpse"
x,y = 3,5
[/have_unit]
)}
[test_do_attack_by_id]
attacker=bob
defender=z2
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 2
type = "Walking Corpse"
x,y = 5,5
[/have_unit]
)}
# side 1 attacks side 4
[test_do_attack_by_id]
attacker=alice
defender=z3
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[not]
[have_unit]
side = 1
x,y = 3,3
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=alice
defender=z4
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[not]
[have_unit]
side = 1
x,y = 5,3
[/have_unit]
[/not]
)}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View file

@ -0,0 +1,98 @@
# wmllint: no translatables
#####
# API(s) being tested: [plague]affect_enemies=
##
# Actions:
# Give the side 1 leader a plague ability that only affects adjacent enemies
# Spawn a side 1 unit
# Have side 2's leader attack the side 1 unit with their first weapon
# Spawn a side 1 unit
# Have side 2's leader attack the side 1 unit with their second weapon
##
# Expected end state:
# Both weapons cause a walking corpse to spawn
#####
{COMMON_KEEP_A_B_UNIT_TEST "plague_affect_enemies" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE plague ([affect_adjacent][/affect_adjacent]type="Walking Corpse") ENEMIES=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[attacks]
value=1
[/attacks]
[damage]
value=100
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
[unit]
type = Mage
x,y = 4,2
side = 1
id = "z1"
[/unit]
[unit]
type = Mage
x,y = 5,4
side = 1
id = "z2"
[/unit]
# side 2 attacks side 1
[test_do_attack_by_id]
attacker=bob
defender=z1
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 2
type = "Walking Corpse"
x,y = 4,2
[/have_unit]
)}
[test_do_attack_by_id]
attacker=bob
defender=z2
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 2
type = "Walking Corpse"
x,y = 5,4
[/have_unit]
)}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,200 @@
# wmllint: no translatables
#####
# API(s) being tested: [plague]affect_allies=
##
# Actions:
# Give the side 1 leader a plague ability with affect_allies, affect_enemies, and affect_self
# Make side 1 and side 2 allies
# Spawn a side 3 unit
# Have side 1's leader attack the side 3 unit with their first weapon
# Spawn a side 3 unit
# Have side 1's leader attack the side 3 unit with their second weapon
# Spawn a side 4 unit
# Have side 2's leader attack the side 4 unit with their first weapon
# Spawn a side 4 unit
# Have side 2's leader attack the side 4 unit with their second weapon
# Spawn a side 1 unit
# Have side 4's leader attack the side 1 unit with their first weapon
# Spawn a side 1 unit
# Have side 4's leader attack the side 1 unit with their second weapon
##
# Expected end state:
# Both weapons for all units cause a walking corpse to spawn
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "plague_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 plague ([affect_adjacent][/affect_adjacent]type="Walking Corpse") 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=100
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
[unit]
type = Mage
x,y = 3,3
side = 3
id = "z1"
[/unit]
[unit]
type = Mage
x,y = 5,3
side = 3
id = "z2"
[/unit]
[unit]
type = Mage
x,y = 3,5
side = 4
id = "z3"
[/unit]
[unit]
type = Mage
x,y = 5,5
side = 4
id = "z4"
[/unit]
[unit]
type = Mage
x,y = 6,3
side = 1
id = "z5"
[/unit]
[unit]
type = Mage
x,y = 6,4
side = 1
id = "z6"
[/unit]
# side 1 attacks side 3
[test_do_attack_by_id]
attacker=alice
defender=z1
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
type = "Walking Corpse"
x,y = 3,3
[/have_unit]
)}
[test_do_attack_by_id]
attacker=alice
defender=z2
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
type = "Walking Corpse"
x,y = 5,3
[/have_unit]
)}
# side 2 attacks side 4
[test_do_attack_by_id]
attacker=bob
defender=z3
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 2
type = "Walking Corpse"
x,y = 3,5
[/have_unit]
)}
[test_do_attack_by_id]
attacker=bob
defender=z4
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 2
type = "Walking Corpse"
x,y = 5,5
[/have_unit]
)}
# side 4 attacks side 1
[test_do_attack_by_id]
attacker=dave
defender=z5
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 4
type = "Walking Corpse"
x,y = 6,3
[/have_unit]
)}
[test_do_attack_by_id]
attacker=dave
defender=z6
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 4
type = "Walking Corpse"
x,y = 6,4
[/have_unit]
)}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View file

@ -0,0 +1,98 @@
# wmllint: no translatables
#####
# API(s) being tested: [plague]affect_self=
##
# Actions:
# Give the leaders a plague ability that doesn't affect themselves.
# Spawn a side 2 unit
# Have side 1's leader attack the side 2 unit with their first weapon
# Spawn a side 2 unit
# Have side 1's leader attack the side 2 unit with their second weapon
##
# Expected end state:
# Neither of side 1's weapons spawn walking corpses
#####
{COMMON_KEEP_A_B_UNIT_TEST "plague_affect_self_no" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE plague (type="Walking Corpse")}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[attacks]
value=1
[/attacks]
[damage]
value=100
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
[unit]
type = Mage
x,y = 4,2
side = 2
id = "z1"
[/unit]
[unit]
type = Mage
x,y = 5,4
side = 2
id = "z2"
[/unit]
[test_do_attack_by_id]
attacker=alice
defender=z1
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[not]
[have_unit]
side = 1
type = "Walking Corpse"
[/have_unit]
[/not]
)}
[test_do_attack_by_id]
attacker=alice
defender=z2
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[not]
[have_unit]
side = 1
type = "Walking Corpse"
[/have_unit]
[/not]
)}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,97 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [plague]
##
# Actions:
# Give the leaders a plague ability
# Spawn a side 2 unit
# Have side 1's leader attack the side 2 unit with their first weapon
# Spawn a side 2 unit
# Have side 1's leader attack the side 2 unit with their second weapon
##
# Expected end state:
# Both weapons cause an elvish archer to spawn
#####
{COMMON_KEEP_A_B_UNIT_TEST "plague_no_type" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE plague () 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=100
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
[unit]
type = Mage
x,y = 4,2
side = 2
id = "z1"
[/unit]
[unit]
type = Mage
x,y = 5,4
side = 2
id = "z2"
[/unit]
[test_do_attack_by_id]
attacker=alice
defender=z1
weapon=0
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
type = "Elvish Archer"
x,y = 4,2
[/have_unit]
)}
[test_do_attack_by_id]
attacker=alice
defender=z2
weapon=1
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT (
[have_unit]
side = 1
type = "Elvish Archer"
x,y = 5,4
[/have_unit]
)}
{SUCCEED}
[/event]
)}

View file

@ -401,7 +401,6 @@
0 effect_increase_attacks
0 opponent_weapon_has_no_special
0 opponent_weapon_has_special
0 plague_without_priority
0 student_teacher_are_same
0 teacher_damage_formula
# Math operations in ability or specials tags
@ -979,6 +978,14 @@
0 petrifies_affect_self_no
0 petrifies_affect_enemies
0 petrifies_affect_everybody
# plague tests
0 plague_ability
0 plague_affect_allies
0 plague_affect_self_no
0 plague_affect_enemies
0 plague_affect_everybody
0 plague_no_type
0 plague_without_priority
# Warnings about WML
0 unknown_scenario_false_positives
0 unknown_scenario_interpolated