| 170 | } |
| 171 | |
| 172 | bool Game_Actor::UseItem(int item_id, const Game_Battler* source) { |
| 173 | const lcf::rpg::Item* item = lcf::ReaderUtil::GetElement(lcf::Data::items, item_id); |
| 174 | if (!item) { |
| 175 | Output::Warning("UseItem: Can't use invalid item {}", item_id); |
| 176 | return false; |
| 177 | } |
| 178 | |
| 179 | if (!IsDead()) { |
| 180 | if (item->type == lcf::rpg::Item::Type_book) { |
| 181 | return LearnSkill(item->skill_id, nullptr); |
| 182 | } |
| 183 | |
| 184 | if (item->type == lcf::rpg::Item::Type_material) { |
| 185 | SetBaseMaxHp(GetBaseMaxHp() + item->max_hp_points); |
| 186 | SetBaseMaxSp(GetBaseMaxSp() + item->max_sp_points); |
| 187 | SetBaseAtk(GetBaseAtk() + item->atk_points2); |
| 188 | SetBaseDef(GetBaseDef() + item->def_points2); |
| 189 | SetBaseAgi(GetBaseAgi() + item->agi_points2); |
| 190 | SetBaseSpi(GetBaseSpi() + item->spi_points2); |
| 191 | |
| 192 | return true; |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | return Game_Battler::UseItem(item_id, source); |
| 197 | } |
| 198 | |
| 199 | bool Game_Actor::IsItemUsable(int item_id) const { |
| 200 | const lcf::rpg::Item* item = lcf::ReaderUtil::GetElement(lcf::Data::items, item_id); |