1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.magicproject.action;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.io.OutputStream;
24
25 /***
26 * Represents all atomic actions necessary to implement all possible abilities
27 * of the Magic play.
28 *
29 * @author Fabrice Daugan
30 * @since 0.1a
31 */
32 public enum Actiontype {
33
34 /***
35 * @see net.sf.magicproject.action.PayMana
36 */
37 PAY_MANA,
38
39 /***
40 */
41 MOVE_PLAYER_CARD,
42
43 /***
44 * @see net.sf.magicproject.action.GiveMana
45 */
46 GIVE_MANA_BASIC,
47
48 /***
49 * @see net.sf.magicproject.action.Target
50 */
51 TARGET,
52
53 /***
54 */
55 ASSIGN_DAMAGE_TARGET,
56
57 /***
58 */
59 TAP,
60
61 /***
62 */
63 SHUFFLE,
64
65 /***
66 * @see net.sf.magicproject.action.InputChoice
67 */
68 CHOICE,
69
70 /***
71 * @see net.sf.magicproject.action.Input
72 */
73 MSG,
74
75 /***
76 */
77 CREATE_CARD,
78
79 /***
80 */
81 SKIP_PHASE,
82
83 /***
84 */
85 FORCE_PLAY,
86
87 /***
88 */
89 LOSE_GAME,
90
91 /***
92 * @see net.sf.magicproject.action.Hop
93 */
94 HOP,
95
96 /***
97 */
98 MOVE_CARD,
99
100 /***
101 */
102 ASSIGN_DAMAGE_SOURCE_DEST,
103
104 /***
105 * @see net.sf.magicproject.action.WaitActivatedChoice
106 */
107 WAIT_ACTIVATED_CHOICE,
108
109 /***
110 * @see net.sf.magicproject.action.WaitTriggeredBufferChoice
111 */
112 WAIT_TRIGGERED_BUFFER_CHOICE,
113
114 /***
115 */
116 UPDATE_LIFE,
117
118 /***
119 */
120 UPDATE_TOUGHNESS,
121
122 /***
123 */
124 LETHAL_DAMAGE,
125
126 /***
127 */
128 UNREGISTER_THIS,
129
130 /***
131 */
132 ATTACH_LIST,
133
134 /***
135 */
136 ATTACH,
137
138 /***
139 */
140 ABORT,
141
142 /***
143 */
144 ADD_OBJECT,
145
146 /***
147 * @see net.sf.magicproject.action.MoveObject
148 */
149 MOVE_OBJECT,
150
151 /***
152 * @see net.sf.magicproject.action.RemoveObject
153 */
154 REMOVE_OBJECT,
155
156 /***
157 * @see net.sf.magicproject.action.Repeat
158 */
159 REPEAT_ACTION,
160
161 /***
162 */
163 IF_THEN_ELSE,
164
165 /***
166 * @see net.sf.magicproject.action.ModifyTargetableRegister
167 */
168 MODIFY_TARGETABLE_REGISTER,
169
170 /***
171 */
172 ZONE_VISIBILITY,
173
174 /***
175 */
176 MODIFY_STACK_REGISTER,
177
178 /***
179 */
180 MODIFY_STATIC_REGISTER,
181
182 /***
183 * @see net.sf.magicproject.action.RemoveMe
184 */
185 REMOVE_ME,
186
187 /***
188 */
189 ADD_MODIFIER,
190
191 /***
192 */
193 SET_ID_CARD,
194
195 /***
196 * @see net.sf.magicproject.action.RefreshModifier
197 */
198 REFRESH_MODIFIER,
199
200 /***
201 * @see net.sf.magicproject.action.AddModifierFromStaticModifier
202 */
203 REFRESH_STATIC_MODIFIER,
204
205 /***
206 * @see net.sf.magicproject.action.DetachMe
207 */
208 DETACH_ME,
209
210 /***
211 */
212 NEXT_CURRENT_PLAYER,
213
214 /***
215 */
216 NEXT_PHASE,
217
218 /***
219 */
220 CREATE_ABILITY,
221
222 /***
223 */
224 CREATE_MODIFIER,
225
226 /***
227 * @see net.sf.magicproject.action.Sound
228 */
229 SOUND,
230
231 /***
232 */
233 MODIFY_ABILITY_REGISTER,
234
235 /***
236 */
237 MODIFY_TARGET_LIST_REGISTER,
238
239 /***
240 * @see net.sf.magicproject.action.ActionFactory
241 */
242 ADD_ABILITY,
243
244 /***
245 * @see net.sf.magicproject.action.ActionFactory
246 */
247 RESOLVE_HIDDEN,
248
249 /***
250 * @see net.sf.magicproject.action.ActionFactory
251 */
252 INPUT_NUMBER,
253
254 /***
255 * @see net.sf.magicproject.action.ActionFactory
256 */
257 INPUT_COLOR,
258
259 /***
260 * @see net.sf.magicproject.action.ActionFactory
261 */
262 INPUT_ZONE,
263
264 /***
265 * @see net.sf.magicproject.action.ActionFactory
266 */
267 INPUT_PROPERTY,
268
269 /***
270 */
271 TARGET_LIST,
272
273 /***
274 */
275 INT_LIST,
276
277 /***
278 */
279 GENERATE_EVENT,
280
281 /***
282 * @see net.sf.magicproject.action.GiveMana
283 */
284 GIVE_MANA_MULTI,
285
286 /***
287 *
288 */
289 TARGET_ALL,
290
291 /***
292 */
293 FACE,
294
295 /***
296 *
297 */
298 OBJECT_MAP,
299
300 /***
301 *
302 */
303 TARGET_RANDOM,
304
305 /***
306 *
307 */
308 MODIFY_REQUIRED_MANA,
309
310 /***
311 *
312 */
313 COPY_CARD,
314
315 /***
316 *
317 */
318 RESTORE_CARD;
319
320 /***
321 * Wrtite this enum to the given outputstream.
322 *
323 * @param out
324 * the stream ths enum would be written.
325 * @throws IOException
326 * If some other I/O error occurs
327 */
328 public void write(OutputStream out) throws IOException {
329 out.write(ordinal());
330 }
331
332 /***
333 * Read and return the enum from the given inputstream.
334 *
335 * @param input
336 * the stream containing the enum to read.
337 * @return the enum from the given inputstream.
338 * @throws IOException
339 * If some other I/O error occurs
340 */
341 static Actiontype valueOf(InputStream input) throws IOException {
342 return values()[input.read()];
343 }
344 }