本文整理汇总了C++中Hero::clean方法的典型用法代码示例。如果您正苦于以下问题:C++ Hero::clean方法的具体用法?C++ Hero::clean怎么用?C++ Hero::clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hero
的用法示例。
在下文中一共展示了Hero::clean方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sheriff
void sheriff(){
clear_screen();
cout << "[Ray]: Ahm the sheriff 'round these parta. Watcha need?" << endl;
cout << "You can either give him your captured monsters (1)" << endl;
cout << "Or leave (2)" << endl;
cout << endl;
int choice=inputI("["+player.name+"]: ");
if (choice==1&&player.caught>0){
float amount=player.caught*2;
player.money+=amount;
player.caught=0;
cout << "[Ray]: Here yer go!" << endl;
cout << "Received " << amount << " Vi from Ray" << endl;
player.clean();
enter();
town();
}else if (choice==1&&player.caught==0){
cout << "[Ray]: Whadder yer want? Me to uh takun' nothin' but air?" << endl;
enter();
town();
} else {
town();
}
}
示例2: bank
void bank(){
clear_screen();
cout << "You have " << player.money << " Vi in your pocket, and " << player.deposit << " Vi in the bank." << endl;
cout << endl;
cout << "[Banker]: Hello, sir. Would you like to make a deposit or withdrawl? Or would you like to leave?" << endl;
string choice=lower(inputS("["+player.name+"]: "));
if (choice=="leave"){
town();
}else if (choice=="deposit"){
cout << "[Banker] How much would you like to deposit?" << endl;
float amount=inputF(": ");
if (amount>player.money){
cout << "You don't have that kind of cash!!!" << endl;
enter();
bank();
}else{
player.money-=amount;
player.deposit+=amount;
player.clean();
cout << "[Banker]: Thanks for your business!" << endl;
enter();
bank();
}
} else if(choice=="withdraw"||choice=="withdrawl"){
float amount=inputF("How much would you like to withdraw? ");
if (amount>player.deposit){
cout << "You don't have that kind of money!!!" << endl;
enter();
bank();
}else{
player.money+=amount;
player.deposit-=amount;
player.clean();
cout << "[Banker]: Thanks for your business!" << endl;
enter();
bank();
}
}else if(choice=="leave"){
town();
}
}
示例3: hospital
void hospital(){
clear_screen();
player.deaths++;
bool said_no=false;
cout << "[Nurse]: Oh my. You seem to have died. Don't worry! We brought you back with SCIENCE!" << endl;
cout << "[Nurse]: ... And a lot of tylenol..." << endl;
cout << "[Nurse]: Anyway, to heal you 100% will cost " << player.money/10+2 << " Vi" << endl;
if (player.money>=player.money/10+2){
cout << "[Nurse]: Would you like to pay for that? " << endl;
if (lower(inputS(": "))=="yes"){
player.money-=player.money/10+2;
player.reset_health();
cout << "[Nurse]: Thank you!" << endl;
} else {
said_no=true;
}
} else {
said_no=true;
}
if (said_no){
cout << "[Nurse]: Oh. Dang, I really wanted that cash." << endl;
cout << "[Nurse]: We can charge you in demonic-... I mean other ways though." << endl;
if (lower(inputS("Interested? \n: "))=="yes"){
player.levels--;
player.reset_health();
} else {
player.health=player.max_health/2;
player.clean();
}
}
enter();
clear_screen();
cout << "[Nurse]: We hope to see you again. Very soon. Hehehehe..." << endl;
enter();
town();
}
示例4: apothecary
void apothecary(){
clear_screen();
bool bought=true;
cout << "You have " << player.money << " Vi, " << player.health << "/" << player.max_health << " health," << endl;
cout << player.max_power << " power, and " << player.defence << " defence." << endl;
cout << endl;
cout << "[Lyla]: I have lots of high quality potions for sale. Would you like:" << endl;
cout << "Small health potion: Heals 20 hp for 1 Vi? (1)" << endl;
cout << "Medium health potion: Heals 80 hp for 3 Vi? (2)" << endl;
cout << "Large health potion? Heals 150 hp for 5 Vi? (3)" << endl;
cout << "Small upper health potion? Increases max health by 5 for 10 Vi? (4)" << endl;
cout << "Medium upper health potion? Increases max health by 20 for 15 Vi? (5)" << endl;
cout << "Large upper health potion? Increases max health by 50 for 30 Vi? (6)" << endl;
cout << "Defence potion? Increases defence by 20% for 15 Vi? (7)" << endl;
cout << "Or maybe a power potion? Increases your power by 20% for 15 Vi? (8)" << endl;
cout << "\n=====================================================================\n" << endl;
cout << "We also have a very large health potion, heal 300 hp for 9 Vi? (9)" << endl;
cout << "And a huge health potion to heal 500 hp for 14 Vi? (10)" << endl;
cout << "Or you could just get out of here> (11)" << endl;
int choice=inputI("["+player.name+"]: ");
if (choice==1&&player.money>=1){
player.money-=1;
player.health+=20;
}else if (choice==2&&player.money>=3){
player.money-=3;
player.health+=80;
}else if (choice==3&&player.money>=5){
player.money-=5;
player.health+=150;
}else if (choice==4&&player.money>=10){
player.money-=10;
player.max_health+=5;
}else if (choice==5&&player.money>=15){
player.money-=15;
player.max_health+=20;
}else if (choice==6&&player.money>=30){
player.money-=30;
player.max_health+=50;
}else if (choice==7&&player.money>=15){
player.money-=15;
player.defence*=1.2;
} else if (choice==8&&player.money>=15){
player.money-=15;
player.max_power*=1.2;
player.reset_power();
}else if (choice==11){
player.check();
town();
}else if (choice==9 && player.money>=9){
player.money-=9;
player.health+=300;
}else if (choice==10 && player.money>=14){
player.money-=14;
player.health+=500;
}else{
cout << "[Lyla] You don't have that kind of cash!";
bought=false;
}
if(bought){cout << "Thanks for your purchase!" << endl;}
player.check();
player.clean();
enter();
apothecary();
}
示例5: doctor
void doctor() {
clear_screen();
int choice;
float amount;
//string s;
float cost;
cout << "[Doctor]: Hello, patient. What can I do for you?" << endl;
cout << "[Doctor]: I am capable of fully healing you (1)" <<
"\nLetting you decide how much to heal (2)" <<
"\nOr showing you to the door (3)" << endl;
choice=inputI(": ");
if (choice==1 && player.health < player.max_health){
clear_screen();
cost=(player.max_health-player.health)/15;
cost=floorf(cost*10+.5)/10;
if(player.money >= cost){
cout << "[Doctor]: That will be " << cost << " Vi. Are you sure?" << endl;
if (lower(inputS(": "))=="yes"){
player.reset_health();
player.money-=cost;
}else {
doctor();
}
}
} else if (choice==2){
clear_screen();
cout << "[Doctor]: Exactly how much would you like me to heal?" << endl;
cout << "[Doctor]: You seems to have " << player.health << "/" << player.max_health << " health." << endl;
amount=inputF(": ");
if (amount > player.max_health-player.health){
amount=player.max_health-player.health;
}
cost=amount/10;
cost=floorf(cost*10+.5)/10;
if (cost>player.money){
cout << "[Doctor]: Your insurance won't cover that!!!" << endl;
enter();
doctor();
}
cout << "That will be " << cost << " Vi. Are you sure?" << endl;
if(lower(inputS(": "))=="yes"){
player.health+=amount;
player.money-=cost;
player.check();
player.clean();
} else {
doctor();
}
} else if (choice==3){
town();
} else {
doctor();
}
}