Peoplemon  0.1.0
Peoplemon 3 game source documentation
WildPeoplemon.cpp
Go to the documentation of this file.
2 
3 #include <BLIB/Util/Random.hpp>
5 
6 namespace core
7 {
8 namespace pplmn
9 {
11  OwnedPeoplemon wild{id, bl::util::Random::get<unsigned int>(minLevel, maxLevel)};
12  int mi = 0;
13  for (unsigned int lvl = 1; lvl <= wild.currentLevel(); ++lvl) {
14  const MoveId move = Peoplemon::moveLearnedAtLevel(wild.id(), lvl);
15  if (move != MoveId::Unknown) {
16  if (mi < 4) {
17  wild.learnMove(move, mi);
18  ++mi;
19  }
20  else {
21  if (bl::util::Random::get<int>(0, 100) <= 40) {
22  wild.learnMove(move, bl::util::Random::get<unsigned int>(0, 3));
23  }
24  }
25  }
26  }
27  return wild;
28 }
29 
30 } // namespace pplmn
31 } // namespace core
MoveId
The id of a move.
Definition: MoveId.hpp:16
Core classes and functionality for both the editor and game.
Represents an instance of a peoplemon. Can be a wild peoplemon, trainer, or player peoplemon....
static MoveId moveLearnedAtLevel(Id ppl, unsigned int level)
Returns the move the peoplemon learns at the given level, if any.
Definition: Peoplemon.cpp:157
Id id
The type of peoplemon to generate.
std::uint8_t minLevel
The minimum level that may spawn, inclusive.
std::uint8_t maxLevel
The maximum level that may spawn, inclusive.
OwnedPeoplemon generate() const
Generate an OwnedPeoplemon from the template.