Skip to content

Commit

Permalink
Use Algo::IsNormalOrSubskill everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
mateofio committed Oct 9, 2020
1 parent 6a5a092 commit 5c26db0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/game_battlealgorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,8 +1152,7 @@ bool Game_BattleAlgorithm::Skill::Execute() {
return this->success;
}

if (!(skill.type == lcf::rpg::Skill::Type_normal ||
skill.type >= lcf::rpg::Skill::Type_subskill)) {
if (!Algo::IsNormalOrSubskill(skill)) {
this->success = false;
return this->success;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game_battler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ bool Game_Battler::UseSkill(int skill_id, const Game_Battler* source) {
bool was_used = false;
int revived = 0;

if (skill->type == lcf::rpg::Skill::Type_normal || skill->type >= lcf::rpg::Skill::Type_subskill) {
if (Algo::IsNormalOrSubskill(*skill)) {
// Only takes care of healing skills outside of battle,
// the other skill logic is in Game_BattleAlgorithm

Expand Down
3 changes: 1 addition & 2 deletions src/game_party.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,7 @@ bool Game_Party::IsSkillUsable(int skill_id, const Game_Actor* target, bool from
return !Game_Battle::IsBattleRunning() && Main_Data::game_system->GetAllowEscape() && Main_Data::game_targets->HasEscapeTarget() && !Main_Data::game_player->IsFlying();
} else if (skill->type == lcf::rpg::Skill::Type_teleport) {
return !Game_Battle::IsBattleRunning() && Main_Data::game_system->GetAllowTeleport() && Main_Data::game_targets->HasTeleportTargets() && !Main_Data::game_player->IsFlying();
} else if (skill->type == lcf::rpg::Skill::Type_normal ||
skill->type >= lcf::rpg::Skill::Type_subskill) {
} else if (Algo::IsNormalOrSubskill(*skill)) {
int scope = skill->scope;

if (Game_Battle::IsBattleRunning()) {
Expand Down
2 changes: 0 additions & 2 deletions src/scene_battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,6 @@ void Scene_Battle::AssignSkill(const lcf::rpg::Skill* skill, const lcf::rpg::Ite
ActionSelectedCallback(active_actor);
return;
}
case lcf::rpg::Skill::Type_normal:
case lcf::rpg::Skill::Type_subskill:
default:
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/scene_skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

// Headers
#include "scene_skill.h"
#include "algo.h"
#include "game_map.h"
#include "game_party.h"
#include "game_player.h"
Expand Down Expand Up @@ -65,7 +66,7 @@ void Scene_Skill::Update() {
Main_Data::game_party->UseSkill(skill_id, actor, actor);
Scene::PopUntil(Scene::Map);
Game_Map::SetNeedRefresh(true);
} else if (skill->type == lcf::rpg::Skill::Type_normal || skill->type >= lcf::rpg::Skill::Type_subskill) {
} else if (Algo::IsNormalOrSubskill(*skill)) {
Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Main_Data::game_system->SFX_Decision));
Scene::Push(std::make_shared<Scene_ActorTarget>(skill_id, actor_index));
skill_index = skill_window->GetIndex();
Expand Down

0 comments on commit 5c26db0

Please sign in to comment.