-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArmory.cpp
More file actions
99 lines (78 loc) · 2.63 KB
/
Copy pathArmory.cpp
File metadata and controls
99 lines (78 loc) · 2.63 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
94
95
96
97
98
99
#include <iostream>
#include "Header.h"
#include <map> //-> for map function
#include <string>
#include <utility>
//Also make as is in weapon.cpp
static std::map<std::string, std::pair<int, int>>& GetWeaponAR() {
static std::map<std::string, std::pair<int, int>> db;
if (db.empty()) {
db = {
// suit name defense cost
{"Padded suit", {11 ,5}},
{"Leather suit", {11, 10}},
{"Studded suit", {12, 22}},
{"Hide suit", {12, 10}},
{"Chain shirt",{ 13, 30}},
{"Scale male", {13, 43}},
{"Spaiked armor", {15 , 50}},
{"Breastplate",{17, 70}},
{"Halfplate", {19, 110}},
{"Ring mail", {14, 40 }},
{"Chain mail", {15, 55}},
{"Splint", {20, 140}},
{"Plate", {26, 250}},
{"Shield", {6, 70}}};
}
return db;
}
std::string Armory::RandomizeArmorStart() //Starter pack armor
{
auto& db = GetWeaponAR();
int choise = rand ()% 3;
switch(choise)
{
case 0:
name_a = "Padded suit";
break;
case 1:
name_a = "Leather suit";
break;
case 2:
name_a = "Studded suit";
break;
}
auto it = db.find(name_a);
if (it != db.end()) {
value_a = it->second.second;
}
return name_a;
}
void Armory::ShowInfo() const //Show armor characteristics
{
std::cout << "\n===Your armor characteristic=== "<< std::endl;
std::cout << "Name : " << name_a << "\nDefend : " << defend_a << "\nDurability : "
<< durability_a << "\nValue : " << value_a <<"\nIs enchanted : " << (isEnchanted_a ? "Yes" : "No") <<"\n"<< std::endl;
}
void Armory::BrokenArmory() //Count is armor broken
{
isBroken_a = true;
durability_a = 0;
std::cout << (IsUsable() ? "Usable" : "Broken") << std::endl;
}
void Armory::Use() {
isEquipped_a = true;
std::cout << name_a << " equipped! Defense: +" << defend_a << std::endl;
}
void Armory::Reset() {
isEquipped_a = false;
std::cout << name_a << " unequipped." << std::endl;
}
//==================================================================Special_weapon=========================================================================
std::string Armory::RandomizeArmorSpeacial() //===============Not Ready
{
name_a = "Dragon suit";
defend_a = 25;
value_a = 500;
return name_a;
}