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

Method ActionIsPossible

src/game_battlealgorithm.cpp:1303–1319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1301}
1302
1303bool Game_BattleAlgorithm::Skill::ActionIsPossible() const {
1304 auto* source = GetSource();
1305 if (item) {
1306 return Main_Data::game_party->GetItemTotalCount(item->ID) > 0;
1307 }
1308 if (!source->IsSkillUsable(skill.ID)) {
1309 return false;
1310 }
1311 // RPG_RT performs this check only for enemies and if skill is single target
1312 const auto* target = GetOriginalSingleTarget();
1313 if (source->GetType() == Game_Battler::Type_Enemy && target && target->GetType() == source->GetType()) {
1314 if (!EnemyAi::IsSkillEffectiveOn(skill, *target, true)) {
1315 return false;
1316 }
1317 }
1318 return true;
1319}
1320
1321Game_BattleAlgorithm::Item::Item(Game_Battler* source, Game_Battler* target, const lcf::rpg::Item& item) :
1322 AlgorithmBase(Type::Item, source, target), item(item) {

Callers

nothing calls this directly

Calls 4

IsSkillEffectiveOnFunction · 0.85
GetItemTotalCountMethod · 0.80
IsSkillUsableMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected