Beispiel #1
0
/**
 * \brief Sets the level of the specified ability.
 * \param ability The ability to set.
 * \param level The level of this ability.
 */
void Equipment::set_ability(Ability ability, int level) {

  savegame.set_integer(get_ability_savegame_variable(ability), level);

  Game* game = get_game();
  if (game != nullptr) {
    if (ability == Ability::TUNIC ||
        ability == Ability::SWORD ||
        ability == Ability::SHIELD) {
      // The hero's sprites may depend on these abilities.
      game->get_hero()->rebuild_equipment();
    }
  }
}
Beispiel #2
0
/**
 * \brief Sets the level of the specified ability.
 * \param ability_name the ability to set
 * \param level the level of this ability
 */
void Equipment::set_ability(const std::string& ability_name, int level) {

  savegame.set_integer(get_ability_savegame_variable(ability_name), level);

  Game* game = get_game();
  if (game != NULL) {
    if (ability_name == "tunic" ||
        ability_name == "sword" ||
        ability_name == "shield") {
      // The hero's sprites depend on these abilities.
      game->get_hero().rebuild_equipment();
    }
  }
}
Beispiel #3
0
/**
 * \brief Returns the level of the specified ability.
 * \param ability The ability to get.
 * \return The level of this ability.
 */
int Equipment::get_ability(Ability ability) const {
  return savegame.get_integer(get_ability_savegame_variable(ability));
}
Beispiel #4
0
/**
 * \brief Returns the level of the specified ability.
 * \param ability_name the ability to get
 * \return the level of this ability
 */
int Equipment::get_ability(const std::string& ability_name) const {
  return savegame.get_integer(get_ability_savegame_variable(ability_name));
}