//
#include <iostream>
#include <cstdio>
#include <string>
#include <ctime>
#include <cstdlib>
using namespace std;
int golds, sam, swp, alh, tps, rmb;
string wps[7] = {"", "头盔", "胸甲", "手套", "护腿", "鞋子", "武器"};
int levels[7] = { 0, 0, 0, 0, 0, 0, 0};
double success[20]= {0.8, 0.8, 0.5, 0.5, 0.3, 0.3, 0.2, 0.2, 0.15, 0.15, 0.1, 0.1, 0.05, 0.05, 0.03, 0.03, 0.01, 0.01, 0.005, 0.005};
// 防具消耗金币数量
int amGold[20] = {0, 0, 0, 0, 70, 90, 110, 130, 130, 180, 350, 350, 350, 350, 350, 360, 380, 390, 400, 420};
// 武器消耗金币数量
int wpGold[20] = {0, 0, 0, 0, 120, 150, 180, 210, 250, 300, 680, 680, 680, 710, 730, 750, 780, 810, 840, 870};
// 防具守护石
int am[20] = {190, 190, 190, 230, 230, 230, 280, 330, 400, 470, 686, 686, 686, 780, 780, 780, 874, 874, 874, 968};
// 武器破坏石
int wp[20]= {310, 310, 310, 380, 380, 380, 460, 540, 660, 780, 1144, 1144, 1144, 1300, 1300, 1300, 1458, 1458, 1458, 1614};
// 防具突破石
int amTps[20] = {6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 14, 16, 16, 18, 20, 22, 24, 26, 28, 30};
// 武器突破石
int wpTps[20] = {10, 10, 11, 11, 12, 13, 14, 15, 16, 17, 22, 24, 28, 32, 32, 34, 38, 42, 44, 48};
// 防具消耗奥雷哈
int amALH[20] = {0, 0, 0, 0, 3, 3, 4, 4, 5, 6, 10, 10, 12, 14, 14, 16, 18, 20, 22, 24};
// 武器消耗奥雷哈
int wpALH[20] = {0, 0, 0, 0, 4, 4, 5, 6, 7, 8, 12, 14, 16, 18, 20, 22, 26, 28, 32, 36};
void showWps(){
for(int i = 1; i <= 6; i++){
printf("%s:%2d; ", wps[i].c_str(), levels[i]);
}
printf("\n");
}
void showSourse(){
printf("截止到现在共消耗: \n");
printf("金币 * %d; ", golds);
printf("武器破坏石 * %d; ", swp);
printf("防具守护石 * %d; ", sam);
printf("突破石 * %d; ", tps);
printf("奥雷哈数量 * %d\n", alh);
}
bool successProbability(double successRate) {
double randomValue = (double)rand() / RAND_MAX; // 生成 0 到 1 之间的随机数
cout << randomValue << endl;
return randomValue < successRate; // 判断是否强化成功
}
int main(){
srand((unsigned int)time(NULL));
while(true){
printf("请选择你要强化的装备(7退出强化): \n");
for(int i = 1; i <= 6; i++){
printf("%d.%s; ", i, wps[i].c_str());
}
printf("\n");
int choose;
do{
cin >> choose;
if(choose == 7){
system("cls");
showWps();
showSourse();
int wpPrice, amPrice, tpsPrice, alhPrice, goldRmb;
printf("请输入当前一组10个武器破坏石的价格: "); cin >> wpPrice;
printf("请输入当前一组10个防具守护石的价格: "); cin >> amPrice;
printf("请输入当前突破石的价格: "); cin >> tpsPrice;
printf("请输入当前奥雷哈的价格: "); cin >> alhPrice;
printf("请输入当前1元能买多少金币: "); cin >> goldRmb;
golds += sam / 10 * amPrice + swp / 10 * wpPrice + tpsPrice * tps + alh * alhPrice;
printf("你总共消耗费用为: %.2lf", golds * 1.0 / goldRmb);
return 0;
}
}while(choose > 6 || choose < 1);
while(true){
system("cls");
printf("准备开始打造(%s)......\n", wps[choose].c_str());
printf("%s的等级是: %d\n", wps[choose].c_str(), levels[choose]);
printf("是否确认强化?(y:是, n: 否)\n");
char c; cin >> c;
if(c == 'y'){
system("cls");
// 消耗金币数量
golds += (choose <= 5 ? amGold[levels[choose]] : wpGold[levels[choose]]);
// 消耗石头数量
if(choose <= 5 ) sam += am[levels[choose]];
else swp += wp[levels[choose]];
// 消耗突破石数量
tps += (choose <= 5 ? amTps[levels[choose]] : wpTps[levels[choose]]);
// 消耗奥雷哈数量
alh += (choose <= 5 ? amALH[levels[choose]] : wpALH[levels[choose]]);
// 判断成功失败
if(successProbability(success[levels[choose]])) cout << "强化成功\n", levels[choose]++;
else cout << "强化失败\n";
showWps();
showSourse();
system("pause");
}else break;
}
}
return 0;
}
// 自动
#include <iostream>
#include <cstdio>
#include <string>
#include <ctime>
#include <cstdlib>
#include <windows.h>
using namespace std;
int golds, sam, swp, alh, tps, rmb;
string wps[7] = {"", "头盔", "胸甲", "手套", "护腿", "鞋子", "武器"};
int levels[7] = { 0, 0, 0, 0, 0, 0, 0};
double success[20]= {0.8, 0.8, 0.5, 0.5, 0.3, 0.3, 0.2, 0.2, 0.15, 0.15, 0.1, 0.1, 0.05, 0.05, 0.03, 0.03, 0.01, 0.01, 0.005, 0.005};
// 防具消耗金币数量
int amGold[20] = {0, 0, 0, 0, 70, 90, 110, 130, 130, 180, 350, 350, 350, 350, 350, 360, 380, 390, 400, 420};
// 武器消耗金币数量
int wpGold[20] = {0, 0, 0, 0, 120, 150, 180, 210, 250, 300, 680, 680, 680, 710, 730, 750, 780, 810, 840, 870};
// 防具守护石
int am[20] = {190, 190, 190, 230, 230, 230, 280, 330, 400, 470, 686, 686, 686, 780, 780, 780, 874, 874, 874, 968};
// 武器破坏石
int wp[20]= {310, 310, 310, 380, 380, 380, 460, 540, 660, 780, 1144, 1144, 1144, 1300, 1300, 1300, 1458, 1458, 1458, 1614};
// 防具突破石
int amTps[20] = {6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 14, 16, 16, 18, 20, 22, 24, 26, 28, 30};
// 武器突破石
int wpTps[20] = {10, 10, 11, 11, 12, 13, 14, 15, 16, 17, 22, 24, 28, 32, 32, 34, 38, 42, 44, 48};
// 防具消耗奥雷哈
int amALH[20] = {0, 0, 0, 0, 3, 3, 4, 4, 5, 6, 10, 10, 12, 14, 14, 16, 18, 20, 22, 24};
// 武器消耗奥雷哈
int wpALH[20] = {0, 0, 0, 0, 4, 4, 5, 6, 7, 8, 12, 14, 16, 18, 20, 22, 26, 28, 32, 36};
void showWps(){
for(int i = 1; i <= 6; i++){
printf("%s:%2d; ", wps[i].c_str(), levels[i]);
}
printf("\n");
}
void showSourse(){
printf("截止到现在共消耗: \n");
printf("金币 * %d; ", golds);
printf("武器破坏石 * %d; ", swp);
printf("防具守护石 * %d; ", sam);
printf("突破石 * %d; ", tps);
printf("奥雷哈数量 * %d\n", alh);
}
bool successProbability(double successRate) {
double randomValue = (double)rand() / RAND_MAX; // 生成 0 到 1 之间的随机数
cout << randomValue << endl;
return randomValue < successRate; // 判断是否强化成功
}
int main(){
srand((unsigned int)time(NULL));
for(int i = 1; i <= 6; i++){
int cnt;
while(levels[i] < 20){
cnt++;
system("cls");
printf("准备开始打造(%s)......\n", wps[i].c_str());
printf("%s的等级是: %d\n", wps[i].c_str(), levels[i]);
// 消耗金币数量
golds += (i <= 5 ? amGold[levels[i]] : wpGold[levels[i]]);
// 消耗石头数量
if(i <= 5 ) sam += am[levels[i]];
else swp += wp[levels[i]];
// 消耗突破石数量
tps += (i <= 5 ? amTps[levels[i]] : wpTps[levels[i]]);
// 消耗奥雷哈数量
alh += (i <= 5 ? amALH[levels[i]] : wpALH[levels[i]]);
// 判断成功失败
if(successProbability(success[levels[i]])) cout << "强化成功\n", levels[i]++;
else cout << "强化失败\n";
}
printf("经过%d次%s强化到20\n", cnt, wps[i].c_str());
Sleep(3000);
}
showSourse();
int wpPrice = 14, amPrice = 4, tpsPrice = 45, alhPrice = 9, goldRmb = 45;
//printf("请输入当前一组10个武器破坏石的价格: "); cin >> wpPrice;
//printf("请输入当前一组10个防具守护石的价格: "); cin >> amPrice;
//printf("请输入当前突破石的价格: "); cin >> tpsPrice;
//printf("请输入当前奥雷哈的价格: "); cin >> alhPrice;
//printf("请输入当前1元能买多少金币: "); cin >> goldRmb;
golds += sam / 10 * amPrice + swp / 10 * wpPrice + tpsPrice * tps + alh * alhPrice;
printf("你总共消耗费用为: %.2lf", golds * 1.0 / goldRmb);
return 0;
}

有话要说...