Skip to content

Commit

Permalink
Highest level actor logic requires can act
Browse files Browse the repository at this point in the history
  • Loading branch information
fmatthew5876 committed Dec 6, 2018
1 parent 83e4626 commit b436171
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/game_battler.cpp
Expand Up @@ -297,7 +297,7 @@ bool Game_Battler::UseItem(int item_id) {
if (skill != nullptr) {
Game_Battler* source = this;
if (skill->scope != RPG::Skill::Scope_self) {
source = Main_Data::game_party->GetHighestLeveledActor();
source = Main_Data::game_party->GetHighestLeveledActorWhoCanAct();
}
UseSkill(item->skill_id, source);
}
Expand Down
4 changes: 2 additions & 2 deletions src/game_party.cpp
Expand Up @@ -632,11 +632,11 @@ bool Game_Party::IsAnyControllable() {
return false;
}

Game_Actor* Game_Party::GetHighestLeveledActor() const {
Game_Actor* Game_Party::GetHighestLeveledActorWhoCanAct() const {
Game_Actor* best = nullptr;

for (auto* actor : GetActors()) {
if (best == nullptr || best->GetLevel() < actor->GetLevel()) {
if (actor->CanAct() && (best == nullptr || best->GetLevel() < actor->GetLevel())) {
best = actor;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/game_party.h
Expand Up @@ -342,11 +342,11 @@ class Game_Party : public Game_Party_Base {
bool IsAnyControllable();

/**
* Gets the actor with the highest level. If there are many, choose the one with the earliest position in the group.
* Gets the actor with the highest level who can act. If there are many, choose the one with the earliest position in the group.
*
* @return The first Highest leveled actor.
* @return The first Highest leveled actor who can act.
*/
Game_Actor* GetHighestLeveledActor() const;
Game_Actor* GetHighestLeveledActorWhoCanAct() const;

private:
const RPG::SaveInventory& data() const;
Expand Down

0 comments on commit b436171

Please sign in to comment.