File | Line |
---|
nl/tudelft/pogamut/ut2004/agent/module/shooting/weapon/AssaultRifleShooting.java | 49 |
nl/tudelft/pogamut/ut2004/agent/module/shooting/weapon/BioRifleShooting.java | 48 |
if (!(target instanceof Player)) {
shootTarget(target, facing, safe);
return;
}
Player player = (Player) target;
if (weaponPref.isPrimary()) {
shootPrimary(player, facing, safe);
} else {
shootSecondary(player, facing, safe);
}
}
/**
* Shoots primary mode at the target, if we are facing it. Secondary mode
* makes no sense. Will not blow a secondary charge if it is not safe to do
* so.
*
* @param target
* @param facing
*/
protected void shootTarget(ILocated target, boolean facing, boolean safe) {
if (facing && safe) {
shoot.shootPrimary(target);
} else if (!info.isSecondaryShooting()) {
shoot.stopShooting();
}
}
/**
* Starts shooting secondary mode.
*/
protected void chargeSecondary() {
shoot.shootSecondary();
}
/**
* Shoots a visible player we are facing with the primary mode, otherwise
* charges up using secondary.
*
* @param player
* @param facing
*/
protected void shootSecondary(Player player, boolean facing, boolean safe) {
// Use primary to shoot visible players.
// This will cause the first shot to be a charged shot.
if (player.isVisible() && facing && safe) {
shoot.shootPrimary(player); |
File | Line |
---|
nl/tudelft/pogamut/ut2004/agent/module/shooting/weapon/LigthningGunShooting.java | 34 |
nl/tudelft/pogamut/ut2004/agent/module/shooting/weapon/ReedeemerShooting.java | 30 |
public ReedeemerShooting(UT2004Bot<?, ?, ?> agent, AgentInfo info, ImprovedShooting shoot, Weaponry weaponry) {
super(agent, info, shoot, weaponry);
}
@Override
protected void shoot() {
// Wrong weapon, wait up.
if (!isWeaponReady()) {
return;
}
// No target, no shoot.
if (!hasTarget()) {
shoot.stopShooting();
return;
}
if (!(target instanceof Player)) {
shoot.shoot(target);
return;
}
Player player = (Player) target;
// Target not visible, hold fire.
if (!player.isVisible() || !FacingUtil.isFacing2D(info, target, FACING_ANGLE)) {
shoot.stopShooting();
} else {
shoot.shoot(target);
}
}
@Override
protected WeaponPref getDefaultWeaponPref() {
return DEFAULT_WEAPON_PREF;
}
} |
File | Line |
---|
nl/tudelft/pogamut/ut2004/agent/module/shooting/weapon/FlakCannonShooting.java | 41 |
nl/tudelft/pogamut/ut2004/agent/module/shooting/weapon/RocketLauncherShooting.java | 51 |
public RocketLauncherShooting(UT2004Bot<?, ?, ?> agent, AgentInfo info, ImprovedShooting shoot, Weaponry weaponry) {
super(agent, info, shoot, weaponry);
}
@Override
protected void shoot() {
// Wrong weapon, wait up.
if (!isWeaponReady()) {
return;
}
// No target, no shoot.
if (!hasTarget()) {
shoot.stopShooting();
return;
}
boolean facing = FacingUtil.isFacing2D(info, target, FACING_ANGLE);
boolean safeToShoot = isSafeToShoot(target);
if (!(target instanceof Player)) {
shootLocation(facing, safeToShoot);
return;
}
Player player = (Player) target;
// Target hidden, flush target out.
if (!player.isVisible() && info.isSecondaryShooting()) { |
File | Line |
---|
nl/tudelft/pogamut/ut2004/agent/module/shooting/weapon/AssaultRifleShooting.java | 20 |
nl/tudelft/pogamut/ut2004/agent/module/shooting/weapon/BioRifleShooting.java | 20 |
public BioRifleShooting(UT2004Bot<?, ?, ?> agent, AgentInfo info, ImprovedShooting shoot, Weaponry weaponry) {
super(agent, info, shoot, weaponry);
}
@Override
protected void shoot() {
// Wrong weapon, wait up.
if (!isWeaponReady()) {
return;
}
// Charge secondary.
if (!hasTarget() && weaponPref.isSecondary()) {
chargeSecondary();
return;
}
// No target, no shoot.
else if (!hasTarget()) {
shoot.stopShooting();
return;
}
boolean facing = FacingUtil.isFacing2D(info, target, FACING_ANGLE);
boolean close = info.getLocation().getDistance(target.getLocation()) < BIO_RIFLE_SPLASH_RADIUS; |