Пример #1
0
 private void checkLevelUp() {
   if (_experience >= _levelExp * _currentLevel) {
     _currentLevel += 1;
     _experience = 0;
     Output.getInstance().separator();
     Output.getInstance().printlnMessage("\t\t**********");
     Output.getInstance().warning("LEVEL UP!!! " + _name + " YOU ARE NOW LEVEL " + _currentLevel);
     Output.getInstance().printlnMessage("\t\t**********");
     Output.getInstance().separator();
     _stats.add(playerStatsCreator.createStats(_type, POINTS_ON_LEVEL_UP));
     PlayerCharacterCreator playerCharacterCreator = new PlayerCharacterCreator();
     learnAbility(playerCharacterCreator.getAbility(_type, this));
   }
 }
Пример #2
0
 private void callItemMenu() {
   Output.getInstance().prompt("Would you like to use or equip an item? 1 for YES, 0 for NO.");
   int input = InputUtil.getInput(0, 1);
   if (input == 1) {
     printInventory();
     pickItem();
   }
 }
Пример #3
0
  private void pickItem() {
    Output.getInstance()
        .prompt(
            "Enter a number corresponding to the item of your choosing, type -1 to pick nothing.");
    int itemPicked = InputUtil.getInput(-1, _inventory.size() - 1);
    if (itemPicked == -1) return;
    Item pick = _inventory.get(itemPicked);

    if (pick.isEquipable()) equipItem((Equipment) pick);
    else useConsumable((UsableItem) pick);
  }
Пример #4
0
 @Override
 protected void applyAbility(ArrayList<CharacterEntity> targets) {
   double damage = _master.getStats().getIntelligence().getValue() * _scaling;
   damage += _baseValue + _perLevel * _level;
   for (CharacterEntity character : targets) {
     if (character.isDead()) continue;
     Output.getInstance()
         .info(_master.getName() + " casts " + _name + " on " + character.getName());
     character.inflictDamage(damage);
   }
 }
Пример #5
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));
  }
Пример #6
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);
 }
Пример #7
0
 private int callAbilityMenu() {
   Output.getInstance().info("List of avaiblable abilities:");
   Output.getInstance().orderedList(_abilities.toArray());
   Output.getInstance().prompt("Enter a number corresponding to the ability chosen");
   return InputUtil.getInput(0, _abilities.size() - 1);
 }
Пример #8
0
 private void printInventory() {
   Output.getInstance().orderedList(_inventory.toArray());
 }
Пример #9
0
 public void assignToInventory(Item obj) {
   _inventory.add(obj);
   _currentInventorySize++;
   Output.getInstance().info(obj.getName() + " was added to your inventory.");
   Output.getInstance().separator();
 }