swarm tests (#9454)

This commit is contained in:
Pentarctagon 2024-10-15 17:31:01 -05:00 committed by GitHub
parent 1c4d2f449f
commit 42d349a65d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 1573 additions and 0 deletions

View File

@ -98,6 +98,7 @@
{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/swarm}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/teleport}
{test/scenarios/wml_tests/UnitsWML/Attacks}
{test/scenarios/wml_tests/WesnothFormulaLanguage}

View File

@ -375,3 +375,62 @@ numerical_equals#endarg
[/if]
[/event]
#enddef
#define SWARM_ATTACK_TEST WEAPON ID1 ID2 DAMAGE1_1 DAMAGE2_1 DAMAGE1_2 DAMAGE2_2
[test_do_attack_by_id]
attacker={ID1}
defender={ID2}
weapon={WEAPON}
resupply_attacks_left=1
[/test_do_attack_by_id]
[store_unit]
[filter]
id={ID1}
[/filter]
variable={ID1}
[/store_unit]
[store_unit]
[filter]
id={ID2}
[/filter]
variable={ID2}
[/store_unit]
{ASSERT {VARIABLE_CONDITIONAL {ID1}.hitpoints numerical_equals "$(${ID1}.max_hitpoints-{DAMAGE1_1})"}}
{ASSERT {VARIABLE_CONDITIONAL {ID2}.hitpoints numerical_equals "$(${ID2}.max_hitpoints-{DAMAGE2_1})"}}
{CLEAR_VARIABLE {ID1}}
{CLEAR_VARIABLE {ID2}}
[test_do_attack_by_id]
attacker={ID1}
defender={ID2}
weapon={WEAPON}
resupply_attacks_left=1
[/test_do_attack_by_id]
[store_unit]
[filter]
id={ID1}
[/filter]
variable={ID1}
[/store_unit]
[store_unit]
[filter]
id={ID2}
[/filter]
variable={ID2}
[/store_unit]
{ASSERT {VARIABLE_CONDITIONAL {ID1}.hitpoints numerical_equals "$(${ID1}.max_hitpoints-{DAMAGE1_2})"}}
{ASSERT {VARIABLE_CONDITIONAL {ID2}.hitpoints numerical_equals "$(${ID2}.max_hitpoints-{DAMAGE2_2})"}}
{CLEAR_VARIABLE {ID1}}
{CLEAR_VARIABLE {ID2}}
[heal_unit]
[filter]
[/filter]
[/heal_unit]
#enddef

View File

@ -0,0 +1,65 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]affect_allies=
##
# Actions:
# Give the side 1 leader a swarm 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:
# alice is unaffected by any swarm ability while bob is affected
# alice has 2 strikes per attack for the first weapon and 4 strikes per attack for the second weapon
# bob has 10 strikes for the first attack of the first weapon and 9 strikes for the second attack (27/29, rounded down)
# bob has 10 strikes for the first attack of the second weapon and 8 strikes for the second attack (25/29, rounded down)
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "swarm_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 swarm ([affect_adjacent][/affect_adjacent]
swarm_attacks_min=0
swarm_attacks_max=10) ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 bob charlie 2 10 4 19}
{SWARM_ATTACK_TEST 1 bob charlie 4 10 8 18}
{SWARM_ATTACK_TEST 0 alice dave 2 2 4 4}
{SWARM_ATTACK_TEST 1 alice dave 4 4 8 8}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View File

