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=base]+classtype[@name=abstract] BEGIN
13  		
14  		// --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=base]+classtype[@name=abstract] END
15      
16   		/**
17           *  
18              				Abstract definition of the GameBots2004 message INITED.  
19              			
20           *
21           *  <p></p><p></p>
22           *  Complete message documentation:               
23           *  
24  		Asynchronous message. Sent after succesfull init command (so usually just once). 
25  		Holds many attributes of the bots like speed, id starting and max health, etc.
26  		Some attributes are not used due to GameBots mechanics.
27  	
28           */
29   	public abstract class InitedMessage   
30    				extends 
31    				InfoMessage
32    						implements IWorldEvent, IWorldChangeEvent, ICompositeWorldObject
33    						
34  	    {
35   	
36      	/** Example how the message looks like - used during parser tests. */
37      	public static final String PROTOTYPE =
38      		"INITED {BotId unreal_id}  {HealthStart 0}  {HealthFull 0}  {HealthMax 0}  {AdrenalineStart 0}  {AdrenalineMax 0}  {ShieldStrengthStart 0}  {ShieldStrengthMax 0}  {MaxMultiJump 0}  {DamageScaling 0}  {GroundSpeed 0}  {WaterSpeed 0}  {AirSpeed 0}  {LadderSpeed 0}  {AccelRate 0}  {JumpZ 0}  {MultiJumpBoost 0}  {MaxFallSpeed 0}  {DodgeSpeedFactor 0}  {DodgeSpeedZ 0}  {AirControl 0} ";
39      
40      	
41      	
42      	/**
43      	 * Parameter-less contructor for the message.
44      	 */
45  		public InitedMessage()
46  		{
47  		}
48  	
49  				// abstract message, it does not have any more constructors				
50  			
51  						
52  						public static final UnrealId InitedMessageId = UnrealId.get("InitedMessageId");
53  					
54  						
55  						public UnrealId getId() {						
56  							return cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage.InitedMessageId;
57  						}
58  					
59  	   		
60  			protected long SimTime;
61  				
62  			/**
63  			 * Simulation time in MILLI SECONDS !!!
64  			 */	
65  			@Override
66  			public long getSimTime() {
67  				return SimTime;
68  			}
69  						
70  			/**
71  			 * Used by Yylex to slip correct time of the object or programmatically.
72  			 */
73  			protected void setSimTime(long SimTime) {
74  				this.SimTime = SimTime;
75  			}
76  	   	
77   		/**
78           * 
79  			A unique unreal Id of the new bot.
80  		 
81           */
82          public abstract UnrealId getBotId()
83   	;
84  		    			
85   		/**
86           * 
87  			Bot will always start with this health amount (usually 100). 
88  		 
89           */
90          public abstract int getHealthStart()
91   	;
92  		    			
93   		/**
94           * 
95  			Full health of the bot (usually 100).
96  		 
97           */
98          public abstract int getHealthFull()
99   	;
100 		    			
101  		/**
102          * 
103 			Maximum health of the bot (default 199).
104 		 
105          */
106         public abstract int getHealthMax()
107  	;
108 		    			
109  		/**
110          * 
111 			Amount of adrenaline at the start. Usually 0.
112 		 
113          */
114         public abstract double getAdrenalineStart()
115  	;
116 		    			
117  		/**
118          * 
119 			Maxium amount of the adrenaline. Usually 100 (this can trigger the combos).
120 		 
121          */
122         public abstract double getAdrenalineMax()
123  	;
124 		    			
125  		/**
126          * 
127 			Starting strength of the bot armor (usually 0).
128 		 
129          */
130         public abstract int getShieldStrengthStart()
131  	;
132 		    			
133  		/**
134          * 
135 			Maximum strength of the bot armor (usually 150).
136 		 
137          */
138         public abstract int getShieldStrengthMax()
139  	;
140 		    			
141  		/**
142          * 
143 			Maximum amount of succesing jumps. Currently limited to double jump in GB.
144 		 
145          */
146         public abstract int getMaxMultiJump()
147  	;
148 		    			
149  		/**
150          * 
151 			Damage scaling for this bot. (he will deal reduced damage depending on the setting).
152 		 
153          */
154         public abstract double getDamageScaling()
155  	;
156 		    			
157  		/**
158          * 
159 			Groundspeed of the bot (on the ground). Default 440.
160 		 
161          */
162         public abstract double getGroundSpeed()
163  	;
164 		    			
165  		/**
166          * 
167 			Waterspeed of the bot (in the water).
168 		 
169          */
170         public abstract double getWaterSpeed()
171  	;
172 		    			
173  		/**
174          * 
175 			AirSpeed of the bot (in the air).
176 		 
177          */
178         public abstract double getAirSpeed()
179  	;
180 		    			
181  		/**
182          * 
183 			Ladderspeed of the bot (on the ladder).
184 		 
185          */
186         public abstract double getLadderSpeed()
187  	;
188 		    			
189  		/**
190          * 
191 			Accelartion rate of this bot. How fast he accelerates.
192 		 
193          */
194         public abstract double getAccelRate()
195  	;
196 		    			
197  		/**
198          * 
199 			 Bot Jump's Z boost.
200 		 
201          */
202         public abstract double getJumpZ()
203  	;
204 		    			
205  		/**
206          * 
207 			Not used in GB.
208 		 
209          */
210         public abstract double getMultiJumpBoost()
211  	;
212 		    			
213  		/**
214          * 
215 			 Max fall speed of the bot.
216 		 
217          */
218         public abstract double getMaxFallSpeed()
219  	;
220 		    			
221  		/**
222          * 
223 			Dodge speed factor.
224 		 
225          */
226         public abstract double getDodgeSpeedFactor()
227  	;
228 		    			
229  		/**
230          * 
231 			Dodge jump Z boost of the bot. 
232 		 
233          */
234         public abstract double getDodgeSpeedZ()
235  	;
236 		    			
237  		/**
238          * 
239 			How well can be the bot controlled in the air (ranges from 0 to 1).
240 		 
241          */
242         public abstract double getAirControl()
243  	;
244 		    			
245     	
246     	public static class InitedMessageUpdate
247      extends GBObjectUpdate implements ICompositeWorldObjectUpdatedEvent, IGBWorldObjectEvent {	
248 			private InitedMessage object;
249 			private long time;
250 			private ITeamId teamId;
251 			
252 			public InitedMessageUpdate
253     (InitedMessage source, long eventTime, ITeamId teamId) {
254 				this.object = source;
255 				this.time = eventTime;
256 				this.teamId = teamId;
257 			}
258 			
259 			/**
260 			 * Simulation time in MILLI SECONDS !!!
261 			 */ 
262 			@Override
263 			public long getSimTime() {
264 				return time;
265 			}
266 	
267 			@Override
268 			public IWorldObject getObject() {
269 				return object;
270 			}
271 	
272 			@Override
273 			public WorldObjectId getId() {
274 				return object.getId();
275 			}
276 	
277 			@Override
278 			public ILocalWorldObjectUpdatedEvent getLocalEvent() {
279 				return new InitedMessageLocalImpl.InitedMessageLocalUpdate
280     ((InitedMessageLocal)object.getLocal(), time);
281 			}
282 	
283 			@Override
284 			public ISharedWorldObjectUpdatedEvent getSharedEvent() {
285 				return new InitedMessageSharedImpl.InitedMessageSharedUpdate
286     ((InitedMessageShared)object.getShared(), time, teamId);
287 			}
288 	
289 			@Override
290 			public IStaticWorldObjectUpdatedEvent getStaticEvent() {
291 				return new InitedMessageStaticImpl.InitedMessageStaticUpdate
292     ((InitedMessageStatic)object.getStatic(), time);
293 			}
294 			
295 		}
296     
297  		
298  	    public String toString() {
299             return
300             	super.toString() + "[" +
301             	
302 		              			"BotId = " + String.valueOf(getBotId()
303  	) + " | " + 
304 		              		
305 		              			"HealthStart = " + String.valueOf(getHealthStart()
306  	) + " | " + 
307 		              		
308 		              			"HealthFull = " + String.valueOf(getHealthFull()
309  	) + " | " + 
310 		              		
311 		              			"HealthMax = " + String.valueOf(getHealthMax()
312  	) + " | " + 
313 		              		
314 		              			"AdrenalineStart = " + String.valueOf(getAdrenalineStart()
315  	) + " | " + 
316 		              		
317 		              			"AdrenalineMax = " + String.valueOf(getAdrenalineMax()
318  	) + " | " + 
319 		              		
320 		              			"ShieldStrengthStart = " + String.valueOf(getShieldStrengthStart()
321  	) + " | " + 
322 		              		
323 		              			"ShieldStrengthMax = " + String.valueOf(getShieldStrengthMax()
324  	) + " | " + 
325 		              		
326 		              			"MaxMultiJump = " + String.valueOf(getMaxMultiJump()
327  	) + " | " + 
328 		              		
329 		              			"DamageScaling = " + String.valueOf(getDamageScaling()
330  	) + " | " + 
331 		              		
332 		              			"GroundSpeed = " + String.valueOf(getGroundSpeed()
333  	) + " | " + 
334 		              		
335 		              			"WaterSpeed = " + String.valueOf(getWaterSpeed()
336  	) + " | " + 
337 		              		
338 		              			"AirSpeed = " + String.valueOf(getAirSpeed()
339  	) + " | " + 
340 		              		
341 		              			"LadderSpeed = " + String.valueOf(getLadderSpeed()
342  	) + " | " + 
343 		              		
344 		              			"AccelRate = " + String.valueOf(getAccelRate()
345  	) + " | " + 
346 		              		
347 		              			"JumpZ = " + String.valueOf(getJumpZ()
348  	) + " | " + 
349 		              		
350 		              			"MultiJumpBoost = " + String.valueOf(getMultiJumpBoost()
351  	) + " | " + 
352 		              		
353 		              			"MaxFallSpeed = " + String.valueOf(getMaxFallSpeed()
354  	) + " | " + 
355 		              		
356 		              			"DodgeSpeedFactor = " + String.valueOf(getDodgeSpeedFactor()
357  	) + " | " + 
358 		              		
359 		              			"DodgeSpeedZ = " + String.valueOf(getDodgeSpeedZ()
360  	) + " | " + 
361 		              		
362 		              			"AirControl = " + String.valueOf(getAirControl()
363  	) + " | " + 
364 		              		
365 				"]";           		
366         }
367  	
368  		
369  		public String toHtmlString() {
370  			return super.toString() + "[<br/>" +
371             	
372 		              			"<b>BotId</b> = " + String.valueOf(getBotId()
373  	) + " <br/> " + 
374 		              		
375 		              			"<b>HealthStart</b> = " + String.valueOf(getHealthStart()
376  	) + " <br/> " + 
377 		              		
378 		              			"<b>HealthFull</b> = " + String.valueOf(getHealthFull()
379  	) + " <br/> " + 
380 		              		
381 		              			"<b>HealthMax</b> = " + String.valueOf(getHealthMax()
382  	) + " <br/> " + 
383 		              		
384 		              			"<b>AdrenalineStart</b> = " + String.valueOf(getAdrenalineStart()
385  	) + " <br/> " + 
386 		              		
387 		              			"<b>AdrenalineMax</b> = " + String.valueOf(getAdrenalineMax()
388  	) + " <br/> " + 
389 		              		
390 		              			"<b>ShieldStrengthStart</b> = " + String.valueOf(getShieldStrengthStart()
391  	) + " <br/> " + 
392 		              		
393 		              			"<b>ShieldStrengthMax</b> = " + String.valueOf(getShieldStrengthMax()
394  	) + " <br/> " + 
395 		              		
396 		              			"<b>MaxMultiJump</b> = " + String.valueOf(getMaxMultiJump()
397  	) + " <br/> " + 
398 		              		
399 		              			"<b>DamageScaling</b> = " + String.valueOf(getDamageScaling()
400  	) + " <br/> " + 
401 		              		
402 		              			"<b>GroundSpeed</b> = " + String.valueOf(getGroundSpeed()
403  	) + " <br/> " + 
404 		              		
405 		              			"<b>WaterSpeed</b> = " + String.valueOf(getWaterSpeed()
406  	) + " <br/> " + 
407 		              		
408 		              			"<b>AirSpeed</b> = " + String.valueOf(getAirSpeed()
409  	) + " <br/> " + 
410 		              		
411 		              			"<b>LadderSpeed</b> = " + String.valueOf(getLadderSpeed()
412  	) + " <br/> " + 
413 		              		
414 		              			"<b>AccelRate</b> = " + String.valueOf(getAccelRate()
415  	) + " <br/> " + 
416 		              		
417 		              			"<b>JumpZ</b> = " + String.valueOf(getJumpZ()
418  	) + " <br/> " + 
419 		              		
420 		              			"<b>MultiJumpBoost</b> = " + String.valueOf(getMultiJumpBoost()
421  	) + " <br/> " + 
422 		              		
423 		              			"<b>MaxFallSpeed</b> = " + String.valueOf(getMaxFallSpeed()
424  	) + " <br/> " + 
425 		              		
426 		              			"<b>DodgeSpeedFactor</b> = " + String.valueOf(getDodgeSpeedFactor()
427  	) + " <br/> " + 
428 		              		
429 		              			"<b>DodgeSpeedZ</b> = " + String.valueOf(getDodgeSpeedZ()
430  	) + " <br/> " + 
431 		              		
432 		              			"<b>AirControl</b> = " + String.valueOf(getAirControl()
433  	) + " <br/> " + 
434 		              		
435 				"<br/>]";     
436 		}
437  	 
438  	    public String toJsonLiteral() {
439             return "InitedMessage(null, "
440             		
441                    + ")";
442         }
443  	
444  		
445  		// --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
446         	
447 		// --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
448 		
449 	    // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=base+classtype[@name=abstract]) ---
450 	        
451 	    // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=base+classtype[@name=abstract]) ---        	            	
452  	
453 		}
454