-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpgrade.cpp
More file actions
45 lines (40 loc) · 1.17 KB
/
Upgrade.cpp
File metadata and controls
45 lines (40 loc) · 1.17 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
#include "Upgrade.h"
std::string upgradeTypeToString(UpgradeType type) {
switch (type) {
case UpgradeType::UtilitySpeed: return "Utility: Speed";
case UpgradeType::DefenseHP: return "Defense: HP";
case UpgradeType::OffensiveDamage: return "Offensive: Damage";
default: return "Unknown";
}
}
UpgradeSystem::UpgradeSystem() {
// Initialize upgrade system if needed
}
void UpgradeSystem::applyUpgrade(Cell& cell, UpgradeType type) {
switch (type) {
case UpgradeType::UtilitySpeed:
cell.speed *= 1.2f;
break;
case UpgradeType::DefenseHP:
cell.maxHp += 20;
cell.hp += 20;
break;
case UpgradeType::OffensiveDamage:
cell.damage *= 1.2f;
break;
}
}
bool UpgradeSystem::canUpgrade(const Cell& cell, UpgradeType type) {
return cell.xp >= upgradeCost(type);
}
int UpgradeSystem::upgradeCost(UpgradeType type) {
switch (type) {
case UpgradeType::UtilitySpeed:
return 10;
case UpgradeType::DefenseHP:
return 20;
case UpgradeType::OffensiveDamage:
return 25;
}
return 0;
}