private void attack() { if (MyPlayer.interacting() == null && !MyPlayer.inCombat()) { Enemy.setNPC(MyPlayer.currentRoom().getNearestNpc(".*goblin geoman.*")); MyMovement.turnTo(Enemy.getNPC()); Enemy.interact("attack"); } }
@Override public int loop() { switch (getState()) { case EAT: MyPlayer.eat(); break; case ATTACK: attack(); break; } return Random.nextInt(500, 600); }
private State getState() { if (MyPlayer.needToEat() && MyPlayer.hasFood()) return State.EAT; else return State.ATTACK; }
@Override public boolean isValid() { return MyPlayer.currentRoom().getNearestNpc(".*goblin geoman.*") != null; }