1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.magicproject.event;
20
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.io.OutputStream;
24
25 /***
26 * This interface contains all events supported
27 *
28 * @since 0.1
29 * @see net.sf.magicproject.event.EventFactory
30 */
31 public enum Event {
32
33 /***
34 *
35 */
36 BECOMING_UNTAPPED,
37
38 /***
39 *
40 */
41 BEFORE_PHASE,
42
43 /***
44 *
45 */
46 BEGINNING_PHASE,
47
48 /***
49 *
50 */
51 EOP,
52
53 /***
54 *
55 */
56 DETACHED_CARD,
57
58 /***
59 *
60 */
61 EXCEPTION,
62
63 /***
64 *
65 */
66 LETHAL_DAMAGE,
67
68 /***
69 *
70 */
71 UPDATE_LIFE,
72
73 /***
74 *
75 */
76 LOSING_GAME,
77
78 /***
79 *
80 */
81 MODIFIED_PROPERTY,
82
83 /***
84 *
85 */
86 MODIFIED_IDCARD,
87
88 /***
89 *
90 */
91 MODIFIED_IDCOLOR,
92
93 /***
94 *
95 */
96 MODIFIED_OWNER,
97
98 /***
99 *
100 */
101 MODIFIED_CONTROLLER,
102
103 /***
104 *
105 */
106 ATTACHED_TO,
107
108 /***
109 *
110 */
111 MODIFIED_REGISTER,
112
113 /***
114 *
115 */
116 DECLARED_BLOCKING,
117
118 /***
119 *
120 */
121 CASTING,
122
123 /***
124 *
125 */
126 DECLARED_ATTACKING,
127 /***
128 *
129 */
130 BECOMING_TAPPED,
131
132 /***
133 *
134 */
135 NEVER_ACTIVATED,
136
137 /***
138 *
139 */
140 UPDATE_TOUGHNESS,
141
142 /***
143 *
144 */
145 TARGETED,
146
147 /***
148 *
149 */
150 CAN_CAST_CARD,
151
152 /***
153 *
154 */
155 DEALTING_DAMAGE,
156
157 /***
158 *
159 */
160 MOVING_CARD,
161
162 /***
163 *
164 */
165 GIVEN_MANA,
166
167 /***
168 *
169 */
170 ARRANGED_ZONE,
171
172 /***
173 *
174 */
175 FACED_UP,
176
177 /***
178 *
179 */
180 FACED_DOWN,
181
182 /***
183 *
184 */
185 MODIFIED_REGISTER_RANGE;
186
187 /***
188 * Wrtite this enum to the given outputstream.
189 *
190 * @param out
191 * the stream ths enum would be written.
192 * @throws IOException
193 * error while writting event's id
194 */
195 public void write(OutputStream out) throws IOException {
196 out.write(ordinal());
197 }
198
199 /***
200 * Read and return the enum from the given inputstream.
201 *
202 * @param input
203 * the stream containing the enum to read.
204 * @return the enum from the given inputstream.
205 * @throws IOException
206 * error while reading event's id.
207 */
208 public static Event valueOf(InputStream input) throws IOException {
209 return values()[input.read()];
210 }
211
212 }