1 #include <BLIB/Util/Random.hpp>
40 const unsigned int i =
static_cast<unsigned int>(s);
45 const unsigned int i =
static_cast<unsigned int>(s);
50 unsigned int level,
const Stats& stages) {
53 const int base = bases.
get(stat);
54 const int ev = evs.
get(stat);
55 const int iv = ivs.
get(stat);
57 const int inside = ((
base * 2 + iv + ev / 4) * level) / 100;
58 if (stat ==
Stat::HP) { result.
get(stat) = inside + level + 10; }
60 result.
get(stat) =
static_cast<float>(inside + 5) * sm;
67 const float s =
static_cast<float>(stage);
68 if (stage <= 0) {
return 2.f / (2.f -
static_cast<float>(s)); }
70 return (2.f +
static_cast<float>(s)) / 2.f;
Stat
Represents a single stat. Used as an offset to access Stats as an array.
Core classes and functionality for both the editor and game.
Stats for Peoplemon. This struct is used for base stats, EVs, IVs, battle increases/decreases,...
void randomize()
Generates random IV stats.
static constexpr int MaxEVStat
The maximum amount that a single EV can be.
Stats()
Initializes all members to 0.
static constexpr int MaxIVStat
The maximum amount that a single IV can be.
int & get(Stat stat)
Returns a reference to the given stat.
static const std::array< Stat, 6 > IterableStats
Helper array to iterate over stats in loop.
static float stageMultiplier(int stage)
Returns the multiplier for a given stat increase/decrease.
static Stats computeStats(const Stats &base, const Stats &evs, const Stats &ivs, unsigned int level, const Stats &stages={})
Helper method to compute a Peoplemon's current stats.
void addEVs(const Stats &evs)
Adds the given EV points to this set of stats while obeying the constraints on EV values and sums.
static const char * statToString(Stat stat)
Converts the given stat to its string representation.
static constexpr int MaxEVSum
The maximum amount that EVs or IVs can sum to.
int sum() const
Returns the sum of the 6 stats that are used for EV calculations.