Skip to content

Commit

Permalink
Refactor EnemyAi functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mateofio committed Oct 6, 2020
1 parent aea0ce7 commit d5502bd
Show file tree
Hide file tree
Showing 6 changed files with 495 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ add_library(${PROJECT_NAME} STATIC
src/dynrpg.h
src/dynrpg_easyrpg.cpp
src/dynrpg_easyrpg.h
src/enemyai.cpp
src/enemyai.h
src/exe_reader.cpp
src/exe_reader.h
src/exfont.h
Expand Down
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ libeasyrpg_player_a_SOURCES = \
src/dynrpg.h \
src/dynrpg_easyrpg.cpp \
src/dynrpg_easyrpg.h \
src/enemyai.cpp \
src/enemyai.h \
src/exe_reader.cpp \
src/exe_reader.h \
src/exfont.h \
Expand Down
21 changes: 21 additions & 0 deletions src/algo.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,27 @@ inline bool IsNormalOrSubskill(const lcf::rpg::Skill& skill) {
|| skill.type >= lcf::rpg::Skill::Type_subskill;
}

/**
* Checks if the skill targets the opposing party.
*
* @param skill the skill to check
* @return true if targets opposing party
*/
inline bool SkillTargetsEnemies(const lcf::rpg::Skill& skill) {
return skill.scope == lcf::rpg::Skill::Scope_enemy
|| skill.type == lcf::rpg::Skill::Scope_enemies;
}

/**
* Checks if the skill targets the allied party.
*
* @param skill the skill to check
* @return true if targets allied party
*/
inline bool SkillTargetsAllies(const lcf::rpg::Skill& skill) {
return !SkillTargetsEnemies(skill);
}

} // namespace Algo


Expand Down
Loading

0 comments on commit d5502bd

Please sign in to comment.