View Javadoc

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