| 116 | } |
| 117 | |
| 118 | static 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 | |
| 140 | static std::shared_ptr<Game_BattleAlgorithm::AlgorithmBase> MakeAction(Game_Enemy& enemy, const lcf::rpg::EnemyAction& action, bool emulate_bugs) { |
| 141 | switch (action.kind) { |
no test coverage detected