-
-
Notifications
You must be signed in to change notification settings - Fork 988
/
feeding.cfg
168 lines (147 loc) · 3.97 KB
/
feeding.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# This unit test defines a WML object based implementation of the "feeding" ability
# and checks that it works. What is being tested here, beyond what is tested in
# test_unit_map and other scenarios that test the attack pathway, is that
# - the die event works
# - objects attach to units by id correctly
# - abilities can be properly detected in filters
# - abillities which add other objects works
# - this impl of feeding works
#define STR_FEEDING
foo
#enddef
#define STR_FEEDING_EFFECT
bar
#enddef
#define STR_FEEDING_DESCRIPTION
baz
#enddef
#define TEST_FEEDING ID EXPECTED_INCREASE
[store_unit]
[filter]
id={ID}
[/filter]
variable=Killer
[/store_unit]
{VARIABLE victim_x $Killer.x}
{VARIABLE_OP victim_x sub 1}
{VARIABLE victim_y $Killer.y}
{VARIABLE Killer.attacks_left 1}
[unstore_unit]
variable=Killer
[/unstore_unit]
{VARIABLE victim_side 3}
{VARIABLE_OP victim_side sub $Killer.side|}
{VARIABLE Killer_start_hp $Killer.hitpoints}
[terrain]
x,y=$victim_x|,$victim_y|
terrain="Xv"
[/terrain]
{UNIT $victim_side| "Elvish Archer" $victim_x| $victim_y| (hitpoints=1)}
[do_command]
[attack]
weapon = 0
defender_weapon = 0
[source]
x,y=$Killer.x|,$Killer.y|
[/source]
[destination]
x,y=$victim_x|,$victim_y|
[/destination]
[/attack]
[/do_command]
[store_unit]
[filter]
id={ID}
[/filter]
variable=Killer
[/store_unit]
{VARIABLE_OP Killer_start_hp add {EXPECTED_INCREASE}}
{ASSERT ({VARIABLE_CONDITIONAL Killer.hitpoints equals $Killer_start_hp})}
#enddef
## TODO: the original feeding ability is implemented differently, maybe we should update this.
{GENERIC_UNIT_TEST "feeding" (
[event]
id=ability_feeding_die
name=die
first_time_only=no
[filter]
[not]
[filter_wml]
[status]
not_living="yes"
[/status]
[/filter_wml]
[/not]
[/filter]
[filter_second]
ability=feeding_Test
[/filter_second]
[unstore_unit]
variable=second_unit
{COLOR_HEAL}
text= {STR_FEEDING_EFFECT}
find_vacant=no
[/unstore_unit]
[object]
silent=yes
duration=forever
[filter]
x,y=$x2|,$y2|
[/filter]
[effect]
apply_to=hitpoints
increase_total=1
increase=1
[/effect]
[/object]
[/event]
[event]
name=start
[object]
id=feeding_object
silent=yes
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=feeding_Test
name= {STR_FEEDING}
female_name= {STR_FEEDING}
description= {STR_FEEDING_DESCRIPTION}
[/dummy]
[/abilities]
[/effect]
[filter]
id=bob
[/filter]
[/object]
[/event]
[event]
name=start
{TEST_FEEDING alice 0}
{TEST_FEEDING alice 0}
{TEST_FEEDING alice 0}
[end_turn]
[/end_turn]
[/event]
[event]
name = side 2 turn 1
{TEST_FEEDING bob 1}
{TEST_FEEDING bob 1}
{TEST_FEEDING bob 1}
[store_unit]
[filter]
id=bob
[/filter]
variable=Bob
[/store_unit]
{VARIABLE_OP Bob.experience add 50}
[unstore_unit]
variable=Bob
[/unstore_unit]
{TEST_FEEDING bob 1}
{TEST_FEEDING bob 1}
{TEST_FEEDING bob 1}
{SUCCEED}
[/event]
)}