-
Notifications
You must be signed in to change notification settings - Fork 0
/
Trait.cpp
93 lines (82 loc) · 1.76 KB
/
Trait.cpp
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
#include "Trait.h"
#include <sstream>
using std::stringstream;
Trait::Trait(string name, int amount) {
this->_amount = amount;
this->_name = name;
this->_discoveryLevel = 0;
}
int Trait::influenceOnSalaryRequirements() {
return 0;
}
bool Trait::discoverMore() {
bool ret = false;
this->_discoveryLevel++;
if (this->_discoveryLevel > 3)
this->_discoveryLevel = 3;
else
ret = true;
return ret;
}
string Trait::getName() {
return this->_name;
}
/**
* This needs a lot of tweaking. For one, the discovery level needs to be stored
* outside of the actual trait in order to promote reuse.
*
* The bigger challenge though is that this needs to be less predictable.
*
* I see more ranges here:
*
* 0) "unknown"
* 1) "high, medium, or low"
* 2-10) n-m where n and m are the right number +- rand() % (10 - x)
*
* A big challenge here then is that this text will have to be stored somewhere
* so that it doesn't fluctuate every time it's queried.
*/
string Trait::getDiscoveryModifiedText() {
stringstream tmp;
string ret;
switch (this->_discoveryLevel) {
case 3:
tmp << this->_amount;
tmp >> ret;
return ret;
break;
case 2:
if (this->_amount < 10)
return "< 10";
if (this->_amount < 20)
return "10s";
if (this->_amount < 30);
return "20s";
if (this->_amount < 40)
return "30s";
if (this->_amount < 50)
return "40s";
if (this->_amount < 60)
return "50s";
if (this->_amount < 70)
return "60s";
if (this->_amount < 80)
return "70s";
if (this->_amount < 90)
return "80s";
return "90s";
break;
case 1:
if (this->_amount < 33)
return "low";
if (this->_amount < 66)
return "medium";
return "high";
break;
case 0:
default:
return "Unknown";
}
}
Trait::~Trait() {
}