MCPcopy Create free account
hub / github.com/EasyRPG/Player / UpdateSkill

Method UpdateSkill

src/scene_actortarget.cpp:153–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153void Scene_ActorTarget::UpdateSkill() {
154 if (Input::IsTriggered(Input::DECISION)) {
155 Game_Actor* actor = &(*Main_Data::game_party)[actor_index];
156
157 if (actor->GetSp() < actor->CalculateSkillCost(id) || actor->GetHp() <= actor->CalculateSkillHpCost(id)) {
158 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Buzzer));
159 return;
160 }
161 if (Main_Data::game_party->UseSkill(id, actor, target_window->GetActor())) {
162 lcf::rpg::Skill* skill = lcf::ReaderUtil::GetElement(lcf::Data::skills, id);
163 lcf::rpg::Animation* animation = lcf::ReaderUtil::GetElement(lcf::Data::animations, skill->animation_id);
164 if (animation) {
165 Main_Data::game_system->SePlay(*animation);
166 }
167 else {
168 Output::Warning("UpdateSkill: Skill {} references invalid animation {}", id, skill->animation_id);
169 }
170 }
171 else {
172 Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Buzzer));
173 }
174
175 status_window->Refresh();
176 target_window->Refresh();
177 }
178}

Callers

nothing calls this directly

Calls 8

CalculateSkillHpCostMethod · 0.80
SePlayMethod · 0.80
GetSpMethod · 0.45
CalculateSkillCostMethod · 0.45
GetHpMethod · 0.45
UseSkillMethod · 0.45
GetActorMethod · 0.45
RefreshMethod · 0.45

Tested by

no test coverage detected