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