哇,肝了我老半天(其实只从21点多做到2点多)
有个bug望大佬们修一下
在战斗时逃跑后会显示战斗失败,但仍会再显示一遍胜利,应该是函数调用的问题
谢谢大佬们了
懂C++的就不要输入作弊名称了,影响游戏体验(主要是因为有bug)
上代码!!!(神特么知道我咋想出这智障剧情)
#include<cstdio>
#include<iostream>
#include<time.h>
#include<windows.h>
#include<cmath>
using namespace std;
struct player {
int Attack,Defence,HP,MP,MaxHP,MaxMP,Money;
int SmallHP,MiddleHP,LargeHP,SmallMP,MiddleMP,LargeMP;
int SmallAttack,MiddleAttack,LargeAttack,SuperAttack,HuluAttack;
int SKill1Level,SKill2Level,SKill3Level,Level,Experience;
int PetKind,PetLevel;
int Vocation,OwnSkill,OwnSkillLevel;
string UserName,OwnSkillName;
}player1;
bool life=1,ForestOpen,EatingGet,WorkOpen,Special,xOpen;
int LevelMost=10,Mission1Get;
int qilins,suannis,taoties,bixis,pixius;
bool qilin=false,suanni=false,taotie=false,bixi=false,pixiu=false;
string MonsterName[20]={" ","小狮子","中狮子","大狮子","神圣狮子","神圣狮子王","小石怪","中石怪","大石怪","神圣石怪","神圣石怪王","混沌魔王"};
int MonsterAttack[20]={0,2,5,10,20,50,5,10,20,50,100,500};
int MonsterDefence[20]={0,0,3,5,10,20,3,5,10,20,50,300};
int MonsterHP[20]={0,10,20,50,100,500,20,50,100,500,1000,5000};
int LevelUp[50]={0,10,20,50,200,500,3000,9000,13000,19000,30000,50000,60000,70000,90000,100000,120000,140000,150000,170000,200000,220000,222222,233333,240000,250000,270000,280000,300000,350000,400000};
string PassWord="我是傻逼";
void Slowsay(string a)
{
int l=a.size();
for(int i=0;i<l;i++)
{
cout<<a[i];
Sleep(30);
}
printf("\n");
}
void Clear()
{
Sleep(1500);
system("cls");
}
void Start()
{
if(MessageBox(NULL,"是否跳过剧情?","圣域之战",MB_YESNO)==7)
{
Slowsay("......");
Slowsay("......");
Slowsay("......");
system("cls");
Slowsay("少年:这......这是哪里?");
Sleep(1500);
Slowsay("少年:为什么我手里握着一把剑,还穿着奇怪的铠甲?");
Slowsay("来自天边的奇怪声音:少年,这是天赐圣剑和天赐圣铠,你是被上天选中的圣域之战!");
Slowsay("来自天边的奇怪声音:你的目标是解救被混沌魔王抢走的公主");
Slowsay("少年:这不就是小木剑和布衣吗?");
Sleep(1500);
Slowsay("来自天边的奇怪声音:呃,其实你说对了,这就是小木剑和布衣,但它们是有等级的,到最高等级就变成了天赐圣剑和天赐圣铠了");
Clear(); Slowsay("来自天边的奇怪声音:它们一共有10级,下面介绍一下:");
Slowsay("来自天边的奇怪声音:0级:小木剑和布衣");
Slowsay("来自天边的奇怪声音:1级:匕首和斗篷");
Slowsay("来自天边的奇怪声音:2级:短剑和轻铠");
Slowsay("来自天边的奇怪声音:3级:铜剑和短铠");
Slowsay("来自天边的奇怪声音:4级:铁剑和铁铠");
Slowsay("来自天边的奇怪声音:5级:长剑和长铠");
Slowsay("来自天边的奇怪声音:6级:重剑和重铠");
Slowsay("来自天边的奇怪声音:7级:巨剑和巨铠");
Slowsay("来自天边的奇怪声音:8级:剑王和铠王");
Slowsay("来自天边的奇怪声音:9级:剑圣和铠圣");
Slowsay("来自天边的奇怪声音:10级:天赐圣剑和天赐圣铠");
Clear();
Slowsay("来自天边的奇怪声音:接下来是操作方式");
Slowsay("来自天边的奇怪声音:根据提示输入数字,千万不要输入不在范围内的数,否则可能会崩溃!");
Slowsay("来自天边的奇怪声音:我会在旁边加括号的,括号里的是说明");
Clear();
}
Slowsay("特别介绍:宠物系统");
Slowsay("目前共有五只宠物:麒麟、饕餮、狻猊、狴犴、貔貅");
Slowsay("它们分别对应功能:攻击、回血、技能、防御、钱财");
Slowsay("宠物也能升级,满级30级");
Slowsay("请问你想选择哪一只:");
cin>>player1.PetKind; player1.PetLevel=1;
Slowsay("来自天边的奇怪声音:最后,告诉我你的名字是:");
cin>>player1.UserName;
if(player1.UserName=="zzr17147")
{
Slowsay("你一定不是zzr17147,所以朋友再见!");
player1.HP=-666666;
return;
}
if(player1.UserName=="CSDN")
{
Slowsay("觉醒吧,沉睡多年的战神!");
Slowsay("神圣觉醒!!!!!!!!!!!!!!!!!!!!");
player1.Attack+=666666666;
player1.Defence+=666666666;
player1.HP=player1.MaxHP+=666666666;
player1.MP=player1.MaxMP+=666666666;
player1.PetLevel+=666666666;
player1.SKill1Level=player1.SKill2Level=player1.SKill3Level=player1.OwnSkillLevel+=666666666;
}
Slowsay("其实你有两种职业可以选择:");
Slowsay("一个是剑圣,一个是坦克");
Slowsay("他们的属性和专属技能也不一样");
Slowsay("在选择职业后还可以选择专属技能");
Slowsay("你想选择的职业是:(剑圣为1,坦克为2)");
cin>>player1.Vocation;
if(player1.Vocation==1)
{
Slowsay("剑圣有三种专属技能:");
Slowsay("1.暴风狂击:剑圣在剑中注入飓风的力量,对对手造成巨量伤害");
Slowsay("2.剑刃风暴:剑圣不停地旋转自己的剑,对对手造成多次伤害");
Slowsay("3.飓风之力:剑圣使自己攻击大幅度提升,并且防御数倍增加");
Slowsay("其中,1,2技能为主动技能,3技能为被动技能");
Slowsay("你想选择的技能是:");
cin>>player1.OwnSkill;
player1.OwnSkillLevel=1;
player1.Attack+=50;
player1.Defence+=20;
player1.MP=player1.MaxMP+=80;
if(player1.OwnSkill==1) player1.OwnSkillName="暴风狂击";
if(player1.OwnSkill==2) player1.OwnSkillName="剑刃风暴";
if(player1.OwnSkill==3)
{
player1.Attack=1.1;
player1.Defence=5;
}
}
if(player1.Vocation==2)
{
Slowsay("坦克有三种专属技能:");
Slowsay("1.雷霆重击:坦克使用雷霆之力砸向地面,对对手造成巨量伤害");
Slowsay("2.闪电狂怒:坦克不停地释放雷霆万钧的闪电,对对手造成多次伤害");
Slowsay("3.闪电突袭:坦克在一次攻击中能发动两次攻击,但攻击力会略微下降");
Slowsay("其中,1,2技能为主动技能,3技能为被动技能");
Slowsay("你想选择的技能是:");
cin>>player1.OwnSkill;
player1.OwnSkillLevel=1;
player1.Attack+=30;
player1.Defence+=50;
player1.HP=player1.MaxHP+=100;
if(player1.OwnSkill==1) player1.OwnSkillName="雷霆重击";
if(player1.OwnSkill==2) player1.OwnSkillName="闪电狂怒";
if(player1.OwnSkill==3) player1.Attack=1.8;
}
Clear();
}
void Read()
{
freopen("LMSN.text","r",stdin);
cin>>player1.UserName;
cin>>player1.Attack>>player1.Defence;
cin>>player1.HP>>player1.MaxHP>>player1.MP>>player1.MaxMP;
cin>>player1.Level>>player1.Experience;
cin>>player1.SKill1Level>>player1.SKill2Level>>player1.SKill3Level;
cin>>player1.SmallHP>>player1.MiddleHP>>player1.LargeHP;
cin>>player1.SmallMP>>player1.MiddleMP>>player1.LargeMP;
cin>>player1.SmallAttack>>player1.MiddleAttack>>player1.LargeAttack>>player1.SuperAttack;
cin>>player1.Money;
cin>>Mission1Get;
cin>>ForestOpen;
cin>>EatingGet;
cin>>Special;
cin>>LevelMost;
cin>>player1.PetKind;
cin>>player1.PetLevel;
cin>>player1.Vocation;
cin>>player1.OwnSkill;
cin>>player1.OwnSkillLevel;
fclose(stdin);
freopen("CON","r",stdin);
}
void Save()
{
freopen("LMSN.text","w",stdout);
cout<<player1.UserName<<endl;
cout<<player1.Attack<<endl;
cout<<player1.Defence<<endl;
cout<<player1.HP<<endl;
cout<<player1.MaxHP<<endl;
cout<<player1.MP<<endl;
cout<<player1.MaxMP<<endl;
cout<<player1.Level<<endl;
cout<<player1.Experience<<endl;
cout<<player1.SKill1Level<<endl;
cout<<player1.SKill2Level<<endl;
cout<<player1.SKill3Level<<endl;
cout<<player1.SmallHP<<endl;
cout<<player1.MiddleHP<<endl;
cout<<player1.LargeHP<<endl;
cout<<player1.SmallMP<<endl;
cout<<player1.MiddleMP<<endl;
cout<<player1.LargeMP<<endl;
cout<<player1.SmallAttack<<endl;
cout<<player1.MiddleAttack<<endl;
cout<<player1.LargeAttack<<endl;
cout<<player1.SuperAttack<<endl;
cout<<player1.Money<<endl;
cout<<Mission1Get<<endl;
cout<<ForestOpen<<endl;
cout<<EatingGet<<endl;
cout<<Special<<endl;
cout<<LevelMost<<endl;
cout<<player1.PetKind<<endl;
cout<<player1.PetLevel<<endl;
cout<<player1.Vocation<<endl;
cout<<player1.OwnSkill<<endl;
cout<<player1.OwnSkillLevel<<endl; fclose(stdout);
}
void say(string a)
{
int l=a.size();
for(int i=0;i<l;i++)
{
cout<<a[i]; Sleep(15);
}
}
bool CanUse(int i)
{
if(i==1&&player1.SmallHP) return 1;
if(i==2&&player1.MiddleHP) return 1;
if(i==3&&player1.LargeHP) return 1;
if(i==4&&player1.SmallMP) return 1;
if(i==5&&player1.MiddleMP) return 1;
if(i==6&&player1.LargeMP) return 1;
if(i==7&&player1.SmallAttack) return 1;
if(i==8&&player1.MiddleAttack) return 1;
if(i==9&&player1.LargeAttack) return 1;
if(i==10&&player1.SuperAttack)return 1;
return 0;
}
void Use(int i)
{
if(i==1)
{
say("成功使用小血瓶,血量增加10点");
printf("\n");
player1.HP=min(player1.HP+10,player1.MaxHP);
player1.SmallHP--;
}
if(i==2)
{
say("成功使用中血瓶,血量增加20点");
printf("\n");
player1.HP=min(player1.HP+20,player1.MaxHP);
player1.MiddleHP--;
}
if(i==3)
{
say("成功使用大血瓶,血量增加50点");
printf("\n");
player1.HP=min(player1.HP+50,player1.MaxHP);
player1.LargeHP--;
}
if(i==4)
{
say("成功使用小魔瓶,魔法值增加10点");
printf("\n");
player1.MP=min(player1.MP+10,player1.MaxMP);
player1.SmallMP--;
}
if(i==5)
{
say("成功使用中魔瓶,魔法值增加20点");
printf("\n");
player1.MP=min(player1.MP+20,player1.MaxMP);
player1.MiddleMP--;
}
if(i==6)
{
say("成功使用大魔瓶,魔法值增加50点");
printf("\n");
player1.MP=min(player1.MP+50,player1.MaxMP);
player1.LargeMP--;
}
}
bool LastMonster()
{
Clear();
int HP=10000;
int Attack=1000;
int Defence=500;
if(player1.PetKind==4)
{
say("你的宠物狴犴使对方攻击降低");
printf("%d",player1.PetLevel*10);
Slowsay("点攻击");
A