C++#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
struct thing
{
string type;
string name;
int attack;
int defense;
int health;
int num;
bool disposable;
int sharp;
int durability;
};
struct w
{
string name;
string b[100];
int bnum;
};
int health = 1000, maxhealth = 1000, defense = 10, attack = 100;
int capacity = 0;
int level = 1;
string name;
int nowway = 0, water = 0, maxwater = 10;
int bagi = 1, protectlevel;
string protect;
string canmakething[1000] = { "退出","木剑","木斧","木镐","工作台" };
int canmakethingi = 5;
string f[300] = {
{"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"},
{"+.........+..........................................................K...................+"},
{"+.......FV+..............................................................................+"},
{"+...................F..........T.........................................................+"},
{"+........+................+.............+.............V.......................CF.........+"},
{"+.......+................................................................................+"},
{"+..........................S...................................+.H.+..............B......+"},
{"+......F.......+.......+............V............................+.......................+"},
{"+...............V....+...............................................................Y...+"},
{"+....................F+........+.............++..........................................+"},
{"+.............................+C+.......o....I+.....o.............................F......+"},
{"+..........................................+++...........................................+"},
{"+.............................+.........................V................................+"},
{"+.........Y...........H......+..........o.......+..A...........+.........................+"},
{"+...........................+......+...........o+............++....G..............YV.....+"},
{"+.................................B...................+......+.I.........................+"},
{"+......................+++........+..............+++..........+..........................+"},
{"+.....................+..U+......................V........+....+.............Y...........+"},
{"+.......H...........++...++..............................................................+"},
{"+.......................+Y................++...................M.........................+"},
{"+......................................+...G+...........T................................+"},
{"+...H...........................................................................Y........+"},
{"+&.......................................................................................+"},
{"+*********G**************************************************G***************************+"},
{"+++++++++************o*******G********+++*********o************************G*+++++++*****+"},
{"+*****+++++++++++++++++++++*******************************+++++++++++++++++++++**********+"},
{"+*****************************************++++++++++****************************++++++++++"},
{"+*******************++++++++***+++++++*o**************************G**********************+"},
{"+****************************************************************************************+"},
{"++++++******G****************************************************************************+"},
{"+**************************************+++++++++++++++++++++++++++++*********************+"},
{"+****************************************************************************************+"},
{"+********++++++++************G******************************************G****************+"},
{"+*******************************************G***********************************++++++++++"},
{"+****************************************************************************************+"},
{"+**********************************++++++++++++++++++++++********************************+"},
{"+*******************++++++++++++++++++++++++++***********G*****+++++++*******************+"},
{"+********G*******************************************************************************+"},
{"++++++++++++++***************************************************************************+"},
{"+*************************G**************************************************************+"},
{"+************************************************************************G***************+"},
{"+**********************************************************++++++++++++******************+"},
{"+**********+++++++***********************************************************************+"},
{"+**************++++++++++++++++********************G*************************************+"},
{"+****************************************************************************************+"},
{"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"},
};
bool isf[1000][10000];
int movex[4] = { 0,-1,0,1 };
int movey[4] = { -1,0,1,0 };
const char gmp[1000]="H:巨坑 I:铁矿 C:煤矿 G:金矿 o:小镇 Y:城市 V:洞穴 S:飞船 F:战场 M:沼泽 T:钛矿 P:前哨 B:硫磺矿 K:军事基地 &:boos *:沙漠 ^:大海 E:珊瑚礁 ";
int Outpostx[100], opxi = 0;
int Outposty[100], opyi = 0;
w way[100] = {
{"池塘",{"进入森林","背包","状态","装备","制作"}, 5},
{"帮助&设置",{"制造配方","地图指南","存档码","导入存档"},1}
};
string str(int n)
{
string s="",t="";
while(n--) s+=n%10+'0',n/=10;
for(int i=s.size()-1;i>=0;i--) t[s.size()-i-1]=s[i];
return t;
}
int waynum = 2;
bool isw[100] = { true, false, false };
bool isb[100] = { true, false, false };
thing nowaxe, nowpickaxe, nowweapon, nowhoe, nowwear, nowx;
thing bag[1000] = {
{"退出","退出",0,0,0,0,false},
};
string outbutton()
{
char c;
int now = 0;
for (int i = 0; i < 100; i++)
{
if (isb[i] == true)
{
now = i;
}
}
while (1)
{
system("cls");
for (int i = 0; way[i].name != ""; i++)
{
if (isw[i] == true)
{
cout << "*" << way[i].name << "*";
}
else
{
cout << " " << way[i].name << " ";
}
}
cout << endl;
for (int i = 0; way[nowway].b[i] != ""; i++)
{
if (isb[i] == true)
{
cout << ">" << way[nowway].b[i] << "<" << endl;
}
else
{
cout << " " << way[nowway].b[i] << " " << endl;
}
}
c = _getch();
if (c == 'w' && now > 0)
{
isb[now] = false;
isb[now - 1] = true;
now -= 1;
}
if (c == 's' && way[nowway].b[now + 1] != "")
{
isb[now] = false;
isb[now + 1] = true;
now += 1;
}
if (c == 'a' && nowway > 0)
{
isw[nowway] = false;
isw[nowway - 1] = true;
nowway -= 1;
isb[now] = false;
isb[0] = true;
}
if (c == 'd' && way[nowway + 1].name != "")
{
isw[nowway] = false;
isw[nowway + 1] = true;
nowway += 1;
isb[now] = false;
isb[0] = true;
}
if (c == 32)
{
return way[nowway].b[now];
}
}
return "";
}
string outbag()
{
char c;
int now = 0;
bool isbag[1000] = { true, false };
while (1)
{
system("cls");
for (int i = 0; bag[i].name != ""; i++)
{
if (isbag[i] == true)
{
cout << ">" << bag[i].name << "<";
}
else
{
cout << " " << bag[i].name << " ";
}
for (int j = 0; j < 20 - bag[i].name.size() - to_string(bag[i].num).size(); j++)
{
cout << " ";
}
cout << bag[i].num << " " << bag[i].durability << endl;
}
c = _getch();
if (c == 'w' && now > 0)
{
isbag[now] = false;
isbag[now - 1] = true;
now -= 1;
}
if (c == 's' && bag[now + 1].name != "")
{
isbag[now] = false;
isbag[now + 1] = true;
now += 1;
}
if (c == 32)
{
return bag[now].name;
}
}
return 0;
}
bool skills[10];
string skillers[10]={"勘察术","美食家","矿工","收集家","野蛮人","战士","铠甲人","医生","忍者"};
int fight(string hn, int hmh, int ha, int hd, int hh)
{
while (1)
{
if (nowweapon.type == "剑") cout << "1,扎刺";
else if (nowweapon.type == "刀") cout << "1,劈砍";
else if (nowweapon.type == "机枪") cout << "1,扫射";
else if (nowweapon.type == "手枪") cout << "1,射击";
else if (nowweapon.type == "") cout << "1,拳击";
bool is1 = false, is2 = false, is3 = false;
int i1, i2, i3, i4;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "手雷" && bag[i].num != 0)
{
cout << " 2,丢出[" << bag[i].num << "]";
is1 = true;
i1 = i;
break;
}
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "长矛" && bag[i].num != 0)
{
cout << " 3,投掷[" << bag[i].num << "]";
is2 = true;
i2 = i;
break;
}
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "熏肉" && bag[i].num != 0)
{
cout << " 4,吃肉[" << bag[i].num << "]";
is3 = true;
i3 = i;
break;
}
}
if (skills[7])
{
cout << "5,医治";
}
for (int i = 0; i < 1000; i++)
{
if ((bag[i].name == "大瓜" || bag[i].name == "野菜") && bag[i].num != 0)
{
cout << " 6,吃瓜[" << bag[i].num << "]";
is3 = true;
i3 = i;
break;
}
}
string which;
cin >> which;
int bullet = 0, missile = 0;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "子弹")
{
bullet = bag[i].num;
}
if (bag[i].name == "导弹")
{
missile = bag[i].num;
}
else if (bag[i].name == "")
{
break;
}
}
if (which == "1")
{
if (nowweapon.type == "剑" || nowweapon.type == "刀" || nowweapon.type == "")
{
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @E[" << hh << "/" << hmh << "]";
if (skills[5]) hh -= (attack + nowweapon.attack) * 2 - hd;
else hh -= attack + nowweapon.attack - hd;
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "] @ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E[" << hh << "/" << hmh << "]";
}
else if (nowweapon.name == "激光步枪" || bullet > 0 || (nowweapon.name == "火箭筒" && missile > 0))
{
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@o E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ o E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ o E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ o E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ o E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ o E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ o E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ oE[" << hh << "/" << hmh << "]";
if (skills[5]) hh -= (attack + nowweapon.attack) * 2 - hd;
else hh -= attack + nowweapon.attack - hd;
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E[" << hh << "/" << hmh << "]";
}
else if (bullet <= 0 || (nowweapon.name == "火箭筒" && missile <= 0))
{
MessageBox(0, TEXT("没弹药了..."), TEXT("重要提示"), MB_OK);
}
}
else if (which == "2" && is1)
{
hh -= 500;
system("cls");
cout << "砰!";
Sleep(100);
system("cls");
cout << "[" << health << "/" << maxhealth << "]@ E[" << hh << "/" << hmh << "]";
bag[i1].num--;
}
else if (which == "3" && is2)
{
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@> E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@-> E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ -> E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ -> E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ -> E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ -> E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ -> E[" << hh << "/" << hmh << "]";
Sleep(25);
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ ->E[" << hh << "/" << hmh << "]";
hh -= 200 - hd;
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E[" << hh << "/" << hmh << "]";
bag[i2].num--;
}
else if (which == "4" && is3)
{
if (skills[2])
{
cout << "生命+1000";
health += 1000;
if (health > maxhealth)
{
health = maxhealth;
}
}
else
{
cout << "生命+500";
health += 500;
if (health > maxhealth)
{
health = maxhealth;
}
}
bag[i3].num--;
}
else if (which == "5" && skills[7])
{
cout << "生命+1500";
health += 1500;
if (health > maxhealth)
{
health = maxhealth;
}
}
else if (which == "6" && is3)
{
cout << "生命+300,瓜子+1";
health += 300;
if (health > maxhealth)
{
health = maxhealth;
}
bag[i3].num--;
thing makething = { "种子","瓜的种子",0,0,0,1,false,10,20 };
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == makething.name)
{
bag[j].num++;
break;
}
if (bag[j].name == "")
{
bag[j] = makething;
break;
}
}
}
if (hh <= 0)
{
cout << "对方死亡";
return 1;
}
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E[" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@E [" << hh << "/" << hmh << "]";
if (skills[8])
{
if (rand() % 3 == 2) health -= ha + -defense;
}
else if (rand() % 2) health -= ha + -defense;
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E [" << hh << "/" << hmh << "]";
system("cls");
cout << "\n\n\n\n\n";
cout << "[" << health << "/" << maxhealth << "]@ E[" << hh << "/" << hmh << "]";
cout << endl;
if (health <= 0)
{
cout << "你死亡";
Sleep(100);
return 0;
}
}
return 0;
}
void slowly(const char* p)
{
while (1)
{
if (*p != 0)
{
printf("%c", *p++);
}
else
{
break;
}
Sleep(40);
}
}
int welcome()
{
cout << "________________________________________" << endl;
cout << "| 野外生存1.1.1 (不支持存档) |" << endl;
cout << "| |" << endl;
cout << "| !!!注意,请开全屏!!! |" << endl;
cout << "| |" << endl;
cout << "| |" << endl;
cout << "| 本页面会持续更新... |" << endl;
cout << "| |" << endl;
cout << "| |" << endl;
cout << "| |" << endl;
cout << "|______________________________________|" << endl;
_getch();
return 0;
}
int start()
{
system("cls");
_getch();
return 0;
}
bool isinto = false;
int town(int y, int x)
{
system("cls");
cout << " ___小镇_______" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|______________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "一个村民手拿大刀,拦在了入口处" << endl;
_getch();
if (!fight("村民", 1000, 100, 10, 1000))
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(100);
return 0;
}
system("cls");
int xunrou = rand() % 3, changmao = rand() % 2, rou = rand() % 5;
cout << "掉落:" << endl;
cout << "1,熏肉*" << xunrou << endl;
cout << "2,肉*" << rou << endl;
cout << "3,长矛*" << changmao << endl;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "熏肉")
{
bag[j].num += xunrou;
break;
}
if (bag[j].name == "" && xunrou != 0)
{
bag[j] = { "食物","熏肉",0,0,0,xunrou,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "肉")
{
bag[j].num += rou;
break;
}
if (bag[j].name == "" && rou != 0)
{
bag[j] = { "食物","肉",0,0,0,rou,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "长矛")
{
bag[j].num += changmao;
break;
}
if (bag[j].name == "" && changmao != 0)
{
bag[j] = { "武器","长矛",0,0,0,changmao,false,0 };
break;
}
}
_getch();
system("cls");
cout << "另一个村民手拿着长矛,跑了过来" << endl;
_getch();
if (!fight("村民", 1000, 100, 10, 1000))
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(100);
return 0;
}
int pimao = rand() % 3, buliao = rand() % 5;
rou = rand() % 5;
cout << "掉落:" << endl;
cout << "1,皮毛*" << pimao << endl;
cout << "2,肉*" << rou << endl;
cout << "3,布料*" << buliao << endl;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "皮毛")
{
bag[j].num += pimao;
break;
}
if (bag[j].name == "" && pimao != 0)
{
bag[j] = { "物品","皮毛",0,0,0,pimao,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "肉")
{
bag[j].num += rou;
break;
}
if (bag[j].name == "" && rou != 0)
{
bag[j] = { "食物","肉",0,0,0,rou,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "布料")
{
bag[j].num += rou;
break;
}
if (bag[j].name == "" && rou != 0)
{
bag[j] = { "物品","布料",0,0,0,buliao,false,0 };
break;
}
}
_getch();
system("cls");
cout << "安静下来了" << endl;
_getch();
pimao = rand() % 3; buliao = rand() % 5; rou = rand() % 5;
cout << "获得:" << endl;
cout << "1,皮毛*" << pimao << endl;
cout << "2,肉*" << rou << endl;
cout << "3,布料*" << buliao << endl;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "皮毛")
{
bag[j].num += pimao;
break;
}
if (bag[j].name == "")
{
bag[j] = { "物品","皮毛",0,0,0,pimao,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "肉")
{
bag[j].num += rou;
break;
}
if (bag[j].name == "")
{
bag[j] = { "食物","肉",0,0,0,rou,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "布料")
{
bag[j].num += rou;
break;
}
if (bag[j].name == "" && rou != 0)
{
bag[j] = { "物品","布料",0,0,0,buliao,false,0 };
break;
}
}
_getch();
slowly("你离开了小镇...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
return 1;
}
else if (c != 'n')
{
town(y, x);
}
return 1;
}
int hole(int y, int x)
{
system("cls");
cout << " __巨坑_______" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|______________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "外星人举起了枪..." << endl;
_getch();
int xxs=fight("外星人", 10000, 1000, 100, 10000);
if(xxs)
{
int waixinghejin = rand() % 3 + 1, taihejin = rand() % 5 + 1, jiguangbuqiang = rand() % 3 + 1;
cout << "掉落:" << endl;
cout << "1,外星合金*" << waixinghejin << endl;
cout << "2,钛合金*" << taihejin << endl;
cout << "3,激光步枪*" << jiguangbuqiang << endl;
bool isfind = false;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "外星合金")
{
isfind = true;
bag[j].num += waixinghejin;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "材料","外星合金",0,0,0,waixinghejin,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "钛合金")
{
isfind = true;
bag[j].num += taihejin;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "材料","钛合金",0,0,0,taihejin,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "激光步枪")
{
isfind = true;
bag[j].num += jiguangbuqiang;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "武器","激光步枪",0,0,0,jiguangbuqiang,false,0 };
break;
}
}
_getch();
system("cls");
slowly("你离开了巨坑...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
}
else
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(1000);
return 0;
}
}
else if (c != 'n')
{
hole(y, x);
}
return 0;
}
int boss1(int y, int x)
{
system("cls");
cout << " __森林之神_____" << endl;
cout << "|是否挑战 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|______________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "森林之神睁开了双眼..." << endl;
_getch();
int xxs=fight("森林之神的考验", 30000, 1500, 150, 30000);
if(xxs)
{
cout << "森林之神赠与了你:" << endl;
cout << "森林之靴*1"<< endl;
_getch();
slowly("靴子散发着一股草的清香。你迫不及待穿上了靴子,不大不小正合适。穿上后,你感受到了一股透在骨子里的清凉,似乎可以抵御沙漠的炎热...");
level++;
bool isfind = false;
_getch();
system("cls");
slowly("你回到了池塘");
f[y][x] = '.';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
}
else
{
system("cls");
slowly("森林之神摇了摇头后,你立刻被传送回了池塘...");
Sleep(1000);
return 0;
}
}
else if (c != 'n')
{
boss1(y, x);
}
return 0;
}
int iron(int y, int x)
{
system("cls");
cout << " ___铁矿_______" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|_____________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "野兽来袭..." << endl;
_getch();
int xxs=fight("野兽", 5000, 500, 50, 5000);
if(xxs)
{
int tie = rand() % 3 + 1;
cout << "掉落:" << endl;
cout << "1,铁*" << tie << endl;
bool isfind = false;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "铁")
{
isfind = true;
bag[j].num += tie;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "材料","铁",0,0,0,tie,false,0 };
break;
}
}
_getch();
system("cls");
for (int i = 0; i < 100; i++)
{
if (way[i].name == "挖矿之路")
{
way[i].b[way[i].bnum++] = "挖铁矿";
break;
}
if (way[i].name == "")
{
way[waynum++] = { "挖矿之路",{"挖铁矿"},1 };
break;
}
}
slowly("你离开了铁矿...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
}
else
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(1000);
return 0;
}
}
else if (c == 'n')
{
iron(y, x);
}
return 0;
}
int muddle(int y, int x)
{
system("cls");
cout << " ___沼泽_______" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|_____________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "野兽来袭..." << endl;
_getch();
int xxs=fight("野兽", 5000, 500, 50, 5000);
if(xxs)
{
int tie = rand() % 3 + 1;
cout << "掉落:" << endl;
cout << "1,瓜的种子*" << tie << endl;
bool isfind = false;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "瓜的种子")
{
isfind = true;
bag[j].num += tie;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "种子","瓜的种子",0,0,0,tie,false,0 };
break;
}
}
_getch();
system("cls");
for (int i = 0; i < 100; i++)
{
if (way[i].name == "植物园")
{
way[i].b[way[i].bnum++] = "瓜田";
break;
}
if (way[i].name == "")
{
way[waynum++] = { "植物园",{"瓜田"},1 };
break;
}
}
slowly("你离开了沼泽...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
}
else
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(1000);
return 0;
}
}
else if (c != 'n')
{
iron(y, x);
}
return 0;
}
int coal(int y, int x)
{
system("cls");
cout << " ___煤矿_______" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|_____________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "野兽来袭..." << endl;
_getch();
int xxs=fight("野兽", 7000, 300, 100, 7000);
if(xxs)
{
int mei = rand() % 3 + 1;
cout << "掉落:" << endl;
cout << "1,煤*" << mei << endl;
bool isfind = false;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "煤")
{
isfind = true;
bag[j].num += mei;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "材料","煤",0,0,0,mei,false,0 };
break;
}
}
_getch();
system("cls");
for (int i = 0; i < 100; i++)
{
if (way[i].name == "挖矿之路")
{
way[i].b[way[i].bnum++] = "挖煤矿";
break;
}
if (way[i].name == "")
{
way[waynum++] = { "挖矿之路",{"挖煤矿"},1 };
break;
}
}
slowly("你离开了煤矿...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
}
else
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(1000);
return 0;
}
}
else if (c != 'n')
{
coal(y, x);
}
return 0;
}
int gold(int y, int x)
{
system("cls");
cout << " ___金矿_______" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|_____________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "野兽来袭..." << endl;
_getch();
int xxs=fight("野兽", 10000, 500, 70, 10000);
if(xxs)
{
int mei = rand() % 3 + 1;
cout << "掉落:" << endl;
cout << "1,金*" << mei << endl;
bool isfind = false;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "金")
{
isfind = true;
bag[j].num += mei;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "材料","金",0,0,0,mei,false,0 };
break;
}
}
_getch();
system("cls");
for (int i = 0; i < 100; i++)
{
if (way[i].name == "挖矿之路")
{
way[i].b[way[i].bnum++] = "挖金矿";
break;
}
if (way[i].name == "")
{
way[waynum++] = { "挖矿之路",{"挖金矿"},1 };
break;
}
}
slowly("你离开了金矿...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
}
else
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(1000);
return 0;
}
}
else if (c != 'n')
{
coal(y, x);
}
return 0;
}
int tai(int y, int x)
{
system("cls");
cout << " ___钛矿_______" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|_____________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "野兽来袭..." << endl;
_getch();
int xxs=fight("野兽", 10000, 500, 70, 10000);
if(xxs)
{
int mei = rand() % 3 + 1;
cout << "掉落:" << endl;
cout << "1,钛*" << mei << endl;
bool isfind = false;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "钛")
{
isfind = true;
bag[j].num += mei;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "材料","钛",0,0,0,mei,false,0 };
break;
}
}
_getch();
system("cls");
for (int i = 0; i < 100; i++)
{
if (way[i].name == "挖矿之路")
{
way[i].b[way[i].bnum++] = "挖钛矿";
break;
}
if (way[i].name == "")
{
way[waynum++] = { "挖矿之路",{"挖钛矿"},1 };
break;
}
}
slowly("你离开了钛矿...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
}
else
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(1000);
return 0;
}
}
else if (c != 'n')
{
coal(y, x);
}
return 0;
}
int brenstone(int y, int x)
{
system("cls");
cout << " ___硫磺矿_____" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|_____________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "野兽来袭..." << endl;
_getch();
int xxs=fight("野兽", 10000, 800, 10, 10000);
if(xxs)
{
int mei = rand() % 3 + 1;
cout << "掉落:" << endl;
cout << "1,硫磺*" << mei << endl;
bool isfind = false;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "硫磺")
{
isfind = true;
bag[j].num += mei;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "材料","硫磺",0,0,0,mei,false,0 };
break;
}
}
_getch();
system("cls");
for (int i = 0; i < 100; i++)
{
if (way[i].name == "挖矿之路")
{
way[i].b[way[i].bnum++] = "挖硫磺矿";
break;
}
if (way[i].name == "")
{
way[waynum++] = { "挖矿之路",{"挖硫磺矿"},1 };
break;
}
}
slowly("你离开了硫磺矿...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
}
else
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(1000);
return 0;
}
}
else if (c != 'n')
{
coal(y, x);
}
return 0;
}
int space_ship(int y, int x)
{
system("cls");
cout << " ___外星飞船___" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|_____________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "火星怪物来袭..." << endl;
_getch();
int xxs=fight("火星怪物", 10000, 1000, 100, 10000);
if(xxs)
{
int waixinghejin = rand() % 10 + 6;
cout << "掉落:" << endl;
cout << "1,外星合金*" << waixinghejin << endl;
cout << "2,跃迁式水袋[容量80]*1"<< endl;
_getch();
slowly("你晃了晃水袋,水袋竟飞向高空,消失不见...");
maxwater = 80;
bool isfind = false;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "外星合金")
{
isfind = true;
bag[j].num += waixinghejin;
break;
}
if (bag[j].name == "" && !isfind)
{
bag[j] = { "材料","外星合金",0,0,0,waixinghejin,false,0 };
break;
}
}
_getch();
system("cls");
slowly("你离开了外星飞船...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
}
else
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(1000);
return 0;
}
}
else if (c != 'n')
{
coal(y, x);
}
return 0;
}
int smallhole(int y, int x)
{
system("cls");
cout << " ___洞穴_______" << endl;
cout << "|是否进入 |" << endl;
cout << "|(y/n) |" << endl;
cout << "|______________|" << endl;
char c;
cin >> c;
if (c == 'y')
{
system("cls");
cout << "一只蜘蛛拦在了入口处" << endl;
_getch();
if (!fight("蜘蛛", 4000, 300, 50, 4000))
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(100);
return 0;
}
system("cls");
int xunrou = rand() % 60 + 9, changmao = rand() % 2, rou = rand() % 5;
cout << "掉落:" << endl;
cout << "1,蛛丝*" << xunrou << endl;
cout << "2,肉*" << rou << endl;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "蛛丝")
{
bag[j].num += xunrou;
break;
}
if (bag[j].name == "" && xunrou != 0)
{
bag[j] = { "材料","蛛丝",0,0,0,xunrou,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "肉")
{
bag[j].num += rou;
break;
}
if (bag[j].name == "" && rou != 0)
{
bag[j] = { "食物","肉",0,0,0,rou,false,0 };
break;
}
}
_getch();
system("cls");
cout << "另一个骷髅手拿着弓箭,跑了过来" << endl;
_getch();
if (!fight("骷髅", 4000, 300, 50, 4000))
{
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(100);
return 0;
}
int pimao = rand() % 3, buliao = rand() % 5;
rou = rand() % 5;
cout << "掉落:" << endl;
cout << "1,骨头*" << pimao << endl;
cout << "2,布料*" << rou << endl;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "骨头")
{
bag[j].num += pimao;
break;
}
if (bag[j].name == "" && pimao != 0)
{
bag[j] = { "物品","骨头",0,0,0,pimao,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "布料")
{
bag[j].num += rou;
break;
}
if (bag[j].name == "" && rou != 0)
{
bag[j] = { "资源","布料",0,0,0,rou,false,0 };
break;
}
}
_getch();
system("cls");
cout << "安静下来了" << endl;
_getch();
pimao = rand() % 3; buliao = rand() % 5; rou = rand() % 5;
cout << "获得:" << endl;
cout << "1,神秘花种子*" << pimao << endl;
cout << "2,苔藓*" << rou << endl;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "神秘花种子")
{
bag[j].num += pimao;
break;
}
if (bag[j].name == "")
{
bag[j] = { "种子","神秘花种子",0,0,0,pimao,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "苔藓")
{
bag[j].num += rou;
break;
}
if (bag[j].name == "")
{
bag[j] = { "食物","苔藓",0,0,0,rou,false,0 };
break;
}
}
_getch();
for (int i = 0; i < 100; i++)
{
if (way[i].name == "植物园")
{
way[i].b[way[i].bnum++] = "神秘花花盆";
break;
}
if (way[i].name == "")
{
way[waynum++] = { "植物园",{"神秘花花盆"},1 };
break;
}
}
slowly("你离开了洞穴...");
f[y][x] = 'P';
Outpostx[opxi++] = x;
Outposty[opyi++] = y;
return 1;
}
else if (c == 'n')
{
smallhole(y, x);
}
return 1;
}
int forest()
{
int x = 51, y = 14;
char c;
for (int i = 0; i < opxi; i++) f[Outposty[i]][Outpostx[i]] = 'P';
while (1)
{
system("cls");
cout << "水:" << water << "/" << maxwater << endl;
f[y][x] = '@';
if (skills[0])
{
isf[y + 3][x] = true;
isf[y + 2][x + 1] = true; isf[y + 2][x] = true; isf[y + 2][x - 1] = true;
isf[y + 1][x + 2] = true; isf[y + 1][x + 1] = true; isf[y + 1][x] = true; isf[y + 1][x - 1] = true; isf[y + 1][x - 2] = true;
isf[y][x + 3] = true; isf[y][x + 2] = true; isf[y][x + 1] = true; isf[y][x] = true; isf[y][x - 1] = true; isf[y][x - 2] = true; isf[y][x - 3] = true;
isf[y - 1][x + 2] = true; isf[y - 1][x + 1] = true; isf[y - 1][x] = true; isf[y - 1][x - 1] = true; isf[y - 1][x - 2] = true;
isf[y - 2][x + 1] = true; isf[y - 2][x] = true; isf[y - 2][x - 1] = true;
isf[y - 3][x] = true;
}
else
{
isf[y + 2][x] = true;
isf[y + 1][x + 1] = true; isf[y + 1][x] = true; isf[y + 1][x - 1] = true;
isf[y][x + 2] = true; isf[y][x + 1] = true; isf[y][x]; isf[y][x] = true; isf[y][x - 1] = true; isf[y][x - 2] = true;
isf[y - 1][x + 1] = true; isf[y - 1][x] = true; isf[y - 1][x - 1] = true;
isf[y - 2][x] = true;
}
for (int i = y - 100; i < y + 100; i++)
{
if (i < 0 || i > 45)
{
continue;
}
for (int j = x - 20; j < x + 20; j++)
{
if (j >= 0 && j <= 100)
{
if (isf[i][j])
{
cout << f[i][j];
}
else
{
cout << " ";
}
}
}
cout << endl;
}
c = _getch();
water--;
if (water == -1) MessageBox(0, TEXT("你感觉口干舌燥"), TEXT("重要提示"), MB_OK);
if (water == -2)
{
MessageBox(0, TEXT("你倒下了..."), TEXT("重要提示"), MB_OK);
system("cls");
slowly("眼前的世界烟消云散...");
Sleep(100);
f[y][x] = '.';
return 0;
}
int move = 4;
if (c == 'w') move = 0;
if (c == 'a') move = 1;
if (c == 's') move = 2;
if (c == 'd') move = 3;
if (move == 4)
{
continue;
}
if (f[y + movey[move]][x + movex[move]] == 'o')
{
if (!town(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == 'H')
{
if (!hole(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == '&')
{
if (!boss1(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == 'B')
{
if (!brenstone(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == 'I')
{
if (!iron(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == 'T')
{
if (!tai(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == 'C')
{
if (!coal(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == 'G')
{
if (!gold(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == 'S')
{
if (!space_ship(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == 'M')
{
if (!muddle(y + movey[move], x + movex[move]))
{
f[y][x] = '.';
return 0;
}
}
else if (f[y + movey[move]][x + movex[move]] == 'P')
{
f[y + movey[move]][x + movex[move]] = '@';
f[y][x] = '.';
y += movey[move];
x += movex[move];
MessageBox(0, TEXT("水补充好了"), TEXT("前方哨所"), MB_OK);
water = maxwater;
MessageBox(0, TEXT("熏肉+7"), TEXT("前方哨所"), MB_OK);
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "熏肉")
{
bag[j].num += 7;
break;
}
if (bag[j].name == "")
{
bag[j] = { "食物","熏肉",0,0,0,7,false,0 };
break;
}
}
}
else if (f[y + movey[move]][x + movex[move]] == 'U')
{
slowly("你来到了一个村庄,是时候享用那些人留下的成绩了...");
int jiguangbuqiang, shoulai, daodan, zidan, buqiang, gang, tie, mei, waixinghejin, taihejin, huojiantong;
jiguangbuqiang = rand() % 2 + 1; shoulai = rand() % 3 + 2; daodan = rand() % 3 + 1;
zidan = rand() % 50 + 50; buqiang = rand() % 5 + 1; waixinghejin = rand() % 5 + 5;
tie = rand() % 10 + 10; mei = rand() % 10 + 10; gang = rand() % 10 + 10;
taihejin = rand() % 10 + 10, huojiantong = rand() % 2 + 1;
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "激光步枪")
{
bag[j].num += jiguangbuqiang;
break;
}
if (bag[j].name == "")
{
bag[j] = { "机枪","激光步枪",1000,0,0,jiguangbuqiang,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "手雷")
{
bag[j].num += shoulai;
break;
}
if (bag[j].name == "")
{
bag[j] = { "武器","手雷",0,0,0,shoulai,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "导弹")
{
bag[j].num += daodan;
break;
}
if (bag[j].name == "")
{
bag[j] = { "武器","导弹",0,0,0,daodan,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "子弹")
{
bag[j].num += zidan;
break;
}
if (bag[j].name == "")
{
bag[j] = { "武器","子弹",0,0,0,zidan,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "火箭筒")
{
bag[j].num += huojiantong;
break;
}
if (bag[j].name == "")
{
bag[j] = { "机枪","火箭筒",700,0,0,huojiantong,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "步枪")
{
bag[j].num += buqiang;
break;
}
if (bag[j].name == "")
{
bag[j] = { "机枪","步枪",300,0,0,buqiang,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "钢")
{
bag[j].num += gang;
break;
}
if (bag[j].name == "")
{
bag[j] = { "材料","钢",0,0,0,gang,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "铁")
{
bag[j].num += tie;
break;
}
if (bag[j].name == "")
{
bag[j] = { "材料","铁",0,0,0,tie,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "煤")
{
bag[j].num += mei;
break;
}
if (bag[j].name == "")
{
bag[j] = { "材料","煤",0,0,0,mei,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "外星合金")
{
bag[j].num += waixinghejin;
break;
}
if (bag[j].name == "")
{
bag[j] = { "材料","外星合金",0,0,0,waixinghejin,false,0 };
break;
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == "钛合金")
{
bag[j].num += taihejin;
break;
}
if (bag[j].name == "")
{
bag[j] = { "材料","钛合金",0,0,0,taihejin,false,0 };
break;
}
}
MessageBox(0, TEXT("你看着这些东西,突然觉悟"), TEXT("你"), MB_OK);
MessageBox(0, TEXT("我能造出更多东西了"), TEXT("你"), MB_OK);
canmakething[canmakethingi++] = "钢";
canmakething[canmakethingi++] = "精铁";
canmakething[canmakethingi++] = "钢刀";
canmakething[canmakethingi++] = "钢剑";
canmakething[canmakethingi++] = "钢镐";
canmakething[canmakethingi++] = "钢斧";
canmakething[canmakethingi++] = "铁刀";
canmakething[canmakethingi++] = "精铁剑";
canmakething[canmakethingi++] = "精铁镐";
canmakething[canmakethingi++] = "精铁斧";
canmakething[canmakethingi++] = "强·石斧";
canmakething[canmakethingi++] = "强·石剑";
canmakething[canmakethingi++] = "强·石镐";
canmakething[canmakethingi++] = "木锄";
canmakething[canmakethingi++] = "石锄";
canmakething[canmakethingi++] = "铁锄";
canmakething[canmakethingi++] = "工作室";
_getch();
}
if (f[y + movey[move]][x + movex[move]] == 'A')
{
f[y][x] = '.';
return 0;
}
if (f[y + movey[move]][x + movex[move]] == '.')
{
f[y][x] = '.';
f[y + movey[move]][x + movex[move]] = '@';
y += movey[move];
x += movex[move];
}
if (f[y + movey[move]][x + movex[move]] == '*')
{
if(level>=2)
{
f[y][x] = '*';
f[y + movey[move]][x + movex[move]] = '@';
y += movey[move];
x += movex[move];
}
else
{
slowly("眼前的沙漠一望无际...");
}
}
}
return 0;
}
int weapon()
{
char c;
int now = 0;
bool isbag[1000] = { true, false };
thing bag2[1000];
int bag2i = 0;
for (int i = 0; bag[i].name != ""; i++)
{
if (bag[i].type == "剑" || bag[i].type == "刀" || bag[i].type == "手枪" || bag[i].type == "机枪")
{
bag2[bag2i] = bag[i];
bag2i++;
}
}
while (1)
{
system("cls");
for (int i = 0; bag2[i].name != ""; i++)
{
if (isbag[i] == true)
{
cout << ">" << bag2[i].name << "<";
}
else
{
cout << " " << bag2[i].name << " ";
}
cout << endl;
}
c = _getch();
if (c == 'w' && now > 0)
{
isbag[now] = false;
isbag[now - 1] = true;
now -= 1;
}
if (c == 's' && bag2[now + 1].name != "")
{
isbag[now] = false;
isbag[now + 1] = true;
now += 1;
}
if (c == 32)
{
nowweapon = bag2[now];
return 0;
}
}
return 0;
}
int tool_axe()
{
char c;
int now = 0;
bool isbag[1000] = { true, false };
thing bag2[1000];
int bag2i = 0;
for (int i = 0; bag[i].name != ""; i++)
{
if (bag[i].type == "斧头" && bag[i].num > 0)
{
bag2[bag2i] = bag[i];
bag2i++;
}
}
while (1)
{
system("cls");
for (int i = 0; bag2[i].name != ""; i++)
{
if (isbag[i] == true)
{
cout << ">" << bag2[i].name << "<";
}
else
{
cout << " " << bag2[i].name << " ";
}
cout << endl;
}
c = _getch();
if (c == 'w' && now > 0)
{
isbag[now] = false;
isbag[now - 1] = true;
now -= 1;
}
if (c == 's' && bag2[now + 1].name != "")
{
isbag[now] = false;
isbag[now + 1] = true;
now += 1;
}
if (c == 32)
{
nowaxe = bag2[now];
return 0;
}
}
return 0;
}
int tool_pickaxe()
{
char c;
int now = 0;
bool isbag[1000] = { true, false };
thing bag2[1000];
int bag2i = 0;
for (int i = 0; bag[i].name != ""; i++)
{
if (bag[i].type == "镐" && bag[i].num > 0)
{
bag2[bag2i] = bag[i];
bag2i++;
}
}
while (1)
{
system("cls");
for (int i = 0; bag2[i].name != ""; i++)
{
if (isbag[i] == true)
{
cout << ">" << bag2[i].name << "<";
}
else
{
cout << " " << bag2[i].name << " ";
}
cout << endl;
}
c = _getch();
if (c == 'w' && now > 0)
{
isbag[now] = false;
isbag[now - 1] = true;
now -= 1;
}
if (c == 's' && bag2[now + 1].name != "")
{
isbag[now] = false;
isbag[now + 1] = true;
now += 1;
}
if (c == 32)
{
nowpickaxe = bag2[now];
return 0;
}
}
return 0;
}
int tool_hoe()
{
char c;
int now = 0;
bool isbag[1000] = { true, false };
thing bag2[1000];
int bag2i = 0;
for (int i = 0; bag[i].name != ""; i++)
{
if (bag[i].type == "锄" && bag[i].num > 0)
{
bag2[bag2i] = bag[i];
bag2i++;
}
}
while (1)
{
system("cls");
for (int i = 0; bag2[i].name != ""; i++)
{
if (isbag[i] == true)
{
cout << ">" << bag2[i].name << "<";
}
else
{
cout << " " << bag2[i].name << " ";
}
cout << endl;
}
c = _getch();
if (c == 'w' && now > 0)
{
isbag[now] = false;
isbag[now - 1] = true;
now -= 1;
}
if (c == 's' && bag2[now + 1].name != "")
{
isbag[now] = false;
isbag[now + 1] = true;
now += 1;
}
if (c == 32)
{
nowhoe = bag2[now];
return 0;
}
}
return 0;
}
int tool_wear()
{
char c;
int now = 0;
bool isbag[1000] = { true, false };
thing bag2[1000];
int bag2i = 0;
for (int i = 0; bag[i].name != ""; i++)
{
if (bag[i].type == "甲" && bag[i].num > 0)
{
bag2[bag2i] = bag[i];
bag2i++;
}
}
while (1)
{
system("cls");
for (int i = 0; bag2[i].name != ""; i++)
{
if (isbag[i] == true)
{
cout << ">" << bag2[i].name << "<";
}
else
{
cout << " " << bag2[i].name << " ";
}
cout << endl;
}
c = _getch();
if (c == 'w' && now > 0)
{
isbag[now] = false;
isbag[now - 1] = true;
now -= 1;
}
if (c == 's' && bag2[now + 1].name != "")
{
isbag[now] = false;
isbag[now + 1] = true;
now += 1;
}
if (c == 32)
{
nowwear = bag2[now];
return 0;
}
}
return 0;
}
int tool_x()
{
char c;
int now = 0;
bool isbag[1000] = { true, false };
thing bag2[1000];
int bag2i = 0;
for (int i = 0; bag[i].name != ""; i++)
{
if (bag[i].type == "陷阱" && bag[i].num > 0)
{
bag2[bag2i] = bag[i];
bag2i++;
}
}
while (1)
{
system("cls");
for (int i = 0; bag2[i].name != ""; i++)
{
if (isbag[i] == true)
{
cout << ">" << bag2[i].name << "<";
}
else
{
cout << " " << bag2[i].name << " ";
}
cout << endl;
}
c = _getch();
if (c == 'w' && now > 0)
{
isbag[now] = false;
isbag[now - 1] = true;
now -= 1;
}
if (c == 's' && bag2[now + 1].name != "")
{
isbag[now] = false;
isbag[now + 1] = true;
now += 1;
}
if (c == 32)
{
nowx = bag2[now];
return 0;
}
}
return 0;
}
string make()
{
char c;
int now = 0;
bool isbag[1000] = { true, false };
while (1)
{
system("cls");
for (int i = 0; i < canmakethingi; i++)
{
if (isbag[i] == true)
{
cout << ">" << canmakething[i] << "<";
}
else
{
cout << " " << canmakething[i] << " ";
}
cout << endl;
}
c = _getch();
if (c == 'w' && now > 0)
{
isbag[now] = false;
isbag[now - 1] = true;
now -= 1;
}
if (c == 's' && canmakething[now + 1] != "")
{
isbag[now] = false;
isbag[now + 1] = true;
now += 1;
}
if (c == 32)
{
return canmakething[now];
}
}
return 0;
}
int make(string thi[100], int num[100], thing makething)
{
bool all = true;
for (int i = 0; thi[i] != ""; i++)
{
for (int j = 0; bag[j].name != ""; j++)
{
if (bag[j].name == thi[i])
{
all &= bag[j].num >= num[i];
}
}
}
if (all)
{
for (int i = 0; thi[i] != ""; i++)
{
for (int j = 0; bag[j].name != ""; j++)
{
if (bag[j].name == thi[i])
{
bag[j].num -= num[i];
}
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == makething.name)
{
bag[j].num++;
break;
}
if (bag[j].name == "")
{
bag[j] = makething;
break;
}
}
cout << "制作成功" << endl;
Sleep(100);
return 1;
}
else
{
cout << "材料不够..." << endl;
Sleep(100);
return 0;
}
return 0;
}
int plant(string thi[100], int num[100], thing makething)
{
bool all = true;
for (int i = 0; thi[i] != ""; i++)
{
for (int j = 0; bag[j].name != ""; j++)
{
if (bag[j].name == thi[i])
{
all &= bag[j].num >= num[i];
}
}
}
if (all)
{
for (int i = 0; thi[i] != ""; i++)
{
for (int j = 0; bag[j].name != ""; j++)
{
if (bag[j].name == thi[i])
{
bag[j].num -= num[i];
}
}
}
for (int j = 0; j < 1000; j++)
{
if (bag[j].name == makething.name)
{
bag[j].num++;
break;
}
if (bag[j].name == "")
{
bag[j] = makething;
break;
}
}
Sleep(1000);
return 1;
}
else
{
cout << "缺乏种子" << endl;
Sleep(1000);
return 0;
}
return 0;
}
int main()
{
srand((unsigned)time(NULL));
welcome();
start();
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "木头")
{
bag[i].num += 100;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","木头",0,0,0,100,false };
break;
}
}
while (1)
{
string a = outbutton();
if (a == "进入森林")
{
system("cls");
water = maxwater;
if (isinto == false)
{
isinto = true;
way[0].b[way[0].bnum++] = "伐木";
}
else
{
slowly("你进入森林");
forest();
}
}
else if (a == "背包")
{
system("cls");
outbag();
}
else if (a == "状态")
{
system("cls");
cout << "生命:" << health << "/" << maxhealth << endl;
cout << "防御:" << defense;
cout << "攻击" << attack << "+" << nowweapon.attack << "(" << attack + nowweapon.attack << ")" << endl;
cout << "装备武器:";
if (nowweapon.name != "") cout << nowweapon.name;
else cout << "未装备";
cout << " 剩余耐久:" << nowweapon.durability << endl;
cout << "装备斧头:";
if (nowaxe.name != "") cout << nowaxe.name;
else cout << "未装备";
cout << " 剩余耐久:" << nowaxe.durability << endl;
cout << "装备镐:";
if (nowpickaxe.name != "") cout << nowpickaxe.name;
else cout << "未装备";
cout << " 剩余耐久:" << nowpickaxe.durability << endl;
cout << "装备锄:";
if (nowhoe.name != "") cout << nowhoe.name;
else cout << "未装备";
cout << " 剩余耐久:" << nowhoe.durability << endl;
cout << "装备护甲:";
if (nowwear.name != "") cout << nowwear.name;
else cout << "未装备";
cout << " 剩余耐久:" << nowwear.durability << endl;
cout << "布设陷阱:";
if (nowwear.name != "") cout << nowx.name;
else cout << "未布设";
cout << " 剩余耐久:" << nowx.durability << endl;
_getch();
}
else if (a == "伐木")
{
if (nowaxe.name == "")
{
cout << "你未装备着斧头...";
Sleep(100);
}
else
{
int ran = rand() % 100 ;
if (ran < 2)
{
cout << "你遇到了野兽" << endl;
_getch();
fight("野兽", 3000, 50, 5, 3000);
}
else
{
ran = rand() % 20 + 8;
cout << "树上掉下来了几根树枝" << endl;
Sleep((rand() % 5000 + 10000) / nowaxe.sharp);
cout << "森林里躺着一棵大树" << endl;
Sleep((rand() % 5000 + 10000) / nowaxe.sharp);
cout << "\t你获得了" << ran << "根木头!" << endl;
_getch();
nowaxe.durability -= 1;
if (nowaxe.durability <= 0)
{
cout << "但很不幸,你的斧断了..." << endl;
cout << "\t你少了一把斧头" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == nowaxe.name)
{
bag[i].num--;
break;
}
}
nowaxe = {};
_getch();
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "木头")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","木头",0,0,0,ran,false };
break;
}
}
}
}
}
else if (a == "装备")
{
system("cls");
cout << " _请选择____________________________________________________" << endl;
cout << "|0,退出 1,武器 2,伐木工具 3,挖矿工具 4,种地工具 5,护甲|" << endl;
cout << "|___________________________________________________________|" << endl;
string x;
cin >> x;
if (x == "1")weapon();
if (x == "2")tool_axe();
if (x == "3")tool_pickaxe();
if (x == "4")tool_hoe();
if (x == "5")tool_wear();
}
else if (a == "制作")
{
string t = make();
if (t == "木剑")
{
string thi[100] = { "木头","" };
int num[100] = { 5,0 };
thing makething = { "剑","木剑",50,0,0,1,false,10,20 };
make(thi, num, makething);
}
else if (t == "木斧")
{
string thi[100] = { "木头","" };
int num[100] = { 5,0 };
thing makething = { "斧头","木斧",0,0,0,1,false,10,20 };
make(thi, num, makething);
}
else if (t == "木镐")
{
string thi[100] = { "木头","" };
int num[100] = { 5,0 };
thing makething = { "镐","木镐",0,0,0,1,false,10,20 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "工作台")
{
string thi[100] = { "木头","" };
int num[100] = { 5,0 };
thing makething = { "物品","工作台",0,0,0,1,false,0,100 };
if (make(thi, num, makething))
{
canmakething[canmakethingi++] = "陷阱";
canmakething[canmakethingi++] = "长矛";
canmakething[canmakethingi++] = "木刀";
canmakething[canmakethingi++] = "水袋[容量20]";
canmakething[canmakethingi++] = "石斧";
canmakething[canmakethingi++] = "石镐";
canmakething[canmakethingi++] = "石剑";
canmakething[canmakethingi++] = "木材";
canmakething[canmakethingi++] = "小屋";
canmakething[canmakethingi++] = "皮革室";
}
}
else if (t == "石质陷阱")
{
string thi[100] = { "木头","石头" };
int num[100] = { 20,10 };
thing makething = { "陷阱","石质陷阱",0,0,0,1,false,20,100 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "查看陷阱")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "查看陷阱";
way[0].bnum++;
break;
}
}
}
}
else if (t == "石剑")
{
string thi[100] = { "木头","石头" };
int num[100] = { 10,5 };
thing makething = { "剑","石剑",100,0,0,1,false,0,50 };
make(thi, num, makething);
}
else if (t == "石斧")
{
string thi[100] = { "木头","石头" };
int num[100] = { 10,5 };
thing makething = { "斧头","石斧",0,0,0,1,false,20,50 };
make(thi, num, makething);
}
else if (t == "石镐")
{
string thi[100] = { "木头","石头" };
int num[100] = { 10,5 };
thing makething = { "镐","石镐",0,0,0,1,false,20,50 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "长矛")
{
string thi[100] = { "木头","石头" };
int num[100] = { 10,5 };
thing makething = { "武器","长矛",0,0,0,1,false,20,100 };
make(thi, num, makething);
}
else if (t == "水袋[容量20]")
{
string thi[100] = { "木头","皮毛" };
int num[100] = { 5,5 };
thing makething = { "水袋","水袋",0,0,0,1,false,20,100 };
if (make(thi, num, makething))
{
if (maxwater < 20)
{
maxwater = 20;
}
}
}
else if (t == "木刀")
{
string thi[100] = { "木头","" };
int num[100] = { 60,0 };
thing makething = { "刀","木刀",75,0,0,1,false,20,100 };
make(thi, num, makething);
}
else if (t == "木材")
{
string thi[100] = { "木头" };
int num[100] = { 10 };
thing makething = { "材料","木材",100,100,100,100,false,100,100 };
make(thi, num, makething);
}
else if (t == "皮革室")
{
string thi[100] = { "木头","木材","石头","" };
int num[100] = { 100,50,50,0,0 };
thing makething = { "房间","皮革室",0,0,0,1,false,0,0 };
if (make(thi, num, makething))
{
MessageBox(0, TEXT("有皮革了..."), TEXT("你"), MB_OK);
way[waynum++] = { "皮革室",{"制造皮革",},1 };
}
}
else if (t == "小屋")
{
string thi[100] = { "木头","木材","石头","皮革","" };
int num[100] = { 100,50,50,15,0 };
thing makething = { "房间","小屋",0,0,0,1,false,0,0 };
if (make(thi, num, makething))
{
MessageBox(0, TEXT("终于有个可以休息的地方了..."), TEXT("你"), MB_OK);
MessageBox(0, TEXT("我可以造一些更好的东西了..."), TEXT("你"), MB_OK);
way[waynum++] = { "小屋",{"添柴",},1 };
canmakething[canmakethingi++] = "岩石";
canmakething[canmakethingi++] = "石刀";
canmakething[canmakethingi++] = "精·石剑";
canmakething[canmakethingi++] = "精·石斧";
canmakething[canmakethingi++] = "精·石剑";
canmakething[canmakethingi++] = "铁剑";
canmakething[canmakethingi++] = "铁斧";
canmakething[canmakethingi++] = "铁剑";
canmakething[canmakethingi++] = "客舍";
canmakething[canmakethingi++] = "水桶[容量30]";
canmakething[canmakethingi++] = "熏肉房";
}
}
else if (t == "岩石")
{
string thi[100] = { "石头" };
int num[100] = { 15,0 };
thing makething = { "材料","岩石",100,100,100,50,false,100,100 };
make(thi, num, makething);
}
else if (t == "精·石剑")
{
string thi[100] = { "木头","岩石" };
int num[100] = { 100,50 };
thing makething = { "剑","精·石剑",160,0,0,1,false,0,100 };
make(thi, num, makething);
}
else if (t == "精·石斧")
{
string thi[100] = { "木头","岩石" };
int num[100] = { 100,50 };
thing makething = { "斧头","精·石斧",0,0,0,1,false,30,100 };
make(thi, num, makething);
}
else if (t == "精·石镐")
{
string thi[100] = { "木头","岩石" };
int num[100] = { 100,50 };
thing makething = { "镐","精·石镐",0,0,0,1,false,30,100 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "精·长矛")
{
string thi[100] = { "木头","石头" };
int num[100] = { 5,10 };
thing makething = { "武器","长矛",0,0,0,1,false,20,100 };
make(thi, num, makething);
}
else if (t == "铁剑")
{
string thi[100] = { "木头","铁" };
int num[100] = { 200,10 };
thing makething = { "剑","铁剑",200,0,0,1,false,0,100 };
make(thi, num, makething);
}
else if (t == "铁斧")
{
string thi[100] = { "木头","铁" };
int num[100] = { 200,10 };
thing makething = { "斧头","铁斧",0,0,0,1,false,50,150 };
make(thi, num, makething);
}
else if (t == "铁镐")
{
string thi[100] = { "木头","铁" };
int num[100] = { 200,10 };
thing makething = { "镐","铁镐",0,0,0,1,false,50,150 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "石刀")
{
string thi[100] = { "木头","岩石" };
int num[100] = { 30,30 };
thing makething = { "刀","石刀",130,0,0,1,false,20,100 };
make(thi, num, makething);
}
else if (t == "铁刀")
{
string thi[100] = { "木头","铁" };
int num[100] = { 100,10 };
thing makething = { "刀","铁刀",180,0,0,1,false,20,100 };
make(thi, num, makething);
}
else if (t == "钢刀")
{
string thi[100] = { "木头","钢" };
int num[100] = { 100,10 };
thing makething = { "刀","钢刀",230,0,0,1,false,20,100 };
make(thi, num, makething);
}
else if (t == "水桶[容量30]")
{
string thi[100] = { "木材","皮毛","岩石" };
int num[100] = { 50,10,100 };
thing makething = { "水袋","水桶",0,0,0,1,false,20,100 };
if (make(thi, num, makething))
{
if (maxwater < 30)
{
maxwater = 30;
}
}
}
else if (t == "织布机")
{
string thi[100] = { "木头","木材","皮革","","" };
int num[100] = { 100,200,50,0,0 };
thing makething = { "房间","织布机",0,0,0,1,false,0,0 };
if (make(thi, num, makething))
{
MessageBox(0, TEXT("织布机造好了..."), TEXT("你"), MB_OK);
MessageBox(0, TEXT("总算有衣服穿了..."), TEXT("你"), MB_OK);
way[waynum++] = { "织布机",{"织布",},1 };
canmakething[canmakethingi++] = "线";
canmakething[canmakethingi++] = "棉";
canmakething[canmakethingi++] = "丝绸";
canmakething[canmakethingi++] = "布料";
canmakething[canmakethingi++] = "床";
}
}
else if (t == "床")
{
string thi[100] = { "丝绸","布料","棉","线" };
int num[100] = { 5, 10, 20, 30 };
thing makething = { "材料","床",0,0,0,1,false,0,0 };
make(thi, num, makething);
}
else if (t == "布料")
{
string thi[100] = { "线" };
int num[100] = { 5 };
thing makething = { "材料","布料",0,0,0,5,false,0,0 };
make(thi, num, makething);
}
else if (t == "丝绸")
{
string thi[100] = { "线" };
int num[100] = { 30 };
thing makething = { "材料","丝绸",0,0,0,5,false,0,0 };
make(thi, num, makething);
}
else if (t == "棉")
{
string thi[100] = { "线" };
int num[100] = { 20 };
thing makething = { "材料","棉",0,0,0,5,false,0,0 };
make(thi, num, makething);
}
else if (t == "线")
{
string thi[100] = { "蛛丝" };
int num[100] = { 10 };
thing makething = { "材料","线",0,0,0,5,false,0,0 };
make(thi, num, makething);
}
else if (t == "强·石剑")
{
string thi[100] = { "木材","岩石" };
int num[100] = { 100,50 };
thing makething = { "剑","强·石剑",250,0,0,1,false,0,100 };
make(thi, num, makething);
}
else if (t == "强·石斧")
{
string thi[100] = { "木材","岩石" };
int num[100] = { 100,50 };
thing makething = { "斧头","强·石斧",0,0,0,1,false,40,120 };
make(thi, num, makething);
}
else if (t == "强·石镐")
{
string thi[100] = { "木材","岩石" };
int num[100] = { 100,50 };
thing makething = { "镐","强·石镐",0,0,0,1,false,40,120 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "钢剑")
{
string thi[100] = { "木头","钢" };
int num[100] = { 100,10 };
thing makething = { "剑","钢剑",300,0,0,1,false,0,100 };
make(thi, num, makething);
}
else if (t == "钢斧")
{
string thi[100] = { "木头","钢" };
int num[100] = { 100,10 };
thing makething = { "斧头","钢斧",0,0,0,1,false,60,160 };
make(thi, num, makething);
}
else if (t == "钢镐")
{
string thi[100] = { "木头","钢" };
int num[100] = { 100,10 };
thing makething = { "镐","钢镐",0,0,0,1,false,60,160 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "钢")
{
string thi[100] = { "铁","煤" };
int num[100] = { 10,10 };
thing makething = { "材料","钢",0,0,0,5,false,20,100 };
make(thi, num, makething);
}
else if (t == "精铁剑")
{
string thi[100] = { "木头","精铁" };
int num[100] = { 200,10 };
thing makething = { "剑","精铁剑",250,0,0,1,false,0,100 };
make(thi, num, makething);
}
else if (t == "精铁斧")
{
string thi[100] = { "木头","精铁" };
int num[100] = { 200,10 };
thing makething = { "斧头","精铁斧",0,0,0,1,false,60,150 };
make(thi, num, makething);
}
else if (t == "精铁镐")
{
string thi[100] = { "木头","精铁" };
int num[100] = { 200,10 };
thing makething = { "镐","精铁镐",0,0,0,1,false,60,150 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "木锄")
{
string thi[100] = { "木头","" };
int num[100] = { 50,0 };
thing makething = { "锄","木锄",0,0,0,1,false,10,20 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "种菜")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "种菜";
way[0].bnum++;
break;
}
}
}
}
else if (t == "石锄")
{
string thi[100] = { "木头","石头" };
int num[100] = { 20,10 };
thing makething = { "锄","石锄",0,0,0,1,false,20,50 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "种菜")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "种菜";
way[0].bnum++;
break;
}
}
}
}
else if (t == "铁锄")
{
string thi[100] = { "木头","铁" };
int num[100] = { 20,10 };
thing makething = { "锄","铁锄",0,0,0,1,false,30,100 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "")
{
way[0].b[i] = "种菜";
way[0].bnum++;
break;
}
}
}
}
else if (t == "精铁")
{
string thi[100] = { "铁","" };
int num[100] = { 10 };
thing makething = { "材料","精铁",0,0,0,4,false,30,100 };
}
else if (t == "大水桶[容量40]")
{
string thi[100] = { "木材","皮毛","岩石" };
int num[100] = { 100,100,100 };
thing makething = { "水袋","大水桶",0,0,0,1,false,20,100 };
if (make(thi, num, makething))
{
if (maxwater < 40)
{
maxwater = 40;
}
}
}
else if (t == "工作室")
{
string thi[100] = { "木材","皮革","岩石" };
int num[100] = { 100,100,100 };
thing makething = { "物品","工作室",0,0,0,1,false,0,200 };
if (make(thi, num, makething))
{
MessageBox(0, TEXT("终于能好好做一些东西了..."), TEXT("你"), MB_OK);
canmakething[canmakethingi++] = "子弹";
canmakething[canmakethingi++] = "手枪";
canmakething[canmakethingi++] = "金子";
canmakething[canmakethingi++] = "水箱[容量50]";
canmakething[canmakethingi++] = "锋利·铁剑";
canmakething[canmakethingi++] = "锋利·铁镐";
canmakething[canmakethingi++] = "锋利·铁斧";
canmakething[canmakethingi++] = "耐久·铁镐";
canmakething[canmakethingi++] = "耐久·铁斧";
canmakething[canmakethingi++] = "锋利·耐久·铁镐";
canmakething[canmakethingi++] = "锋利·耐久·铁斧";
canmakething[canmakethingi++] = "锋利·钢剑";
canmakething[canmakethingi++] = "锋利·钢镐";
canmakething[canmakethingi++] = "锋利·钢斧";
canmakething[canmakethingi++] = "耐久·钢镐";
canmakething[canmakethingi++] = "耐久·钢斧";
canmakething[canmakethingi++] = "锋利·耐久·钢镐";
canmakething[canmakethingi++] = "锋利·耐久·钢斧";
canmakething[canmakethingi++] = "制造室";
canmakething[canmakethingi++] = "钉子";
canmakething[canmakethingi++] = "钢合金";
canmakething[canmakethingi++] = "钢甲";
canmakething[canmakethingi++] = "外星甲";
}
}
else if (t == "钉子")
{
string thi[100] = { "铁" };
int num[100] = { 1 };
thing makething = { "材料","钉子",0,0,0,200,false,0,0 };
make(thi, num, makething);
}
else if (t == "子弹")
{
string thi[100] = { "钢","硫磺" };
int num[100] = { 10,10 };
thing makething = { "弹药","子弹",0,0,0,10,true,0,1 };
make(thi, num, makething);
}
else if (t == "手枪")
{
string thi[100] = { "钢","铁" };
int num[100] = { 100,100 };
thing makething = { "手枪","手枪",500,0,0,1,false,0,1 };
make(thi, num, makething);
}
else if (t == "金子")
{
string thi[100] = { "金","" };
int num[100] = { 1 };
thing makething = { "钱","金子",0,0,0,10,false,0,1 };
make(thi, num, makething);
}
else if (t == "水箱[容量50]")
{
string thi[100] = { "木材","皮毛","岩石","钉子" };
int num[100] = { 100,100,100,50 };
thing makething = { "水袋","水箱",0,0,0,1,false,20,100 };
if (make(thi, num, makething))
{
if (maxwater < 50)
{
maxwater = 50;
}
}
}
else if (t == "锋利·铁剑")
{
string thi[100] = { "铁剑","精铁" };
int num[100] = { 1,50 };
thing makething = { "剑","锋利·铁剑",350,0,0,1,false,0,100 };
make(thi, num, makething);
}
else if (t == "锋利·铁斧")
{
string thi[100] = { "铁斧","精铁" };
int num[100] = { 1,50 };
thing makething = { "斧头","锋利·铁斧",0,0,0,1,false,70,150 };
make(thi, num, makething);
}
else if (t == "锋利·铁镐")
{
string thi[100] = { "铁镐","精铁" };
int num[100] = { 1,50 };
thing makething = { "镐","锋利·铁镐",0,0,0,1,false,70,150 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "耐久·铁斧")
{
string thi[100] = { "铁斧","铁" };
int num[100] = { 1,100 };
thing makething = { "斧头","耐久·铁斧",0,0,0,1,false,60,200 };
make(thi, num, makething);
}
else if (t == "耐久·铁镐")
{
string thi[100] = { "铁镐","铁" };
int num[100] = { 1,100 };
thing makething = { "镐","耐久·铁镐",0,0,0,1,false,60,200 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "锋利·耐久·铁斧")
{
string thi[100] = { "耐久·铁斧","精铁" };
int num[100] = { 1,50 };
thing makething = { "斧头","锋利·耐久·铁斧",0,0,0,1,false,70,200 };
make(thi, num, makething);
}
else if (t == "锋利·耐久·铁镐")
{
string thi[100] = { "耐久·铁镐","精铁" };
int num[100] = { 1,50 };
thing makething = { "镐","锋利·耐久·铁镐",0,0,0,1,false,70,200 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "锋利·钢剑")
{
string thi[100] = { "钢剑","钢合金" };
int num[100] = { 1,50 };
thing makething = { "剑","锋利·钢剑",400,0,0,1,false,0,100 };
make(thi, num, makething);
}
else if (t == "锋利·钢斧")
{
string thi[100] = { "钢斧","钢合金" };
int num[100] = { 1,50 };
thing makething = { "斧头","锋利·钢斧",0,0,0,1,false,80,150 };
make(thi, num, makething);
}
else if (t == "锋利·钢镐")
{
string thi[100] = { "钢镐","钢合金" };
int num[100] = { 1,50 };
thing makething = { "镐","锋利·钢镐",0,0,0,1,false,80,150 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "耐久·钢斧")
{
string thi[100] = { "钢斧","钢" };
int num[100] = { 1,100 };
thing makething = { "斧头","耐久·钢斧",0,0,0,1,false,70,230 };
make(thi, num, makething);
}
else if (t == "耐久·钢镐")
{
string thi[100] = { "钢镐","钢" };
int num[100] = { 1,100 };
thing makething = { "镐","耐久·钢镐",0,0,0,1,false,70,230 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "锋利·耐久·钢斧")
{
string thi[100] = { "耐久·钢斧","钢合金" };
int num[100] = { 1,50 };
thing makething = { "斧头","锋利·耐久·钢斧",0,0,0,1,false,80,230 };
make(thi, num, makething);
}
else if (t == "锋利·耐久·钢镐")
{
string thi[100] = { "耐久·钢镐","钢合金" };
int num[100] = { 1,50 };
thing makething = { "镐","锋利·耐久·钢镐",0,0,0,1,false,80,230 };
if (make(thi, num, makething))
{
for (int i = 0; i < 100; i++)
{
if (way[0].b[i] == "矿洞")
{
break;
}
if (way[0].b[i] == "")
{
way[0].b[i] = "矿洞";
way[0].bnum++;
break;
}
}
}
}
else if (t == "钢合金")
{
string thi[100] = { "钢","金" };
int num[100] = { 5,5 };
thing makething = { "材料","钢合金",0,0,0,1,false,0,1 };
make(thi, num, makething);
}
else if (t == "钢甲")
{
string thi[100] = { "钢","皮革","皮毛","布料" };
int num[100] = { 500,30,300,50 };
thing makething = { "甲","钢甲",0,300,0,1,false,200,1000 };
make(thi, num, makething);
}
else if (t == "外星甲")
{
string thi[100] = { "外星合金","皮革","皮毛","布料" };
int num[100] = { 100,30,500,100 };
thing makething = { "甲","外星甲",0,600,0,1,false,2000,10000 };
make(thi, num, makething);
}
}
else if (a == "查看陷阱")
{
if (nowx.name == "")
{
cout << "你未布设着陷阱啊..." << endl;
Sleep(100);
}
else
{
int ran = rand() % 13 + 6;
cout << "草丛一点动静" << endl;
Sleep((rand() % 5000 + 10000) / nowx.sharp);
cout << "好像有东西掉进了陷阱" << endl;
Sleep((rand() % 5000 + 10000) / nowx.sharp);
cout << "陷阱满了" << endl;
Sleep((rand() % 5000 + 10000) / nowx.sharp);
if (rand() % 2)
{
int ran = rand() % 6;
cout << "\t你获得了" << ran << "块肉!" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "肉")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "食物","肉",0,0,0,ran,false };
break;
}
}
}
if (rand() % 5)
{
int ran = rand() % 30 +4;
cout << "\t你获得了" << ran << "片皮毛!" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "皮毛")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","皮毛",0,0,0,ran,false };
break;
}
}
}
_getch();
}
}
else if (a == "矿洞")
{
if (nowpickaxe.name == "")
{
cout << "你未装备着镐啊..." << endl;
Sleep(100);
}
else
{
int ran = rand() % 13 + 6;
cout << "砰,矿洞里回响着敲打岩石的声音" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "几块碎石掉了下来" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "一大块岩石倒在地上" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "\t你获得了" << ran << "块岩石!" << endl;
_getch();
nowpickaxe.durability -= 1;
if (nowpickaxe.durability <= 0)
{
cout << "但很不幸,你的镐断了..." << endl;
cout << "\t你少了一把镐" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == nowpickaxe.name)
{
bag[i].num--;
break;
}
}
nowpickaxe = {};
_getch();
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "石头")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","石头",0,0,0,ran,false };
break;
}
}
}
}
else if (a == "做熏肉")
{
string thi[100] = { "肉","木头" };
int num[100] = { 5,5 };
thing makething = { "食物","熏肉",0,0,0,1,false,0,10 };
make(thi, num, makething);
}
else if (a == "制造皮革")
{
string thi[100] = { "皮毛","" };
int num[100] = { 5,0 };
thing makething = { "材料","皮革",0,0,0,1,false,0,10 };
make(thi, num, makething);
}
else if (a == "添柴")
{
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "木头")
{
bag[i].num--;
}
}
cout << "房间暖和...";
Sleep(1000);
}
else if (a == "种菜")
{
if (nowhoe.name == "")
{
cout << "你未装备着锄啊..." << endl;
Sleep(100);
}
else
{
int ran = rand() % 20 + 10;
cout << "种菜中... 请稍等" << endl;
Sleep((rand() % 30000 + 30000) / nowhoe.sharp);
cout << "\t你获得了" << ran << "个野菜!" << endl;
_getch();
nowhoe.durability -= 1;
if (nowhoe.durability <= 0)
{
cout << "但很不幸,你的锄断了..." << endl;
cout << "\t你少了一把锄" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == nowhoe.name)
{
bag[i].num--;
break;
}
}
nowhoe = {};
_getch();
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "野菜")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "食物","野菜",0,0,0,ran,false,0,10 };
break;
}
}
}
}
else if (a == "制造配方")
{
system("start https://paste.ubuntu.com/p/sm2MWhTXqh/");
}
else if (a == "地图指南")
{
slowly(gmp);
}
else if (a == "存档码")
{
cout<<"loading...";
string icloud="";
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "") break;
icloud+=bag[i].name;
icloud+=",";
icloud+=str(bag[i].attack);
icloud+=",";
icloud+=str(bag[i].defense);
icloud+=",";
icloud+=str(bag[i].disposable);
icloud+=",";
icloud+=str(bag[i].durability);
icloud+=",";
icloud+=str(bag[i].health);
icloud+=",";
icloud+=str(bag[i].num);
icloud+=",";
icloud+=str(bag[i].sharp);
icloud+=";";
icloud+=bag[i].type;
icloud+=";";
}
icloud+="~";
for(int i=0;i<=50;i++)
{
for(int j=0;j<=90;j++)
{
if(isf[i][j]) icloud+="1";
else icloud+="0";
}
}
icloud+="~";
icloud+=opxi+'0';
icloud+=";";
for (int i = 0; i < opxi; i++) icloud+=Outposty[i],icloud+=",";
for (int i = 0; i < opxi; i++) icloud+=Outpostx[i],icloud+=",";
icloud+="~";
icloud+=str(level);
for(int i=0;i<100;i++)
{
if(way[i].name=="") continue;
icloud+=way[i].name;
icloud+=",";
icloud+=str(way[i].bnum);
icloud+=",";
for(int j=0;j<100;j++)
{
if(way[i].b[j]=="") continue;
icloud+=way[i].b[j];
icloud+="+";
}
icloud+=";";
}
icloud+="~";
icloud+=str(maxhealth);
icloud+=",";
icloud+=str(defense);
icloud+=",";
icloud+=str(attack);
icloud+=",";
icloud+=str(maxwater);
icloud+="~";
for(int i=0;i<1000;i++)
{
if(canmakething[i]=="") continue;
icloud+=canmakething[i];
icloud+=",";
}
icloud+="~";
for(int i=0;i<100;i++)
{
if(isw[i]) icloud+="1";
else icloud+="0";
if(isb[i]) icloud+="1";
else icloud+="0";
}
icloud+="~";
for(int i=0;i<10;i++)
{
if(skills[i]) icloud+="1";
else icloud+="0";
}
cout<<"\n下次粘贴至“载入存档”即可!\n";
cout<<"存档码已存至exe所在文件夹下,命名为:“save.in”。";
freopen("save.in","w",stdout);
cout<<icloud;
_getch();
return 0;
}
else if (a == "导入存档")
{
slowly(gmp);
}
else if (a=="钓鱼")
{
printf("正在钓鱼中...\n");
_getch();
Sleep(1000);
printf("鱼上勾了!\n");
if (rand() % 2)
{
int ran = rand() % 5;
cout << "\t你获得了" << ran << "块肉!" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "肉")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "食物","肉",0,0,0,ran,false };
break;
}
}
}
if (rand() % 5)
{
int ran = rand() % 5 +1;
cout << "\t你获得了" << ran << "片皮毛!" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "皮毛")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","皮毛",0,0,0,ran,false };
break;
}
}
}
if (!rand() % 20)
{
cout << "\t你获得了1个技能宝箱!" << endl;
cout << "\t打开看看" << endl;
_getch();
int skran=0;
while(skills[skran]) skran=rand() % 10;
cout<<"你变成了一名优秀的"<<skillers[skran]<<'!';
skills[skran]=true;
}
_getch();
}
else if (a == "挖煤矿")
{
if (nowpickaxe.name == "")
{
cout << "你未装备着镐啊..." << endl;
Sleep(100);
}
else
{
int ran = rand() % 13 + 6;
cout << "砰,矿洞里回响着敲打矿石的声音" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "几块煤矿掉了下来" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "一大块岩石倒在地上" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "\t你获得了" << ran << "块煤矿!" << endl;
_getch();
nowpickaxe.durability -= 1;
if (nowpickaxe.durability <= 0)
{
cout << "但很不幸,你的镐断了..." << endl;
cout << "\t你少了一把镐" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == nowpickaxe.name)
{
bag[i].num--;
break;
}
}
nowpickaxe = {};
_getch();
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "煤")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","煤",0,0,0,ran,false };
break;
}
}
}
}
else if (a == "挖铁矿")
{
if (nowpickaxe.name == "")
{
cout << "你未装备着镐啊..." << endl;
Sleep(100);
}
else
{
int ran = rand() % 13 + 6;
cout << "砰,矿洞里回响着敲打矿石的声音" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "几块铁矿掉了下来" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "一大块岩石倒在地上" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "\t你获得了" << ran << "块铁矿!" << endl;
_getch();
nowpickaxe.durability -= 1;
if (nowpickaxe.durability <= 0)
{
cout << "但很不幸,你的镐断了..." << endl;
cout << "\t你少了一把镐" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == nowpickaxe.name)
{
bag[i].num--;
break;
}
}
nowpickaxe = {};
_getch();
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "铁")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","铁",0,0,0,ran,false };
break;
}
}
}
}
else if (a == "挖金矿")
{
if (nowpickaxe.name == "")
{
cout << "你未装备着镐啊..." << endl;
Sleep(100);
}
else
{
int ran = rand() % 8 + 2;
cout << "砰,矿洞里回响着敲打矿石的声音" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "几块金矿掉了下来" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "一大块岩石倒在地上" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "\t你获得了" << ran << "块金矿!" << endl;
_getch();
nowpickaxe.durability -= 1;
if (nowpickaxe.durability <= 0)
{
cout << "但很不幸,你的镐断了..." << endl;
cout << "\t你少了一把镐" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == nowpickaxe.name)
{
bag[i].num--;
break;
}
}
nowpickaxe = {};
_getch();
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "金")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","金",0,0,0,ran,false };
break;
}
}
}
}
else if (a == "挖钛矿")
{
if (nowpickaxe.name == "")
{
cout << "你未装备着镐啊..." << endl;
Sleep(100);
}
else
{
int ran = rand() % 6 + 2;
cout << "砰,矿洞里回响着敲打矿石的声音" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "几块钛矿掉了下来" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "一大块岩石倒在地上" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "\t你获得了" << ran << "块钛矿!" << endl;
_getch();
nowpickaxe.durability -= 1;
if (nowpickaxe.durability <= 0)
{
cout << "但很不幸,你的镐断了..." << endl;
cout << "\t你少了一把镐" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == nowpickaxe.name)
{
bag[i].num--;
break;
}
}
nowpickaxe = {};
_getch();
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "钛")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","钛",0,0,0,ran,false };
break;
}
}
}
}
else if (a == "挖硫磺矿")
{
if (nowpickaxe.name == "")
{
cout << "你未装备着镐啊..." << endl;
Sleep(100);
}
else
{
int ran = rand() % 8 + 2;
cout << "砰,矿洞里回响着敲打矿石的声音" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "几块硫磺矿掉了下来" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "一大块岩石倒在地上" << endl;
Sleep((rand() % 5000 + 10000) / nowpickaxe.sharp);
cout << "\t你获得了" << ran << "块硫磺矿!" << endl;
_getch();
nowpickaxe.durability -= 1;
if (nowpickaxe.durability <= 0)
{
cout << "但很不幸,你的镐断了..." << endl;
cout << "\t你少了一把镐" << endl;
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == nowpickaxe.name)
{
bag[i].num--;
break;
}
}
nowpickaxe = {};
_getch();
}
for (int i = 0; i < 1000; i++)
{
if (bag[i].name == "硫磺")
{
bag[i].num += ran;
break;
}
if (bag[i].name == "")
{
bag[i] = { "材料","硫磺",0,0,0,ran,false };
break;
}
}
}
}
else if (a=="瓜田")
{
system("cls");
cout << "________________" << endl;
cout << "|种植大瓜吗? |" << endl;
cout << "|(y/n) |" << endl;
cout << "|______________|" << endl;
char c;
cin >> c;
if(c=='y'){
cout<<"你要种多少个?\n";
int nnnum;cin>>nnnum;
if(nnnum>0){
string thi[100] = { "瓜的种子","" };
int num[100] = { 2*nnnum,0 };
thing makething = { "食物","大瓜",0,0,0,nnnum,false,10,20 };
int x=plant(thi, num, makething);
if(x){
printf("你种下了%d个小瓜瓜\n",nnnum);
printf("等待它长大吧...\n");
Sleep(1000);
system("cls");
printf("小瓜瓜长大了\n你获得了%d个大瓜",nnnum);
_getch();
}
}
}
}
health = maxhealth;
}
return 0;
}