Support [harm_unit]experience values kill/attack/defend/fight/yes/no (#8231)
This commit is contained in:
parent
1f50e0f2d2
commit
2056be55a3
27 changed files with 1310 additions and 12 deletions
|
@ -160,19 +160,52 @@ function wml_actions.harm_unit(cfg)
|
|||
|
||||
wesnoth.interface.float_label( unit_to_harm.x, unit_to_harm.y, string.format( "<span foreground='red'>%s</span>", text ) )
|
||||
|
||||
local xp_mode = {kill=false, attack=false, defend=false}
|
||||
local experience_split = tostring(experience):split()
|
||||
for _,opt in ipairs(experience_split) do
|
||||
if opt == 'true' or opt == 'yes' or opt == 'nil' then
|
||||
xp_mode.kill = true
|
||||
xp_mode.attack = true
|
||||
xp_mode.defend = true
|
||||
elseif opt == 'fight' then
|
||||
xp_mode.attack = true
|
||||
xp_mode.defend = true
|
||||
elseif opt == 'attack' then
|
||||
xp_mode.attack = true
|
||||
elseif opt == 'defend' then
|
||||
xp_mode.defend = true
|
||||
elseif opt == 'kill' then
|
||||
xp_mode.kill = true
|
||||
elseif not (opt == 'no' or opt == 'false') then
|
||||
wml.error('Invalid [harm_unit] experience: should be boolean or a list of one or more of the following: kill, fight, attack, defend')
|
||||
end
|
||||
-- with 'no' or 'false' preserve previous value
|
||||
end
|
||||
if #experience_split == 0 then
|
||||
xp_mode = {kill=true, attack=true, defend=true}
|
||||
end
|
||||
|
||||
local function calc_xp( level ) -- to calculate the experience in case of kill
|
||||
if level == 0 then return math.ceil(wesnoth.game_config.kill_experience / 2)
|
||||
else return level * wesnoth.game_config.kill_experience end
|
||||
end
|
||||
|
||||
if experience ~= false and harmer and harmer.valid
|
||||
if harmer and harmer.valid
|
||||
and wesnoth.sides.is_enemy( unit_to_harm.side, harmer.side )
|
||||
then
|
||||
if kill ~= false and unit_to_harm.hitpoints <= 0 then
|
||||
harmer.experience = harmer.experience + calc_xp( unit_to_harm.level )
|
||||
if unit_to_harm.hitpoints <= 0 then
|
||||
if xp_mode.kill then
|
||||
harmer.experience = harmer.experience + calc_xp( unit_to_harm.level )
|
||||
elseif xp_mode.attack then
|
||||
harmer.experience = harmer.experience + wesnoth.game_config.combat_experience * unit_to_harm.level
|
||||
end
|
||||
else
|
||||
unit_to_harm.experience = unit_to_harm.experience + harmer.level
|
||||
harmer.experience = harmer.experience + wesnoth.game_config.combat_experience * unit_to_harm.level
|
||||
if xp_mode.defend then
|
||||
unit_to_harm.experience = unit_to_harm.experience + wesnoth.game_config.combat_experience * harmer.level
|
||||
end
|
||||
if xp_mode.attack then
|
||||
harmer.experience = harmer.experience + wesnoth.game_config.combat_experience * unit_to_harm.level
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -190,11 +223,11 @@ function wml_actions.harm_unit(cfg)
|
|||
end
|
||||
|
||||
-- both units may no longer be alive at this point, so double check
|
||||
if experience ~= false and unit_to_harm and unit_to_harm.valid then
|
||||
if xp_mode.defend and unit_to_harm and unit_to_harm.valid then
|
||||
unit_to_harm:advance(toboolean(animate), fire_event ~= false)
|
||||
end
|
||||
|
||||
if experience ~= false and harmer and harmer.valid then
|
||||
if (xp_mode.attack or xp_mode.kill) and harmer and harmer.valid then
|
||||
harmer:advance(toboolean(animate), fire_event ~= false)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -480,7 +480,7 @@
|
|||
{DEFAULT_KEY slowed s_bool no}
|
||||
{DEFAULT_KEY petrified s_bool no}
|
||||
{DEFAULT_KEY unhealable s_bool no}
|
||||
{DEFAULT_KEY experience s_bool no}
|
||||
{DEFAULT_KEY experience string_list yes}
|
||||
{DEFAULT_KEY resistance_modifier s_real 1}
|
||||
{FILTER_TAG "primary_attack" weapon {INSERT_TAG}}
|
||||
{FILTER_TAG "secondary_attack" weapon {INSERT_TAG}}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage but with kill=no.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage but with kill=no.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims get reduced to 1 hp, but survive.
|
||||
# Alice gets 3 experience in total.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_no_experience_attack" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=attack
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 1}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 0}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=attack
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 0}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 1 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 1 0}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,63 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage but with kill=no.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage but with kill=no.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims get reduced to 1 hp, but survive.
|
||||
# Alice gets 3 points and everyone else gets 1 point of experience.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_no_experience_attack_defend" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=attack,defend
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 1}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=attack,defend
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "dave" 1 1}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,63 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage but with kill=no.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage but with kill=no.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims get reduced to 1 hp, but survive.
|
||||
# Alice gets 3 points of experience.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_no_experience_attack_kill" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=attack,kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 1}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 0}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=attack,kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 0}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 1 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 1 0}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,63 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage but with kill=no.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage but with kill=no.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims get reduced to 1 hp, but survive.
|
||||
# Bob, Charlie, Dave get 1 point of experience.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_no_experience_defend" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=defend
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=defend
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "dave" 1 1}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,63 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage but with kill=no.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage but with kill=no.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims get reduced to 1 hp, but survive.
|
||||
# Bob, Charlie, Dave get 1 point of experience.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_no_experience_defend_kill" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=defend,kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=defend,kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "dave" 1 1}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,63 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage but with kill=no.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage but with kill=no.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims get reduced to 1 hp, but survive.
|
||||
# Alice gets 3 experience, everone else gets 1.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_no_experience_fight" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=fight
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 1}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=fight
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "dave" 1 1}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,63 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage but with kill=no.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage but with kill=no.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims get reduced to 1 hp, but survive.
|
||||
# Nobody gets any experience.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_no_experience_kill" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 0}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 0}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 1 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 1 0}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,64 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage but with kill=no.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage but with kill=no.
|
||||
# Comma-separated list in experience key works additively, that means that "no" in it should have no effect.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims get reduced to 1 hp, but survive.
|
||||
# Alice gets 3 points and everyone else gets 1 point of experience.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_no_experience_no_attack_defend_kill" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=no,attack,defend,kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 1}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=no,attack,defend,kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "dave" 1 1}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,63 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage but with kill=no.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage but with kill=no.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims get reduced to 1 hp, but survive.
|
||||
# Alice and Bob get 1 experience point each for the first fight.
|
||||
# Alice gets 2 experience points for the second fight, Charlie and Dave get 1 each.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_no_experience_unset" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
# experience=yes is the default, so this test leaves it unset
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 1}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 1 1}
|
||||
{ASSERT_UNIT_HP_XP "dave" 1 1}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -36,7 +36,7 @@
|
|||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
# experience=yes is the default, so this test leaves it unset
|
||||
experience=yes
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 1}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
|
@ -52,6 +52,7 @@
|
|||
[/filter_second]
|
||||
amount=10
|
||||
kill=no
|
||||
experience=yes
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 1 1}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set Alice, Charlie and Dave to a known number of hitpoints.
|
||||
# Set Bob to a known but higher number of hitpoints.
|
||||
# Use [harm_unit] with Alice as harmer, the others as victims, and damage equal to Charlie's hitpoints.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 3 experience points, Bob gets 0, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_split_experience_attack" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=15
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob,charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
experience=attack
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 0}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,60 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set Alice, Charlie and Dave to a known number of hitpoints.
|
||||
# Set Bob to a known but higher number of hitpoints.
|
||||
# Use [harm_unit] with Alice as harmer, the others as victims, and damage equal to Charlie's hitpoints.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 3 experience points, Bob gets 1, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_split_experience_attack_defend" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=15
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob,charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
experience=attack,defend
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,60 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set Alice, Charlie and Dave to a known number of hitpoints.
|
||||
# Set Bob to a known but higher number of hitpoints.
|
||||
# Use [harm_unit] with Alice as harmer, the others as victims, and damage equal to Charlie's hitpoints.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 17 experience points, Bob gets 0, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_split_experience_attack_kill" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=15
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob,charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
experience=attack,kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 17}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 0}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,60 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set Alice, Charlie and Dave to a known number of hitpoints.
|
||||
# Set Bob to a known but higher number of hitpoints.
|
||||
# Use [harm_unit] with Alice as harmer, the others as victims, and damage equal to Charlie's hitpoints.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 0 experience points, Bob gets 1, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_split_experience_defend" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=15
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob,charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
experience=defend
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,60 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set Alice, Charlie and Dave to a known number of hitpoints.
|
||||
# Set Bob to a known but higher number of hitpoints.
|
||||
# Use [harm_unit] with Alice as harmer, the others as victims, and damage equal to Charlie's hitpoints.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 16 experience points, Bob gets 1, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_split_experience_defend_kill" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=15
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob,charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
experience=kill,defend
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 16}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,60 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set Alice, Charlie and Dave to a known number of hitpoints.
|
||||
# Set Bob to a known but higher number of hitpoints.
|
||||
# Use [harm_unit] with Alice as harmer, the others as victims, and damage equal to Charlie's hitpoints.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 3 experience points, Bob gets 1, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_split_experience_fight" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=15
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob,charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
experience=fight
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,60 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set Alice, Charlie and Dave to a known number of hitpoints.
|
||||
# Set Bob to a known but higher number of hitpoints.
|
||||
# Use [harm_unit] with Alice as harmer, the others as victims, and damage equal to Charlie's hitpoints.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 16 experience points, Bob gets 0, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_split_experience_kill" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=15
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob,charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
experience=kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 16}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 0}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,61 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set Alice, Charlie and Dave to a known number of hitpoints.
|
||||
# Set Bob to a known but higher number of hitpoints.
|
||||
# Use [harm_unit] with Alice as harmer, the others as victims, and damage equal to Charlie's hitpoints.
|
||||
# Comma-separated list in experience key works additively, that means that "no" in it should have no effect.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 17 experience points, Bob gets 1, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_split_experience_no_attack_defend_kill" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=15
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob,charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
experience=no,attack,defend,kill
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 17}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -0,0 +1,60 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set Alice, Charlie and Dave to a known number of hitpoints.
|
||||
# Set Bob to a known but higher number of hitpoints.
|
||||
# Use [harm_unit] with Alice as harmer, the others as victims, and damage equal to Charlie's hitpoints.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 17 experience points, Bob gets 1, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_split_experience_unset" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=15
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob,charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
# experience=yes is the default, so this test leaves it unset
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 17}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -43,7 +43,7 @@
|
|||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
# experience=yes is the default, so this test leaves it unset
|
||||
experience=yes
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 17}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a fatal amount of damage.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a fatal amount of damage.
|
||||
##
|
||||
# Expected end state:
|
||||
# Alice gets 8 experience points for the first fight, Bob dies.
|
||||
# Alice gets 16 experience points for the second fight, Charlie and Dave die.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_kill_yes_experience_unset" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
# experience=yes is the default, so this test leaves it unset
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 8}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=bob
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 24}
|
||||
{ASSERT (
|
||||
[not]
|
||||
[have_unit]
|
||||
id=bob,charlie,dave
|
||||
[/have_unit]
|
||||
[/not]
|
||||
)}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -35,7 +35,7 @@
|
|||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
# experience=yes is the default, so this test leaves it unset
|
||||
experience=yes
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 8}
|
||||
{ASSERT (
|
||||
|
@ -57,6 +57,7 @@
|
|||
[/filter_second]
|
||||
amount=10
|
||||
kill=yes
|
||||
experience=yes
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 24}
|
||||
{ASSERT (
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
# wmllint: no translatables
|
||||
|
||||
#####
|
||||
# API(s) being tested: [harm_unit]
|
||||
##
|
||||
# Actions:
|
||||
# Set all units to a known number of hitpoints.
|
||||
# Both of these have Alice as the harmer.
|
||||
# Use [harm_unit] with Bob as the victim, and a non-fatal amount of damage.
|
||||
# Use [harm_unit] with Charlie and Dave as victims, and a non-fatal amount of damage.
|
||||
##
|
||||
# Expected end state:
|
||||
# The victims take the expected amount of damage.
|
||||
# Alice and Bob get 1 experience point each for the first fight.
|
||||
# Alice gets 2 experience points for the second fight, Charlie and Dave get 1 each.
|
||||
#####
|
||||
{COMMON_KEEP_A_B_C_D_UNIT_TEST "harm_unit_survivable_experience_unset" (
|
||||
[event]
|
||||
name=side 1 turn
|
||||
[modify_unit]
|
||||
[filter]
|
||||
id=alice,bob,charlie,dave
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=hitpoints
|
||||
set=10
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=bob
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=5
|
||||
# experience=yes is the default, so this test leaves it unset
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 1}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 10 0}
|
||||
{ASSERT_UNIT_HP_XP "dave" 10 0}
|
||||
|
||||
[harm_unit]
|
||||
[filter]
|
||||
id=charlie,dave
|
||||
[/filter]
|
||||
[filter_second]
|
||||
id=alice
|
||||
[/filter_second]
|
||||
amount=5
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
{ASSERT_UNIT_HP_XP "charlie" 5 1}
|
||||
{ASSERT_UNIT_HP_XP "dave" 5 1}
|
||||
|
||||
{SUCCEED}
|
||||
[/event]
|
||||
)}
|
|
@ -35,7 +35,7 @@
|
|||
id=alice
|
||||
[/filter_second]
|
||||
amount=5
|
||||
# experience=yes is the default, so this test leaves it unset
|
||||
experience=yes
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 1}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
|
@ -50,6 +50,7 @@
|
|||
id=alice
|
||||
[/filter_second]
|
||||
amount=5
|
||||
experience=yes
|
||||
[/harm_unit]
|
||||
{ASSERT_UNIT_HP_XP "alice" 10 3}
|
||||
{ASSERT_UNIT_HP_XP "bob" 5 1}
|
||||
|
|
|
@ -223,12 +223,32 @@
|
|||
0 no_duplicate_advancements
|
||||
0 add_advancement
|
||||
0 harm_unit_survivable_experience_no
|
||||
0 harm_unit_survivable_experience_unset
|
||||
0 harm_unit_survivable_experience_yes
|
||||
0 harm_unit_kill_no_experience_attack
|
||||
0 harm_unit_kill_no_experience_attack_defend
|
||||
0 harm_unit_kill_no_experience_attack_kill
|
||||
0 harm_unit_kill_no_experience_defend
|
||||
0 harm_unit_kill_no_experience_defend_kill
|
||||
0 harm_unit_kill_no_experience_fight
|
||||
0 harm_unit_kill_no_experience_kill
|
||||
0 harm_unit_kill_no_experience_no_attack_defend_kill
|
||||
0 harm_unit_kill_no_experience_no
|
||||
0 harm_unit_kill_no_experience_unset
|
||||
0 harm_unit_kill_no_experience_yes
|
||||
0 harm_unit_kill_split_experience_attack
|
||||
0 harm_unit_kill_split_experience_attack_defend
|
||||
0 harm_unit_kill_split_experience_attack_kill
|
||||
0 harm_unit_kill_split_experience_defend
|
||||
0 harm_unit_kill_split_experience_defend_kill
|
||||
0 harm_unit_kill_split_experience_fight
|
||||
0 harm_unit_kill_split_experience_kill
|
||||
0 harm_unit_kill_split_experience_no_attack_defend_kill
|
||||
0 harm_unit_kill_split_experience_no
|
||||
0 harm_unit_kill_split_experience_unset
|
||||
0 harm_unit_kill_split_experience_yes
|
||||
0 harm_unit_kill_yes_experience_no
|
||||
0 harm_unit_kill_yes_experience_unset
|
||||
0 harm_unit_kill_yes_experience_yes
|
||||
# Terrain mask tests
|
||||
0 test_terrain_mask_simple_nop
|
||||
|
|
Loading…
Add table
Reference in a new issue