drains tests

This commit is contained in:
pentarctagon 2024-08-23 22:38:11 -05:00 committed by Pentarctagon
parent c1fd40c7a0
commit 815739f1c2
40 changed files with 1295 additions and 1 deletions

View file

@ -84,6 +84,7 @@
{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/drains}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/heals}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/hides}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/illuminates}

View file

@ -137,6 +137,7 @@
# DAMAGE1 is expected hp loss for ID1 (alice).
# DAMAGE2 is expected hp loss for ID2 (bob), it defaults to the same as DAMAGE1.
# WEAPON_COUNT is how many weapons to test, starting from the first.
# STRIKE_COUNT is how many strikes to make
# DAMAGE_VALUE is the contents of the [damage] ability to set the attack to the default of 100
# ID1_HP is the hitpoints and max_hitpoints for the ID1 unit to have
# ID2_HP is the hitpoints and max_hitpoints for the ID2 unit to have
@ -154,6 +155,9 @@ bob#endarg
#arg WEAPON_COUNT
1#endarg
#arg STRIKE_COUNT
1#endarg
#arg ID1_HP
1000#endarg
@ -175,7 +179,7 @@ bob#endarg
[set_specials]
mode=append
[attacks]
value=1
value={STRIKE_COUNT}
[/attacks]
{DAMAGE_VALUE}
[chance_to_hit]

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders an drains ability with both the value and add attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 6 hp (5+1), add is ignored
# The leader of side 1 heals 6 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 12 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_add" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 5 (add=1) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 194 DAMAGE2=188 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with the value, add, and divide attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 3 hp ((5+1)/2)
# The leader of side 1 heals 3 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 6 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_add_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 5 (add=1
divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 197 DAMAGE2=194 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with the value, add, and multiply attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 12 hp ((5+1)*2)
# The leader of side 1 heals 12 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 24 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_add_multiply" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 5 (add=1
multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 188 DAMAGE2=176 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with the value, add, and sub attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 3 hp (5-2), add is ignored
# The leader of side 1 heals 3 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 6 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_add_sub" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 5 (add=1
sub=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 197 DAMAGE2=194 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,41 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]affect_allies=
##
# Actions:
# Give the side 1 leader a drains 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 all leaders have 2 weapons each of which now drains 2 hp
# The leader of side 2 heals 2 hp total since it has full hp when its first strike is made
# No other units are healed via drains
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "drains_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 drains 2 ([affect_adjacent][/affect_adjacent]) ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 198 DAMAGE2=200 ID1=bob ID2=charlie WEAPON_COUNT=2 STRIKE_COUNT=2}
{ATTACK_AND_VALIDATE 200 ID1=alice ID2=dave WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]affect_enemies=
##
# Actions:
# Give the side 1 leader a drains ability that only affects adjacent enemies
# 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 has drains 2 hp
# The side 1 leader has 2 weapons neither of which has been modified to have drains
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_affect_enemies" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 2 ([affect_adjacent][/affect_adjacent]) ENEMIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 200 DAMAGE2=196 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,44 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]affect_allies=
##
# Actions:
# Give the side 1 leader a drains 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 now drains 2 hp
# The side 2 leader has 2 weapons each of which now has drains 2 hp
# The side 4 leader has 2 weapons each of which now has drains 2 hp
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "drains_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 drains 2 ([affect_adjacent][/affect_adjacent]) ENEMIES=yes SELF=yes ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 198 DAMAGE2=196 ID1=alice ID2=charlie WEAPON_COUNT=2 STRIKE_COUNT=2}
{ATTACK_AND_VALIDATE 198 DAMAGE2=196 ID1=bob ID2=dave WEAPON_COUNT=2 STRIKE_COUNT=2}
{ATTACK_AND_VALIDATE 198 DAMAGE2=196 ID1=dave ID2=alice WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]affect_self=
##
# Actions:
# Give the leaders a drains 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 drains
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_affect_self_no" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 2 ()}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 200 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]cumulative=
##
# Actions:
# Give the leaders a drains ability with non-unique IDs, one with cumulative=yes, and one with cumulative=no
# The drains abilities give a lower value than drains' default of 50% gives
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons both of which drain 50 hp (50% of 100), since the 50% default gives a higher value
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_default_cumulative_both" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 40 () ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY drains 30 () ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 150 DAMAGE2=100 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]cumulative=
##
# Actions:
# Give the leaders a drains ability with non-unique IDs with cumulative=no
# The drains abilities give a lower value than drains' default of 50% gives
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons both of which drain 30 hp, using the value of the cumulative=no ability even though it's lower
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_default_cumulative_no" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 30 () ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 170 DAMAGE2=140 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]cumulative=
##
# Actions:
# Give the leaders a drains ability with non-unique IDs with cumulative=yes
# The drains abilities give a lower value than drains' default of 50% gives
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons both of which drain 50 hp (50% of 100), since the 50% default gives a higher value
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_default_cumulative_yes" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 30 () ID=1 CUMULATIVE=yes SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 150 DAMAGE2=100 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with both the value and divide attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 3 hp (6/2)
# The leader of side 1 heals 3 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 6 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 6 (divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 197 DAMAGE2=194 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,35 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with a value of 3.8.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 3 hp
# The leader of side 1 heals 3 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 6 hp total since it was damaged when its first strike was made
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "drains_high_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 3.8 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 197 DAMAGE2=194 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}
#endif

