import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * FasterGuns: Increase firing speed of guns, up to a maximum of 1 missile every 5 turns. * * @author Jannis Andrija Schnitzer, Martin Schend * @version 2011-01-20 */ public class FasterGuns extends Collectible { public void act() { super.act(); } /** * Iterate through the ship's guns, speeding them up one by one. */ public boolean hit(ManuallyControlledSpaceship ship) { int n_guns = ship.getNumberOfGuns(); for (int i = 0; i < n_guns; i++) { int old_recovery = ship.guns[i].getRecovery(); int recovery; if (old_recovery - 1 < 5) recovery = 5; else if (old_recovery > 13) recovery = old_recovery - 2; else recovery = old_recovery - 1; ship.guns[i].setRecovery(recovery); } return false; } }