@ -0,0 +1,56 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]affect_enemies=
##
# Actions:
# Give the side 1 leader a swarm ability that only affects adjacent enemies
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# alice is unaffected by any swarm ability while bob is affected
# alice has 2 strikes per attack for the first weapon and 4 strikes per attack for the second weapon
# bob has 10 strikes for the first attack of the first weapon and 9 strikes for the second attack (27/29, rounded down)
# bob has 10 strikes for the first attack of the second weapon and 8 strikes for the second attack (25/29, rounded down)
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_affect_enemies" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm ([affect_adjacent][/affect_adjacent]
swarm_attacks_min=0
swarm_attacks_max=10) ENEMIES=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 2 19 4}
{SWARM_ATTACK_TEST 1 alice bob 10 4 18 8}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,67 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the side 1 leader a swarm 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:
# For all weapons, the first attack has 10 strikes and the second attack has 6 strikes
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "swarm_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 swarm ([affect_adjacent][/affect_adjacent]
swarm_attacks_min=0
swarm_attacks_max=10) ENEMIES=yes SELF=yes ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice charlie 10 10 16 16}
{SWARM_ATTACK_TEST 1 alice charlie 10 10 16 16}
{SWARM_ATTACK_TEST 0 bob dave 10 10 16 16}
{SWARM_ATTACK_TEST 1 bob dave 10 10 16 16}
{SWARM_ATTACK_TEST 0 dave alice 10 10 16 16}
{SWARM_ATTACK_TEST 1 dave alice 10 10 16 16}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]affect_self=
##
# Actions:
# Give the leaders a swarm ability with the min value of 0 and the max value of 10
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# Neither weapon is affected by the swarm ability
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_affect_self_no" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=10)}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 2 2 4 4}
{SWARM_ATTACK_TEST 1 alice bob 4 4 8 8}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,54 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the max value of 28 and an unspecified min value
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# The first weapon has 28 strikes the first attack and 0 strikes for the second attack
# The second weapon has 28 strikes for the first attack and 0 strikes for the second attack
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_max" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_max=28) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 28 28 28 28}
{SWARM_ATTACK_TEST 1 alice bob 28 28 28 28}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,55 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the min value of 0 and the max value of 28.9
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# For both weapons, the first attack has 28 strikes and the second attack has 0 strikes (28/29, rounded down)
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_max_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=28.9) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 28 28 28 28}
{SWARM_ATTACK_TEST 1 alice bob 28 28 28 28}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}
#endif

View File

