public void buildAbilityScores() {
    _abilityScore = _asGenerate.createAbilityList();

    _nimblePlayer.setDexterity(_abilityScore[5]);
    _nimblePlayer.setConstitution(_abilityScore[4]);
    _nimblePlayer.setStrength(_abilityScore[3]);
    _nimblePlayer.setIntelligence(_abilityScore[2]);
    _nimblePlayer.setCharisma(_abilityScore[1]);
    _nimblePlayer.setWisdom(_abilityScore[0]);
  }
Beispiel #2
0
  public void unequip(Character player) {
    for (int i = 0; i < player.getEquipped().length; i++) {
      if (player.getEquipped()[i] != null) {
        if (player.getEquipped()[i].getName() == this.getName()) {
          player.setEquippedItem(null, i);
          System.out.println(this.getName() + " unequipped");

          if (this.stat0 != null) {
            if (this.stat0.equals("health")) {
              player.setMaxHealth(player.getMaxHealth() - this.effect0);
            } else if (this.stat0.equals("mana")) {
              player.setMaxMana(player.getMaxMana() - this.effect0);
            } else if (this.stat0.equals("strength")) {
              player.setStrength(player.getStrength() - this.effect0);
            } else if (this.stat0.equals("defense")) {
              player.setDefense(player.getDefense() - this.effect0);
            } else if (this.stat0.equals("speed")) {
              player.setSpeed(player.getSpeed() - this.effect0);
            } else {
              System.out.println("Stat " + this.stat0 + " not found");
              return;
            }
            System.out.println(this.stat0 + " changed by " + this.effect0);
          }

          if (this.stat1 != null) {
            if (this.stat1.equals("health")) {
              player.setMaxHealth(player.getMaxHealth() - this.effect1);
            } else if (this.stat1.equals("mana")) {
              player.setMaxMana(player.getMaxMana() - this.effect1);
            } else if (this.stat1.equals("strength")) {
              player.setStrength(player.getStrength() - this.effect1);
            } else if (this.stat1.equals("defense")) {
              player.setDefense(player.getDefense() - this.effect1);
            } else if (this.stat1.equals("speed")) {
              player.setSpeed(player.getSpeed() - this.effect1);
            } else {
              System.out.println("Stat " + this.stat1 + " not found");
              return;
            }
            System.out.println(this.stat1 + " changed by " + this.effect1);
          }

          if (this.stat2 != null) {
            if (this.stat2.equals("health")) {
              player.setMaxHealth(player.getMaxHealth() - this.effect2);
            } else if (this.stat2.equals("mana")) {
              player.setMaxMana(player.getMaxMana() - this.effect2);
            } else if (this.stat2.equals("strength")) {
              player.setStrength(player.getStrength() - this.effect2);
            } else if (this.stat2.equals("defense")) {
              player.setDefense(player.getDefense() - this.effect2);
            } else if (this.stat2.equals("speed")) {
              player.setSpeed(player.getSpeed() - this.effect2);
            } else {
              System.out.println("Stat " + this.stat2 + " not found");
              return;
            }
            System.out.println(this.stat2 + " changed by " + this.effect2);
          }

          break;
        }
      }
    }
  }
Beispiel #3
0
  // -----------------------------------
  // Keep/remove equipment
  public void equip(Character player) {
    for (int i = 0; i < player.getChest().length; i++) {
      if (player.getChest()[i] != null) {
        if (!player.getChest()[i].getName().equals(this.name)
            && i == player.getChest().length - 1) {
          System.out.println("Error: Equipment not found");
          System.out.println();
          return;
        } else {
          break;
        }
      } else {
        if (i == player.getChest().length - 1) {
          System.out.println("Error: Chest Empty");
          System.out.println();
          return;
        }
      }
    }
    int slot = 0;
    if (this.getType().equals("weapon")) {
      slot = 0;
    } else if (this.getType().equals("head")) {
      slot = 1;
    } else if (this.getType().equals("chest")) {
      slot = 2;
    } else if (this.getType().equals("legs")) {
      slot = 3;
    } else if (this.getType().equals("boots")) {
      slot = 4;
    } else if (this.getType().equals("ring")) {
      slot = 5;
    } else if (this.getType().equals("amulet")) {
      slot = 6;
    } else {
      System.out.println("Error: Type not found");
      return;
    }

    if (player.getEquipped()[slot] != null) {
      player.getEquipped()[slot].unequip(player);
    }

    player.setEquippedItem(this, slot);
    System.out.println(this.getName() + " equipped");

    if (this.stat0 != null) {
      if (this.stat0.equals("health")) {
        player.setMaxHealth(player.getMaxHealth() + this.effect0);
      } else if (this.stat0.equals("mana")) {
        player.setMaxMana(player.getMaxMana() + this.effect0);
      } else if (this.stat0.equals("strength")) {
        player.setStrength(player.getStrength() + this.effect0);
      } else if (this.stat0.equals("defense")) {
        player.setDefense(player.getDefense() + this.effect0);
      } else if (this.stat0.equals("speed")) {
        player.setSpeed(player.getSpeed() + this.effect0);
      } else {
        System.out.println("Stat " + this.stat0 + " not found");
        return;
      }
      System.out.println(this.stat0 + " changed by " + this.effect0);
    }

    if (this.stat1 != null) {
      if (this.stat1.equals("health")) {
        player.setMaxHealth(player.getMaxHealth() + this.effect1);
      } else if (this.stat1.equals("mana")) {
        player.setMaxMana(player.getMaxMana() + this.effect1);
      } else if (this.stat1.equals("strength")) {
        player.setStrength(player.getStrength() + this.effect1);
      } else if (this.stat1.equals("defense")) {
        player.setDefense(player.getDefense() + this.effect1);
      } else if (this.stat1.equals("speed")) {
        player.setSpeed(player.getSpeed() + this.effect1);
      } else {
        System.out.println("Stat " + this.stat1 + " not found");
        return;
      }
      System.out.println(this.stat1 + " changed by " + this.effect1);
    }

    if (this.stat2 != null) {
      if (this.stat2.equals("health")) {
        player.setMaxHealth(player.getMaxHealth() + this.effect2);
      } else if (this.stat2.equals("mana")) {
        player.setMaxMana(player.getMaxMana() + this.effect2);
      } else if (this.stat2.equals("strength")) {
        player.setStrength(player.getStrength() + this.effect2);
      } else if (this.stat2.equals("defense")) {
        player.setDefense(player.getDefense() + this.effect2);
      } else if (this.stat2.equals("speed")) {
        player.setSpeed(player.getSpeed() + this.effect2);
      } else {
        System.out.println("Stat " + this.stat2 + " not found");
        return;
      }
      System.out.println(this.stat2 + " changed by " + this.effect2);
    }
    System.out.println();
  }