3 #include <BLIB/Util/FileUtil.hpp>
4 #include <BLIB/Util/Random.hpp>
13 const std::string Invalid =
"<INVALID>";
14 std::vector<MoveId> allIds;
16 void refreshIds(
const std::unordered_map<MoveId, std::string>* names) {
18 allIds.reserve(names->size());
19 for (
const auto& p : *names) { allIds.emplace_back(p.first); }
23 std::unordered_map<MoveId, std::string>* Move::names =
nullptr;
24 std::unordered_map<MoveId, std::string>* Move::descriptions =
nullptr;
25 std::unordered_map<MoveId, Type>* Move::types =
nullptr;
26 std::unordered_map<MoveId, int>* Move::damages =
nullptr;
27 std::unordered_map<MoveId, int>* Move::accuracies =
nullptr;
28 std::unordered_map<MoveId, int>* Move::priorities =
nullptr;
29 std::unordered_map<MoveId, unsigned int>* Move::pps =
nullptr;
30 std::unordered_map<MoveId, bool>* Move::contactors =
nullptr;
31 std::unordered_map<MoveId, bool>* Move::specials =
nullptr;
32 std::unordered_map<MoveId, MoveEffect>* Move::effects =
nullptr;
33 std::unordered_map<MoveId, int>* Move::effectChances =
nullptr;
34 std::unordered_map<MoveId, int>* Move::effectIntensities =
nullptr;
35 std::unordered_map<MoveId, bool>* Move::effectSelves =
nullptr;
65 #ifdef PEOPLEMON_DEBUG
72 const auto it = names->find(
id);
73 return it != names->end() ? it->second : Invalid;
77 const auto it = descriptions->find(
id);
78 return it != descriptions->end() ? it->second : Invalid;
82 const auto it = types->find(
id);
83 return it != types->end() ? it->second :
Type::None;
87 const auto it = damages->find(
id);
88 return it != damages->end() ? it->second : 0;
92 const auto it = accuracies->find(
id);
93 return it != accuracies->end() ? it->second : 0;
97 const auto it = priorities->find(
id);
98 return it != priorities->end() ? it->second : 0;
102 const auto it = pps->find(
id);
103 return it != pps->end() ? it->second : 0;
107 const auto it = contactors->find(
id);
108 return it != contactors->end() ? it->second :
false;
112 const auto it = specials->find(
id);
113 return it != specials->end() ? it->second :
false;
117 const auto it = effects->find(
id);
122 const auto it = effectChances->find(
id);
123 return it != effectChances->end() ? it->second : 0;
127 const auto it = effectIntensities->find(
id);
128 return it != effectIntensities->end() ? it->second : 0;
132 const auto it = effectSelves->find(
id);
133 return it != effectSelves->end() ? it->second :
false;
138 const std::string f2 = bl::util::FileUtil::joinPath(f1,
name(move));
139 return bl::util::FileUtil::joinPath(f2,
"Front/Background.anim");
144 const std::string f2 = bl::util::FileUtil::joinPath(f1,
name(move));
145 return bl::util::FileUtil::joinPath(f2,
"Front/Foreground.anim");
150 const std::string f2 = bl::util::FileUtil::joinPath(f1,
name(move));
151 return bl::util::FileUtil::joinPath(f2,
"Back/Background.anim");
156 const std::string f2 = bl::util::FileUtil::joinPath(f1,
name(move));
157 return bl::util::FileUtil::joinPath(f2,
"Back/Foreground.anim");
163 ret = allIds[bl::util::Random::get<std::size_t>(0, allIds.size() - 1)];
Type
Represents a type that a move or Peoplemon can be. Types may be combined.
MoveEffect
Represents an effect that a move can have. Copied verbatim from Peoplemon 2, may refactor later when ...
Core classes and functionality for both the editor and game.
Stores the metadata of all peoplemon moves.
std::unordered_map< pplmn::MoveId, bool > specials
std::unordered_map< pplmn::MoveId, bool > contactors
std::unordered_map< pplmn::MoveId, std::int32_t > damages
std::unordered_map< pplmn::MoveId, std::uint32_t > pps
std::unordered_map< pplmn::MoveId, std::int32_t > accuracies
std::unordered_map< pplmn::MoveId, std::string > descriptions
std::unordered_map< pplmn::MoveId, std::int32_t > effectChances
std::unordered_map< pplmn::MoveId, std::int32_t > priorities
std::unordered_map< pplmn::MoveId, pplmn::MoveEffect > effects
std::unordered_map< pplmn::MoveId, std::int32_t > effectIntensities
std::unordered_map< pplmn::MoveId, std::string > names
std::unordered_map< pplmn::MoveId, pplmn::Type > types
std::unordered_map< pplmn::MoveId, bool > effectSelves
static unsigned int pp(MoveId move)
Returns the max pp of the given move.
static int damage(MoveId move)
Returns the damage of the given move.
static const std::string & description(MoveId move)
Returns the description of the given move.
static int accuracy(MoveId move)
Returns the accuracy of the given move.
static std::string playerAnimationBackground(MoveId move)
Returns the path to the animation for when the local player uses the move.
static const std::vector< MoveId > & validIds()
Returns the list of all valid move ids.
static int priority(MoveId move)
Returns the priority of the given move.
static bool makesContact(MoveId move)
Returns whether or not the given move makes physical contact when used.
static int effectIntensity(MoveId move)
Returns the effect intensity of the given move.
static std::string playerAnimationForeground(MoveId move)
Returns the path to the animation for when the local player uses the move.
static void setDataSource(file::MoveDB &source)
Set the data source for each method.
static MoveEffect effect(MoveId move)
Returns the effect of the given move.
static MoveId getRandomMove(bool allowRandomEffect=false)
Returns a random, valid move. Optionally filters moves that have the Random effect.
static const std::string & name(MoveId move)
Returns the name of the given move.
static Type type(MoveId move)
Returns the type of the given move.
static int effectChance(MoveId move)
Returns the effect chance of the given move.
static bool isSpecial(MoveId move)
Returns whether or not the given move is special.
static std::string opponentAnimationForeground(MoveId move)
Returns the path to the animation for when the opponent uses the move.
static std::string opponentAnimationBackground(MoveId move)
Returns the path to the animation for when the opponent uses the move.
static MoveId cast(unsigned int id)
Converts the given raw id to a move id, or Unknown if invalid.
static bool affectsUser(MoveId move)
Returns whether or not the given move affects the user or the opponent.
static const std::string & AnimationPath()