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

Method SelectNextActor

src/scene_battle_rpg2k.cpp:1736–1797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1734}
1735
1736void Scene_Battle_Rpg2k::SelectNextActor(bool auto_battle) {
1737 std::vector<Game_Actor*> allies = Main_Data::game_party->GetActors();
1738
1739 if ((size_t)actor_index == allies.size()) {
1740 // All actor actions decided, player turn ends
1741 SetState(State_Battle);
1742 NextTurn();
1743
1744 CreateEnemyActions();
1745 CreateExecutionOrder();
1746
1747 return;
1748 }
1749
1750 active_actor = allies[actor_index];
1751 status_window->SetIndex(actor_index);
1752 actor_index++;
1753
1754 Game_Battler* random_target = NULL;
1755
1756 if (!active_actor->CanAct()) {
1757 active_actor->SetBattleAlgorithm(std::make_shared<Game_BattleAlgorithm::None>(active_actor));
1758 battle_actions.push_back(active_actor);
1759 SelectNextActor(auto_battle);
1760 return;
1761 }
1762
1763 switch (active_actor->GetSignificantRestriction()) {
1764 case lcf::rpg::State::Restriction_attack_ally:
1765 random_target = Main_Data::game_party->GetRandomActiveBattler();
1766 break;
1767 case lcf::rpg::State::Restriction_attack_enemy:
1768 random_target = Main_Data::game_enemyparty->GetRandomActiveBattler();
1769 break;
1770 default:
1771 break;
1772 }
1773
1774 if (random_target) {
1775 // RPG_RT doesn't support "Attack All" weapons when battler is confused or provoked.
1776 active_actor->SetBattleAlgorithm(std::make_shared<Game_BattleAlgorithm::Normal>(active_actor, random_target));
1777 battle_actions.push_back(active_actor);
1778
1779 SelectNextActor(auto_battle);
1780 return;
1781 }
1782
1783 if (auto_battle || active_actor->GetAutoBattle()) {
1784 if (active_actor->GetActorAi() == -1) {
1785 this->autobattle_algos[default_autobattle_algo]->SetAutoBattleAction(*active_actor);
1786 } else {
1787 this->autobattle_algos[active_actor->GetActorAi()]->SetAutoBattleAction(*active_actor);
1788 }
1789 assert(active_actor->GetBattleAlgorithm() != nullptr);
1790 battle_actions.push_back(active_actor);
1791
1792 SelectNextActor(auto_battle);
1793 return;

Callers

nothing calls this directly

Calls 11

CanActMethod · 0.80
SetBattleAlgorithmMethod · 0.80
GetAutoBattleMethod · 0.80
GetActorAiMethod · 0.80
SetAutoBattleActionMethod · 0.80
GetBattleAlgorithmMethod · 0.80
GetActorsMethod · 0.45
sizeMethod · 0.45
SetIndexMethod · 0.45

Tested by

no test coverage detected