Repository navigation
Expand file tree
/
Copy pathShinyHuntTracker.cpp
More file actions
93 lines (82 loc) · 2.38 KB
/
Copy pathShinyHuntTracker.cpp
File metadata and controls
93 lines (82 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* Shiny Hunt Tracker
*
* From: https://github.com/PokemonAutomation/
*
*/
#include "Common/Cpp/Exceptions.h"
#include "ShinyHuntTracker.h"
namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonSwSh{
ShinyHuntTracker::ShinyHuntTracker(bool shiny_types)
: m_encounters(m_stats["Encounters"])
, m_caught(m_stats["Caught"])
, m_errors(m_stats["Errors"])
, m_unknown_shinies(m_stats[shiny_types ? "Unknown Shinies" : "Shinies"])
, m_star_shinies(m_stats["Star Shinies"])
, m_square_shinies(m_stats["Square Shinies"])
{
m_display_order.emplace_back("Encounters");
m_display_order.emplace_back("Errors", HIDDEN_IF_ZERO);
if (shiny_types){
m_display_order.emplace_back("Star Shinies", HIDDEN_IF_ZERO);
m_display_order.emplace_back("Square Shinies", HIDDEN_IF_ZERO);
m_display_order.emplace_back("Unknown Shinies", HIDDEN_IF_ZERO);
}else{
m_display_order.emplace_back("Shinies", HIDDEN_IF_ZERO);
}
m_display_order.emplace_back("Caught", HIDDEN_IF_ZERO);
}
ShinyHuntTracker::ShinyHuntTracker(bool shiny_types, std::map<std::string, std::string> aliases)
: ShinyHuntTracker(shiny_types)
{
m_aliases = std::move(aliases);
}
void ShinyHuntTracker::operator+=(ShinyType detection){
switch (detection){
case ShinyType::UNKNOWN:
m_errors++;
break;
case ShinyType::NOT_SHINY:
m_encounters++;
break;
case ShinyType::MAYBE_SHINY:
throw InternalProgramError(nullptr, PA_CURRENT_FUNCTION, "Attempted to add a MAYBE_SHINY to stats.");
case ShinyType::UNKNOWN_SHINY:
m_encounters++;
m_unknown_shinies++;
break;
case ShinyType::STAR_SHINY:
m_encounters++;
m_star_shinies++;
break;
case ShinyType::SQUARE_SHINY:
m_encounters++;
m_square_shinies++;
break;
}
}
void ShinyHuntTracker::add_non_shiny(){
m_encounters++;
}
void ShinyHuntTracker::add_error(){
m_errors++;
}
void ShinyHuntTracker::add_unknown_shiny(){
m_encounters++;
m_unknown_shinies++;
}
void ShinyHuntTracker::add_star_shiny(){
m_encounters++;
m_star_shinies++;
}
void ShinyHuntTracker::add_square_shiny(){
m_encounters++;
m_square_shinies++;
}
void ShinyHuntTracker::add_caught(){
m_caught++;
}
}
}
}