@ -0,0 +1,54 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the max value of -5 and the min value of 0
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# For both weapons, both attacks have 0 strikes
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_max_negative" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=-5) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 0 0 0 0}
{SWARM_ATTACK_TEST 1 alice bob 0 0 0 0}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,54 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the min value of 0 and the max value of 14 (29/2, rounded down)
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# For both weapons, the first attack has 14 strikes and the second attack has 7 strikes (15/29, rounded down)
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_max_wfl" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max="(max_hitpoints/2)") SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 14 14 21 21}
{SWARM_ATTACK_TEST 1 alice bob 14 14 21 21}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,54 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the min value of 0 and an unspecified max value
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# The first weapon has 2 strikes the first attack and 1 strike for the second attack
# The second weapon has 4 strikes for the first attack and 3 strikes for the second attack
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_min" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 2 2 3 3}
{SWARM_ATTACK_TEST 1 alice bob 4 4 7 7}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,56 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the min value of 0.9 and the max value of 28
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# For both weapons, the first attack has 28 strikes and the second attack has 0 strikes (28/29, rounded down)
# swarm_attacks_min does not round up to 1
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_min_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0.9
swarm_attacks_max=28) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 28 28 28 28}
{SWARM_ATTACK_TEST 1 alice bob 28 28 28 28}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}
#endif

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the min value of 10 and the max value of 5
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# For both weapons, the first attack has 5 strikes and the second attack has 6 strikes (24/29, rounded up)
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_min_higher" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=10
swarm_attacks_max=5) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 5 5 11 11}
{SWARM_ATTACK_TEST 1 alice bob 5 5 11 11}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the min value of 0 and the max value of 10
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# For both weapons, the first attack has 10 strikes and the second attack has 6 strikes (19/29, rounded down)
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_min_lower" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=10) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 10 16 16}
{SWARM_ATTACK_TEST 1 alice bob 10 10 16 16}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,55 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the min value of -5 and the max value of 28
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# For both weapons, the first attack has 28 strikes and the second attack has 0 strikes (28/29, rounded down)
# swarm_attacks_min does not round up to 1
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_min_negative" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=-5
swarm_attacks_max=28) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 28 28 28 28}
{SWARM_ATTACK_TEST 1 alice bob 28 28 28 28}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,54 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the min value of 0 (29 max hp minus 29) and the max value of 10
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# For both weapons, the first attack has 10 strikes and the second attack has 6 strikes (19/29, rounded down)
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_attacks_min_wfl" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min="(max_hitpoints-29)"
swarm_attacks_max=10) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 10 16 16}
{SWARM_ATTACK_TEST 1 alice bob 10 10 16 16}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with the min value of 0 and the max value of 0
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# Neither weapon has any strikes
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_min_max_zero" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=0) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 0 0 0 0}
{SWARM_ATTACK_TEST 1 alice bob 0 0 0 0}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the leaders a swarm ability with no min or max value
# Have the side 1 leader attack the side 2 leader with its first weapon twice
# Heal both units
# Have the side 1 leader attack the side 2 leader with its second weapon twice
##
# Expected end state:
# The first weapon has 2 strikes the first attack and 1 strike for the second attack
# The second weapon has 4 strikes for the first attack and 3 strikes for the second attack
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_no_min_no_max" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 2 2 3 3}
{SWARM_ATTACK_TEST 1 alice bob 4 4 7 7}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,55 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]overwrite_specials=
##
# Actions:
# Give the side 1 leader a swarm ability with the overwrite_specials=both_sides attribute
# Give the side 1 leader a swarm ability without the overwrite_specials attribute
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# For both weapons, the first attack has 10 strikes and the second attack has 6 strikes (19/29, rounded down), overwrite_specials ability takes priority
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_overwrite_specials_both_sides" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (overwrite_specials=both_sides
swarm_attacks_min=0
swarm_attacks_max=10) SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=4
swarm_attacks_max=6) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 10 16 16}
{SWARM_ATTACK_TEST 1 alice bob 10 10 16 16}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,56 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]
##
# Actions:
# Give the side 1 leader a swarm ability with the overwrite_specials=both_sides attribute
# Give the side 1 leader a swarm ability without the overwrite_specials attribute
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The higher swarm_attacks_max swarm and swarm_attacks_min is used, effectively giving a min of 4 and a max of 10
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_overwrite_specials_mixed" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (overwrite_specials=one_side
swarm_attacks_min=0
swarm_attacks_max=10) SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (overwrite_specials=both_sides
swarm_attacks_min=4
swarm_attacks_max=6) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 10 17 17}
{SWARM_ATTACK_TEST 1 alice bob 10 10 17 17}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,55 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]overwrite_specials=
##
# Actions:
# Give the side 1 leader an swarm ability with the overwrite_specials=one_side attribute
# Give the side 1 leader an swarm ability without the overwrite_specials attribute
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# For both weapons, the first attack has 10 strikes and the second attack has 6 strikes (19/29, rounded down), overwrite_specials ability takes priority
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_overwrite_specials_one_side" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (overwrite_specials=one_side
swarm_attacks_min=0
swarm_attacks_max=10) SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=4
swarm_attacks_max=6) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 10 16 16}
{SWARM_ATTACK_TEST 1 alice bob 10 10 16 16}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,56 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]overwrite_specials=
##
# Actions:
# Give the side 1 leader an swarm ability with the overwrite_specials=both_sides attribute
# Give the side 1 leader another swarm ability with the overwrite_specials=both_sides attribute
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The higher swarm_attacks_max swarm and swarm_attacks_min is used, effectively giving a min of 4 and a max of 10
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_overwrite_specials_two_both_sides" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (overwrite_specials=both_sides
swarm_attacks_min=0
swarm_attacks_max=10) SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (overwrite_specials=both_sides
swarm_attacks_min=4
swarm_attacks_max=6) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 10 17 17}
{SWARM_ATTACK_TEST 1 alice bob 10 10 17 17}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,56 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]overwrite_specials=
##
# Actions:
# Give the side 1 leader an swarm ability with the overwrite_specials=one_side attribute
# Give the side 1 leader another swarm ability with the overwrite_specials=one_side attribute
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The higher swarm_attacks_max swarm and swarm_attacks_min is used, effectively giving a min of 4 and a max of 10
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_overwrite_specials_two_one_side" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (overwrite_specials=one_side
swarm_attacks_min=0
swarm_attacks_max=10) SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (overwrite_specials=one_side
swarm_attacks_min=4
swarm_attacks_max=6) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 10 17 17}
{SWARM_ATTACK_TEST 1 alice bob 10 10 17 17}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]cumulative=
##
# Actions:
# Give the leaders an swarm ability with non-unique IDs, one with cumulative=yes, and one with cumulative=no
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# Both the min and max values are summed together
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_two_cumulative_mixed_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=10) ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=4
swarm_attacks_max=6) ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 16 16 25 25}
{SWARM_ATTACK_TEST 1 alice bob 16 16 25 25}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]cumulative=
##
# Actions:
# Give the leaders an swarm ability with unique IDs, one with cumulative=yes, and one with cumulative=no
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# Both the min and max values are summed together
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_two_cumulative_mixed_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=10) ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=4
swarm_attacks_max=6) ID=2 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 16 16 25 25}
{SWARM_ATTACK_TEST 1 alice bob 16 16 25 25}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]cumulative=
##
# Actions:
# Give the leaders an swarm ability with non-unique IDs and cumulative=no
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The higher swarm_attacks_max swarm and swarm_attacks_min is used, effectively giving a min of 4 and a max of 10
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_two_cumulative_no_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=10) ID=1 CUMULATIVE=no SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=4
swarm_attacks_max=6) ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 10 17 17}
{SWARM_ATTACK_TEST 1 alice bob 10 10 17 17}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]cumulative=
##
# Actions:
# Give the leaders an swarm ability with unique IDs and cumulative=no
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The higher swarm_attacks_max swarm and swarm_attacks_min is used, effectively giving a min of 4 and a max of 10
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_two_cumulative_no_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=10) ID=1 CUMULATIVE=no SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=4
swarm_attacks_max=6) ID=2 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 10 10 17 17}
{SWARM_ATTACK_TEST 1 alice bob 10 10 17 17}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]cumulative=
##
# Actions:
# Give the leaders an swarm ability with non-unique IDs and cumulative=yes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# Both the min and max values are summed together
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_two_cumulative_yes_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=10) ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=4
swarm_attacks_max=6) ID=1 CUMULATIVE=yes SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 16 16 25 25}
{SWARM_ATTACK_TEST 1 alice bob 16 16 25 25}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -0,0 +1,53 @@
# wmllint: no translatables
#####
# API(s) being tested: [swarm]cumulative=
##
# Actions:
# Give the leaders an swarm ability with unique IDs and cumulative=yes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# Both the min and max values are summed together
#####
{COMMON_KEEP_A_B_UNIT_TEST "swarm_two_cumulative_yes_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=0
swarm_attacks_max=10) ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY_NO_VALUE swarm (swarm_attacks_min=4
swarm_attacks_max=6) ID=2 CUMULATIVE=yes SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
[modify_unit]
[filter]
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[damage]
value=1
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
[/modify_unit]
{SWARM_ATTACK_TEST 0 alice bob 16 16 25 25}
{SWARM_ATTACK_TEST 1 alice bob 16 16 25 25}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View File

