CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

FileLine
nl/tudelft/pogamut/ut3/agent/module/shooting/weapon/RedeemerShooting.java30
nl/tudelft/pogamut/ut3/agent/module/shooting/weapon/SniperRifleShooting.java35
    public SniperRifleShooting(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;
    }
}
FileLine
nl/tudelft/pogamut/ut3/agent/module/shooting/weapon/EnforcerShooting.java16
nl/tudelft/pogamut/ut3/agent/module/shooting/weapon/StingerMinigunShooting.java17
    public StingerMinigunShooting(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.
        // Keep firing even if not facing, gives time to spin up minigun.
        if (!player.isVisible()) {
            shoot.stopShooting();            
        } else {
            shoot.shoot(weaponPref, target);
        }
    }

    @Override
    protected WeaponPref getDefaultWeaponPref() {
        return STINGER_MINIGUN_PRIMARY;
FileLine
nl/tudelft/pogamut/ut3/agent/module/shooting/weapon/FlakCannonShooting.java38
nl/tudelft/pogamut/ut3/agent/module/shooting/weapon/RocketLauncherShooting.java46
    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()) {