damage ability tests (#9137)

This commit is contained in:
Pentarctagon 2024-07-30 19:06:38 -05:00 committed by GitHub
parent d74b4061fa
commit 3cef48fe38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 1225 additions and 25 deletions

View file

@ -81,6 +81,7 @@
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/attacks}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/berserk}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/chance_to_hit}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/damage}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/heals}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/hides}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/illuminates}

View file

@ -82,6 +82,10 @@
# By default "alice" attacks "bob", these can be overridden with the ID1 and ID2 optional arguments.
# 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.
# 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
#define ATTACK_AND_VALIDATE DAMAGE1
#arg ID1
@ -93,6 +97,21 @@ bob#endarg
#arg DAMAGE2
{DAMAGE1}#endarg
#arg WEAPON_COUNT
1#endarg
#arg ID1_HP
1000#endarg
#arg ID2_HP
1000#endarg
#arg DAMAGE_VALUE
[damage]
value=100
[/damage]
#endarg
[modify_unit]
[filter]
id={ID1},{ID2}
@ -104,41 +123,62 @@ bob#endarg
[attacks]
value=1
[/attacks]
[damage]
value=100
[/damage]
{DAMAGE_VALUE}
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
hitpoints = 1000
max_hitpoints = 1000
[/modify_unit]
[test_do_attack_by_id]
attacker={ID1}
defender={ID2}
[/test_do_attack_by_id]
{VARIABLE weapons {WEAPON_COUNT}}
[for]
start=0
end="$($weapons-1)"
step=1
[do]
[modify_unit]
[filter]
id={ID1}
[/filter]
hitpoints = {ID1_HP}
max_hitpoints = {ID1_HP}
[/modify_unit]
[modify_unit]
[filter]
id={ID2}
[/filter]
hitpoints = {ID2_HP}
max_hitpoints = {ID2_HP}
[/modify_unit]
[store_unit]
[filter]
id={ID1}
[/filter]
variable={ID1}
[/store_unit]
[store_unit]
[filter]
id={ID2}
[/filter]
variable={ID2}
[/store_unit]
[test_do_attack_by_id]
attacker={ID1}
defender={ID2}
weapon=$i
resupply_attacks_left=1
[/test_do_attack_by_id]
{ASSERT {VARIABLE_CONDITIONAL {ID1}.hitpoints numerical_equals "$(${ID1}.max_hitpoints-{DAMAGE1})"}}
{ASSERT {VARIABLE_CONDITIONAL {ID2}.hitpoints numerical_equals "$(${ID2}.max_hitpoints-{DAMAGE2})"}}
[store_unit]
[filter]
id={ID1}
[/filter]
variable={ID1}
[/store_unit]
[store_unit]
[filter]
id={ID2}
[/filter]
variable={ID2}
[/store_unit]
{CLEAR_VARIABLE {ID1}}
{CLEAR_VARIABLE {ID2}}
{ASSERT {VARIABLE_CONDITIONAL {ID1}.hitpoints numerical_equals "$(${ID1}.max_hitpoints-{DAMAGE1})"}}
{ASSERT {VARIABLE_CONDITIONAL {ID2}.hitpoints numerical_equals "$(${ID2}.max_hitpoints-{DAMAGE2})"}}
{CLEAR_VARIABLE {ID1}}
{CLEAR_VARIABLE {ID2}}
[/do]
[/for]
#enddef
# Takes a unit id, and checks that its hitpoints and experience are the expected values.

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders an damage 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 side 1 leader has 2 weapons each of which now has 6 damage (5+1)
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_add" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 5 (add=1) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 6 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons each of which now has 3 damage ((5+1)/2)
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_add_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 5 (add=1
divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 3 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons each of which now has 12 damage ((5+1)*2)
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_add_multiply" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 5 (add=1
multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 12 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons each of which now has 3 damage (5-2), add is ignored
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_add_sub" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 5 (add=1
sub=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 3 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,40 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]affect_allies=
##
# Actions:
# Give the side 1 leader a damage ability that only affects adjacent allies
# Have the side 2 leader attack the side 3 leader with both its weapons
# Have the side 1 leader attack the side 4 leader with both its weapons
##
# Expected end state:
# The side 2 leader has 2 weapons each of which now has 2 damage
# The side 1 leader has 2 weapons neither of which has been modified to have 2 damage
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "damage_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 damage 2 ([affect_adjacent][/affect_adjacent]) ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 5 DAMAGE2=2 (DAMAGE_VALUE=) ID1=bob ID2=charlie WEAPON_COUNT=2}
{ATTACK_AND_VALIDATE 5 (DAMAGE_VALUE=) ID1=alice ID2=dave WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE_LEADER="Elvish Archer"}

View file

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

View file

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

