View Javadoc

1   package nl.tudelft.goal.ut2004.agent;
2   
3   import java.util.HashMap;
4   
5   import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType;
6   
7   
8   public class WeaponDamage {
9   	
10  	private static HashMap<String, ItemType> damageToItem = new HashMap<String, ItemType>();
11  	
12  	static {
13  		add(ItemType.SNIPER_RIFLE, "XWeapons.DamTypeSniperHeadShot", "XWeapons.DamTypeSniperShot");
14  		add(ItemType.ROCKET_LAUNCHER, "XWeapons.DamTypeRocket", "XWeapons.DamTypeRocketHoming");
15  		add(ItemType.FLAK_CANNON, "XWeapons.DamTypeFlakShell", "XWeapons.DamTypeFlakChunk");
16  		add(ItemType.MINIGUN, "XWeapons.DamTypeMinigunAlt", "XWeapons.DamTypeMinigunBullet");
17  		add(ItemType.LINK_GUN, "XWeapons.DamTypeLinkShaft","XWeapons.DamTypeLinkPlasma");
18  		add(ItemType.SHOCK_RIFLE, "XWeapons.DamTypeShockCombo", "XWeapons.DamTypeShockBall", "XWeapons.DamTypeShockBeam");
19  		add(ItemType.BIO_RIFLE, "XWeapons.DamTypeBioGlob");
20  		add(ItemType.ASSAULT_RIFLE, "XWeapons.DamTypeAssaultBullet", "XWeapons.DamTypeAssaultGrenade");
21  		add(ItemType.SHIELD_GUN, "XWeapons.DamTypeShieldImpact");
22  	}
23  	
24  	
25  	private static void  add(ItemType weapon, String... damage){
26  		for(String d: damage){
27  			damageToItem.put(d, weapon);
28  		}
29  	}
30  
31  	public static ItemType weaponForDamage(String uDamage){
32  		return damageToItem.get(uDamage);
33  	}
34  	
35  }