Beispiel #1
0
 @Override
 public void attack(GameObjectID attacker, int direction) throws BozorgExceptionBase {
   Player p = (Player) objects.get(attacker.getNumber());
   int w = map.getMap()[p.x][p.y].getWalls();
   if (p.getHp() == 0) throw new BozorgExceptionBase();
   if (direction < 0 || direction > 4) throw new BozorgExceptionBase();
   if ((w >> direction) % 2 == 1) throw new BozorgExceptionBase();
   if (p.getAttackTime() > 0) throw new BozorgExceptionBase();
   p.setAttackTime(p.getSpeed() + p.getAttackTime());
   p.setAttackDir(direction);
 }