@Override public boolean collidesWithListener(Upgrade upgrade) { if ((Math.abs(upgrade.getPosX() - this.posX) < 50) && (Math.abs(upgrade.getPosY() - this.posY) < 50)) { return true; } return false; }
public void grantItems(Arena arena, Player p, String className) { List<Upgrade> list = upgrades.get(className); if (list == null) return; if (giveAll) { for (Upgrade upgrade : list) { upgrade.upgrade(arena, p); } } else { int index = new Random().nextInt(list.size()); list.get(index).upgrade(arena, p); } }
public void upgradeDatabase(SqlExecutor executor, int oldVersion, int newVersion) throws Exception { Upgrade[] upgrades = contentProviderAnnotation.upgrades(); for (Upgrade upgrade : upgrades) { if (upgrade.version() <= oldVersion || upgrade.version() > newVersion) { continue; } for (String sql : upgrade.SQLs()) { try { System.out.println("SORMA" + "\t" + "execute update " + sql); executor.execute(sql); } catch (Exception e) { throw new SormaException(e); } } } }
/** * Handles the upgrade given by the giveUpgrade function * * @param upgrade */ private void handleUpgrades(Upgrade upgrade) { Color tmpColor = upgrade.getColor(); if ((tmpColor == Color.pink) && !maxBombs_used) { if (maxbombs < 4) { maxbombs++; maxBombs_used = true; } } if ((tmpColor == Color.blue) && !bombRadius_used) { if (bombradius < 3) { bombradius++; bombRadius_used = true; } } if (tmpColor == Color.cyan) { if (!shieldEqu) { shieldEqu = true; } } if (tmpColor == Color.magenta) { bombRemote = true; } if (tmpColor == Color.lightGray) { if (!immortal) { immortal = true; shieldProtection = false; animation.setCurrentAnimation("playerDown_immortal"); immortalStartTime = System.nanoTime(); } } if (maxBombs_used) { if (tmpColor == Color.pink) { maxBombs_used = false; } } if (bombRadius_used) { if (tmpColor == Color.blue) { bombRadius_used = false; } } }
@Override public void giveUpgrade(Upgrade upgrade) { handleUpgrades(upgrade); upgrade.setDestroyed(true); }