Peoplemon  0.1.0
Peoplemon 3 game source documentation
PeoplemonEditorWindow.cpp
Go to the documentation of this file.
2 
4 #include <Core/Resources.hpp>
5 
6 namespace editor
7 {
8 namespace component
9 {
10 using namespace bl::gui;
11 using namespace core::pplmn;
13 
14 namespace
15 {
16 std::string moveToStr(MoveId move) {
17  std::stringstream ss;
18  ss << "Id: " << static_cast<int>(move) << " | ";
19  ss << Move::name(move);
20  return ss.str();
21 }
22 
23 std::string learnMoveToStr(const std::pair<unsigned int, MoveId>& lm) {
24  std::stringstream ss;
25  ss << "Lvl " << lm.first << " | " << Move::name(lm.second);
26  return ss.str();
27 }
28 
29 template<typename T>
30 T parseInput(const bl::gui::TextEntry::Ptr& input) {
31  const long long val = std::atoll(input->getInput().c_str());
32  return static_cast<T>(val);
33 }
34 
35 void error(const std::string& e) {
36  bl::dialog::tinyfd_messageBox("Error", e.c_str(), "ok", "error", 1);
37 }
38 
39 bool warning(const std::string& e) {
40  return 1 == bl::dialog::tinyfd_messageBox("Warning", e.c_str(), "yesno", "warning", 0);
41 }
42 
43 } // namespace
44 
46 : peoplemonDb(db)
47 , onChange(onChange)
48 , statEntry(StatBox::IV, false)
49 , evAwardEntry(StatBox::IV, false) {
50  window = Window::create(LinePacker::create(LinePacker::Vertical, 4.f), "Editing Peoplemon");
51  window->getSignal(Event::Closed)
52  .willAlwaysCall(std::bind(&PeoplemonEditorWindow::onCancel, this));
53 
54  LinePacker::Ptr rowPack = LinePacker::create(LinePacker::Horizontal, 4.f);
55  LinePacker::Ptr colPack = LinePacker::create(LinePacker::Vertical, 4.f);
56  const auto onEdit = std::bind(&PeoplemonEditorWindow::makeDirty, this);
57  applyBut = Button::create("Save");
58 
59  Button::Ptr cancelBut = Button::create("Cancel");
60  cancelBut->getSignal(Event::LeftClicked)
61  .willAlwaysCall(std::bind(&PeoplemonEditorWindow::onCancel, this));
62  applyBut->getSignal(Event::LeftClicked)
63  .willAlwaysCall(std::bind(&PeoplemonEditorWindow::onSave, this));
64 
65  idEntry = TextEntry::create();
66  idEntry->setMode(TextEntry::Mode::Unsigned | TextEntry::Mode::Integer);
67  idEntry->getSignal(Event::TextEntered).willAlwaysCall(onEdit);
68  idEntry->setRequisition({60.f, 1.f});
69  Button::Ptr imgReload = Button::create("Reload Images");
70  imgReload->getSignal(Event::LeftClicked)
71  .willAlwaysCall(std::bind(&PeoplemonEditorWindow::reloadImages, this));
72  nameEntry = TextEntry::create();
73  nameEntry->getSignal(Event::TextEntered).willAlwaysCall(onEdit);
74  nameEntry->setRequisition({160.f, 1.f});
75  descEntry = TextEntry::create();
76  descEntry->getSignal(Event::TextEntered).willAlwaysCall(onEdit);
77  descEntry->setRequisition({400.f, 1.f});
78  type1Select = TypeSelector::create();
79  type2Select = TypeSelector::create();
80 
81  movePoolEntry = SelectBox::create();
82  movePoolEntry->setRequisition({200.f, 1.f});
83  movePoolEntry->setMaxSize({250.f, 300.f});
84  movePoolSelect = MoveSelector::create(false);
85  Button::Ptr movePoolAddBut = Button::create("Add");
86  movePoolAddBut->getSignal(Event::LeftClicked)
87  .willAlwaysCall(std::bind(&PeoplemonEditorWindow::onMovePoolAdd, this));
88  Button::Ptr movePoolRmBut = Button::create("Remove");
89  movePoolRmBut->getSignal(Event::LeftClicked)
90  .willAlwaysCall(std::bind(&PeoplemonEditorWindow::onMovePoolDelete, this));
91  movePoolRmBut->setColor(sf::Color::Red, sf::Color::Black);
92 
93  learnMoveEntry = SelectBox::create();
94  learnMoveEntry->setRequisition({200.f, 1.f});
95  learnMoveEntry->setMaxSize({250.f, 300.f});
96  moveLearnSelect = MoveSelector::create(false);
97  moveLevelEntry = TextEntry::create();
98  moveLevelEntry->setRequisition({45.f, 1.f});
99  Button::Ptr moveLearnAddBut = Button::create("Add");
100  moveLearnAddBut->getSignal(Event::LeftClicked)
101  .willAlwaysCall(std::bind(&PeoplemonEditorWindow::onLearnMoveAdd, this));
102  Button::Ptr moveLearnRmBut = Button::create("Remove");
103  moveLearnRmBut->getSignal(Event::LeftClicked)
104  .willAlwaysCall(std::bind(&PeoplemonEditorWindow::onLearnMoveDelete, this));
105  moveLearnRmBut->setColor(sf::Color::Red, sf::Color::Black);
106 
107  abilitySelect = ComboBox::create();
108  abilitySelect->addOption("None");
109  abilitySelect->addOption("BoardGameMaster");
110  abilitySelect->addOption("Chillaxed");
111  abilitySelect->addOption("Classy");
112  abilitySelect->addOption("Goon");
113  abilitySelect->addOption("QuickDraw");
114  abilitySelect->addOption("AlwaysFriendly");
115  abilitySelect->addOption("Sassy");
116  abilitySelect->addOption("ImpulseBuy");
117  abilitySelect->addOption("RunAway");
118  abilitySelect->addOption("MrExtra");
119  abilitySelect->addOption("BeefedUp");
120  abilitySelect->addOption("Reserved");
121  abilitySelect->addOption("DukeOfJokes");
122  abilitySelect->addOption("Engaging");
123  abilitySelect->addOption("SnackShare");
124  abilitySelect->addOption("DerpDerp");
125  abilitySelect->addOption("Klutz");
126  abilitySelect->addOption("GenderBend");
127  abilitySelect->addOption("Garbage");
128  abilitySelect->addOption("BikeMechanic");
129  abilitySelect->addOption("SidetrackTeach");
130  abilitySelect->addOption("NoJokeTeach");
131  abilitySelect->addOption("FieryTeach");
132  abilitySelect->addOption("ExperiencedTeach");
133  abilitySelect->addOption("NewTeach");
134  abilitySelect->addOption("DozeOff");
135  abilitySelect->addOption("DouseFlames");
136  abilitySelect->addOption("Flirty");
137  abilitySelect->addOption("UndyingFaith");
138  abilitySelect->addOption("TooCool");
139  abilitySelect->addOption("FakeStudy");
140  abilitySelect->addOption("Alcoholic");
141  abilitySelect->addOption("TotalBro");
142  abilitySelect->addOption("TotalMom");
143  abilitySelect->addOption("CantSwim");
144  abilitySelect->addOption("AllNighter");
145  abilitySelect->addOption("AilmentSaturated");
146  abilitySelect->addOption("Adament");
147  abilitySelect->addOption("AbsolutePitch");
148  abilitySelect->addOption("GamemakerVirus");
149  abilitySelect->addOption("Snapshot");
150  abilitySelect->addOption("GetBaked");
151  abilitySelect->setMaxHeight(300.f);
152  xpGroupSelect = ComboBox::create();
153  xpGroupSelect->addOption("Slow");
154  xpGroupSelect->addOption("Standard");
155  xpGroupSelect->addOption("Fast");
156  xpGroupSelect->getSignal(Event::ValueChanged).willAlwaysCall(onEdit);
157  evolveLevelEntry = TextEntry::create();
158  evolveLevelEntry->setMode(TextEntry::Mode::Unsigned | TextEntry::Mode::Integer);
159  evolveLevelEntry->getSignal(Event::TextEntered).willAlwaysCall(onEdit);
160  evolveLevelEntry->setRequisition({60.f, 1.f});
161  evolveIdSelect = PeoplemonSelector::create(true);
162  evolveIdSelect->getSignal(Event::ValueChanged).willAlwaysCall(onEdit);
163  xpRewardMultEntry = TextEntry::create();
164  xpRewardMultEntry->setMode(TextEntry::Mode::Unsigned | TextEntry::Mode::Integer);
165  xpRewardMultEntry->setRequisition({30.f, 1.f});
166  xpRewardMultEntry->getSignal(Event::TextEntered).willAlwaysCall(onEdit);
167  catchRateEntry = TextEntry::create();
168  catchRateEntry->setMode(TextEntry::Mode::Unsigned | TextEntry::Mode::Integer);
169  catchRateEntry->setRequisition({30.f, 1.f});
170  catchRateEntry->getSignal(Event::TextEntered).willAlwaysCall(onEdit);
171 
172  auto img =
173  bl::resource::ResourceManager<sf::Image>::load(Peoplemon::thumbnailImage(Id::Unknown));
174  thumbImg = Image::create(img);
175  thumbImg->scaleToSize({100.f, 100.f});
176  playerImg = Image::create(img);
177  playerImg->scaleToSize({150.f, 150.f});
178  opImg = Image::create(img);
179  opImg->scaleToSize({150.f, 150.f});
180 
181  Box::Ptr row = Box::create(rowPack);
182  Box::Ptr col = Box::create(colPack);
183  Box::Ptr subRow = Box::create(rowPack);
184 
185  row->pack(Label::create("ID:"), false, true);
186  row->pack(idEntry, false, true);
187  row->pack(Label::create("Name:"), false, true);
188  row->pack(nameEntry, false, true);
189  row->pack(Label::create("Type:"), false, true);
190  row->pack(type1Select, false, true);
191  row->pack(Label::create("Secondary Type:"), false, true);
192  row->pack(type2Select, false, true);
193  window->pack(row, true, false);
194 
195  row = Box::create(rowPack);
196  row->pack(Label::create("Description:"), false, true);
197  row->pack(descEntry, true, true);
198  window->pack(row, true, false);
199 
200  row = Box::create(rowPack);
201  col->pack(Label::create("Move Pool"));
202  col->pack(movePoolEntry, true, true);
203  row->pack(col, false, true);
204  col = Box::create(colPack);
205  col->pack(movePoolSelect, true, false);
206  col->pack(movePoolAddBut);
207  col->pack(movePoolRmBut);
208  row->pack(col);
209  col = Box::create(colPack);
210  col->pack(Label::create("Learned Moves"));
211  col->pack(learnMoveEntry, true, true);
212  row->pack(col, false, true);
213  col = Box::create(colPack);
214  subRow->pack(Label::create("Lvl:"), false, true);
215  subRow->pack(moveLevelEntry, true, true);
216  col->pack(subRow, true, false);
217  col->pack(moveLearnSelect, true, false);
218  col->pack(moveLearnAddBut);
219  col->pack(moveLearnRmBut);
220  row->pack(col);
221  window->pack(row, true, false);
222 
223  row = Box::create(rowPack);
224  col = Box::create(colPack);
225  subRow = Box::create(rowPack);
226  col->pack(Label::create("Base Stats:"));
227  statEntry.pack(*col);
228  row->pack(col, false, true);
229  col = Box::create(colPack);
230  col->pack(Label::create("EV Award"));
231  evAwardEntry.pack(*col);
232  row->pack(col, false, true);
233 
234  col = Box::create(colPack);
235  subRow->pack(Label::create("Special Ability:"), false, true);
236  subRow->pack(abilitySelect, true, true);
237  col->pack(subRow, true, false);
238  subRow = Box::create(rowPack);
239  subRow->pack(Label::create("Level-up Speed:"), false, true);
240  subRow->pack(xpGroupSelect, true, true);
241  col->pack(subRow, true, false);
242  subRow = Box::create(rowPack);
243  subRow->pack(Label::create("Evolve Level:"), false, true);
244  subRow->pack(evolveLevelEntry, true, true);
245  col->pack(subRow, true, false);
246  subRow = Box::create(rowPack);
247  subRow->pack(Label::create("Evolve Into:"), false, true);
248  subRow->pack(evolveIdSelect, true, true);
249  col->pack(subRow, true, false);
250  subRow = Box::create(rowPack);
251  subRow->pack(Label::create("XP-Yield Multiplier:"), false, true);
252  subRow->pack(xpRewardMultEntry, true, true);
253  col->pack(subRow, true, false);
254  subRow = Box::create(rowPack);
255  subRow->pack(Label::create("Wild Catch Rate:"), false, true);
256  subRow->pack(catchRateEntry, true, true);
257  col->pack(subRow, true, false);
258  subRow = Box::create(LinePacker::create(
259  LinePacker::Horizontal, 4.f, LinePacker::Compact, LinePacker::RightAlign));
260  subRow->pack(cancelBut);
261  col->pack(subRow, true, false);
262  subRow->pack(applyBut, false, true);
263  row->pack(col, false, true);
264 
265  col = Box::create(colPack);
266  subRow = Box::create(rowPack);
267  Box::Ptr subCol = Box::create(colPack);
268  subCol->pack(Label::create("Thumbnail:"));
269  subCol->pack(thumbImg);
270  subRow->pack(subCol, false, true);
271  subRow->pack(imgReload);
272  col->pack(subRow, true, false);
273  subRow = Box::create(rowPack);
274  subCol = Box::create(colPack);
275  subCol->pack(Label::create("Player:"));
276  subCol->pack(playerImg);
277  subRow->pack(subCol, false, true);
278  subCol = Box::create(colPack);
279  subCol->pack(Label::create("Opponent:"));
280  subCol->pack(opImg);
281  subRow->pack(subCol, false, true);
282  col->pack(subRow, true, false);
283  row->pack(col, false, true);
284  window->pack(row, true, false);
285 }
286 
287 void PeoplemonEditorWindow::open(GUI* parent, Id ppl) {
288  openId = ppl;
289  doingNewPeoplemon = ppl == Id::Unknown;
290 
291  movePoolSelect->refresh();
292  moveLearnSelect->refresh();
293  evolveIdSelect->refresh();
294 
295  const std::pair<Type, Type> types =
296  TypeUtil::getTypes(doingNewPeoplemon ? Type::None : Peoplemon::type(ppl));
297  movePool.clear();
298  learnMoves.clear();
299  if (!doingNewPeoplemon) {
300  const auto& mp = peoplemonDb.validMoves[ppl];
301  movePool.reserve(mp.size());
302  for (const MoveId move : mp) { movePool.emplace_back(move); }
303 
304  const auto& lm = peoplemonDb.learnedMoves[ppl];
305  learnMoves.reserve(lm.size());
306  for (const auto& mp : lm) { learnMoves.emplace_back(mp.first, mp.second); }
307  }
308 
309  idEntry->setInput(doingNewPeoplemon ? "0" : std::to_string(static_cast<int>(ppl)));
310  nameEntry->setInput(doingNewPeoplemon ? "" : Peoplemon::name(ppl));
311  descEntry->setInput(doingNewPeoplemon ? "" : Peoplemon::description(ppl));
312  type1Select->setCurrentType(types.first);
313  type2Select->setCurrentType(types.second);
314  statEntry.update(doingNewPeoplemon ? Stats{} : Peoplemon::baseStats(ppl));
315 
316  for (const MoveId move : movePool) { movePoolEntry->addOption(moveToStr(move)); }
317  movePoolSelect->selectRandom();
318  for (const auto& mp : learnMoves) { learnMoveEntry->addOption(learnMoveToStr(mp)); }
319  moveLevelEntry->setInput("30");
320  moveLearnSelect->selectRandom();
321 
322  abilitySelect->setSelectedOption(
323  doingNewPeoplemon ? 0 : static_cast<int>(Peoplemon::specialAbility(ppl)));
324  evolveLevelEntry->setInput(doingNewPeoplemon ? "0" :
325  std::to_string(Peoplemon::evolveLevel(ppl)));
326  evolveIdSelect->setPeoplemon(doingNewPeoplemon ? Id::Unknown : Peoplemon::evolvesInto(ppl));
327  xpGroupSelect->setSelectedOption(doingNewPeoplemon ? 1 : peoplemonDb.xpGroups[ppl]);
328  xpRewardMultEntry->setInput(
329  doingNewPeoplemon ? "1" : std::to_string(Peoplemon::xpYieldMultiplier(ppl)));
330  evAwardEntry.update(doingNewPeoplemon ? Stats{} : Peoplemon::evAward(ppl));
331  catchRateEntry->setInput(
332  doingNewPeoplemon ? "48" : std::to_string(static_cast<int>(Peoplemon::catchRate(ppl))));
333 
334  reloadImages();
335 
336  dirty = false;
337  applyBut->setColor(sf::Color(20, 240, 50), sf::Color::Black);
338  parent->pack(window);
339  window->setForceFocus(true);
340 }
341 
342 void PeoplemonEditorWindow::reloadImages() {
343  const Id ppl = parseInput<Id>(idEntry);
344  thumbImg->setImage(
345  bl::resource::ResourceManager<sf::Image>::load(Peoplemon::thumbnailImage(ppl)), false);
346  playerImg->setImage(bl::resource::ResourceManager<sf::Image>::load(Peoplemon::playerImage(ppl)),
347  false);
348  opImg->setImage(bl::resource::ResourceManager<sf::Image>::load(Peoplemon::opponentImage(ppl)),
349  false);
350 }
351 
352 void PeoplemonEditorWindow::makeDirty() {
353  dirty = true;
354  applyBut->setColor(sf::Color(230, 30, 30), sf::Color::Black);
355 }
356 
357 void PeoplemonEditorWindow::onCancel() {
358  if (dirty) {
359  if (!warning("Discard unsaved changes?")) { return; }
360  }
361  close();
362 }
363 
364 void PeoplemonEditorWindow::close() {
365  window->setForceFocus(false);
366  window->remove();
367 }
368 
369 void PeoplemonEditorWindow::onMovePoolAdd() {
370  const MoveId move = movePoolSelect->currentMove();
371  if (move == MoveId::Unknown) {
372  error("Please select a move to add");
373  return;
374  }
375  for (const MoveId vm : movePool) {
376  if (vm == move) {
377  error("This move is already in the move pool");
378  return;
379  }
380  }
381  movePool.emplace_back(move);
382  movePoolEntry->addOption(moveToStr(move));
383  makeDirty();
384 }
385 
386 void PeoplemonEditorWindow::onMovePoolDelete() {
387  const auto io = movePoolEntry->getSelectedOption();
388  if (!io.has_value()) {
389  error("Please select a move to delete");
390  return;
391  }
392  const unsigned int i = io.value();
393  if (i >= movePool.size() || i >= movePoolEntry->optionCount()) {
394  error("Somehow in invalid state. Move index is greater than move count");
395  return;
396  }
397  movePool.erase(movePool.begin() + i);
398  movePoolEntry->removeOption(i);
399  makeDirty();
400 }
401 
402 void PeoplemonEditorWindow::onLearnMoveAdd() {
403  const unsigned int lvl = std::atoi(moveLevelEntry->getInput().c_str());
404  const MoveId move = moveLearnSelect->currentMove();
405 
406  if (lvl == 0 || lvl > 100) {
407  error("Level is out of range [1, 100]");
408  return;
409  }
410  if (move == MoveId::Unknown) {
411  error("Please select a move to learn");
412  return;
413  }
414  for (const auto& lp : learnMoves) {
415  if (lp.first == lvl) {
416  error("A move is already being learned at this level");
417  return;
418  }
419  }
420  learnMoves.emplace_back(lvl, move);
421  learnMoveEntry->addOption(learnMoveToStr(learnMoves.back()));
422  makeDirty();
423 }
424 
425 void PeoplemonEditorWindow::onLearnMoveDelete() {
426  const auto io = learnMoveEntry->getSelectedOption();
427  if (!io.has_value()) {
428  error("Please select a learned move to delete");
429  return;
430  }
431  const unsigned int i = io.value();
432  if (i >= learnMoves.size() || i >= learnMoveEntry->optionCount()) {
433  error("In invalid state. Index is out of range");
434  return;
435  }
436  learnMoves.erase(learnMoves.begin() + i);
437  learnMoveEntry->removeOption(i);
438  makeDirty();
439 }
440 
441 void PeoplemonEditorWindow::onSave() {
442  const Id id = parseInput<Id>(idEntry);
443  const Id eid = evolveIdSelect->currentPeoplemon();
444  const unsigned int el = parseInput<unsigned int>(evolveLevelEntry);
445  const unsigned int xpGroup = xpGroupSelect->getSelectedOption();
446  const int xpYieldMult = parseInput<int>(xpRewardMultEntry);
447  const unsigned int cr = parseInput<unsigned int>(catchRateEntry);
448  const Type type = type1Select->currentType() | type2Select->currentType();
449  const SpecialAbility ab = static_cast<SpecialAbility>(abilitySelect->getSelectedOption());
450 
451  if (id == Id::Unknown) {
452  error("Invalid id");
453  return;
454  }
455  if (openId != id && peoplemonDb.names.find(id) != peoplemonDb.names.end()) {
456  if (!warning("Id already exists. Overwrite it?")) { return; }
457  }
458 
459  if (nameEntry->getInput().empty()) {
460  error("Please enter a name");
461  return;
462  }
463  if (descEntry->getInput().empty()) {
464  error("Please a description");
465  return;
466  }
467  if (type == Type::None) {
468  error("Please select at least one type");
469  return;
470  }
471  if (statEntry.currentValue().sum() == 0) {
472  if (!warning("Base stats are all 0. Continue anyways?")) { return; }
473  }
474 
475  if (movePool.empty()) {
476  if (!warning("Valid move pool is empty. Continue?")) { return; }
477  }
478  if (learnMoves.empty()) {
479  if (!warning("No moves are learned by leveling. Continue?")) { return; }
480  }
481 
482  if (eid != Id::Unknown) {
483  if (el == 0 || el > 100) {
484  error("Evolve level is out of range [1, 100]");
485  return;
486  }
487  }
488 
489  if (xpGroup > 2) {
490  error("Invalid level-up speed");
491  return;
492  }
493  if (xpYieldMult < 0) {
494  error("Invalid XP yield multiplier");
495  return;
496  }
497  if (xpYieldMult == 0) {
498  if (!warning("Rewards 0 XP on defeat. Continue?")) { return; }
499  }
500  if (evAwardEntry.currentValue().sum() == 0) {
501  if (!warning("Rewards no EVs. Continue?")) { return; }
502  }
503  if (cr <= 0 || cr > 255) {
504  error("Catch rate is out of range [1, 255]");
505  return;
506  }
507 
508  peoplemonDb.names[id] = nameEntry->getInput();
509  peoplemonDb.descriptions[id] = descEntry->getInput();
510  peoplemonDb.types[id] = type;
511  peoplemonDb.abilities[id] = ab;
512  peoplemonDb.stats[id] = statEntry.currentValue();
513 
514  peoplemonDb.validMoves[id] = {};
515  auto& mp = peoplemonDb.validMoves[id];
516  for (const MoveId move : movePool) { mp.emplace(move); }
517  peoplemonDb.learnedMoves[id] = {};
518  auto& lms = peoplemonDb.learnedMoves[id];
519  for (const auto& lm : learnMoves) { lms.emplace(lm.first, lm.second); }
520 
521  peoplemonDb.evolveLevels[id] = el;
522  peoplemonDb.evolveIds[id] = eid;
523  peoplemonDb.evAwards[id] = evAwardEntry.currentValue();
524  peoplemonDb.xpGroups[id] = xpGroup;
525  peoplemonDb.xpMults[id] = xpYieldMult;
526  peoplemonDb.catchRates[id] = cr;
527 
528  onChange();
529  close();
530 }
531 
532 } // namespace component
533 } // namespace editor
Type
Represents a type that a move or Peoplemon can be. Types may be combined.
Definition: Type.hpp:18
MoveId
The id of a move.
Definition: MoveId.hpp:16
SpecialAbility
Represents a special ability that a Peoplemon may have.
Id
The id of a peoplemon.
Definition: Id.hpp:16
All classes and functionality used for implementing the game editor.
Definition: Tile.hpp:11
Collection of classes and enums pertaining to Peoplemon themselves.
Definition: Ailment.hpp:9
Data structure that holds the underlaying data for all the peoplemon.
Definition: PeoplemonDB.hpp:26
std::unordered_map< pplmn::Id, int > catchRates
Definition: PeoplemonDB.hpp:77
std::unordered_map< pplmn::Id, pplmn::Id > evolveIds
Definition: PeoplemonDB.hpp:73
std::unordered_map< pplmn::Id, pplmn::SpecialAbility > abilities
Definition: PeoplemonDB.hpp:68
std::unordered_map< pplmn::Id, int > xpMults
Definition: PeoplemonDB.hpp:76
std::unordered_map< pplmn::Id, pplmn::Type > types
Definition: PeoplemonDB.hpp:67
std::unordered_map< pplmn::Id, std::unordered_set< pplmn::MoveId > > validMoves
Definition: PeoplemonDB.hpp:70
std::unordered_map< pplmn::Id, unsigned int > xpGroups
Definition: PeoplemonDB.hpp:75
std::unordered_map< pplmn::Id, pplmn::Stats > stats
Definition: PeoplemonDB.hpp:69
std::unordered_map< pplmn::Id, unsigned int > evolveLevels
Definition: PeoplemonDB.hpp:72
std::unordered_map< pplmn::Id, pplmn::Stats > evAwards
Definition: PeoplemonDB.hpp:74
std::unordered_map< pplmn::Id, std::string > descriptions
Definition: PeoplemonDB.hpp:66
std::unordered_map< pplmn::Id, std::unordered_map< unsigned int, pplmn::MoveId > > learnedMoves
Definition: PeoplemonDB.hpp:71
std::unordered_map< pplmn::Id, std::string > names
Definition: PeoplemonDB.hpp:65
static const std::string & name(MoveId move)
Returns the name of the given move.
Definition: Move.cpp:71
static unsigned int evolveLevel(Id id)
Returns the minimum level that the given peoplemon will evolve at.
Definition: Peoplemon.cpp:166
static std::string playerImage(Id id)
Returns the full path to the image to use in battle for the player peoplemon.
Definition: Peoplemon.cpp:219
static float catchRate(Id id)
Returns the base catch rate for the given peoplemon.
Definition: Peoplemon.cpp:237
static SpecialAbility specialAbility(Id id)
Returns the ability of the given peoplemon, if any.
Definition: Peoplemon.cpp:141
static std::string opponentImage(Id id)
Returns the full path to the image to use in battle for the opponent peoplemon.
Definition: Peoplemon.cpp:228
static int xpYieldMultiplier(Id id)
Returns the multiplier used when computing the XP award for defeating the given peoplemon.
Definition: Peoplemon.cpp:182
static Id evolvesInto(Id orig)
Returns what the given peoplemon will evolve into.
Definition: Peoplemon.cpp:171
static const std::string & description(Id id)
Returns the description of the given Peoplemon.
Definition: Peoplemon.cpp:131
static const Stats & baseStats(Id id)
Returns the base stats for the given peoplemon.
Definition: Peoplemon.cpp:146
static const std::string & name(Id id)
Returns the name of the given Peoplemon.
Definition: Peoplemon.cpp:126
static const Stats & evAward(Id id)
Returns the ev points awarded for defeating the given peoplemon.
Definition: Peoplemon.cpp:176
static Type type(Id id)
Returns the type of the Peoplemon.
Definition: Peoplemon.cpp:136
static std::string thumbnailImage(Id id)
Returns the path of the image to render as the peoplemon thumbnail.
Definition: Peoplemon.cpp:211
Stats for Peoplemon. This struct is used for base stats, EVs, IVs, battle increases/decreases,...
Definition: Stats.hpp:19
int sum() const
Returns the sum of the 6 stats that are used for EV calculations.
Definition: Stats.cpp:25
static std::pair< Type, Type > getTypes(Type type)
Returns the primary and secondary type of the given composite type.
Definition: Type.cpp:153
static Ptr create(bool enableFilter, const ChangeCb &changeCb={})
Create a new MoveSelector.
void open(bl::gui::GUI *parent, core::pplmn::Id ppl)
PeoplemonEditorWindow(core::file::PeoplemonDB &db, const OnChange &onChange)
static Ptr create(bool allowUnknown=false)
Creates a new peoplemon selector.
Provides an inline GUI entry for stats in either EV mode or IV mode.
Definition: StatBox.hpp:17
void pack(bl::gui::Box &container)
Packs the GUI elements into the given container.
Definition: StatBox.cpp:111
core::pplmn::Stats currentValue() const
Returns the current Stats value entered.
Definition: StatBox.cpp:83
void update(const core::pplmn::Stats &value)
Updates the GUI elements with the given value.
Definition: StatBox.cpp:94
static Ptr create()
Create a new TypeSelector.