View file

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

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 3 damage
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 6 (divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 3 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 3 damage
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "damage_high_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 3.8 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 3 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}
#endif

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 3 damage
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "damage_low_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 3.2 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 3 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}
#endif

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 1 damage
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_max_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 3 (max_value=1) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 1 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 8 damage (2*4)
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_multiply" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 4 (multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 8 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 6 damage ((4*3)/2)
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_multiply_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 4 (multiply=3
divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 6 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 6 damage (3*3, the .5 is truncated)
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "damage_multiply_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 3.5 (multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 6 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}
#endif

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage ability with a value of -10.
# 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 1 damage
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_negative_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage -10 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 1 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,39 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage ability missing the value attribute.
# Have the side 1 leader attack the side 2 leader with both its weapons
##
# Expected end state:
# The weapons' damage is not changed.
# No errors are logged.
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_no_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
[damage]
id = "test-damage"
name = _"test-damage"
affect_self = yes
affect_allies = no
affect_enemies = no
cumulative = no
[/damage]
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 5 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]overwrite_specials=
##
# Actions:
# Give the side 1 leader a damage ability with the overwrite_specials=both_sides attribute
# Give the side 1 leader a damage 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 has 2 damage, since the 2 damage ability takes priority due to overwrite_specials
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_overwrite_specials_both_sides" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 2 (overwrite_specials=both_sides) SELF=yes}
{TEST_ABILITY damage 7 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 5 DAMAGE2=2 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

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

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]overwrite_specials=
##
# Actions:
# Give the side 1 leader a damage ability with the overwrite_specials=one_side attribute
# Give the side 1 leader a damage 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 has 2 damage, since the 2 damage ability takes priority due to overwrite_specials
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_overwrite_specials_one_side" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 2 (overwrite_specials=one_side) SELF=yes}
{TEST_ABILITY damage 7 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 5 DAMAGE2=2 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

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

View file

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

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 1 damage (3-2)
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_sub" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 3 (sub=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 1 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 1 damage ((3-1)/2)
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_sub_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 3 (sub=1
divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 1 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 side 1 leader has 2 weapons both of which have 4 damage ((3-1)*2)
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_sub_multiply" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 3 (sub=1
multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 4 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]cumulative=
##
# Actions:
# Give the leaders a damage 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 have 6 damage
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_two_cumulative_mixed_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 6 () ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY damage 4 () ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 6 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]cumulative=
##
# Actions:
# Give the leaders a damage 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 have 6 damage
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_two_cumulative_mixed_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 6 () ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY damage 4 () ID=2 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 6 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]cumulative=
##
# Actions:
# Give the leaders a damage 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 have 6 damage
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_two_cumulative_no_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 6 () ID=1 CUMULATIVE=no SELF=yes}
{TEST_ABILITY damage 4 () ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 6 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]cumulative=
##
# Actions:
# Give the leaders a damage 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 have 6 damage
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_two_cumulative_no_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 6 () ID=1 CUMULATIVE=no SELF=yes}
{TEST_ABILITY damage 4 () ID=2 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 6 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]cumulative=
##
# Actions:
# Give the leaders a damage 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 have 6 damage
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_two_cumulative_yes_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 6 () ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY damage 4 () ID=1 CUMULATIVE=yes SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 6 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]cumulative=
##
# Actions:
# Give the leaders a damage 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 have 6 damage
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_two_cumulative_yes_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 6 () ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY damage 4 () ID=2 CUMULATIVE=yes SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 6 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 250 damage (1000/4), other is the attacker
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_wfl_other" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage "(other.max_hitpoints/4)" () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 250 DAMAGE2=200 (DAMAGE_VALUE=) WEAPON_COUNT=2 ID1_HP=800}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 250 damage (1000/4), self is the attacker
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_wfl_self" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage "(max_hitpoints/4)" () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 200 DAMAGE2=250 (DAMAGE_VALUE=) WEAPON_COUNT=2 ID2_HP=800}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [damage]value=
##
# Actions:
# Give the leaders a damage 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 have 0 damage
# No errors are logged
#####
{COMMON_KEEP_A_B_UNIT_TEST "damage_zero" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY damage 0 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 0 (DAMAGE_VALUE=) WEAPON_COUNT=2}
{SUCCEED}
[/event]
) SIDE2_LEADER="Elvish Archer"}

View file

@ -722,6 +722,7 @@
0 attacks_add_divide
0 attacks_add_multiply
0 attacks_add_sub
0 attacks_affect_allies
0 attacks_affect_self_no
0 attacks_affect_enemies
0 attacks_affect_everybody
@ -756,6 +757,7 @@
0 berserk_add_divide
0 berserk_add_multiply
0 berserk_add_sub
0 berserk_affect_allies
0 berserk_affect_self_no
0 berserk_affect_enemies
0 berserk_affect_everybody
@ -789,6 +791,7 @@
0 chance_to_hit_add_divide
0 chance_to_hit_add_multiply
0 chance_to_hit_add_sub
0 chance_to_hit_affect_allies
0 chance_to_hit_affect_self_no
0 chance_to_hit_affect_enemies
0 chance_to_hit_affect_everybody
@ -813,6 +816,41 @@
0 chance_to_hit_overwrite_specials_two_both_sides
0 chance_to_hit_overwrite_specials_two_one_side
0 chance_to_hit_overwrite_specials_mixed
# damage ability tests
0 damage_negative_value
0 damage_zero
0 damage_add
0 damage_add_divide
0 damage_add_multiply
0 damage_add_sub
0 damage_affect_allies
0 damage_affect_self_no
0 damage_affect_enemies
0 damage_affect_everybody
0 damage_divide
0 damage_high_fraction
0 damage_low_fraction
0 damage_multiply
0 damage_multiply_divide
0 damage_multiply_fraction
0 damage_no_value
0 damage_sub
0 damage_sub_divide
0 damage_sub_multiply
0 damage_wfl_other
0 damage_wfl_self
0 damage_two_cumulative_yes_same_id
0 damage_two_cumulative_yes_unique_id
0 damage_two_cumulative_no_same_id
0 damage_two_cumulative_no_unique_id
0 damage_two_cumulative_mixed_same_id
0 damage_two_cumulative_mixed_unique_id
0 damage_max_value
0 damage_overwrite_specials_one_side
0 damage_overwrite_specials_both_sides
0 damage_overwrite_specials_two_both_sides
0 damage_overwrite_specials_two_one_side
0 damage_overwrite_specials_mixed
# Warnings about WML
0 unknown_scenario_false_positives
0 unknown_scenario_interpolated