View file

@ -0,0 +1,35 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with a value of 3.2.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 3 hp
# The leader of side 1 heals 3 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 6 hp total since it was damaged when its first strike was made
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "drains_low_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 3.2 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 197 DAMAGE2=194 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}
#endif

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with both the value and add attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# max_value works.
# The both leaders have 2 weapons each of which now drains 1 hp
# The leader of side 1 heals 1 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 2 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_max_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 3 (max_value=1) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 199 DAMAGE2=198 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with both the value and multiply attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 8 hp (2*4)
# The leader of side 1 heals 8 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 16 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_multiply" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 4 (multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 192 DAMAGE2=184 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with the value, multiply, and divide attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 6 hp ((4*3)/2)
# The leader of side 1 heals 6 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 12 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_multiply_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 4 (multiply=3
divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 194 DAMAGE2=188 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,35 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with both the value and multiply attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 6 hp (3*2, the .5 is truncated)
# The leader of side 1 heals 6 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 12 hp total since it was damaged when its first strike was made
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "drains_multiply_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 3.5 (multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 194 DAMAGE2=188 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}
#endif

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with a value of -10.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The leader of side 1 heals takes 10 damage per hit against the side 2 leader plus 100 per hit from the side 2 leader's retaliation
# The leader of side 2 heals takes 10 damage per hit against the side 1 leader plus 100 per hit from the side 1 leader's retaliation
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_negative_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains -10 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 220 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,40 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability missing the value attribute.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 50 hp (50% of 100 damage)
# The leader of side 1 heals 50 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 100 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_no_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
[drains]
id = "test-drains"
name = _"test-drains"
affect_self = yes
affect_allies = no
affect_enemies = no
cumulative = no
[/drains]
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 150 DAMAGE2=100 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]overwrite_specials=
##
# Actions:
# Give the side 1 leader a drains ability with the overwrite_specials=both_sides attribute
# Give the side 1 leader a drains ability without the overwrite_specials attribute
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons each of which now drains 2 hp, since the 2 hp drains ability takes priority due to overwrite_specials
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_overwrite_specials_both_sides" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 2 (overwrite_specials=both_sides) SELF=yes}
{TEST_ABILITY drains 7 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 198 DAMAGE2=200 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]overwrite_specials=
##
# Actions:
# Give the side 1 leader a drains ability with the overwrite_specials=one_side attribute
# Give the side 1 leader another drains 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 side 1 leader has 2 weapons each of which now drains 7 hp, since the the higher value ability is used
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_overwrite_specials_mixed" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 2 (overwrite_specials=one_side) SELF=yes}
{TEST_ABILITY drains 7 (overwrite_specials=both_sides) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 193 DAMAGE2=200 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]overwrite_specials=
##
# Actions:
# Give the side 1 leader a drains ability with the overwrite_specials=one_side attribute
# Give the side 1 leader a drains ability without the overwrite_specials attribute
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons each of which now drains 2 hp, since the 2 hp drains ability takes priority due to overwrite_specials
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_overwrite_specials_one_side" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 2 (overwrite_specials=one_side) SELF=yes}
{TEST_ABILITY drains 7 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 198 DAMAGE2=200 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]overwrite_specials=
##
# Actions:
# Give the side 1 leader a drains ability with the overwrite_specials=both_sides attribute
# Give the side 1 leader another drains 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 side 1 leader has 2 weapons each of which now drains 7, since the the higher value ability is used
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_overwrite_specials_two_both_sides" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 7 (overwrite_specials=both_sides) SELF=yes}
{TEST_ABILITY drains 2 (overwrite_specials=both_sides) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 193 DAMAGE2=200 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]overwrite_specials=
##
# Actions:
# Give the side 1 leader a drains ability with the overwrite_specials=one_side attribute
# Give the side 1 leader another drains 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 side 1 leader has 2 weapons each of which now drains 7 hp, since the the higher value ability is used
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_overwrite_specials_two_one_side" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 2 (overwrite_specials=one_side) SELF=yes}
{TEST_ABILITY drains 7 (overwrite_specials=one_side) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 193 DAMAGE2=200 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with both the value and sub attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 1 hp (3-2)
# The leader of side 1 heals 4 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 8 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_sub" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 3 (sub=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 199 DAMAGE2=198 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with both the value, sub, and divide attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 1 hp ((3-1)/2)
# The leader of side 1 heals 1 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 2 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_sub_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 3 (sub=1
divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 199 DAMAGE2=198 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with both the value, sub, and multiply attributes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The both leaders have 2 weapons each of which now drains 4 hp ((3-1)*2)
# The leader of side 1 heals 4 hp total since it has full hp when its first strike is made
# The leader of side 2 heals 8 hp total since it was damaged when its first strike was made
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_sub_multiply" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 3 (sub=1
multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 196 DAMAGE2=192 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]cumulative=
##
# Actions:
# Give the leaders a drains 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:
# The side 1 leader has 2 weapons both of which drain 75 hp
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_two_cumulative_mixed_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 75 () ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY drains 60 () ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 125 DAMAGE2=50 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]cumulative=
##
# Actions:
# Give the leaders a drains 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:
# The side 1 leader has 2 weapons both of which drains 75
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_two_cumulative_mixed_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 75 () ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY drains 60 () ID=2 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 125 DAMAGE2=50 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]cumulative=
##
# Actions:
# Give the leaders a drains 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 side 1 leader has 2 weapons both of which drains 75 hp
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_two_cumulative_no_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 75 () ID=1 CUMULATIVE=no SELF=yes}
{TEST_ABILITY drains 60 () ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 125 DAMAGE2=50 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]cumulative=
##
# Actions:
# Give the leaders a drains 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 side 1 leader has 2 weapons both of which drains 75 hp
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_two_cumulative_no_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 75 () ID=1 CUMULATIVE=no SELF=yes}
{TEST_ABILITY drains 60 () ID=2 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 125 DAMAGE2=50 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]cumulative=
##
# Actions:
# Give the leaders a drains 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:
# The side 1 leader has 2 weapons both of which drains 75 hp
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_two_cumulative_yes_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 75 () ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY drains 60 () ID=1 CUMULATIVE=yes SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 125 DAMAGE2=50 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]cumulative=
##
# Actions:
# Give the leaders a drains ability with unique IDs and cumulative=yes
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons both of which drains 75 hp
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_two_cumulative_yes_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 75 () ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY drains 60 () ID=2 CUMULATIVE=yes SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 125 DAMAGE2=50 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability that does a quarter of the max hp of the other unit as strikes.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons both of which have 40 drains (800/20), other is self
# The side 2 leader has 1 weapons both of which have 50 drains (1000/20), other is self
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_wfl_other" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains "(other.max_hitpoints/20)" () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 160 DAMAGE2=100 ID1_HP=800 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability that does a quarter its own max hp.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons both of which have 40 drains (800/20), self is the attacker
# The side 2 leader has 1 weapons both of which have 50 drains (1000/20), self is the defender
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_wfl_self" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains "(max_hitpoints/20)" () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 160 DAMAGE2=100 ID1_HP=800 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [drains]value=
##
# Actions:
# Give the leaders a drains ability with a value of 0.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The side 1 leader has 2 weapons both of which drains 0 hp
# No errors are logged
#####
{COMMON_KEEP_A_B_UNIT_TEST "drains_zero" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY drains 0 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 200 WEAPON_COUNT=2 STRIKE_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -887,6 +887,44 @@
0 disable_affect_self_no
0 disable_affect_enemies
0 disable_affect_everybody
# drains ability tests
0 drains_negative_value
0 drains_zero
0 drains_add
0 drains_add_divide
0 drains_add_multiply
0 drains_add_sub
0 drains_affect_allies
0 drains_affect_self_no
0 drains_affect_enemies
0 drains_affect_everybody
0 drains_divide
0 drains_high_fraction
0 drains_low_fraction
0 drains_multiply
0 drains_multiply_divide
0 drains_multiply_fraction
0 drains_no_value
0 drains_sub
0 drains_sub_divide
0 drains_sub_multiply
0 drains_wfl_other
0 drains_wfl_self
0 drains_two_cumulative_yes_same_id
0 drains_two_cumulative_yes_unique_id
0 drains_two_cumulative_no_same_id
0 drains_two_cumulative_no_unique_id
0 drains_two_cumulative_mixed_same_id
0 drains_two_cumulative_mixed_unique_id
0 drains_default_cumulative_yes
0 drains_default_cumulative_no
0 drains_default_cumulative_both
0 drains_max_value
0 drains_overwrite_specials_one_side
0 drains_overwrite_specials_both_sides
0 drains_overwrite_specials_two_both_sides
0 drains_overwrite_specials_two_one_side
0 drains_overwrite_specials_mixed
# Warnings about WML
0 unknown_scenario_false_positives
0 unknown_scenario_interpolated