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

Function MakeSkillAction

src/enemyai.cpp:118–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118static std::shared_ptr<Game_BattleAlgorithm::AlgorithmBase> MakeSkillAction(Game_Enemy& enemy, const lcf::rpg::EnemyAction& action, bool emulate_bugs) {
119 const auto* skill = lcf::ReaderUtil::GetElement(lcf::Data::skills, action.skill_id);
120 if (!skill) {
121 Output::Warning("EnemyAi::MakeSkillAction: Enemy can't use invalid skill {}", action.skill_id);
122 return nullptr;
123 }
124
125 switch (skill->scope) {
126 case lcf::rpg::Skill::Scope_enemy:
127 return std::make_shared<Game_BattleAlgorithm::Skill>(&enemy, Main_Data::game_party->GetRandomActiveBattler(), *skill);
128 case lcf::rpg::Skill::Scope_ally:
129 return std::make_shared<Game_BattleAlgorithm::Skill>(&enemy, GetRandomSkillTarget(*Main_Data::game_enemyparty, *skill, emulate_bugs), *skill);
130 case lcf::rpg::Skill::Scope_enemies:
131 return std::make_shared<Game_BattleAlgorithm::Skill>(&enemy, Main_Data::game_party.get(), *skill);
132 case lcf::rpg::Skill::Scope_self:
133 return std::make_shared<Game_BattleAlgorithm::Skill>(&enemy, &enemy, *skill);
134 case lcf::rpg::Skill::Scope_party:
135 return std::make_shared<Game_BattleAlgorithm::Skill>(&enemy, Main_Data::game_enemyparty.get(), *skill);
136 }
137 return nullptr;
138}
139
140static std::shared_ptr<Game_BattleAlgorithm::AlgorithmBase> MakeAction(Game_Enemy& enemy, const lcf::rpg::EnemyAction& action, bool emulate_bugs) {
141 switch (action.kind) {

Callers 1

MakeActionFunction · 0.85

Calls 3

GetRandomSkillTargetFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected