开始 2024-08-19 00:00:00

8.19-8.24集训第一天

结束 2024-08-25 23:59:00
Contest is over.
当前 2024-12-22 14:01:45

筱鼬席

include<bits/stdc++.h>

include <conio.h>

include <windows.h>

using namespace std; const int N=1e2+10; const int INF=0x3f3f3f3f;

bool YOU_DIED=0,YOU_WON=0; int EXP_TO_LOVE[25]={0,20,25,30,40,50,60,70,80,94,115,120,130,150,167,189,190,200,200,230,1000000}; int Trophy[8][2]={ 0,0, 0,7, 0,7, 0,7, 0,7, 0,7, 0,7, 0,7};

struct Ploblems{

string pr; int ans,spd; }p[N]; struct Things{

string name; int help_atk,help_def,help_hp; int Much_Buy,G,Kind_Of;//1武器2防具3药 }tg[N]; struct Monsters{

int Max_HP,ATK,HP,DEF,Mercy_Time,Shot; string name,Speak; }m[N]; struct Frisk{

int Max_HP,ATK,HP,DEF; int LV,EXP,G,Stage; int Drug_Bag[N],ATK_Bag[N],DEF_Bag[N]; int Have_Drug,Have_ATK,Have_DEF; int knife,shield; string name; }y;

void slowsay(string a,int speed=39) {

int alen=a.size(); for(int i=0;i<alen;i++){ Sleep(speed); cout<<a[i]; } }

void Shop_Draw(int l) {

printf("-----------------------------------\n"); l==1?printf(">>傻逼薄片 40G\n"):printf(" 傻逼薄片 40G\n"); l==2?printf(">>传说英雄 280G\n"):printf(" 传说英雄 280G\n"); l==3?printf(">>屎 400G\n"):printf(" 屎 400G\n"); l==4?printf(">>平底锅 500G\n"):printf(" 平底锅 500G\n"); l==5?printf(">>智障盔甲!! 1700G\n"):printf(" 智障盔甲!! 1700G\n"); l==6?printf(">>脑残片套餐 9999G\n"):printf(" 脑残片套餐 9999G\n"); l==7?printf(">>退出商店\n"):printf(" 退出商店\n"); printf("-----------------------------------\n"); if(l==1)printf("防具 防御+20\n不用担心防御,轻轻松松地战斗\n");
if(l==2)printf("药品 HP+40\n很好吃的三明治\n");
if(l==3)printf("药品 HP+60\n有奇效的(流体)蛋糕awa\n");
if(l==4)printf("防具 防御+30,攻击+10\n神器\n");
if(l==5)printf("防具 防御+?\n你等着瞧叭,看看它多纸张!\n");
if(l==6)printf("?? \n傻逼!!!\n"); if(l==7)printf("*按'k'键退出\n"); printf("-----------------------------------\n"); } void Buy_Things_From_Shop() {

system("cls"); slowsay("你吼,我素傻逼!欢迎来到傻逼 SHOP!!\n"); Sleep(200); BUY_AGAIN: system("cls"); printf("你吼,我素傻逼!欢迎来到傻逼 SHOP!!\n"); int HREAT_LINE=1; Shop_Draw(HREAT_LINE); while(1) {

Sleep(10);
if(kbhit())
{
    char x=_getch();
    if(x=='k' && HREAT_LINE==7)
    {
    	system("cls");
		slowsay("欢银下次光临!"); 
		Sleep(300); 
		return;
	}
	else if(x=='w')
	{
		system("cls");
		printf("*你吼,我素傻逼!欢迎来到傻逼 SHOP!!\n");
		Shop_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
	}
	else if(x=='s')
	{
		system("cls");
		printf("*你吼,我素傻逼!欢迎来到傻逼 SHOP!!\n");
		Shop_Draw(HREAT_LINE==7?7:++HREAT_LINE); 
	}
	else if(x=='k')
	{
		system("cls");
		if(y.G>=tg[HREAT_LINE].G && tg[HREAT_LINE].Much_Buy>=1)
		{
			slowsay("*购买成功!\n");
			if(HREAT_LINE==6)
			{
				Sleep(1000);
				slowsay("*傻逼偷偷嗦:介个家伙素不素有钱没地方花..."); 
			}
			y.G-=tg[HREAT_LINE].G;
			tg[HREAT_LINE].Much_Buy-=1;
			if(tg[HREAT_LINE].Kind_Of==1)
			{
				y.ATK_Bag[++y.Have_ATK]=HREAT_LINE;
			}
			if(tg[HREAT_LINE].Kind_Of==2)
			{
				y.DEF_Bag[++y.Have_DEF]=HREAT_LINE;
			}
			if(tg[HREAT_LINE].Kind_Of==3)
			{
				y.Drug_Bag[++y.Have_Drug]=HREAT_LINE;
			}
		}
		else if(y.G<tg[HREAT_LINE].G)
		{
			slowsay("*你好像没有足够哒钱钱\n");
		}
		else if(tg[HREAT_LINE].Much_Buy<1)
		{
			slowsay("*啊哦,今天售罄了...\n");
		}
		Sleep(500);
		goto BUY_AGAIN;
	}
}

} return; } void Main_Draw(int l) {

printf("-----------------------------------\n"); l==1?printf(">>商店\n"):printf(" 商店\n"); l==2?printf(">>存档\n"):printf(" 存档\n"); l==3?printf(">>查看\n"):printf(" 查看\n"); l==4?printf(">>战斗\n"):printf(" 战斗\n"); l==5?printf(">>退出\n"):printf(" 退出\n"); printf("-----------------------------------\n"); printf("操作方式:w上 s下 k确认\n"); printf("-----------------------------------"); return; } void File() {

system("cls"); int c=y.G; int atk=y.ATK; int def=y.DEF; int mh=y.Max_HP; int hp=y.HP; int exp=y.EXP; int lv=y.LV; int hd=y.Have_Drug,ha=y.Have_ATK,hde=y.Have_DEF;

FILE*fp=fopen("./undertale_cundang.txt","w"); fprintf(fp,"%d %d %d %d %d %d %d %d %d %d %d ",c,atk,def,mh,hp,exp,lv,hd,ha,hde,y.Stage); for(int i=1;i<=y.Have_Drug;++i) {

fprintf(fp,"%d ",y.Drug_Bag[i]);

} for(int i=1;i<=y.Have_ATK;++i) {

fprintf(fp,"%d ",y.ATK_Bag[i]);

} for(int i=1;i<=y.Have_DEF;++i) {

fprintf(fp,"%d ",y.DEF_Bag[i]);

} fclose(fp);

for(int i=1;i<10;i++) { system("cls"); if(i%3==0)cout<<"正在存档中..."; if(i%3==1)cout<<"正在存档中."; if(i%3==2)cout<<"正在存档中.."; Sleep(300); } system("cls"); cout<<"存档成功!"; Sleep(2000); system("cls"); return; } void Frisk_Define() {

y.ATK=18; y.DEF=0; y.EXP=0; y.G=0; y.Have_Drug=0; y.HP=20; y.LV=1; y.Max_HP=20; y.name="Frisk"; y.Stage=1; } void Monster_Define() {

m[1].ATK=19,m[1].DEF=0,m[1].HP=25,m[1].Max_HP=25,m[1].name=" 小花 ";m[1].Speak="杀或被杀\n"; m[2].ATK=6,m[2].DEF=8,m[2].HP=20,m[2].Max_HP=20,m[2].name=" 蛙吉特 ";m[2].Speak="第一个对手\n"; m[3].ATK=10,m[3].DEF=3,m[3].HP=18,m[3].Max_HP=18,m[3].name=" 独眼怪 ";m[3].Speak="样子怪怪的\n"; m[4].ATK=8,m[4].DEF=5,m[4].HP=30,m[4].Max_HP=30,m[4].name=" 小幽灵 ";m[4].Speak="时常哭泣\n"; m[5].ATK=12,m[5].DEF=2,m[5].HP=31,m[5].Max_HP=31,m[5].name=" 爵士虫 ";m[5].Speak="飘渺的对手\n"; m[6].ATK=9,m[6].DEF=8,m[6].HP=50,m[6].Max_HP=50,m[6].name=" 蛙吉特 ";m[6].Speak="再见面\n"; m[7].ATK=2,m[7].DEF=10,m[7].HP=180,m[7].Max_HP=180,m[7].name=" 托丽尔 ";m[7].Speak="亲爱的守护者\n"; m[8].ATK=19,m[8].DEF=32,m[8].HP=320,m[8].Max_HP=320,m[8].name=" 盾狗 ";m[8].Speak="憨憨的模样\n"; m[9].ATK=46,m[9].DEF=41,m[9].HP=1020,m[9].Max_HP=1020,m[9].name=" 帕派瑞斯 ";m[9].Speak="小天使\n"; m[10].ATK=5,m[10].DEF=184,m[10].HP=10089,m[10].Max_HP=10089,m[10].name=" 不灭的安黛因 ";m[10].Speak="真正的大傻逼\n"; m[11].ATK=1,m[11].DEF=1,m[11].HP=1,m[11].Max_HP=1,m[11].name=" 衫斯 ";m[11].Speak="最简单的敌人\n只能承受1点伤害\n";
} void Things_Define() {

tg[1].help_atk=0,tg[1].help_def=20,tg[1].help_hp=0,tg[1].Much_Buy=1,tg[1].name="提米薄片",tg[1].G=1,tg[1].Kind_Of=2; tg[2].help_atk=0,tg[2].help_def=0,tg[2].help_hp=40,tg[2].Much_Buy=INF,tg[2].name="传说英雄",tg[2].G=1,tg[2].Kind_Of=3; tg[3].help_atk=0,tg[3].help_def=0,tg[3].help_hp=60,tg[3].Much_Buy=INF,tg[3].name="屎",tg[3].G=1,tg[3].Kind_Of=3; tg[4].help_atk=10,tg[4].help_def=30,tg[4].help_hp=0,tg[4].Much_Buy=1,tg[4].name="平底锅",tg[4].G=1,tg[4].Kind_Of=2; tg[5].help_atk=0,tg[5].help_def=0,tg[5].help_hp=0,tg[5].Much_Buy=1,tg[5].name="智障盔甲",tg[5].G=1,tg[5].Kind_Of=2; tg[6].help_atk=0,tg[6].help_def=0,tg[6].help_hp=0,tg[6].Much_Buy=INF,tg[6].name="脑残片套餐",tg[6].G=1,tg[6].Kind_Of=3; tg[7].help_atk=0,tg[7].help_def=0,tg[7].help_hp=15,tg[7].Much_Buy=INF,tg[7].name="肉桂屁包",tg[7].G=1,tg[7].Kind_Of=3;

} void Ploblems_Define() {

p[1].pr="1&1",p[1].ans=1,p[1].spd=2; p[2].pr="1|1",p[2].ans=1,p[2].spd=3; p[3].pr="1^1",p[3].ans=0,p[3].spd=3; p[4].pr="0&1",p[4].ans=0,p[4].spd=3; p[5].pr="0&0",p[5].ans=0,p[5].spd=3; p[6].pr="1|0",p[6].ans=1,p[6].spd=2; p[7].pr="0^0",p[7].ans=0,p[7].spd=3; p[8].pr="1^0",p[8].ans=1,p[8].spd=3; p[9].pr="1&1^1",p[9].ans=0,p[9].spd=2; p[10].pr="0|1|0",p[10].ans=1,p[10].spd=2; } void Get_File() {

system("cls"); FILE *fp=fopen("./undertale_cundang.txt","r"); Monster_Define(); Things_Define(); Ploblems_Define(); if(fp) {

slowsay("检测到有存档,是否读档?(1/0):\n");
int aorpo;
cin>>aorpo;
if(aorpo)
{
	for(int i=1;i<10;i++)
	{
		system("cls");
		if(i%3==0)cout<<"正在读取存档中...";
		if(i%3==1)cout<<"正在读取存档中.";
		if(i%3==2)cout<<"正在读取存档中..";
		Sleep(300);
	}
	int c,atk,def,mh,hp,exp,lv,st,hd,ha,hde;
	fscanf(fp,"%d%d%d%d%d%d%d%d%d%d%d",&c,&atk,&def,&mh,&hp,&exp,&lv,&hd,&ha,&hde,&st);
	for(int i=1;i<=hd;++i)
	{
		fscanf(fp,"%d",&y.Drug_Bag[i]);
	}
	for(int i=1;i<=ha;++i)
	{
		fscanf(fp,"%d",&y.ATK_Bag[i]);
	}
	for(int i=1;i<=hde;++i)
	{
		fscanf(fp,"%d",&y.DEF_Bag[i]);
	}
	fclose(fp);
	y.ATK=atk,y.DEF=def,y.EXP=exp,y.G=c,y.Have_Drug=hd;y.Have_ATK=ha;
	y.LV=lv,y.Max_HP=mh,y.name="Frisk";y.HP=hp;y.Stage=st;y.Have_DEF=hde;
	slowsay("读取成功!");
	Sleep(1000);
	return;
}

} Frisk_Define(); } void Check_Kit_Draw(int li,int lj) {

printf("-----------------------------------\n\n"); bool flag=0; if(li==1) {

printf("[武器]      防具\n\n");
for(int i=1;i<=y.Have_ATK;++i)
{
	lj==i?printf(">>"):printf("  ");
	cout<<tg[y.ATK_Bag[i]].name<<'\n';
}
lj==y.Have_ATK+1?printf(">>退出\n"):printf("  退出\n");

} else {

flag=1;
printf(" 武器      [防具]\n\n");
for(int i=1;i<=y.Have_DEF;++i)
{
	lj==i?printf(">>"):printf("  ");
	cout<<tg[y.DEF_Bag[i]].name<<'\n';
}
lj==y.Have_DEF+1?printf(">>退出\n"):printf("  退出\n");

} printf("-----------------------------------\n"); if((!flag && lj!=y.Have_ATK+1)||(flag && lj!=y.Have_DEF+1)) {

li==1?printf("*武器\n"):printf("*防具\n"); 
printf("*攻击+%d  防御+%d  血量+%d\n",tg[y.DEF_Bag[lj]].help_atk,tg[y.DEF_Bag[lj]].help_def,tg[y.DEF_Bag[lj]].help_hp);
printf("*输入k确认装备\n"); 	

} printf("-----------------------------------\n"); return; } void Drug_Draw(int lj) {

printf("-----------------------------------\n"); int d=y.Have_Drug; for(int i=1;i<=d;++i) {

lj==i?printf(">>"):printf("  ");
cout<<tg[y.Drug_Bag[i]].name<<endl;

} lj==d+1?printf(">>退出\n"):printf(" 退出\n"); printf("-----------------------------------\n"); printf("*药品 血量+%d\n",tg[y.Drug_Bag[lj]].help_hp); printf("按k键丢弃\n"); printf("-----------------------------------\n"); return; } void Check_Yourself() {

system("cls"); printf("-----------------------------------\n"); printf("Frisk:\n"); printf("LV(等级):%d EXP(经验):%d\n",y.LV,y.EXP); printf("Max_HP(血量上限):%d\n",y.Max_HP); printf("ATK(攻击):%d\n",y.ATK); printf("DEF(防御):%d\n",y.DEF); printf("HP(当前血量):%d\n",y.HP); printf("CN(金币):%d\n",y.G); cout<<"武器:"<<tg[y.knife].name<<" 防具:"<<tg[y.shield].name<<endl; printf("BAG(背包):%d/10\n",y.Have_Drug); for(int i=1;i<=y.Have_Drug;++i) { cout<<tg[y.Drug_Bag[i]].name<<" "; } printf("\n-----------------------------------\n输入1查看装备,2查看背包,3退出:"); int Your_Choose; cin>>Your_Choose; if(Your_Choose==1) {

CHECK_AGAIN:
system("cls");
int HREAT_LINE=1,HREAT_ROW=1;
Check_Kit_Draw(HREAT_ROW,HREAT_LINE);
while(1)
{
	Sleep(10);
	if(kbhit())
	{
	    char x=_getch();
		if(x=='w')
		{
			system("cls");
			Check_Kit_Draw(HREAT_ROW,HREAT_LINE==1?1:--HREAT_LINE); 
		}
		else if(x=='s')
		{
			system("cls");
			Check_Kit_Draw(HREAT_ROW,HREAT_ROW==1?(HREAT_LINE==y.Have_ATK+1?y.Have_ATK+1:++HREAT_LINE):(HREAT_LINE==y.Have_DEF+1?y.Have_DEF+1:++HREAT_LINE)); 
		}
		else if(x=='a')
		{
			system("cls");
			HREAT_LINE=1;
			Check_Kit_Draw(HREAT_ROW==1?1:--HREAT_ROW,1); 
		}
		else if(x=='d')
		{
			system("cls");
			HREAT_LINE=1;
			Check_Kit_Draw(HREAT_ROW==2?2:++HREAT_ROW,1); 
		}
		else if(x=='k' && ((HREAT_ROW==1&&HREAT_LINE==y.Have_ATK+1)||((HREAT_ROW==1&&HREAT_LINE==y.Have_DEF+1))) )
		{
			return;
		}
		else if(x=='k')
		{
			system("cls");
			cout<<"装备成功!\n";
			Sleep(1700);
			if(HREAT_ROW==1)y.knife=y.ATK_Bag[HREAT_LINE];
			if(HREAT_ROW==2)y.shield=y.DEF_Bag[HREAT_LINE];
			goto CHECK_AGAIN;
		} 
	}
}

} if(Your_Choose==2) {

CHECK_AGAIN2:
system("cls");
int HREAT_LINE=1;
Drug_Draw(HREAT_LINE);
while(1)
{
	Sleep(10);
	if(kbhit())
	{
	    char x=_getch();
		if(x=='w')
		{
			system("cls");
			Drug_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
		}
		else if(x=='s')
		{
			system("cls");
			Drug_Draw(HREAT_LINE==y.Have_Drug+1?HREAT_LINE:++HREAT_LINE); 
		}
		else if(x=='k' && HREAT_LINE==y.Have_Drug+1 )
		{
			return;
		}
		else if(x=='k')
		{
			system("cls");
			cout<<"丢弃成功!\n";
			Sleep(1700);
			y.Drug_Bag[HREAT_LINE]=0;
			for(int i=HREAT_LINE+1;i<=y.Have_Drug;++i)
			{
				y.Drug_Bag[i-1]=y.Drug_Bag[i];
			}
			y.Have_Drug--;
			goto CHECK_AGAIN2;
		} 
	}
}

} else {

return;

} } void ITEM_Draw(int lj) {

system("cls"); printf("-----------------------------------\n"); int d=y.Have_Drug; for(int i=1;i<=d;++i) {

lj==i?printf(">>"):printf("  ");
cout<<tg[y.Drug_Bag[i]].name<<endl;

} lj==d+1?printf(">>退出\n"):printf(" 退出\n"); printf("-----------------------------------\n"); } void M_FIGHT() {

system("cls"); cout<<"怪物攻击!"<<endl; Sleep(500); int k=m[y.Stage].ATK,r=rand()%5+1; while(r--) { int a=rand()%10+1; int t=p[a].spd1000,flag=0; cout<<endl<<p[a].pr<<endl; while(t>0)

{
	t-=100;
	Sleep(100);
	if(kbhit())
	{
		char x=_getch();
		int my_ans=x-'0';
		if(my_ans!=p[a].ans)
		{
			flag=2;
			cout<<"回答错误!\n";
			Sleep(200);
			break;
		}
		else 
		{
			flag=1; 
			cout<<"回答正确!\n";
			Sleep(200);
			break;
		}
	}
}
if(flag!=1)
{
	if(flag==0)cout<<"超时!\n";
	y.HP-=(k<=5?k:k-y.DEF-tg[y.shield].help_def);
}
Sleep(1000);

} } void FIGHT() {

double k=y.ATK+tg[y.knife].help_atk+tg[y.shield].help_atk; system("cls"); bool flag=0; //for循环1~100再到1攻击力 for(long long i=100000;i<=1000000;++i) {

cout<<i;
Sleep(5);
system("cls");
if(kbhit())
{
	char x=_getch();
	cout<<i<<"%伤害!\n";
	Sleep(500);
	int sum=k*i/100.0+1-m[y.Stage].DEF;
	printf("你对怪物造成了 %d 点伤害!",max(sum,0) ); 
	m[y.Stage].HP-=max(sum,0);
	flag=1;
	break;
}

} if(flag==0) {

for(int i=99;i>=30;--i)
{
	cout<<i;
	Sleep(5);
	system("cls");
	if(kbhit())
	{
		char x=_getch();
		cout<<i<<"%伤害!\n";
		Sleep(500);
		int sum=k*i/100.0+1-m[y.Stage].DEF;
		printf("你对怪物造成了 %d 点伤害!",max(sum,0) ); 
		m[y.Stage].HP-=max(sum,0);
		flag=1;
		break;
	}
} 	

} if(flag==0) {

cout<<"30%伤害!\n";
int sum=k*0.3+1-m[y.Stage].DEF;
printf("你对怪物造成了 %d 点伤害!",max(sum,0) ); 
m[y.Stage].HP-=max(sum,0);

} Sleep(1000); cout<<endl; if(m[y.Stage].HP<=0) { YOU_WON=1;int s=rand()%30+10,w=rand()%30+15; Sleep(500); slowsay("\n你胜利了!"); printf("\n你获得了 %d 点EXP和 %d 金币!\n",s,w); Sleep(100); slowsay("\n\n*你还获得了:\n"); for(int i=1;i<=1;++i) { Sleep(200); cout<<tg[Trophy[y.Stage][i]].name<<endl; y.Drug_Bag[++y.Have_Drug]=Trophy[y.Stage][i]; } Sleep(200); y.EXP+=s;y.G+=w; if(y.EXP>=EXP_TO_LOVE[y.LV])

{
	y.EXP-=EXP_TO_LOVE[y.LV];
	y.LV++;
	Sleep(200);
	slowsay("\n*你升级了!\n"); 
	y.Max_HP+=5;
	y.ATK+=2;
	y.DEF+=1;
}

} Sleep(1500); } void ACT() {

system("cls"); printf("-----------------------------------\n"); slowsay("*");slowsay(m[y.Stage].name);slowsay(" ");cout<<m[y.Stage].ATK; slowsay(" ATK ");cout<<m[y.Stage].DEF;slowsay(" DEF\n"); slowsay(m[y.Stage].Speak); printf("-----------------------------------\n"); Sleep(500); printf("按任意键继续:"); char o; cin>>o; return; } void ITEM() {

system("cls"); int HREAT_LINE=1; ITEM_Draw(HREAT_LINE); while(1) {

Sleep(10);
if(kbhit())
{
    char x=_getch();
	if(x=='w')
	{
		system("cls");
		ITEM_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
	}
	else if(x=='s')
	{
		system("cls");
		ITEM_Draw(HREAT_LINE==y.Have_Drug+1?HREAT_LINE:++HREAT_LINE); 
	}
	else if(x=='k' && HREAT_LINE==y.Have_Drug+1)
	{
		return;
	}
	else if(x=='k')
	{
		system("cls");
		slowsay("*你吃掉了 ");slowsay(tg[y.Drug_Bag[HREAT_LINE]].name);
		slowsay(" !\n*你恢复了");printf("%d",tg[y.Drug_Bag[HREAT_LINE]].help_hp);slowsay("点HP!");
		Sleep(1700);
		y.HP=min(y.Max_HP,y.HP+tg[y.Drug_Bag[HREAT_LINE]].help_hp);
		y.Drug_Bag[HREAT_LINE]=0;
		for(int i=HREAT_LINE+1;i<=y.Have_Drug;++i)
		{
			y.Drug_Bag[i-1]=y.Drug_Bag[i];
		}
		y.Have_Drug--;
		system("cls");
		return;
	} 
}

} } void MERCY() {

system("cls"); int y=4; if(y==4) {

slowsay("你胜利了!");
slowsay("\n你获得了 0 点EXP和 0 金币!"); 
Sleep(1000);
YOU_WON=1;

} else {

slowsay("怪物拒绝了!");
Sleep(1000);

} return; } void Fight_Draw() {

YOU_WON=0; system("cls"); int s=y.Stage,hl; slowsay("*");slowsay(m[s].name);slowsay("发起战斗!\n"); Sleep(300); FIGHT_AGAIN: if(YOU_WON==1) {

y.Stage++;
return;

} if(y.HP<=0) {

system("cls");
printf("*(心碎)\n");
Sleep(2200);
slowsay("GAME   OVER\n");
Sleep(2000);
slowsay("*你是我们的希望...\n");
Sleep(1000);
slowsay("*Frisk,保持你的决心!");
Sleep(2000);
YOU_DIED=1;
return; 

} system("cls"); cout<<m[s].name<<" "<<m[s].HP<<"/"<<m[s].Max_HP<<endl; printf("-----------------------------------\n"); slowsay("*尽管攻击!\n"); printf("FRISK %d / %d\n",y.HP,y.Max_HP); printf("-----------------------------------\n"); hl=1; hl==1?printf(">>[战斗] "):printf(" [战斗] "); hl==2?printf(">>[行动] "):printf(" [行动] "); hl==3?printf(">>[物品] "):printf(" [物品] "); hl==4?printf(">>[仁慈] "):printf(" [仁慈] ");
while(1) {

Sleep(10);
if(kbhit())
{
    char x=_getch();
	if(x=='a')
	{
		system("cls");
		hl==1?hl=1:hl--;
		cout<<m[s].name<<"   "<<m[s].HP<<"/"<<m[s].Max_HP<<endl;
		printf("-----------------------------------\n");
		printf("*尽管攻击!\n");
		printf("FRISK %d / %d\n",y.HP,y.Max_HP);
		printf("-----------------------------------\n");
		hl==1?printf(">>[战斗]  "):printf("  [战斗]  "); 
		hl==2?printf(">>[行动]  "):printf("  [行动]  "); 
		hl==3?printf(">>[物品]  "):printf("  [物品]  "); 
		hl==4?printf(">>[仁慈]  "):printf("  [仁慈]  "); 

	}
	else if(x=='d')
	{
		system("cls");
		hl==4?hl=4:hl++;
		cout<<m[s].name<<"   "<<m[s].HP<<"/"<<m[s].Max_HP<<endl;
		printf("-----------------------------------\n");
		printf("*尽管攻击!\n");
		printf("FRISK %d / %d\n",y.HP,y.Max_HP);
		printf("-----------------------------------\n");
		hl==1?printf(">>[战斗]  "):printf("  [战斗]  "); 
		hl==2?printf(">>[行动]  "):printf("  [行动]  "); 
		hl==3?printf(">>[物品]  "):printf("  [物品]  "); 
		hl==4?printf(">>[仁慈]  "):printf("  [仁慈]  "); 
	}
	else if(x=='k')
	{
		if(hl==1)FIGHT();
		if(hl==2)ACT();
		if(hl==3)ITEM();
		if(hl==4)MERCY();
		if(YOU_WON!=1)
		{
			M_FIGHT();
		} 
		goto FIGHT_AGAIN;
	}
}

}

} void Start_Fight() {

system("cls"); cout<<"当前关数:"<<y.Stage<<" "<<m[y.Stage].name<<endl; Sleep(200); slowsay("\nENTER K TO START!:"); char ys; cin>>ys; if(ys=='k' || ys=='K') {

Fight_Draw();

} else {

return;

} } int main() {

srand(time(0)); Get_File(); system("cls"); Sleep(3000); slowsay("U N D E R T A L E"); Sleep(1000); slowsay("\nby lingzai\n"); slowsay("\n魔改作者:BDX\n"); Sleep(2000); cout<<"按任意键开始:"; char cin_to_start;int HREAT_LINE=1; cin>>cin_to_start; AGAIN: if(YOU_DIED) {

return 0;

} system("cls"); Main_Draw(HREAT_LINE); while(1) {

Sleep(10);
if(kbhit())
{
    char x=_getch();
	if(x=='w')
	{
		system("cls");
		Main_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
	}
	else if(x=='s')
	{
		system("cls");
		Main_Draw(HREAT_LINE==5?5:++HREAT_LINE); 
	}
	else if(x=='k')
	{
		if(HREAT_LINE==1)Buy_Things_From_Shop();
		else if(HREAT_LINE==2)File();
		else if(HREAT_LINE==3)Check_Yourself();
		else if(HREAT_LINE==4)Start_Fight(); 
		else if(HREAT_LINE==5)
		{
			system("cls");
			Sleep(3000);
			slowsay("U N D E R T A L E");
			Sleep(1000);
			slowsay("\n感谢游玩!\n");
			return 0;
		}
		goto AGAIN;
	}
}

} return 0; }


Biandingxi  •  3个月前
include<bits/stdc++.h>
include <conio.h>
include <windows.h>
using namespace std; const int N=1e2+10; const int INF=0x3f3f3f3f;

bool YOU_DIED=0,YOU_WON=0; int EXP_TO_LOVE[25]={0,20,25,30,40,50,60,70,80,94,115,120,130,150,167,189,190,200,200,230,1000000}; int Trophy[8][2]={ 0,0, 0,7, 0,7, 0,7, 0,7, 0,7, 0,7, 0,7};

struct Ploblems{

string pr; int ans,spd; }p[N]; struct Things{

string name; int help_atk,help_def,help_hp; int Much_Buy,G,Kind_Of;//1武器2防具3药 }tg[N]; struct Monsters{

int Max_HP,ATK,HP,DEF,Mercy_Time,Shot; string name,Speak; }m[N]; struct Frisk{

int Max_HP,ATK,HP,DEF; int LV,EXP,G,Stage; int Drug_Bag[N],ATK_Bag[N],DEF_Bag[N]; int Have_Drug,Have_ATK,Have_DEF; int knife,shield; string name; }y;

void slowsay(string a,int speed=39) {

int alen=a.size(); for(int i=0;i<alen;i++){ Sleep(speed); cout<<a[i]; } }

