-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFood.cpp
39 lines (33 loc) · 1.1 KB
/
Food.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
#include "Food.h"
Food::Food(int addhp, std::string name, std::string description, std::string type, int level, int buyValue, int sellValue, int rarity)
:Item(name, description, type, level, buyValue, sellValue , rarity), addhp(addhp)
{}
Food::~Food(){
}
void Food::showAtribute(){
std::cout << "== 物品表 ==" << std::endl;
std::cout << "||名字: " << name << std::endl;
std::cout << "||类别: " << type << std::endl;
std::cout << "||加血: " << addhp << std::endl;
std::cout << "||等级: " << level << std::endl;
std::cout << "||稀有度: " << rarity << std::endl;
cout << description << endl;
cout << "-----------------" << endl;
}
void Food::interact(){
cout << "其名为" << name << ", 是:" << type << endl;
cout << description << endl;
cout << "请输入想做的动作:\n";
std::cout << "-1: 退出 0: 查看"<< std::endl;
cout << "--------------------\n";
int cho;
while(std::cin >> cho){
cout << "\n\n\n";
if(cho == -1){
break;
}else if(cho == 0){
showAtribute();
break;
}
}
}