bool Game_Actor::UseItem(int item_id, const Game_Battler* source) { const RPG::Item* item = ReaderUtil::GetElement(Data::items, item_id); if (!item) { Output::Warning("UseItem: Can't use invalid item %d", item_id); return false; } if (IsDead() && item->type != RPG::Item::Type_medicine) { return false; } if (item->type == RPG::Item::Type_book) { return LearnSkill(item->skill_id); } if (item->type == RPG::Item::Type_material) { SetBaseMaxHp(GetBaseMaxHp() + item->max_hp_points); SetBaseMaxSp(GetBaseMaxSp() + item->max_sp_points); SetBaseAtk(GetBaseAtk() + item->atk_points2); SetBaseDef(GetBaseDef() + item->def_points2); SetBaseAgi(GetBaseAgi() + item->agi_points2); SetBaseSpi(GetBaseSpi() + item->spi_points2); return true; } return Game_Battler::UseItem(item_id, source); }
int Game_Battler::GetMaxHp() const { return GetBaseMaxHp(); }
void Game_Actor::SetBaseMaxHp(int maxhp) { data.hp_mod += maxhp - GetBaseMaxHp(); SetHp(data.current_hp); }
int Game_Actor::GetBaseMaxHp() const { return GetBaseMaxHp(true); }
void Game_Actor::SetBaseMaxHp(int maxhp) { int new_hp_mod = GetData().hp_mod + (maxhp - GetBaseMaxHp()); GetData().hp_mod = new_hp_mod; SetHp(GetData().current_hp); }