package cats.rts.game; import java.io.Serializable; import java.util.LinkedList; public class Bullet implements Serializable, Cloneable{ public static final LinkedList ALL = new LinkedList(); static{ for(final BulletInfo b : BulletInfo.ALL) ALL.add(new Bullet(b)); } private BulletInfo info; private int speed; private int damage; public Bullet(final BulletInfo info){ this.info = info; this.speed = (info.getColor().getRed() / 118) + 1; this.damage = (BulletInfo.ALL.indexOf(info) / 5) + 1; } public Bullet(final Bullet bullet){ this(bullet.getInfo()); } public BulletInfo getInfo(){ return info; } public int getSpeed(){ return speed; } public int getDamage(){ return damage; } public Bullet clone(){ return new Bullet(this); } public String toString(){ return String.format("Speed: %d | Damage: %d | Info: %s", speed, damage, info); } }