View Javadoc

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. Bot hurt another player. Hit them with a
35  		shot.
36  	
37                            Corresponding GameBots message is
38                            HIT.
39                        
40               */
41              
42              public class
43              PlayerDamaged
44                      extends GBEvent
45                  
46  	            	implements IWorldEvent, IWorldChangeEvent
47  
48              {
49              
50              /**
51                Creates new instance of command PlayerDamaged.
52                
53  		Asynchronous message. Bot hurt another player. Hit them with a
54  		shot.
55  	Corresponding GameBots message for this command is
56                .
57                    @param Id Unique Id of the player hit.
58                    @param Damage Amount of damage done.
59                    @param DamageType 
60  			A string describing what kind of damage.
61  		
62                    @param WeaponName 
63  			Name of the weapon that caused this damage.
64  		
65                    @param Flaming 
66  			If this damage is causing our bot to burn. TODO
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.
76  		
77                */
78               public PlayerDamaged(
79                  UnrealId Id,  int Damage,  String DamageType,  String WeaponName,  boolean Flaming,  boolean DirectDamage,  boolean BulletHit,  boolean VehicleHit) {
80                      
81                      this.Id = Id;
82                  
83                      this.Damage = Damage;
84                  
85                      this.DamageType = DamageType;
86                  
87                      this.WeaponName = WeaponName;
88                  
89                      this.Flaming = Flaming;
90                  
91                      this.DirectDamage = DirectDamage;
92                  
93                      this.BulletHit = BulletHit;
94                  
95                      this.VehicleHit = VehicleHit;
96                  
97                  }
98  
99              
100     	/** Example how the message looks like - used during parser tests. */
101     	public static final String PROTOTYPE =
102     		"HIT {Id unreal_id} {Damage 0} {DamageType text} {WeaponName text} {Flaming False} {DirectDamage False} {BulletHit False} {VehicleHit False}";
103     
104 
105             /////// Properties BEGIN
106             
107         /**
108         Unique Id of the player hit. */
109         protected
110          UnrealId Id =
111         	null;
112 
113         
114         /**
115         Unique Id of the player hit. */
116         public
117         UnrealId getId() {
118             return
119          Id;
120         }
121         
122 
123         
124         /**
125         Amount of damage done. */
126         protected
127          int Damage =
128         	0;
129 
130         
131         /**
132         Amount of damage done. */
133         public
134         int getDamage() {
135             return
136          Damage;
137         }
138         
139 
140         
141         /**
142         
143 			A string describing what kind of damage.
144 		 */
145         protected
146          String DamageType =
147         	null;
148 
149         
150         /**
151         
152 			A string describing what kind of damage.
153 		 */
154         public
155         String getDamageType() {
156             return
157          DamageType;
158         }
159         
160 
161         
162         /**
163         
164 			Name of the weapon that caused this damage.
165 		 */
166         protected
167          String WeaponName =
168         	null;
169 
170         
171         /**
172         
173 			Name of the weapon that caused this damage.
174 		 */
175         public
176         String getWeaponName() {
177             return
178          WeaponName;
179         }
180         
181 
182         
183         /**
184         
185 			If this damage is causing our bot to burn. TODO
186 		 */
187         protected
188          boolean Flaming =
189         	false;
190 
191         
192         /**
193         
194 			If this damage is causing our bot to burn. TODO
195 		 */
196         public
197         boolean isFlaming() {
198             return
199          Flaming;
200         }
201         
202 
203         
204         /**
205         
206 			If the damage is direct. TODO
207 		 */
208         protected
209          boolean DirectDamage =
210         	false;
211 
212         
213         /**
214         
215 			If the damage is direct. TODO
216 		 */
217         public
218         boolean isDirectDamage() {
219             return
220          DirectDamage;
221         }
222         
223 
224         
225         /**
226         
227 			If this damage was caused by bullet.
228 		 */
229         protected
230          boolean BulletHit =
231         	false;
232 
233         
234         /**
235         
236 			If this damage was caused by bullet.
237 		 */
238         public
239         boolean isBulletHit() {
240             return
241          BulletHit;
242         }
243         
244 
245         
246         /**
247         
248 			If this damage was caused by vehicle running over.
249 		 */
250         protected
251          boolean VehicleHit =
252         	false;
253 
254         
255         /**
256         
257 			If this damage was caused by vehicle running over.
258 		 */
259         public
260         boolean isVehicleHit() {
261             return
262          VehicleHit;
263         }
264         
265 
266         
267             /////// Properties END
268 
269             /////// Extra Java code BEGIN
270 
271             	/////// Additional code from xslt BEGIN
272             		
273        					public long getSimTime() {
274        						// NOT IMPLEMENTED FOR UDK
275        						return 0;
276        					}
277             		
278 
279 
280             	/////// Additional code from xslt END
281 
282 	            /////// Extra Java from XML BEGIN
283             		
284             	/////// Extra Java from XML END
285 
286             /////// Extra Java code END
287 
288             
289 
290             /**
291               * Cloning constructor.
292               */
293              public PlayerDamaged(PlayerDamaged original) {
294                 
295                      this.Id=original.Id;
296                 
297                      this.Damage=original.Damage;
298                 
299                      this.DamageType=original.DamageType;
300                 
301                      this.WeaponName=original.WeaponName;
302                 
303                      this.Flaming=original.Flaming;
304                 
305                      this.DirectDamage=original.DirectDamage;
306                 
307                      this.BulletHit=original.BulletHit;
308                 
309                      this.VehicleHit=original.VehicleHit;
310                 
311              }
312 
313              
314                  /**
315                   * Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
316                   */
317 	             public PlayerDamaged() {
318 	             }
319              
320 
321                  
322             public String toString() {
323                 return
324                 
325                 		super.toString() + " | " +
326                 		
327 				               "Id = " +
328 				               String.valueOf(Id) + " | " +
329 				            
330 				               "Damage = " +
331 				               String.valueOf(Damage) + " | " +
332 				            
333 				               "DamageType = " +
334 				               String.valueOf(DamageType) + " | " +
335 				            
336 				               "WeaponName = " +
337 				               String.valueOf(WeaponName) + " | " +
338 				            
339 				               "Flaming = " +
340 				               String.valueOf(Flaming) + " | " +
341 				            
342 				               "DirectDamage = " +
343 				               String.valueOf(DirectDamage) + " | " +
344 				            
345 				               "BulletHit = " +
346 				               String.valueOf(BulletHit) + " | " +
347 				            
348 				               "VehicleHit = " +
349 				               String.valueOf(VehicleHit) + " | " +
350 				             "";
351                 	
352              }
353 
354              public String toHtmlString() {
355                 return super.toString() +
356             
357             "<b>Id</b> : " +
358             String.valueOf(Id) +
359             " <br/> " +
360             
361             "<b>Damage</b> : " +
362             String.valueOf(Damage) +
363             " <br/> " +
364             
365             "<b>DamageType</b> : " +
366             String.valueOf(DamageType) +
367             " <br/> " +
368             
369             "<b>WeaponName</b> : " +
370             String.valueOf(WeaponName) +
371             " <br/> " +
372             
373             "<b>Flaming</b> : " +
374             String.valueOf(Flaming) +
375             " <br/> " +
376             
377             "<b>DirectDamage</b> : " +
378             String.valueOf(DirectDamage) +
379             " <br/> " +
380             
381             "<b>BulletHit</b> : " +
382             String.valueOf(BulletHit) +
383             " <br/> " +
384             
385             "<b>VehicleHit</b> : " +
386             String.valueOf(VehicleHit) +
387             " <br/> " +
388              "";
389              }
390 
391              
392              
393              }
394 
395