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

Method UseSkill

src/game_party.cpp:438–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438bool Game_Party::UseSkill(int skill_id, Game_Actor* source, Game_Actor* target) {
439 bool was_used = false;
440
441 if (target) {
442 was_used = target->UseSkill(skill_id, source);
443 }
444 else {
445 std::vector<Game_Actor*> actors = GetActors();
446 std::vector<Game_Actor*>::iterator it;
447 for (it = actors.begin(); it != actors.end(); ++it) {
448 was_used |= (*it)->UseSkill(skill_id, source);
449 }
450 }
451
452 if (was_used) {
453 source->SetSp(source->GetSp() - source->CalculateSkillCost(skill_id));
454 source->SetHp(source->GetHp() - source->CalculateSkillHpCost(skill_id));
455 }
456
457 return was_used;
458}
459
460void Game_Party::AddActor(int actor_id) {
461 auto* actor = Main_Data::game_actors->GetActor(actor_id);

Callers 3

vUpdateMethod · 0.45
UpdateSkillMethod · 0.45
vUpdateMethod · 0.45

Calls 8

CalculateSkillHpCostMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
SetSpMethod · 0.45
GetSpMethod · 0.45
CalculateSkillCostMethod · 0.45
SetHpMethod · 0.45
GetHpMethod · 0.45

Tested by

no test coverage detected