Test multiplying by a fractional value.

This commit is contained in:
pentarctagon 2023-12-07 00:07:33 -06:00
parent da936425dc
commit 16ccaefc86
3 changed files with 117 additions and 0 deletions

View file

@ -0,0 +1,59 @@
#####
# API(s) being tested: [heals]value=
##
# Actions:
# Give the leaders a heals ability with both the value and multiply attributes
# Spawn a Mage next to the side 1 leader.
# Set all units' hitpoints to 1.
# Wait a turn for healing to take place.
##
# Expected end state:
# The Mage has 7 hp: 1 + 2 (rest healing) + 4 ([heals], 2.5*2), the 2.5 is truncated to just 2 prior to being multiplied
#####
#ifndef SCHEMA_VALIDATION
{GENERIC_UNIT_TEST "heal_multiply_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY heals 2.5 ([affect_adjacent][/affect_adjacent]
multiply=2) ALLIES=yes}
[/abilities]
[/effect]
[/modify_unit]
{NOTRAIT_UNIT 1 (Mage) 7 4}
{SET_HP VALUE=1}
[end_turn][/end_turn]
[/event]
[event]
name = side 2 turn 1
[end_turn][/end_turn]
[/event]
[event]
name =side 1 turn 2
[end_turn][/end_turn]
[/event]
[event]
name = side 2 turn 2
[store_unit]
[filter]
type = "Mage"
[/filter]
variable = temp
[/store_unit]
{ASSERT {VARIABLE_CONDITIONAL temp.hitpoints numerical_equals 7}}
{SUCCEED}
[/event]
)}
#endif

View file

@ -0,0 +1,56 @@
#####
# API(s) being tested: [regenerate]value=
##
# Actions:
# Give the leaders a regenerate ability with both the value and multiply attributes
# Set all units' hitpoints to 1.
# Wait a turn for regenerating to take place.
##
# Expected end state:
# The Mage has 7 hp: 1 + 2 (rest healing) + 4 ([regenerate], 2.5*2), the 2.5 is truncated to just 2 prior to being multiplied
#####
#ifndef SCHEMA_VALIDATION
{GENERIC_UNIT_TEST "regenerate_multiply_fraction" (
[event]
name = start
[modify_unit]
[filter]
[/filter]
[effect]
apply_to = new_ability
[abilities]
{TEST_ABILITY regenerate 2.5 (multiply=2) SELF=yes}
[/abilities]
[/effect]
[/modify_unit]
{SET_HP VALUE=1}
[end_turn][/end_turn]
[/event]
[event]
name = side 2 turn 1
[end_turn][/end_turn]
[/event]
[event]
name =side 1 turn 2
[end_turn][/end_turn]
[/event]
[event]
name = side 2 turn 2
[store_unit]
[filter]
type = "Elvish Archer"
[/filter]
variable = temp
[/store_unit]
{ASSERT {VARIABLE_CONDITIONAL temp.hitpoints numerical_equals 7}}
{SUCCEED}
[/event]
)}
#endif

View file

@ -485,6 +485,7 @@
0 heal_low_fraction
0 heal_multiply
0 heal_multiply_divide
0 heal_multiply_fraction
0 heal_no_value
0 heal_sub
0 heal_sub_divide
@ -516,6 +517,7 @@
0 regenerate_low_fraction
0 regenerate_multiply
0 regenerate_multiply_divide
0 regenerate_multiply_fraction
0 regenerate_no_value
0 regenerate_sub
0 regenerate_sub_divide