@Override public void updateInfo(GameObjectID id, String infoKey, Integer infoValue) throws BozorgExceptionBase { if (objects.get(id.getNumber()).getClass().equals(Fan.class)) { Fan f = (Fan) objects.get(id.getNumber()); if (infoKey.equals(JudgeAbstract.ROW)) f.x = infoValue; if (infoKey.equals(JudgeAbstract.COL)) f.y = infoValue; if (infoKey.equals(JudgeAbstract.OWNER)) for (Player p : players) if (p.getName() == infoValue) f.owner = p; if (infoKey.equals(JudgeAbstract.IS_ALIVE)) if (infoValue == JudgeAbstract.ALIVE) f.isAlive = true; else f.isAlive = false; } if (objects.get(id.getNumber()).getClass().equals(Player.class)) { Player p = (Player) objects.get(id.getNumber()); if (infoKey.equals(JudgeAbstract.ROW)) p.x = infoValue; if (infoKey.equals(JudgeAbstract.COL)) p.y = infoValue; if (infoKey.equals(JudgeAbstract.IS_ALIVE)) if (infoValue == JudgeAbstract.ALIVE) if (p.getHp() == 0) p.setHp(100); if (infoKey.equals(JudgeAbstract.SPEED)) p.setSpeed(infoValue); if (infoKey.equals(JudgeAbstract.NAME)) p.setName(infoValue); if (infoKey.equals(JudgeAbstract.POWER)) p.setPower(infoValue); if (infoKey.equals(JudgeAbstract.VISION)) p.setVision(infoValue); if (infoKey.equals(JudgeAbstract.FANS)) p.setFans(infoValue); } }
@Override public void getGift(GameObjectID player) throws BozorgExceptionBase { Player p = (Player) objects.get(player.getNumber()); if (p.getHp() == 0) throw new BozorgExceptionBase(); if (getMapCellType(p.x, p.y, player) != BONUS_CELL) throw new BozorgExceptionBase(); for (Player x : Judge.players) { if (x.equals(p)) continue; if (x.x == p.x && x.y == p.y) throw new BozorgExceptionBase(); } int t = map.getMap()[p.x][p.y].getType(); if (t == JUMP_CELL) { p.setJump(p.getJump() + 2000); } if (t == SPEEDUP_CELL) { p.setSpeed(p.getSpeed() + 5000); } if (t == STONE_CELL) { p.setStun(p.getStun() + 3000); } if (t == FAN_CELL) { p.setFans(p.getFans() + 3); } if (t == RADAR_CELL) { p.setVision(p.getVision() + 3000); } if (t == HOSPITAL_CELL) { p.setHp(Math.min(p.getHp() + 20, 100)); } map.getMap()[p.x][p.y].setType(0); }