作者:QWQAWAQWQAWA
日志
infdev 1.0发布
2.0更新合成方式,与neal不一致,会消耗物品
2.1钻石更新
3.0战斗更新(感谢fatale反馈bug)3.1修复问题
4.0 由@fatale完成的存档功能这一版本也在这里 最伟大的更新!与1.7.10一样 4.1天数也会被存档了,也是@fatale完成的
4.1更新地牢
#include <bits/stdc++.h>
using namespace std;
int l=1,p[100005]={1},w;int c[100005];string q[10005]={"0 Ultra 磁铁 magnet","1 wood","2 stone",
"3 stonepax","4 ironore","5 iron","6 sword","7 ironpax","8 !omnis","9 cobblestone","10 stove"
,"11 !portal","12 quartz","13 diamond","14 diamondore","15 bread","16 cookedbread","17 heart",
"18 Ultra 不死图腾 totem","19 Super 幸运 luck","20 !dungeon","21 apple","22 纪念品 omnis"};int health=10,v=2;
long long auto_sti(string input)//string_to_int 将一个数字组成的字符串转换为整形
{
int a[65];
for(int i=0;i<input.size();i++)
{
a[i]=input[i]-'0';
}
long long ans=0;
for(int i=0;i<input.size();i++)
{
unsigned long long cnt=1;
for(int j=input.size()-1;j>i;j--)
{
cnt*=10;
}
ans+=a[i]*cnt;
//cout << endl << ans << endl;
}
return ans;
}
void save()
{
FILE* original_stdout = stdout;
freopen("saves.txt", "w", stdout);
for(int i=1;i<=30;i++)
{
cout << max(0,c[i]) << endl;
}
cout << health << endl << w;
freopen("CONOUT$", "w", stdout);
}
void load()
{
std::ifstream file("saves.txt");
if (!file.is_open())
{
std::cerr << "Error opening file for reading." << std::endl;
return;
}
for(int i=1;i<=30;i++)
{
string s;
getline(file,s);
c[i]=auto_sti(s);
}
string s;
getline(file,s);
health=auto_sti(s);
getline(file,s);
w=auto_sti(s);
file.close();
if (c[1]==0)
{
std::cerr << "No data read from file or end of file reached." << std::endl;
}
else
{
std::cout << "Read archive successfully" << std::endl;
}
return ;
}
void oms(){
cout<<"袭击结束了"<<endl;
cout<<"灾厄村民:灾厄不败!"<<endl;
cout<<"???:qwq,不要管这些灾厄村民,你得去下界,而不是继续打。"<<endl;
cout<<"qwq(萌新):我不想打什么袭击"<<endl;
for(int i=1;i<=5;i++){
cout<<"..."<<endl;
}
cout<<"qwq:我之前也是萌新啊,不过???是谁"<<endl;
cout<<"fatale:不用管了,不死图腾很有用,收着吧" << endl;
}
void dun(){
cout<<"qwq:这是什么啊"<<endl;
cout<<"fatale:准备好sword去攻击!"<<endl;
cout<<"........."<<endl;
}
void gls(){
}
int main()
{
load();
l=1;p[1]=1;
cout<<"输入编号合成";
int a,b;
while(1){
c[1]=1;
save();
cout<<"你现在有的元素:"<<endl;
for(int i=1;i<=30;i++)
{
if(c[i]>0 or i==1)
cout<<max(1,c[i])<<" "<<q[i]<<endl;
}
cout<<"生命值"<<health<<endl;
w++;cin>>a>>b;
if(rand()%5==1 and w>15 and c[8]<=1){
cout<<"似乎有一丝不详的预兆"<<endl;
c[8]++;
}
if(rand()%9==1 and c[22]){
dun();
c[20]++;
}
if(rand()%4==1){
cout<<"你拿到一个苹果"<<endl;
c[21]++;
}
if(c[a]<=0 and a!=1)continue;
if(c[b]<=0 and b!=1)continue;
if(c[a]==0 and a!=1)cout<<"没有"<<q[a]<<"了" <<endl;
if(c[b]==0 and b!=1)cout<<"没有"<<q[b]<<"了" <<endl;
if(a==1 and b==1){
c[2]++;
}
if(a==1 and b==2){
c[3]++;
if(a!=b)c[b]--;c[a]--;
if(a==b) c[a]--;
}
if(a==2 and b==2){
c[4]++;
if(a==b) c[a]--;
}
if(a==3 and b==4){
c[5]++;
if(a!=b)c[b]--;c[a]--;
if(a==b) c[a]--;
}
if(a==1 and b==5){
c[7]++;
if(a!=b)c[b]--;c[a]--;
if(a==b) c[a]--;
}
if(a==2 and b==3){
c[10]++;
if(a!=b)c[b]--;c[a]--;
if(a==b) c[a]--;
}
if(a==4 and b==4){
c[14]++;
if(a==b) c[a]--;
}
if(a==7 and b==14){
c[13]++;if(rand()%v==1)c[a]--;
c[b]--;
}
if(a==1 and b==13){
l++;c[6]++;
if(a!=b)c[b]--;c[a]--;
if(a==b) c[a]--;
}
if(a==6 and b==8){
if(a!=b)c[b]--;if(rand()%v==1)c[a]--;
if(!c[22])oms();
c[18]++;
c[22]++;
}
if(a==6 and b==20){
cout<<"你进入了地牢"<<endl;
c[15]++;
if(rand()%5==1)c[19]++;
if(rand()%5==3){
c[20]--;cout<<"探索完毕。"<<endl;
}
health-=rand()%6; int uu=min(c[19],2);
health+=rand%uu;
}
if(a==21 and b==21){
health+=3;
if(a==b) c[a]--;
}
if(a==15 and b==15){
health+=5;
if(a==b) c[a]--;
}
if(c[8]){
health--;
if(health<0){
if(c[18]){
c[18]--;
health=5;
continue;
}
cout<<"qwq被灾厄击垮了!"<<endl;
for(int i=1;i<=30;i++)
{
c[i]=0;
}
break;
}}
}
return 0;
}