@ -1005,6 +1005,34 @@
0 slow_affect_self_no
0 slow_affect_enemies
0 slow_affect_everybody
# swarm tests
0 swarm_affect_allies
0 swarm_affect_enemies
0 swarm_affect_everybody
0 swarm_affect_self_no
0 swarm_attacks_max
0 swarm_attacks_max_fraction
0 swarm_attacks_max_negative
0 swarm_attacks_max_wfl
0 swarm_attacks_min
0 swarm_attacks_min_fraction
0 swarm_attacks_min_higher
0 swarm_attacks_min_lower
0 swarm_attacks_min_negative
0 swarm_attacks_min_wfl
0 swarm_min_max_zero
0 swarm_no_min_no_max
0 swarm_overwrite_specials_both_sides
0 swarm_overwrite_specials_mixed
0 swarm_overwrite_specials_one_side
0 swarm_overwrite_specials_two_both_sides
0 swarm_overwrite_specials_two_one_side
0 swarm_two_cumulative_mixed_same_id
0 swarm_two_cumulative_mixed_unique_id
0 swarm_two_cumulative_no_same_id
0 swarm_two_cumulative_no_unique_id
0 swarm_two_cumulative_yes_same_id
0 swarm_two_cumulative_yes_unique_id
# Warnings about WML
0 unknown_scenario_false_positives
0 unknown_scenario_interpolated