1
2 /**
3 IMPORTANT !!!
4
5 DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbinfomessages BY
6 THE JavaClassesGenerator.xslt. MODIFY THESE FILES INSTEAD OF THIS ONE.
7
8 IMPORTANT END !!!
9 */
10 package
11 cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages;
12 import java.util.*;
13 import javax.vecmath.*;
14 import cz.cuni.amis.pogamut.base.communication.messages.*;
15 import cz.cuni.amis.pogamut.base.communication.worldview.*;
16 import cz.cuni.amis.pogamut.base.communication.worldview.event.*;
17 import cz.cuni.amis.pogamut.base.communication.worldview.object.*;
18 import cz.cuni.amis.pogamut.base.communication.translator.event.*;
19 import cz.cuni.amis.pogamut.base3d.worldview.object.*;
20 import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;
21 import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
22 import cz.cuni.amis.pogamut.udk.communication.messages.*;
23 import cz.cuni.amis.pogamut.udk.communication.worldview.objects.*;
24 import cz.cuni.amis.pogamut.udk.communication.translator.itemdescriptor.*;
25 import cz.cuni.amis.pogamut.udk.communication.messages.ItemType.Category;
26 import cz.cuni.amis.utils.exception.*;
27 import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;
28 import cz.cuni.amis.utils.SafeEquals;
29 import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;
30
31
32 /**
33
34 Asynchronous message. This bot has been damaged.
35
36 Corresponding GameBots message is
37 DAM.
38
39 */
40
41 public class
42 BotDamaged
43 extends GBEvent
44
45 implements IWorldEvent, IWorldChangeEvent
46
47 {
48
49 /**
50 Creates new instance of command BotDamaged.
51
52 Asynchronous message. This bot has been damaged.
53 Corresponding GameBots message for this command is
54 .
55 @param Damage Amount of damage taken.
56 @param DamageType
57 A string describing what kind of damage.
58
59 @param WeaponName
60 Name of the weapon that caused this damage. Not sent right now.
61
62 @param Flaming
63 If this damage is causing our bot to burn. TODO
64
65 @param CausedByWorld
66 If this damage was caused by world - falling into lava, or falling down.
67
68 @param DirectDamage
69 If the damage is direct. TODO
70
71 @param BulletHit
72 If this damage was caused by bullet.
73
74 @param VehicleHit
75 If this damage was caused by vehicle running over us.
76
77 @param Instigator
78 Id of the player who is damaging the bot, filled only if
79 instigator is in the field of view of the bot.
80
81 */
82 public BotDamaged(
83 int Damage, String DamageType, String WeaponName, boolean Flaming, boolean CausedByWorld, boolean DirectDamage, boolean BulletHit, boolean VehicleHit, UnrealId Instigator) {
84
85 this.Damage = Damage;
86
87 this.DamageType = DamageType;
88
89 this.WeaponName = WeaponName;
90
91 this.Flaming = Flaming;
92
93 this.CausedByWorld = CausedByWorld;
94
95 this.DirectDamage = DirectDamage;
96
97 this.BulletHit = BulletHit;
98
99 this.VehicleHit = VehicleHit;
100
101 this.Instigator = Instigator;
102
103 }
104
105
106 /** Example how the message looks like - used during parser tests. */
107 public static final String PROTOTYPE =
108 "DAM {Damage 0} {DamageType text} {WeaponName text} {Flaming False} {CausedByWorld False} {DirectDamage False} {BulletHit False} {VehicleHit False} {Instigator unreal_id}";
109
110
111 /////// Properties BEGIN
112
113 /**
114 Amount of damage taken. */
115 protected
116 int Damage =
117 0;
118
119
120 /**
121 Amount of damage taken. */
122 public
123 int getDamage() {
124 return
125 Damage;
126 }
127
128
129
130 /**
131
132 A string describing what kind of damage.
133 */
134 protected
135 String DamageType =
136 null;
137
138
139 /**
140
141 A string describing what kind of damage.
142 */
143 public
144 String getDamageType() {
145 return
146 DamageType;
147 }
148
149
150
151 /**
152
153 Name of the weapon that caused this damage. Not sent right now.
154 */
155 protected
156 String WeaponName =
157 null;
158
159
160 /**
161
162 Name of the weapon that caused this damage. Not sent right now.
163 */
164 public
165 String getWeaponName() {
166 return
167 WeaponName;
168 }
169
170
171
172 /**
173
174 If this damage is causing our bot to burn. TODO
175 */
176 protected
177 boolean Flaming =
178 false;
179
180
181 /**
182
183 If this damage is causing our bot to burn. TODO
184 */
185 public
186 boolean isFlaming() {
187 return
188 Flaming;
189 }
190
191
192
193 /**
194
195 If this damage was caused by world - falling into lava, or falling down.
196 */
197 protected
198 boolean CausedByWorld =
199 false;
200
201
202 /**
203
204 If this damage was caused by world - falling into lava, or falling down.
205 */
206 public
207 boolean isCausedByWorld() {
208 return
209 CausedByWorld;
210 }
211
212
213
214 /**
215
216 If the damage is direct. TODO
217 */
218 protected
219 boolean DirectDamage =
220 false;
221
222
223 /**
224
225 If the damage is direct. TODO
226 */
227 public
228 boolean isDirectDamage() {
229 return
230 DirectDamage;
231 }
232
233
234
235 /**
236
237 If this damage was caused by bullet.
238 */
239 protected
240 boolean BulletHit =
241 false;
242
243
244 /**
245
246 If this damage was caused by bullet.
247 */
248 public
249 boolean isBulletHit() {
250 return
251 BulletHit;
252 }
253
254
255
256 /**
257
258 If this damage was caused by vehicle running over us.
259 */
260 protected
261 boolean VehicleHit =
262 false;
263
264
265 /**
266
267 If this damage was caused by vehicle running over us.
268 */
269 public
270 boolean isVehicleHit() {
271 return
272 VehicleHit;
273 }
274
275
276
277 /**
278
279 Id of the player who is damaging the bot, filled only if
280 instigator is in the field of view of the bot.
281 */
282 protected
283 UnrealId Instigator =
284 null;
285
286
287 /**
288
289 Id of the player who is damaging the bot, filled only if
290 instigator is in the field of view of the bot.
291 */
292 public
293 UnrealId getInstigator() {
294 return
295 Instigator;
296 }
297
298
299
300 /////// Properties END
301
302 /////// Extra Java code BEGIN
303
304 /////// Additional code from xslt BEGIN
305
306 public long getSimTime() {
307 // NOT IMPLEMENTED FOR UDK
308 return 0;
309 }
310
311
312
313 /////// Additional code from xslt END
314
315 /////// Extra Java from XML BEGIN
316
317 /////// Extra Java from XML END
318
319 /////// Extra Java code END
320
321
322
323 /**
324 * Cloning constructor.
325 */
326 public BotDamaged(BotDamaged original) {
327
328 this.Damage=original.Damage;
329
330 this.DamageType=original.DamageType;
331
332 this.WeaponName=original.WeaponName;
333
334 this.Flaming=original.Flaming;
335
336 this.CausedByWorld=original.CausedByWorld;
337
338 this.DirectDamage=original.DirectDamage;
339
340 this.BulletHit=original.BulletHit;
341
342 this.VehicleHit=original.VehicleHit;
343
344 this.Instigator=original.Instigator;
345
346 }
347
348
349 /**
350 * Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
351 */
352 public BotDamaged() {
353 }
354
355
356
357 public String toString() {
358 return
359
360 super.toString() + " | " +
361
362 "Damage = " +
363 String.valueOf(Damage) + " | " +
364
365 "DamageType = " +
366 String.valueOf(DamageType) + " | " +
367
368 "WeaponName = " +
369 String.valueOf(WeaponName) + " | " +
370
371 "Flaming = " +
372 String.valueOf(Flaming) + " | " +
373
374 "CausedByWorld = " +
375 String.valueOf(CausedByWorld) + " | " +
376
377 "DirectDamage = " +
378 String.valueOf(DirectDamage) + " | " +
379
380 "BulletHit = " +
381 String.valueOf(BulletHit) + " | " +
382
383 "VehicleHit = " +
384 String.valueOf(VehicleHit) + " | " +
385
386 "Instigator = " +
387 String.valueOf(Instigator) + " | " +
388 "";
389
390 }
391
392 public String toHtmlString() {
393 return super.toString() +
394
395 "<b>Damage</b> : " +
396 String.valueOf(Damage) +
397 " <br/> " +
398
399 "<b>DamageType</b> : " +
400 String.valueOf(DamageType) +
401 " <br/> " +
402
403 "<b>WeaponName</b> : " +
404 String.valueOf(WeaponName) +
405 " <br/> " +
406
407 "<b>Flaming</b> : " +
408 String.valueOf(Flaming) +
409 " <br/> " +
410
411 "<b>CausedByWorld</b> : " +
412 String.valueOf(CausedByWorld) +
413 " <br/> " +
414
415 "<b>DirectDamage</b> : " +
416 String.valueOf(DirectDamage) +
417 " <br/> " +
418
419 "<b>BulletHit</b> : " +
420 String.valueOf(BulletHit) +
421 " <br/> " +
422
423 "<b>VehicleHit</b> : " +
424 String.valueOf(VehicleHit) +
425 " <br/> " +
426
427 "<b>Instigator</b> : " +
428 String.valueOf(Instigator) +
429 " <br/> " +
430 "";
431 }
432
433
434
435 }
436
437