1 package nl.tudelft.pogamut.ut3.agent.module.shooting.weapon;
2
3 import cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Weaponry;
4 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.WeaponPref;
5 import cz.cuni.amis.pogamut.ut2004.bot.command.ImprovedShooting;
6 import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot;
7 import cz.cuni.amis.pogamut.ut3.communication.messages.UT3ItemType;
8 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentInfo;
9 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player;
10 import nl.tudelft.pogamut.unreal.agent.module.shooting.AbstractWeaponShooting;
11
12
13
14
15
16 public class SlowVolumeShooting extends AbstractWeaponShooting {
17
18 protected static final WeaponPref SLOWVOLUME_PRIMARY = new WeaponPref(UT3ItemType.SLOW_VOLUME, true);
19
20 public SlowVolumeShooting(UT2004Bot<?, ?, ?> agent, AgentInfo info, ImprovedShooting shoot, Weaponry weaponry) {
21 super(agent, info, shoot, weaponry);
22 }
23
24 @Override
25 protected void shoot() {
26
27 if (!isWeaponReady()) {
28 return;
29 }
30
31 if (!hasTarget()) {
32 shoot.stopShooting();
33 return;
34 }
35
36 if (!(target instanceof Player)) {
37 shoot.shoot(target);
38 return;
39 }
40
41 Player player = (Player) target;
42
43 if (!player.isVisible()) {
44 shoot.stopShooting();
45 } else {
46 shoot.shoot(weaponPref, target);
47 }
48 }
49
50 @Override
51 protected WeaponPref getDefaultWeaponPref() {
52 return SLOWVOLUME_PRIMARY;
53 }
54 }