add a bunch of resistance ability tests (#8105)

This commit is contained in:
Pentarctagon 2023-12-15 09:59:01 -06:00 committed by GitHub
parent f5c6402ed1
commit 6322ca8bc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 1534 additions and 154 deletions

View file

@ -80,6 +80,7 @@
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/heals}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/regenerate}
{test/scenarios/wml_tests/UnitsWML/AbilitiesWML/resistance}
{test/scenarios/wml_tests/UnitsWML/Attacks}
{test/scenarios/wml_tests/WesnothFormulaLanguage}

View file

@ -26,9 +26,6 @@ no#endarg
#arg ENEMIES
no#endarg
#arg POISON
"slowed"#endarg
#arg CUMULATIVE
no#endarg
@ -38,9 +35,8 @@ no#endarg
affect_self = {SELF}
affect_allies = {ALLIES}
affect_enemies = {ENEMIES}
poison = {POISON}
value = {VALUE}
{OTHER}
cumulative = {CUMULATIVE}
{OTHER}
[/{ABIL}]
#enddef

View file

@ -75,3 +75,64 @@
[/then]
[/if]
#enddef
# have one adjacent unit attack another adjacent unit
# each unit is given 1000 hp and their attack is made to 1x100, with a 100% chance of hitting
#define ATTACK_AND_VALIDATE DAMAGE1
#arg ID1
alice#endarg
#arg ID2
bob#endarg
#arg DAMAGE2
{DAMAGE1}#endarg
[modify_unit]
[filter]
id={ID1},{ID2}
[/filter]
[effect]
apply_to=attack
[set_specials]
mode=append
[attacks]
value=1
[/attacks]
[damage]
value=100
[/damage]
[chance_to_hit]
value=100
[/chance_to_hit]
[/set_specials]
[/effect]
hitpoints = 1000
max_hitpoints = 1000
[/modify_unit]
[test_do_attack_by_id]
attacker={ID1}
defender={ID2}
[/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})"}}
{ASSERT {VARIABLE_CONDITIONAL {ID2}.hitpoints numerical_equals "$(${ID2}.max_hitpoints-{DAMAGE2})"}}
{CLEAR_VARIABLE {ID1}}
{CLEAR_VARIABLE {ID2}}
#enddef

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#define EXPECT_HITPOINTS leader1 healer1 leader2 healer2
[store_unit]
[filter]

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]affect_allies=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]affect_enemies=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]affect_allies=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]affect_self=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]poison=
##
@ -20,7 +22,7 @@
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY heals 4 ([affect_adjacent][/affect_adjacent]) POISON="cured" ALLIES=yes}
{TEST_ABILITY heals 4 ([affect_adjacent][/affect_adjacent]poison="cured") ALLIES=yes}
[/abilities]
[/effect]
[effect]

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]poison=
##
@ -20,7 +22,7 @@
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY heals 4 ([affect_adjacent][/affect_adjacent]) ALLIES=yes}
{TEST_ABILITY heals 4 ([affect_adjacent][/affect_adjacent]poison="slowed") ALLIES=yes}
[/abilities]
[/effect]
[effect]

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [heals]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]affect_allies=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]affect_enemies=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]affect_allies=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]affect_self=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]poison=
##
@ -18,7 +20,7 @@
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY regenerate 4 () POISON="cured" SELF=yes}
{TEST_ABILITY regenerate 4 (poison="cured") SELF=yes}
[/abilities]
[/effect]
[effect]

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]poison=
##
@ -18,7 +20,7 @@
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY regenerate 4 () SELF=yes}
{TEST_ABILITY regenerate 4 (poison="slowed") SELF=yes}
[/abilities]
[/effect]
[effect]

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]cumulative=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -1,3 +1,5 @@
# wmllint: no translatables
#####
# API(s) being tested: [regenerate]value=
##

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]active_on=
##
# Actions:
# Give all units resistance to all damage types with a value of 50
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 50% for the attacker
# The damage from the attack is reduced by 50% for the defender
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_active_on_both" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 50 DAMAGE2=50}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]active_on=
##
# Actions:
# Give all units resistance to all damage types with a value of 50, active only when defending
# Attack each other
##
# Expected end state:
# The damage from the attack is not reduced for the attacker
# The damage from the attack is reduced by 50% for the defender
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_active_on_defense" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
active_on=defense) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 100 DAMAGE2=50}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]active_on=
##
# Actions:
# Give all units resistance to all damage types with a value of 50, active only on offense
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 50% for the attacker
# The damage from the attack is not reduced for the defender
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_active_on_offense" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
active_on=offense) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 50 DAMAGE2=100}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 70% resistance to all damage types (50+20)
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 70%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_add" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
add=20) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 30}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 30% resistance to all damage types ((50+10)/2)
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 30%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_add_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
add=10
divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 70}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 60% resistance to all damage types ((20+10)*2)
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 60%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_add_multiply" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 20 (max_value=100
add=10
multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 40}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 40% resistance to all damage types (50-10), add is ignored
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 40%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_add_sub" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
add=20
sub=10) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 60}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,42 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]affect_allies=
##
# Actions:
# Make sides 1 and 2 allies
# Give side 1's adjacent allies 50% resistance to all damage types
# Have side 2 attack side 4
# Have side 3 attack side 1
##
# Expected end state:
# The damage from the attack is reduced by 50% for allies (you are not allied with yourself)
# The damage from the attack is not reduced for others
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "resistance_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 resistance 50 (max_value=100
[affect_adjacent][/affect_adjacent]) ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 50 ID1=bob ID2=dave DAMAGE2=100}
{ATTACK_AND_VALIDATE 100 ID1=charlie ID2=alice}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,35 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]affect_enemies=
##
# Actions:
# Give side 1's adjacent enemies 50% resistance to all damage types
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 50% the enemy
# The damage from the attack is not reduced for itself
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_affect_enemies" (
[event]
name = start
[modify_unit]
[filter]
side=1
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
[affect_adjacent][/affect_adjacent]) ENEMIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 100 DAMAGE2=50}
{ATTACK_AND_VALIDATE 50 ID1=bob ID2=alice DAMAGE2=100}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,41 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]affect_allies=
##
# Actions:
# Give side 1 units as well as all adjacent units 50% resistance to all damage types
# Attack each other
# Have side 1 attack side 4
# Have side 2 attack side 3
##
# Expected end state:
# The damage from all attacks is reduced by 50%
#####
{COMMON_KEEP_A_B_C_D_UNIT_TEST "resistance_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 resistance 50 (max_value=100
[affect_adjacent][/affect_adjacent]) ENEMIES=yes SELF=yes ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 50 ID2=dave}
{ATTACK_AND_VALIDATE 50 ID1=bob ID2=charlie}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]affect_self=
##
# Actions:
# Give all units 50% resistance to all damage types, but which affects no one
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 0% since it doesn't actually affect anyone
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_affect_self_no" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100) SELF=no}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 100}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]apply_to=
##
# Actions:
# Give all units resistance to blade damage with a value of 50
# Attack each other with blade weapons
##
# Expected end state:
# The damage from the attack is reduced by 50%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_apply_to_blade" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
apply_to=blade) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 50}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]apply_to=
##
# Actions:
# Give all units resistance to an invalid damage type with a value of 50, but an invalid apply_to value
# Attack each other with blade weapons
##
# Expected end state:
# The damage from the attack is not reduced
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_apply_to_invalid" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
apply_to=blah) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 100}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]apply_to=
##
# Actions:
# Give all units resistance to fire damage with a value of 50
# Attack each other with blade weapons
##
# Expected end state:
# The damage from the attack is not reduced by 50%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_apply_to_non_blade" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
apply_to=fire) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 100}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 20% resistance to all damage types (60/3)
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 20%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 60 (max_value=100
divide=3) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 80}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 45.8% resistance to all damage types
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 45% - the .8 is truncated
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "resistance_high_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 45.8 (max_value=100) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 55}
{SUCCEED}
[/event]
)}
#endif

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 45.2% resistance to all damage types
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 45% - the .2 is truncated
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "resistance_low_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 45.2 (max_value=100) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 55}
{SUCCEED}
[/event]
)}
#endif

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]max_value=
##
# Actions:
# Give all units resistance to all damage types with a value of 50 but a max_value of 10
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 10%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_max_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=10) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 90}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 50% resistance to all damage types (25*2)
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 50%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_multiply" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 25 (max_value=100
multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 50}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 40% resistance to all damage types (20*4/2)
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 40%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_multiply_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 20 (max_value=100
multiply=4
divide=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 60}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 22.9% resistance to all damage types
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 44% - the .9 is truncated before multiplication is done
#####
#ifndef SCHEMA_VALIDATION
{COMMON_KEEP_A_B_UNIT_TEST "resistance_multiply_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 22.9 (max_value=100
multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 56}
{SUCCEED}
[/event]
)}
#endif

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]max_value=
##
# Actions:
# Give all units resistance to all damage types with a value of 50 but a max_value of -10
# Attack each other
##
# Expected end state:
# The damage from the attack is increased by 10%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_negative_max_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=-10) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 110}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,31 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units -50% resistance to all damage types
# Attack each other
##
# Expected end state:
# The damage from the attack is increased by 50%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_negative_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance -50 (max_value=100) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 150}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]max_value
##
# Actions:
# Give all units resistance to all damage types with a value of 50
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 50%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_no_max_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 () SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 50}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,38 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Provide no value attribute
# Attack each other
##
# Expected end state:
# The damage from the attack is not reduced
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_no_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
[resistance]
id = resistance1
name = _"test-resistance_1"
affect_self = yes
affect_allies = no
affect_enemies = no
max_value = 100
[/resistance]
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 100}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,38 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [resistance]max_value
##
# Actions:
# Give all units resistance to all damage types no value or max_value specified
# Attack each other
##
# Expected end state:
# The damage from the attack is not reduced
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_no_value_no_max_value" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
[resistance]
id = resistance1
name = _"test-resistance_1"
affect_self = yes
affect_allies = no
affect_enemies = no
[/resistance]
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 100}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,39 @@
#textdomain wesnoth-test
#####
# API(s) being tested: [resistance]max_value
##
# Actions:
# Give all units resistance to all damage types no value or max_value specified, but with add=20
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 20%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_no_value_no_max_value_add" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
[resistance]
id = resistance1
name = _"test-resistance_1"
affect_self = yes
affect_allies = no
affect_enemies = no
add=20
[/resistance]
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 80}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,32 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 30% resistance to all damage types (50-20)
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 30%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_sub" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
sub=20) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 70}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 25% resistance to all damage types ((60-10)/2)
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 25%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_sub_divide" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 60 (max_value=100
divide=2
sub=10) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 75}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,33 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]value=
##
# Actions:
# Give all units 60% resistance to all damage types ((50-20)*2)
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 60%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_sub_multiply" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 50 (max_value=100
sub=20
multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 40}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]cumulative=
##
# Actions:
# Give all units 20% resistance to all damage types with cumulative=yes
# Give all units 30% resistance to all damage types with cumulative=no
# Both abilities have the same id
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 30%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_two_cumulative_mixed_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 20 (max_value=100) ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY resistance 30 (max_value=100) ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 70}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]cumulative=
##
# Actions:
# Give all units 20% resistance to all damage types with cumulative=yes
# Give all units 30% resistance to all damage types with cumulative=no
# Both abilities have the a unique id
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 30%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_two_cumulative_mixed_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 20 (max_value=100) ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY resistance 30 (max_value=100) ID=2 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 70}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]cumulative=
##
# Actions:
# Give all units 20% resistance to all damage types with cumulative=no
# Give all units 30% resistance to all damage types with cumulative=no
# Both abilities have the same id
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 30%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_two_cumulative_no_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 20 (max_value=100) ID=1 CUMULATIVE=no SELF=yes}
{TEST_ABILITY resistance 30 (max_value=100) ID=1 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 70}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]cumulative=
##
# Actions:
# Give all units 20% resistance to all damage types with cumulative=no
# Give all units 30% resistance to all damage types with cumulative=no
# Both abilities have unique ids
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 30%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_two_cumulative_no_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 20 (max_value=100) ID=1 CUMULATIVE=no SELF=yes}
{TEST_ABILITY resistance 30 (max_value=100) ID=2 CUMULATIVE=no SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 70}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]cumulative=
##
# Actions:
# Give all units 20% resistance to all damage types with cumulative=yes
# Give all units 30% resistance to all damage types with cumulative=yes
# Both abilities have the same id
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 30%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_two_cumulative_yes_same_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 20 (max_value=100) ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY resistance 30 (max_value=100) ID=1 CUMULATIVE=yes SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 70}
{SUCCEED}
[/event]
)}

View file

@ -0,0 +1,34 @@
# wmllint: no translatables
#####
# API(s) being tested: [resistance]cumulative=
##
# Actions:
# Give all units 20% resistance to all damage types with cumulative=yes
# Give all units 30% resistance to all damage types with cumulative=yes
# Both abilities have unique ids
# Attack each other
##
# Expected end state:
# The damage from the attack is reduced by 30%
#####
{COMMON_KEEP_A_B_UNIT_TEST "resistance_two_cumulative_yes_unique_id" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY resistance 20 (max_value=100) ID=1 CUMULATIVE=yes SELF=yes}
{TEST_ABILITY resistance 30 (max_value=100) ID=2 CUMULATIVE=yes SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{ATTACK_AND_VALIDATE 70}
{SUCCEED}
[/event]
)}

Some files were not shown because too many files have changed in this diff Show more