void Shop_Draw(int l) {

printf("-----------------------------------\n"); l==1?printf(">>傻逼薄片 40G\n"):printf(" 傻逼薄片 40G\n"); l==2?printf(">>传说英雄 280G\n"):printf(" 传说英雄 280G\n"); l==3?printf(">>屎 400G\n"):printf(" 屎 400G\n"); l==4?printf(">>平底锅 500G\n"):printf(" 平底锅 500G\n"); l==5?printf(">>智障盔甲!! 1700G\n"):printf(" 智障盔甲!! 1700G\n"); l==6?printf(">>脑残片套餐 9999G\n"):printf(" 脑残片套餐 9999G\n"); l==7?printf(">>退出商店\n"):printf(" 退出商店\n"); printf("-----------------------------------\n"); if(l==1)printf("防具 防御+20\n不用担心防御,轻轻松松地战斗\n");
if(l==2)printf("药品 HP+40\n很好吃的三明治\n");
if(l==3)printf("药品 HP+60\n有奇效的(流体)蛋糕awa\n");
if(l==4)printf("防具 防御+30,攻击+10\n神器\n");
if(l==5)printf("防具 防御+?\n你等着瞧叭,看看它多纸张!\n");
if(l==6)printf("?? \n傻逼!!!\n"); if(l==7)printf("*按'k'键退出\n"); printf("-----------------------------------\n"); } void Buy_Things_From_Shop() {

system("cls"); slowsay("你吼,我素傻逼!欢迎来到傻逼 SHOP!!\n"); Sleep(200); BUY_AGAIN: system("cls"); printf("你吼,我素傻逼!欢迎来到傻逼 SHOP!!\n"); int HREAT_LINE=1; Shop_Draw(HREAT_LINE); while(1) {

Sleep(10);
if(kbhit())
{
    char x=_getch();
    if(x=='k' && HREAT_LINE==7)
    {
    	system("cls");
		slowsay("欢银下次光临!"); 
		Sleep(300); 
		return;
	}
	else if(x=='w')
	{
		system("cls");
		printf("*你吼,我素傻逼!欢迎来到傻逼 SHOP!!\n");
		Shop_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
	}
	else if(x=='s')
	{
		system("cls");
		printf("*你吼,我素傻逼!欢迎来到傻逼 SHOP!!\n");
		Shop_Draw(HREAT_LINE==7?7:++HREAT_LINE); 
	}
	else if(x=='k')
	{
		system("cls");
		if(y.G>=tg[HREAT_LINE].G && tg[HREAT_LINE].Much_Buy>=1)
		{
			slowsay("*购买成功!\n");
			if(HREAT_LINE==6)
			{
				Sleep(1000);
				slowsay("*傻逼偷偷嗦:介个家伙素不素有钱没地方花..."); 
			}
			y.G-=tg[HREAT_LINE].G;
			tg[HREAT_LINE].Much_Buy-=1;
			if(tg[HREAT_LINE].Kind_Of==1)
			{
				y.ATK_Bag[++y.Have_ATK]=HREAT_LINE;
			}
			if(tg[HREAT_LINE].Kind_Of==2)
			{
				y.DEF_Bag[++y.Have_DEF]=HREAT_LINE;
			}
			if(tg[HREAT_LINE].Kind_Of==3)
			{
				y.Drug_Bag[++y.Have_Drug]=HREAT_LINE;
			}
		}
		else if(y.G<tg[HREAT_LINE].G)
		{
			slowsay("*你好像没有足够哒钱钱\n");
		}
		else if(tg[HREAT_LINE].Much_Buy<1)
		{
			slowsay("*啊哦,今天售罄了...\n");
		}
		Sleep(500);
		goto BUY_AGAIN;
	}
}
} return; } void Main_Draw(int l) {

printf("-----------------------------------\n"); l==1?printf(">>商店\n"):printf(" 商店\n"); l==2?printf(">>存档\n"):printf(" 存档\n"); l==3?printf(">>查看\n"):printf(" 查看\n"); l==4?printf(">>战斗\n"):printf(" 战斗\n"); l==5?printf(">>退出\n"):printf(" 退出\n"); printf("-----------------------------------\n"); printf("操作方式:w上 s下 k确认\n"); printf("-----------------------------------"); return; } void File() {

system("cls"); int c=y.G; int atk=y.ATK; int def=y.DEF; int mh=y.Max_HP; int hp=y.HP; int exp=y.EXP; int lv=y.LV; int hd=y.Have_Drug,ha=y.Have_ATK,hde=y.Have_DEF;

FILE*fp=fopen("./undertale_cundang.txt","w"); fprintf(fp,"%d %d %d %d %d %d %d %d %d %d %d ",c,atk,def,mh,hp,exp,lv,hd,ha,hde,y.Stage); for(int i=1;i<=y.Have_Drug;++i) {

fprintf(fp,"%d ",y.Drug_Bag[i]);
} for(int i=1;i<=y.Have_ATK;++i) {

fprintf(fp,"%d ",y.ATK_Bag[i]);
} for(int i=1;i<=y.Have_DEF;++i) {

fprintf(fp,"%d ",y.DEF_Bag[i]);
} fclose(fp);

for(int i=1;i<10;i++) { system("cls"); if(i%3==0)cout<<"正在存档中..."; if(i%3==1)cout<<"正在存档中."; if(i%3==2)cout<<"正在存档中.."; Sleep(300); } system("cls"); cout<<"存档成功!"; Sleep(2000); system("cls"); return; } void Frisk_Define() {

y.ATK=18; y.DEF=0; y.EXP=0; y.G=0; y.Have_Drug=0; y.HP=20; y.LV=1; y.Max_HP=20; y.name="Frisk"; y.Stage=1; } void Monster_Define() {

m[1].ATK=19,m[1].DEF=0,m[1].HP=25,m[1].Max_HP=25,m[1].name=" 小花 ";m[1].Speak="杀或被杀\n"; m[2].ATK=6,m[2].DEF=8,m[2].HP=20,m[2].Max_HP=20,m[2].name=" 蛙吉特 ";m[2].Speak="第一个对手\n"; m[3].ATK=10,m[3].DEF=3,m[3].HP=18,m[3].Max_HP=18,m[3].name=" 独眼怪 ";m[3].Speak="样子怪怪的\n"; m[4].ATK=8,m[4].DEF=5,m[4].HP=30,m[4].Max_HP=30,m[4].name=" 小幽灵 ";m[4].Speak="时常哭泣\n"; m[5].ATK=12,m[5].DEF=2,m[5].HP=31,m[5].Max_HP=31,m[5].name=" 爵士虫 ";m[5].Speak="飘渺的对手\n"; m[6].ATK=9,m[6].DEF=8,m[6].HP=50,m[6].Max_HP=50,m[6].name=" 蛙吉特 ";m[6].Speak="再见面\n"; m[7].ATK=2,m[7].DEF=10,m[7].HP=180,m[7].Max_HP=180,m[7].name=" 托丽尔 ";m[7].Speak="亲爱的守护者\n"; m[8].ATK=19,m[8].DEF=32,m[8].HP=320,m[8].Max_HP=320,m[8].name=" 盾狗 ";m[8].Speak="憨憨的模样\n"; m[9].ATK=46,m[9].DEF=41,m[9].HP=1020,m[9].Max_HP=1020,m[9].name=" 帕派瑞斯 ";m[9].Speak="小天使\n"; m[10].ATK=5,m[10].DEF=184,m[10].HP=10089,m[10].Max_HP=10089,m[10].name=" 不灭的安黛因 ";m[10].Speak="真正的大傻逼\n"; m[11].ATK=1,m[11].DEF=1,m[11].HP=1,m[11].Max_HP=1,m[11].name=" 衫斯 ";m[11].Speak="最简单的敌人\n只能承受1点伤害\n";
} void Things_Define() {

tg[1].help_atk=0,tg[1].help_def=20,tg[1].help_hp=0,tg[1].Much_Buy=1,tg[1].name="提米薄片",tg[1].G=1,tg[1].Kind_Of=2; tg[2].help_atk=0,tg[2].help_def=0,tg[2].help_hp=40,tg[2].Much_Buy=INF,tg[2].name="传说英雄",tg[2].G=1,tg[2].Kind_Of=3; tg[3].help_atk=0,tg[3].help_def=0,tg[3].help_hp=60,tg[3].Much_Buy=INF,tg[3].name="屎",tg[3].G=1,tg[3].Kind_Of=3; tg[4].help_atk=10,tg[4].help_def=30,tg[4].help_hp=0,tg[4].Much_Buy=1,tg[4].name="平底锅",tg[4].G=1,tg[4].Kind_Of=2; tg[5].help_atk=0,tg[5].help_def=0,tg[5].help_hp=0,tg[5].Much_Buy=1,tg[5].name="智障盔甲",tg[5].G=1,tg[5].Kind_Of=2; tg[6].help_atk=0,tg[6].help_def=0,tg[6].help_hp=0,tg[6].Much_Buy=INF,tg[6].name="脑残片套餐",tg[6].G=1,tg[6].Kind_Of=3; tg[7].help_atk=0,tg[7].help_def=0,tg[7].help_hp=15,tg[7].Much_Buy=INF,tg[7].name="肉桂屁包",tg[7].G=1,tg[7].Kind_Of=3;

} void Ploblems_Define() {

p[1].pr="1&1",p[1].ans=1,p[1].spd=2; p[2].pr="1|1",p[2].ans=1,p[2].spd=3; p[3].pr="1^1",p[3].ans=0,p[3].spd=3; p[4].pr="0&1",p[4].ans=0,p[4].spd=3; p[5].pr="0&0",p[5].ans=0,p[5].spd=3; p[6].pr="1|0",p[6].ans=1,p[6].spd=2; p[7].pr="0^0",p[7].ans=0,p[7].spd=3; p[8].pr="1^0",p[8].ans=1,p[8].spd=3; p[9].pr="1&1^1",p[9].ans=0,p[9].spd=2; p[10].pr="0|1|0",p[10].ans=1,p[10].spd=2; } void Get_File() {

system("cls"); FILE *fp=fopen("./undertale_cundang.txt","r"); Monster_Define(); Things_Define(); Ploblems_Define(); if(fp) {

slowsay("检测到有存档,是否读档?(1/0):\n");
int aorpo;
cin>>aorpo;
if(aorpo)
{
	for(int i=1;i<10;i++)
	{
		system("cls");
		if(i%3==0)cout<<"正在读取存档中...";
		if(i%3==1)cout<<"正在读取存档中.";
		if(i%3==2)cout<<"正在读取存档中..";
		Sleep(300);
	}
	int c,atk,def,mh,hp,exp,lv,st,hd,ha,hde;
	fscanf(fp,"%d%d%d%d%d%d%d%d%d%d%d",&c,&atk,&def,&mh,&hp,&exp,&lv,&hd,&ha,&hde,&st);
	for(int i=1;i<=hd;++i)
	{
		fscanf(fp,"%d",&y.Drug_Bag[i]);
	}
	for(int i=1;i<=ha;++i)
	{
		fscanf(fp,"%d",&y.ATK_Bag[i]);
	}
	for(int i=1;i<=hde;++i)
	{
		fscanf(fp,"%d",&y.DEF_Bag[i]);
	}
	fclose(fp);
	y.ATK=atk,y.DEF=def,y.EXP=exp,y.G=c,y.Have_Drug=hd;y.Have_ATK=ha;
	y.LV=lv,y.Max_HP=mh,y.name="Frisk";y.HP=hp;y.Stage=st;y.Have_DEF=hde;
	slowsay("读取成功!");
	Sleep(1000);
	return;
}
} Frisk_Define(); } void Check_Kit_Draw(int li,int lj) {

printf("-----------------------------------\n\n"); bool flag=0; if(li==1) {

printf("[武器]      防具\n\n");
for(int i=1;i<=y.Have_ATK;++i)
{
	lj==i?printf(">>"):printf("  ");
	cout<<tg[y.ATK_Bag[i]].name<<'\n';
}
lj==y.Have_ATK+1?printf(">>退出\n"):printf("  退出\n");
} else {

flag=1;
printf(" 武器      [防具]\n\n");
for(int i=1;i<=y.Have_DEF;++i)
{
	lj==i?printf(">>"):printf("  ");
	cout<<tg[y.DEF_Bag[i]].name<<'\n';
}
lj==y.Have_DEF+1?printf(">>退出\n"):printf("  退出\n");
} printf("-----------------------------------\n"); if((!flag && lj!=y.Have_ATK+1)||(flag && lj!=y.Have_DEF+1)) {

li==1?printf("*武器\n"):printf("*防具\n"); 
printf("*攻击+%d  防御+%d  血量+%d\n",tg[y.DEF_Bag[lj]].help_atk,tg[y.DEF_Bag[lj]].help_def,tg[y.DEF_Bag[lj]].help_hp);
printf("*输入k确认装备\n"); 	
} printf("-----------------------------------\n"); return; } void Drug_Draw(int lj) {

printf("-----------------------------------\n"); int d=y.Have_Drug; for(int i=1;i<=d;++i) {

lj==i?printf(">>"):printf("  ");
cout<<tg[y.Drug_Bag[i]].name<<endl;
} lj==d+1?printf(">>退出\n"):printf(" 退出\n"); printf("-----------------------------------\n"); printf("*药品 血量+%d\n",tg[y.Drug_Bag[lj]].help_hp); printf("按k键丢弃\n"); printf("-----------------------------------\n"); return; } void Check_Yourself() {

system("cls"); printf("-----------------------------------\n"); printf("Frisk:\n"); printf("LV(等级):%d EXP(经验):%d\n",y.LV,y.EXP); printf("Max_HP(血量上限):%d\n",y.Max_HP); printf("ATK(攻击):%d\n",y.ATK); printf("DEF(防御):%d\n",y.DEF); printf("HP(当前血量):%d\n",y.HP); printf("CN(金币):%d\n",y.G); cout<<"武器:"<<tg[y.knife].name<<" 防具:"<<tg[y.shield].name<<endl; printf("BAG(背包):%d/10\n",y.Have_Drug); for(int i=1;i<=y.Have_Drug;++i) { cout<<tg[y.Drug_Bag[i]].name<<" "; } printf("\n-----------------------------------\n输入1查看装备,2查看背包,3退出:"); int Your_Choose; cin>>Your_Choose; if(Your_Choose==1) {

CHECK_AGAIN:
system("cls");
int HREAT_LINE=1,HREAT_ROW=1;
Check_Kit_Draw(HREAT_ROW,HREAT_LINE);
while(1)
{
	Sleep(10);
	if(kbhit())
	{
	    char x=_getch();
		if(x=='w')
		{
			system("cls");
			Check_Kit_Draw(HREAT_ROW,HREAT_LINE==1?1:--HREAT_LINE); 
		}
		else if(x=='s')
		{
			system("cls");
			Check_Kit_Draw(HREAT_ROW,HREAT_ROW==1?(HREAT_LINE==y.Have_ATK+1?y.Have_ATK+1:++HREAT_LINE):(HREAT_LINE==y.Have_DEF+1?y.Have_DEF+1:++HREAT_LINE)); 
		}
		else if(x=='a')
		{
			system("cls");
			HREAT_LINE=1;
			Check_Kit_Draw(HREAT_ROW==1?1:--HREAT_ROW,1); 
		}
		else if(x=='d')
		{
			system("cls");
			HREAT_LINE=1;
			Check_Kit_Draw(HREAT_ROW==2?2:++HREAT_ROW,1); 
		}
		else if(x=='k' && ((HREAT_ROW==1&&HREAT_LINE==y.Have_ATK+1)||((HREAT_ROW==1&&HREAT_LINE==y.Have_DEF+1))) )
		{
			return;
		}
		else if(x=='k')
		{
			system("cls");
			cout<<"装备成功!\n";
			Sleep(1700);
			if(HREAT_ROW==1)y.knife=y.ATK_Bag[HREAT_LINE];
			if(HREAT_ROW==2)y.shield=y.DEF_Bag[HREAT_LINE];
			goto CHECK_AGAIN;
		} 
	}
}
} if(Your_Choose==2) {

CHECK_AGAIN2:
system("cls");
int HREAT_LINE=1;
Drug_Draw(HREAT_LINE);
while(1)
{
	Sleep(10);
	if(kbhit())
	{
	    char x=_getch();
		if(x=='w')
		{
			system("cls");
			Drug_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
		}
		else if(x=='s')
		{
			system("cls");
			Drug_Draw(HREAT_LINE==y.Have_Drug+1?HREAT_LINE:++HREAT_LINE); 
		}
		else if(x=='k' && HREAT_LINE==y.Have_Drug+1 )
		{
			return;
		}
		else if(x=='k')
		{
			system("cls");
			cout<<"丢弃成功!\n";
			Sleep(1700);
			y.Drug_Bag[HREAT_LINE]=0;
			for(int i=HREAT_LINE+1;i<=y.Have_Drug;++i)
			{
				y.Drug_Bag[i-1]=y.Drug_Bag[i];
			}
			y.Have_Drug--;
			goto CHECK_AGAIN2;
		} 
	}
}
} else {

return;
} } void ITEM_Draw(int lj) {

system("cls"); printf("-----------------------------------\n"); int d=y.Have_Drug; for(int i=1;i<=d;++i) {

lj==i?printf(">>"):printf("  ");
cout<<tg[y.Drug_Bag[i]].name<<endl;
} lj==d+1?printf(">>退出\n"):printf(" 退出\n"); printf("-----------------------------------\n"); } void M_FIGHT() {

system("cls"); cout<<"怪物攻击!"<<endl; Sleep(500); int k=m[y.Stage].ATK,r=rand()%5+1; while(r--) { int a=rand()%10+1; int t=p[a].spd1000,flag=0; cout<<endl<<p[a].pr<<endl; while(t>0)

{
	t-=100;
	Sleep(100);
	if(kbhit())
	{
		char x=_getch();
		int my_ans=x-'0';
		if(my_ans!=p[a].ans)
		{
			flag=2;
			cout<<"回答错误!\n";
			Sleep(200);
			break;
		}
		else 
		{
			flag=1; 
			cout<<"回答正确!\n";
			Sleep(200);
			break;
		}
	}
}
if(flag!=1)
{
	if(flag==0)cout<<"超时!\n";
	y.HP-=(k<=5?k:k-y.DEF-tg[y.shield].help_def);
}
Sleep(1000);
} } void FIGHT() {

double k=y.ATK+tg[y.knife].help_atk+tg[y.shield].help_atk; system("cls"); bool flag=0; //for循环1~100再到1攻击力 for(long long i=100000;i<=1000000;++i) {

cout<<i;
Sleep(5);
system("cls");
if(kbhit())
{
	char x=_getch();
	cout<<i<<"%伤害!\n";
	Sleep(500);
	int sum=k*i/100.0+1-m[y.Stage].DEF;
	printf("你对怪物造成了 %d 点伤害!",max(sum,0) ); 
	m[y.Stage].HP-=max(sum,0);
	flag=1;
	break;
}
} if(flag==0) {

for(int i=99;i>=30;--i)
{
	cout<<i;
	Sleep(5);
	system("cls");
	if(kbhit())
	{
		char x=_getch();
		cout<<i<<"%伤害!\n";
		Sleep(500);
		int sum=k*i/100.0+1-m[y.Stage].DEF;
		printf("你对怪物造成了 %d 点伤害!",max(sum,0) ); 
		m[y.Stage].HP-=max(sum,0);
		flag=1;
		break;
	}
} 	
} if(flag==0) {

cout<<"30%伤害!\n";
int sum=k*0.3+1-m[y.Stage].DEF;
printf("你对怪物造成了 %d 点伤害!",max(sum,0) ); 
m[y.Stage].HP-=max(sum,0);
} Sleep(1000); cout<<endl; if(m[y.Stage].HP<=0) { YOU_WON=1;int s=rand()%30+10,w=rand()%30+15; Sleep(500); slowsay("\n你胜利了!"); printf("\n你获得了 %d 点EXP和 %d 金币!\n",s,w); Sleep(100); slowsay("\n\n*你还获得了:\n"); for(int i=1;i<=1;++i) { Sleep(200); cout<<tg[Trophy[y.Stage][i]].name<<endl; y.Drug_Bag[++y.Have_Drug]=Trophy[y.Stage][i]; } Sleep(200); y.EXP+=s;y.G+=w; if(y.EXP>=EXP_TO_LOVE[y.LV])

{
	y.EXP-=EXP_TO_LOVE[y.LV];
	y.LV++;
	Sleep(200);
	slowsay("\n*你升级了!\n"); 
	y.Max_HP+=5;
	y.ATK+=2;
	y.DEF+=1;
}
} Sleep(1500); } void ACT() {

system("cls"); printf("-----------------------------------\n"); slowsay("*");slowsay(m[y.Stage].name);slowsay(" ");cout<<m[y.Stage].ATK; slowsay(" ATK ");cout<<m[y.Stage].DEF;slowsay(" DEF\n"); slowsay(m[y.Stage].Speak); printf("-----------------------------------\n"); Sleep(500); printf("按任意键继续:"); char o; cin>>o; return; } void ITEM() {

system("cls"); int HREAT_LINE=1; ITEM_Draw(HREAT_LINE); while(1) {

Sleep(10);
if(kbhit())
{
    char x=_getch();
	if(x=='w')
	{
		system("cls");
		ITEM_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
	}
	else if(x=='s')
	{
		system("cls");
		ITEM_Draw(HREAT_LINE==y.Have_Drug+1?HREAT_LINE:++HREAT_LINE); 
	}
	else if(x=='k' && HREAT_LINE==y.Have_Drug+1)
	{
		return;
	}
	else if(x=='k')
	{
		system("cls");
		slowsay("*你吃掉了 ");slowsay(tg[y.Drug_Bag[HREAT_LINE]].name);
		slowsay(" !\n*你恢复了");printf("%d",tg[y.Drug_Bag[HREAT_LINE]].help_hp);slowsay("点HP!");
		Sleep(1700);
		y.HP=min(y.Max_HP,y.HP+tg[y.Drug_Bag[HREAT_LINE]].help_hp);
		y.Drug_Bag[HREAT_LINE]=0;
		for(int i=HREAT_LINE+1;i<=y.Have_Drug;++i)
		{
			y.Drug_Bag[i-1]=y.Drug_Bag[i];
		}
		y.Have_Drug--;
		system("cls");
		return;
	} 
}
} } void MERCY() {

system("cls"); int y=4; if(y==4) {

slowsay("你胜利了!");
slowsay("\n你获得了 0 点EXP和 0 金币!"); 
Sleep(1000);
YOU_WON=1;
} else {

slowsay("怪物拒绝了!");
Sleep(1000);
} return; } void Fight_Draw() {

YOU_WON=0; system("cls"); int s=y.Stage,hl; slowsay("*");slowsay(m[s].name);slowsay("发起战斗!\n"); Sleep(300); FIGHT_AGAIN: if(YOU_WON==1) {

y.Stage++;
return;
} if(y.HP<=0) {

system("cls");
printf("*(心碎)\n");
Sleep(2200);
slowsay("GAME   OVER\n");
Sleep(2000);
slowsay("*你是我们的希望...\n");
Sleep(1000);
slowsay("*Frisk,保持你的决心!");
Sleep(2000);
YOU_DIED=1;
return; 
} system("cls"); cout<<m[s].name<<" "<<m[s].HP<<"/"<<m[s].Max_HP<<endl; printf("-----------------------------------\n"); slowsay("*尽管攻击!\n"); printf("FRISK %d / %d\n",y.HP,y.Max_HP); printf("-----------------------------------\n"); hl=1; hl==1?printf(">>[战斗] "):printf(" [战斗] "); hl==2?printf(">>[行动] "):printf(" [行动] "); hl==3?printf(">>[物品] "):printf(" [物品] "); hl==4?printf(">>[仁慈] "):printf(" [仁慈] ");
while(1) {

Sleep(10);
if(kbhit())
{
    char x=_getch();
	if(x=='a')
	{
		system("cls");
		hl==1?hl=1:hl--;
		cout<<m[s].name<<"   "<<m[s].HP<<"/"<<m[s].Max_HP<<endl;
		printf("-----------------------------------\n");
		printf("*尽管攻击!\n");
		printf("FRISK %d / %d\n",y.HP,y.Max_HP);
		printf("-----------------------------------\n");
		hl==1?printf(">>[战斗]  "):printf("  [战斗]  "); 
		hl==2?printf(">>[行动]  "):printf("  [行动]  "); 
		hl==3?printf(">>[物品]  "):printf("  [物品]  "); 
		hl==4?printf(">>[仁慈]  "):printf("  [仁慈]  "); 

	}
	else if(x=='d')
	{
		system("cls");
		hl==4?hl=4:hl++;
		cout<<m[s].name<<"   "<<m[s].HP<<"/"<<m[s].Max_HP<<endl;
		printf("-----------------------------------\n");
		printf("*尽管攻击!\n");
		printf("FRISK %d / %d\n",y.HP,y.Max_HP);
		printf("-----------------------------------\n");
		hl==1?printf(">>[战斗]  "):printf("  [战斗]  "); 
		hl==2?printf(">>[行动]  "):printf("  [行动]  "); 
		hl==3?printf(">>[物品]  "):printf("  [物品]  "); 
		hl==4?printf(">>[仁慈]  "):printf("  [仁慈]  "); 
	}
	else if(x=='k')
	{
		if(hl==1)FIGHT();
		if(hl==2)ACT();
		if(hl==3)ITEM();
		if(hl==4)MERCY();
		if(YOU_WON!=1)
		{
			M_FIGHT();
		} 
		goto FIGHT_AGAIN;
	}
}
}

} void Start_Fight() {

system("cls"); cout<<"当前关数:"<<y.Stage<<" "<<m[y.Stage].name<<endl; Sleep(200); slowsay("\nENTER K TO START!:"); char ys; cin>>ys; if(ys=='k' || ys=='K') {

Fight_Draw();
} else {

return;
} } int main() {

srand(time(0)); Get_File(); system("cls"); Sleep(3000); slowsay("U N D E R T A L E"); Sleep(1000); slowsay("\nby lingzai\n"); slowsay("\n魔改作者:BDX\n"); Sleep(2000); cout<<"按任意键开始:"; char cin_to_start;int HREAT_LINE=1; cin>>cin_to_start; AGAIN: if(YOU_DIED) {

return 0;
} system("cls"); Main_Draw(HREAT_LINE); while(1) {

Sleep(10);
if(kbhit())
{
    char x=_getch();
	if(x=='w')
	{
		system("cls");
		Main_Draw(HREAT_LINE==1?1:--HREAT_LINE); 
	}
	else if(x=='s')
	{
		system("cls");
		Main_Draw(HREAT_LINE==5?5:++HREAT_LINE); 
	}
	else if(x=='k')
	{
		if(HREAT_LINE==1)Buy_Things_From_Shop();
		else if(HREAT_LINE==2)File();
		else if(HREAT_LINE==3)Check_Yourself();
		else if(HREAT_LINE==4)Start_Fight(); 
		else if(HREAT_LINE==5)
		{
			system("cls");
			Sleep(3000);
			slowsay("U N D E R T A L E");
			Sleep(1000);
			slowsay("\n感谢游玩!\n");
			return 0;
		}
		goto AGAIN;
	}
}
} return 0; }

LIUYC  •  3个月前

比赛已结束。