public static boolean canAttackIgnoreRange(Tower t, NPC n) { if (n.isUntargetable()) return false; if (!t.isShootingAir() && n.isFlying()) return false; if (!t.isShootingGround() && !n.isFlying()) return false; return true; }
public static boolean canAttack(Tower t, NPC n) { if (n.isUntargetable()) return false; if (!t.isShootingAir() && n.isFlying()) return false; if (!t.isShootingGround() && !n.isFlying()) return false; if (getDistance(t.getX(), t.getY(), n.getX(), n.getY()) > t.getRange() * Main.instance.getGame().getTileWidth()) return false; return true; }
public Tower upgradeTo(TowerType t) { if (m.getGame().getMoney() >= t.getCost()) { m.getGame().setMoney(m.getGame().getMoney() - t.getCost()); Tower t2 = m.getGame().createTower(t); t2.setX(getX()); t2.setY(getY()); destroy(); return t2; } else { m.getGame().setStatus("Not enough money!"); m.setNewEvent( new Event(m, 2000, 1) { public void run(int delta) { m.getGame().setStatus("", "Not enough money!"); } }); } return null; }
public void copyFromTower(Tower t) { setAnimationPreAttack(t.getAnimationPreAttack()); setAnimationPreAttackDuration(t.getAnimationPreAttackDuration()); setAnimationPostAttack(t.getAnimationPostAttack()); setAnimationPostAttackDuration(t.getAnimationPostAttackDuration()); setAnimationStand(t.getAnimationStand()); setAnimationStandDuration(t.getAnimationStandDuration()); setAttackSpeed(t.getAttackSpeed()); setDamage(t.getDamage()); setProjectileAnimationDeath(t.getProjectileAnimationDeath()); setProjectileAnimationStand(t.getProjectileAnimationStand()); setProjectileAnimationDeathDuration(t.getProjectileAnimationDeathDuration()); setProjectileAnimationStandDuration(t.getProjectileAnimationStandDuration()); setProjectileSpeed(t.getProjectileSpeed()); setRange(t.getRange()); setShootingAir(t.isShootingAir()); setShootingGround(t.isShootingGround()); }