【置顶】无尽之剑3.0出了!更新:附魔,优化战斗。有需要关注私信我
#include <iostream>
#include <cstdio>
#include<string>
#include<stdlib.h>
#include<map>
#include<algorithm>
#include<time.h>
#include<windows.h>
#include<conio.h>
#include<cmath>
using namespace std;
map<string,int>m;
char op;int dam=1,he=20,xp=0,fy=0;string pickaxe="none";
void ss(string s,int a)
{
int len=s.length();
for(int i=0;i<=len-1;i++)
{
cout << s[i];
Sleep(40);
}
if(a==1)
{
cout << endl;
}
}
void fight(int hp,int f)
{
int h=hp;
while(h>0)
{
system("cls");
cout << "当前敌方血量:" << h << endl;
int r;
srand(time(0));
Sleep(1000);
if(rand()%3==0)
{
cout << "你打出了暴击伤害" << floor(dam * 1.5) << endl;
h-=floor(dam * 1.5);
}
else
{
cout << "你打出了" << dam << "伤害" << endl;
h-=dam;
}
cout << "敌方对你造成了" << floor((f / 100.0) * (100 - fy * 4))<< "伤害" << endl;
he-=floor((f / 100.0) * (100 - fy * 4));
cout << "你剩余" << he << "血量" << endl;
if(he<=0)
{
while(1)
{
cout << "You died!" << endl;
Sleep(500);
system("cls");
}
}
system("pause");
}
cout << "你打败了怪物" << endl;
int o1;
o1=(hp*2)+f;
cout << "你获得了" << o1 << "经验" << endl;
xp+=o1;
system("pause");
}
int daguai()
{
int mm;int nn;
gongji:
cout << "请输入你想要打的怪物的血量(本次输入需要按下回车)" << endl;
cin >> mm;
if(mm<=0)
{
cout << "输入无效" << endl;
goto gongji;
}
gj:
cout << &