示例#1
0
  public void playTurn(Party hostiles) {
    if (isDead()) return;
    Party targetParty;
    Output.getInstance().separator();
    Output.getInstance().warning(this + ", your turn has begun!");

    callItemMenu();
    int command = callAbilityMenu();
    Output.getInstance().separator();
    int target;
    if (_abilities.get(command).getAbilityType() == AbilityType.DEFENSIVE) targetParty = _party;
    else targetParty = hostiles;

    target = callTargetMenu(targetParty);
    while (targetParty.getParty().get(target).isDead()) {
      Output.getInstance().warning("You can't target a dead target!");
      target = callTargetMenu(targetParty);
    }

    _abilities.get(command).castAbility(targetParty.getParty().get(target));
  }
示例#2
0
 private int callTargetMenu(Party enemies) {
   Output.getInstance().info("List of avaiblable targets:");
   Output.getInstance().orderedList(enemies.getParty().toArray());
   Output.getInstance().prompt("Enter a number corresponding to the target chosen");
   return InputUtil.getInput(0, enemies.getParty().size() - 1);
 }