| 111 | } |
| 112 | |
| 113 | void Scene_ActorTarget::UpdateItem() { |
| 114 | if (Input::IsTriggered(Input::DECISION)) { |
| 115 | if (Main_Data::game_party->GetItemCount(id) <= 0) { |
| 116 | Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Buzzer)); |
| 117 | return; |
| 118 | } |
| 119 | if (Main_Data::game_party->UseItem(id, target_window->GetActor())) { |
| 120 | auto* item = lcf::ReaderUtil::GetElement(lcf::Data::items, id); |
| 121 | assert(item); |
| 122 | |
| 123 | bool do_skill = (item->type == lcf::rpg::Item::Type_special) |
| 124 | || (item->use_skill && ( |
| 125 | item->type == lcf::rpg::Item::Type_weapon |
| 126 | || item->type == lcf::rpg::Item::Type_shield |
| 127 | || item->type == lcf::rpg::Item::Type_armor |
| 128 | || item->type == lcf::rpg::Item::Type_helmet |
| 129 | || item->type == lcf::rpg::Item::Type_accessory |
| 130 | ) |
| 131 | ); |
| 132 | |
| 133 | if (do_skill) { |
| 134 | auto* skill = lcf::ReaderUtil::GetElement(lcf::Data::skills, item->skill_id); |
| 135 | assert(skill); |
| 136 | auto* animation = lcf::ReaderUtil::GetElement(lcf::Data::animations, skill->animation_id); |
| 137 | if (animation) { |
| 138 | Main_Data::game_system->SePlay(*animation); |
| 139 | } |
| 140 | } else { |
| 141 | Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_UseItem)); |
| 142 | } |
| 143 | } |
| 144 | else { |
| 145 | Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Buzzer)); |
| 146 | } |
| 147 | |
| 148 | status_window->Refresh(); |
| 149 | target_window->Refresh(); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | void Scene_ActorTarget::UpdateSkill() { |
| 154 | if (Input::IsTriggered(Input::DECISION)) { |
nothing calls this directly
no test coverage detected