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

Function GetRandomSkillTarget

src/enemyai.cpp:104–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104static Game_Battler* GetRandomSkillTarget(Game_Party_Base& party, const lcf::rpg::Skill& skill, bool emulate_bugs) {
105 std::vector<Game_Battler*> battlers;
106 party.GetBattlers(battlers);
107 for (auto iter = battlers.begin(); iter != battlers.end();) {
108 if (IsSkillEffectiveOn(skill, **iter, emulate_bugs)) {
109 ++iter;
110 } else {
111 iter = battlers.erase(iter);
112 }
113 }
114 auto choice = Rand::GetRandomNumber(0, battlers.size() - 1);
115 return battlers[choice];
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);

Callers 1

MakeSkillActionFunction · 0.85

Calls 5

IsSkillEffectiveOnFunction · 0.85
GetBattlersMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected