Tests of events in [abilities] and [specials] tags
This commit is contained in:
parent
bddbf060a5
commit
c4610a0283
2 changed files with 381 additions and 0 deletions
|
@ -0,0 +1,326 @@
|
|||
#####
|
||||
# API(s) being tested: [unit][abilities][dummy][event]
|
||||
##
|
||||
# Actions:
|
||||
# Define a custom event in an (arbitrarily named) ability tag in a unit made with ActionWML
|
||||
# Fire the custom event
|
||||
##
|
||||
# Expected end state:
|
||||
# The custom event has executed
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "event_in_ability_in_unit" (
|
||||
[event]
|
||||
name=start
|
||||
[unit]
|
||||
type=Elvish Lady
|
||||
[abilities]
|
||||
[dummy]
|
||||
id=ability_in_unit
|
||||
[event]
|
||||
name=event_in_ability_in_unit
|
||||
{VARIABLE variable_in_event_in_ability_in_unit 1}
|
||||
[/event]
|
||||
[/dummy]
|
||||
[/abilities]
|
||||
[/unit]
|
||||
{VARIABLE variable_in_event_in_ability_in_unit 0}
|
||||
[fire_event]
|
||||
name=event_in_ability_in_unit
|
||||
[/fire_event]
|
||||
{RETURN ({VARIABLE_CONDITIONAL variable_in_event_in_ability_in_unit equals 1})}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [unit][specials][dummy][event]
|
||||
##
|
||||
# Actions:
|
||||
# Define a custom event in an (arbitrarily named) weapon special tag in a unit made with ActionWML
|
||||
# Fire the custom event
|
||||
##
|
||||
# Expected end state:
|
||||
# The custom event has executed
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "event_in_special_in_unit" (
|
||||
[event]
|
||||
name=start
|
||||
[unit]
|
||||
type=Elvish Lady
|
||||
[attack]
|
||||
name=stick
|
||||
type=impact
|
||||
range=melee
|
||||
damage=2
|
||||
number=2
|
||||
[specials]
|
||||
[dummy]
|
||||
id=special_in_unit
|
||||
[event]
|
||||
name=event_in_special_in_unit
|
||||
{VARIABLE variable_in_event_in_special_in_unit 1}
|
||||
[/event]
|
||||
[/dummy]
|
||||
[/specials]
|
||||
[/attack]
|
||||
[/unit]
|
||||
{VARIABLE variable_in_event_in_special_in_unit 0}
|
||||
[fire_event]
|
||||
name=event_in_special_in_unit
|
||||
[/fire_event]
|
||||
{RETURN ({VARIABLE_CONDITIONAL variable_in_event_in_special_in_unit equals 1})}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side][unit][abilities][dummy][event]
|
||||
##
|
||||
# Actions:
|
||||
# Define a custom event in an (arbitrarily named) ability tag in a unit made in a side with SideWML
|
||||
# Fire the custom event
|
||||
##
|
||||
# Expected end state:
|
||||
# The custom event has executed
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "event_in_ability_in_unit_in_side" (
|
||||
[side]
|
||||
side=3
|
||||
[unit]
|
||||
type=Elvish Lady
|
||||
[abilities]
|
||||
[dummy]
|
||||
id=ability_in_unit_in_side
|
||||
[event]
|
||||
name=event_in_ability_in_unit_in_side
|
||||
{VARIABLE variable_in_event_in_ability_in_unit_in_side 1}
|
||||
[/event]
|
||||
[/dummy]
|
||||
[/abilities]
|
||||
[/unit]
|
||||
[/side]
|
||||
[event]
|
||||
name=start
|
||||
{VARIABLE variable_in_event_in_ability_in_unit_in_side 0}
|
||||
[fire_event]
|
||||
name=event_in_ability_in_unit_in_side
|
||||
[/fire_event]
|
||||
{RETURN ({VARIABLE_CONDITIONAL variable_in_event_in_ability_in_unit_in_side equals 1})}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [side][unit][specials][dummy][event]
|
||||
##
|
||||
# Actions:
|
||||
# Define a custom event in an (arbitrarily named) weapon special tag in a unit made in a side with SideWML
|
||||
# Fire the custom event
|
||||
##
|
||||
# Expected end state:
|
||||
# The custom event has executed
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "event_in_special_in_unit_in_side" (
|
||||
[side]
|
||||
side=3
|
||||
[unit]
|
||||
type=Elvish Lady
|
||||
[attack]
|
||||
name=stick
|
||||
type=impact
|
||||
range=melee
|
||||
damage=2
|
||||
number=2
|
||||
[specials]
|
||||
[dummy]
|
||||
id=special_in_unit_in_side
|
||||
[event]
|
||||
name=event_in_special_in_unit_in_side
|
||||
{VARIABLE variable_in_event_in_special_in_unit_in_side 1}
|
||||
[/event]
|
||||
[/dummy]
|
||||
[/specials]
|
||||
[/attack]
|
||||
[/unit]
|
||||
[/side]
|
||||
[event]
|
||||
name=start
|
||||
{VARIABLE variable_in_event_in_special_in_unit_in_side 0}
|
||||
[fire_event]
|
||||
name=event_in_special_in_unit_in_side
|
||||
[/fire_event]
|
||||
{RETURN ({VARIABLE_CONDITIONAL variable_in_event_in_special_in_unit_in_side equals 1})}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [unit_type][abilities][dummy][event]
|
||||
##
|
||||
# Actions:
|
||||
# Define a custom event in an (arbitrarily named) ability tag in a unit type
|
||||
# Add unit of this unit_type
|
||||
# Fire the custom event
|
||||
##
|
||||
# Expected end state:
|
||||
# The custom event has executed
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "event_in_ability_in_unit_type" (
|
||||
[event]
|
||||
name=start
|
||||
{VARIABLE variable_in_event_in_ability_in_unit_type 0}
|
||||
[unit]
|
||||
type=Test Unit Ability Event
|
||||
[/unit]
|
||||
[fire_event]
|
||||
name=event_in_ability_in_unit_type
|
||||
[/fire_event]
|
||||
{RETURN ({VARIABLE_CONDITIONAL variable_in_event_in_ability_in_unit_type equals 1})}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [unit_type][specials][dummy][event]
|
||||
##
|
||||
# Actions:
|
||||
# Define a custom event in an (arbitrarily named) special tag in a unit type
|
||||
# Add unit of this unit_type
|
||||
# Fire the custom event
|
||||
##
|
||||
# Expected end state:
|
||||
# The custom event has executed
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "event_in_special_in_unit_type" (
|
||||
[event]
|
||||
name=start
|
||||
{VARIABLE variable_in_event_in_special_in_unit_type 0}
|
||||
[unit]
|
||||
type=Test Unit Special Event
|
||||
[/unit]
|
||||
[fire_event]
|
||||
name=event_in_special_in_unit_type
|
||||
[/fire_event]
|
||||
{RETURN ({VARIABLE_CONDITIONAL variable_in_event_in_special_in_unit_type equals 1})}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [modify_unit][effect][abilities][dummy][event]
|
||||
##
|
||||
# Actions:
|
||||
# Define a custom event in an (arbitrarily named) ability tag in an effect applying a new ability
|
||||
# Apply the effect to a unit
|
||||
# Fire the custom event
|
||||
##
|
||||
# Expected end state:
|
||||
# The custom event has executed
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "event_in_ability_in_effect" (
|
||||
[event]
|
||||
name=start
|
||||
[unit]
|
||||
type=Elvish Lady
|
||||
[/unit]
|
||||
[modify_unit]
|
||||
[filter]
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=new_ability
|
||||
[abilities]
|
||||
[dummy]
|
||||
id=ability_in_effect
|
||||
[event]
|
||||
name=event_in_ability_in_effect
|
||||
{VARIABLE variable_in_event_in_ability_in_effect 1}
|
||||
[/event]
|
||||
[/dummy]
|
||||
[/abilities]
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
{VARIABLE variable_in_event_in_ability_in_effect 0}
|
||||
[fire_event]
|
||||
name=event_in_ability_in_effect
|
||||
[/fire_event]
|
||||
{RETURN ({VARIABLE_CONDITIONAL variable_in_event_in_ability_in_effect equals 1})}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [modify_unit][effect][specials][dummy][event]
|
||||
##
|
||||
# Actions:
|
||||
# Define a custom event in an (arbitrarily named) special tag in an effect applying a new attack
|
||||
# Apply the effect to a unit
|
||||
# Fire the custom event
|
||||
##
|
||||
# Expected end state:
|
||||
# The custom event has executed
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "event_in_special_in_effect" (
|
||||
[event]
|
||||
name=start
|
||||
[unit]
|
||||
type=Elvish Lady
|
||||
[/unit]
|
||||
[modify_unit]
|
||||
[filter]
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=new_attack
|
||||
[specials]
|
||||
[dummy]
|
||||
id=special_in_effect
|
||||
[event]
|
||||
name=event_in_special_in_effect
|
||||
{VARIABLE variable_in_event_in_special_in_effect 1}
|
||||
[/event]
|
||||
[/dummy]
|
||||
[/specials]
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
{VARIABLE variable_in_event_in_special_in_effect 0}
|
||||
[fire_event]
|
||||
name=event_in_special_in_effect
|
||||
[/fire_event]
|
||||
{RETURN ({VARIABLE_CONDITIONAL variable_in_event_in_special_in_effect equals 1})}
|
||||
[/event]
|
||||
)}
|
||||
|
||||
#####
|
||||
# API(s) being tested: [modify_unit][effect][set_specials][dummy][event]
|
||||
##
|
||||
# Actions:
|
||||
# Define a custom event in an (arbitrarily named) special tag in an effect applying a new special to an existing attack
|
||||
# Apply the effect to a unit
|
||||
# Fire the custom event
|
||||
##
|
||||
# Expected end state:
|
||||
# The custom event has executed
|
||||
#####
|
||||
{GENERIC_UNIT_TEST "event_in_set_special_in_effect" (
|
||||
[event]
|
||||
name=start
|
||||
[unit]
|
||||
type=Elvish Lady
|
||||
[/unit]
|
||||
[modify_unit]
|
||||
[filter]
|
||||
[/filter]
|
||||
[effect]
|
||||
apply_to=attack
|
||||
range=melee
|
||||
[set_specials]
|
||||
mode=append
|
||||
[dummy]
|
||||
id=set_special_in_effect
|
||||
[event]
|
||||
name=event_in_set_special_in_effect
|
||||
{VARIABLE variable_in_event_in_set_special_in_effect 1}
|
||||
[/event]
|
||||
[/dummy]
|
||||
[/set_specials]
|
||||
[/effect]
|
||||
[/modify_unit]
|
||||
{VARIABLE variable_in_event_in_set_special_in_effect 0}
|
||||
[fire_event]
|
||||
name=event_in_set_special_in_effect
|
||||
[/fire_event]
|
||||
{RETURN ({VARIABLE_CONDITIONAL variable_in_event_in_set_special_in_effect equals 1})}
|
||||
[/event]
|
||||
)}
|
55
data/test/units/events_in_ability_and_special_tags.cfg
Normal file
55
data/test/units/events_in_ability_and_special_tags.cfg
Normal file
|
@ -0,0 +1,55 @@
|
|||
#textdomain wesnoth-test
|
||||
|
||||
[unit_type]
|
||||
id=Test Unit Ability Event
|
||||
race=test
|
||||
image="misc/blank-hex.png"
|
||||
hitpoints=1
|
||||
movement_type=fly
|
||||
movement=1
|
||||
experience=1
|
||||
level=1
|
||||
alignment=neutral
|
||||
advances_to=null
|
||||
cost=1
|
||||
usage=scout
|
||||
hide_help=yes
|
||||
do_not_list=yes
|
||||
[abilities]
|
||||
[dummy]
|
||||
id=ability_in_unit_type
|
||||
[event]
|
||||
name=event_in_ability_in_unit_type
|
||||
{VARIABLE variable_in_event_in_ability_in_unit_type 1}
|
||||
[/event]
|
||||
[/dummy]
|
||||
[/abilities]
|
||||
[/unit_type]
|
||||
|
||||
[unit_type]
|
||||
id=Test Unit Special Event
|
||||
race=test
|
||||
image="misc/blank-hex.png"
|
||||
hitpoints=1
|
||||
movement_type=fly
|
||||
movement=1
|
||||
experience=1
|
||||
level=1
|
||||
alignment=neutral
|
||||
advances_to=null
|
||||
cost=1
|
||||
usage=scout
|
||||
hide_help=yes
|
||||
do_not_list=yes
|
||||
[attack]
|
||||
[specials]
|
||||
[dummy]
|
||||
id=special_in_unit_type
|
||||
[event]
|
||||
name=event_in_special_in_unit_type
|
||||
{VARIABLE variable_in_event_in_special_in_unit_type 1}
|
||||
[/event]
|
||||
[/dummy]
|
||||
[/specials]
|
||||
[/attack]
|
||||
[/unit_type]
|
Loading…
Add table
Reference in a new issue