forked from wesnoth/wesnoth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the events-test_filter_attack_type test verify what [filter_attack]type= can check type of damage same if modified by [damage]replacement/alternative_type. The second verify [filter_weapon]type= called by a special(or leadership/resistance abilities) can ckeck type without modofication by [damage] for don't risk infinite recursion.
- Loading branch information
1 parent
f4f2bc9
commit c2a5ec9
Showing
3 changed files
with
142 additions
and
15 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
data/test/scenarios/wml_tests/ScenarioWML/EventWML/events-test_filter_attack_type.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# wmllint: no translatables | ||
|
||
##### | ||
# API(s) being tested: [event][filter_attack]type= | ||
## | ||
# Actions: | ||
# Give Alice an ability that adds a damage special with addition of arcnae type to all of his weapons. | ||
# Define events that use filter_attack matching Alice's arcane type. | ||
# Have Alice attack Bob. | ||
## | ||
# Expected end state: | ||
# An event triggers when Alice attacks during side 1's turn because type=arcane detected. | ||
##### | ||
{GENERIC_UNIT_TEST event_test_filter_attack_type ( | ||
[event] | ||
name=start | ||
[object] | ||
silent=yes | ||
[effect] | ||
apply_to=new_ability | ||
[abilities] | ||
[damage] | ||
id=test_arcane_damage | ||
alternative_type=arcane | ||
[/damage] | ||
[/abilities] | ||
[/effect] | ||
[filter] | ||
id=alice | ||
[/filter] | ||
[/object] | ||
[modify_unit] | ||
[filter] | ||
[/filter] | ||
# Make sure they don't die during the attacks | ||
[status] | ||
invulnerable=yes | ||
[/status] | ||
[/modify_unit] | ||
{VARIABLE triggers 0} | ||
[/event] | ||
[event] | ||
name=side 1 turn 1 | ||
[do_command] | ||
[move] | ||
x=7,13 | ||
y=3,4 | ||
[/move] | ||
[attack] | ||
[source] | ||
x,y=13,4 | ||
[/source] | ||
[destination] | ||
x,y=13,3 | ||
[/destination] | ||
[/attack] | ||
[/do_command] | ||
[end_turn][/end_turn] | ||
[/event] | ||
|
||
[event] | ||
name=side 2 turn | ||
[do_command] | ||
[attack] | ||
[source] | ||
x,y=13,3 | ||
[/source] | ||
[destination] | ||
x,y=13,4 | ||
[/destination] | ||
[/attack] | ||
[/do_command] | ||
[end_turn][/end_turn] | ||
[/event] | ||
|
||
# Event when Alice attacks | ||
[event] | ||
name=attack | ||
first_time_only=no | ||
[filter_attack] | ||
type=arcane | ||
[/filter_attack] | ||
{ASSERT ({VARIABLE_CONDITIONAL side_number equals 1})} | ||
{ASSERT ({VARIABLE_CONDITIONAL triggers equals 0})} | ||
{VARIABLE_OP triggers add 1} | ||
[/event] | ||
[event] | ||
name=turn 2 | ||
{RETURN ({VARIABLE_CONDITIONAL triggers equals 1})} | ||
[/event] | ||
)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters