diff --git a/data/test/_main.cfg b/data/test/_main.cfg index e895b10e0c07..4692aaf86242 100644 --- a/data/test/_main.cfg +++ b/data/test/_main.cfg @@ -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} diff --git a/data/test/macros/wml_unit_test_macros.cfg b/data/test/macros/wml_unit_test_macros.cfg index 548b01895b2f..9444e5453e5f 100644 --- a/data/test/macros/wml_unit_test_macros.cfg +++ b/data/test/macros/wml_unit_test_macros.cfg @@ -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] diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add.cfg new file mode 100644 index 000000000000..ee77da0ef8c1 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add_divide.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add_divide.cfg new file mode 100644 index 000000000000..fc5056ad16ec --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add_divide.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add_multiply.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add_multiply.cfg new file mode 100644 index 000000000000..bcc0a7d92939 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add_multiply.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add_sub.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add_sub.cfg new file mode 100644 index 000000000000..9c644047870c --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_add_sub.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_allies.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_allies.cfg new file mode 100644 index 000000000000..2add71d42586 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_allies.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_enemies.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_enemies.cfg new file mode 100644 index 000000000000..ed7b23a0f2e8 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_enemies.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_everybody.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_everybody.cfg new file mode 100644 index 000000000000..1f10b589f5ea --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_everybody.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_self_no.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_self_no.cfg new file mode 100644 index 000000000000..01833a2b906d --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_affect_self_no.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_default_cumulative_both.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_default_cumulative_both.cfg new file mode 100644 index 000000000000..a8efd4cdc3be --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_default_cumulative_both.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_default_cumulative_no.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_default_cumulative_no.cfg new file mode 100644 index 000000000000..b3fcea90d8a4 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_default_cumulative_no.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_default_cumulative_yes.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_default_cumulative_yes.cfg new file mode 100644 index 000000000000..ac0505e269de --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_default_cumulative_yes.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_divide.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_divide.cfg new file mode 100644 index 000000000000..66601fe8c6ae --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_divide.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_high_fraction.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_high_fraction.cfg new file mode 100644 index 000000000000..9509ebafc969 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_high_fraction.cfg @@ -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 diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_low_fraction.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_low_fraction.cfg new file mode 100644 index 000000000000..fbd0ebdd2879 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_low_fraction.cfg @@ -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 diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_max_value.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_max_value.cfg new file mode 100644 index 000000000000..6a7a95a1d973 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_max_value.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_multiply.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_multiply.cfg new file mode 100644 index 000000000000..fa23fa9fc849 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_multiply.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_multiply_divide.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_multiply_divide.cfg new file mode 100644 index 000000000000..cbda1f0be996 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_multiply_divide.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_multiply_fraction.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_multiply_fraction.cfg new file mode 100644 index 000000000000..0a6083e65309 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_multiply_fraction.cfg @@ -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 diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_negative_value.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_negative_value.cfg new file mode 100644 index 000000000000..78f087e0bca9 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_negative_value.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_no_value.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_no_value.cfg new file mode 100644 index 000000000000..0afa78a1306c --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_no_value.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_both_sides.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_both_sides.cfg new file mode 100644 index 000000000000..7f8dffa0d04e --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_both_sides.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_mixed.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_mixed.cfg new file mode 100644 index 000000000000..b30834ef30bf --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_mixed.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_one_side.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_one_side.cfg new file mode 100644 index 000000000000..078beec0ad7a --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_one_side.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_two_both_sides.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_two_both_sides.cfg new file mode 100644 index 000000000000..2d4ded9c9afd --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_two_both_sides.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_two_one_side.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_two_one_side.cfg new file mode 100644 index 000000000000..98218976b89a --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_overwrite_specials_two_one_side.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_sub.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_sub.cfg new file mode 100644 index 000000000000..e7f05eda446a --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_sub.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_sub_divide.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_sub_divide.cfg new file mode 100644 index 000000000000..d388641fb06b --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_sub_divide.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_sub_multiply.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_sub_multiply.cfg new file mode 100644 index 000000000000..352c00b3df70 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_sub_multiply.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_mixed_same_id.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_mixed_same_id.cfg new file mode 100644 index 000000000000..2d66f7dee9d5 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_mixed_same_id.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_mixed_unique_id.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_mixed_unique_id.cfg new file mode 100644 index 000000000000..b3af42a97eaa --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_mixed_unique_id.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_no_same_id.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_no_same_id.cfg new file mode 100644 index 000000000000..1988de229b56 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_no_same_id.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_no_unique_id.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_no_unique_id.cfg new file mode 100644 index 000000000000..88163fc16bc5 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_no_unique_id.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_yes_same_id.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_yes_same_id.cfg new file mode 100644 index 000000000000..935b1acbb280 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_yes_same_id.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_yes_unique_id.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_yes_unique_id.cfg new file mode 100644 index 000000000000..988b75f3ac1f --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_two_cumulative_yes_unique_id.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_wfl_other.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_wfl_other.cfg new file mode 100644 index 000000000000..8c16a7390929 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_wfl_other.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_wfl_self.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_wfl_self.cfg new file mode 100644 index 000000000000..0af98e281768 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_wfl_self.cfg @@ -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"} diff --git a/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_zero.cfg b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_zero.cfg new file mode 100644 index 000000000000..ce3b2f292f37 --- /dev/null +++ b/data/test/scenarios/wml_tests/UnitsWML/AbilitiesWML/drains/drains_zero.cfg @@ -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"} diff --git a/wml_test_schedule b/wml_test_schedule index 00e33ac8c0bd..4e5b3f1a8f2d 100644 --- a/wml_test_schedule +++ b/wml_test_schedule @@ -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