跳到正文

个人记录

小游戏 · 6 幻灵ARPG

xutongwei约 26 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 26 分钟

版本

  1. v1当前

本游戏为友链高山爬行者提供(修改了几个bug) sand_town 正在施工ing……

C++
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
unsigned long long iron=0,pork=0,iron_ingot=0,att,heal=20,att_speed,fang,gold,gold_sword,meat;//大数据变量堆
bool sword,helmet,chestplate,trousers,boots,sand,sandtown;//判断变量堆
void genxinrizhi()
{
    cout<<"更新日志:"<<endl;
    cout<<"2019.8.8 开始编写并且完工新手村的养猪场"<<endl;
    cout<<"2019.8.9 13:45 完工新手村的铁匠铺"<<endl;
    cout<<"2019.8.9 13:57 完工新手村"<<endl;
    cout<<"2019.9.6 19:39 总算想起还有云之边际"<<endl;
    cout<<"2019.9.6 19:41 花了2min决定改名为幻灵ARPG"<<endl;
    return;
}
bool panig(int x)
{
    if (x<=iron_ingot)
     return true;
    else
     return false;
}
void s()
{
    system("cls");
}
void p()
{
    Sleep(1500);
}
void start()
{
    genxinrizhi();
    p();
    cout<<endl;
    cout<<"Tips:";
    system("pause");
    cout<<"欢迎来到休闲养生的幻灵ARPG!"<<endl;
    p();
    p();
    s();
    cout<<"本图没有剧情!(实际上会补充)"<<endl;
    p();
    s();
    cout<<"5秒后开始正式主线"<<endl;
    Sleep(5000);
    s();
    cout<<"游戏开始!"<<endl;
    p();
    s();
}
void xinshou_village_pig_farm()
{
    p11:cout<<"您可以去:"<<endl;
    p();
    cout<<"1、猪刷怪笼(刷新小猪)"<<endl;
    p();
    cout<<"2、王不缺钱家(对王不缺钱是个人)(售卖猪肉)"<<endl;
    p();
    cout<<"3、返回新手村"<<endl;
    cout<<"同样的,输入你想去的地方吧!"<<endl;
    int bh2;
    cin>>bh2;
    if (bh2==1)
    {
        s();
        cout<<"您走向猪刷怪笼"<<endl;
        p();
        s();
        p1:cout<<"你的面前出现了一只小猪!"<<endl;
        p();
        cout<<"你成功的干掉了小猪!"<<endl;
        srand(time(NULL));
        int pig=rand()%4;
        p();
        cout<<"您获得了"<<pig<<"个猪肉!"<<endl;
        p();
        pork+=pig;
        cout<<"您想不想要再继续打呢?(1、想,2、不想)"<<endl;
        int bh3;
        cin>>bh3;
        if (bh3==1)
        {
            s();
            goto p1;
        }
        else
        {
            cout<<"您现在有"<<pork<<"个猪肉!"<<endl;
            p();
            cout<<"您走回养猪场"<<endl;
            p();
            s();
            goto p11;
        }
    }
    else
     if (bh2==2)
     {
        p();
        cout<<"您走去王不缺钱家"<<endl;
        p();
        s();
        p3:cout<<"您现在有"<<pork<<"个猪肉!"<<endl;
        p();
        cout<<"您想要卖掉几个猪肉呢?(猪肉3个换一个铁粒)"<<endl;
        unsigned long long sell;
        p2:cin>>sell;
        if (sell%3!=0)
        {
            cout<<"您输入的不是3的倍数!会有损失哦,请重新输入!"<<endl;
            p();
            goto p2;
        }
        else
        if (sell>pork)
        {
            cout<<"猪肉不够哟~请重新输入!"<<endl;
            p();
            goto p2;
        }
        {
            int pmoney=sell/3;
            pork-=sell;
            cout<<"您获得了"<<pmoney<<"个铁粒!"<<endl;
            p();
            iron+=pmoney;
            cout<<"您现在总共有"<<iron<<"个铁粒!"<<endl;
            p();
            s();
            cout<<"您想要再换吗?"<<endl;
            p();
            cout<<"1、换,2、不换"<<endl;
            int bh4;
            cin>>bh4;
            if (bh4==1)
             goto p3;
            else
            {
                cout<<"您离开了王不缺钱家"<<endl;
                p();
                s();
                goto p11;
            }
        }
     }
     else
      if (bh2==3)
      {
        cout<<"您返回了新手村"<<endl;
        p();
        s();
        return;
      }
     return;
}
void xinshou_village_iron_store()
{
    p12:cout<<"您可以去:"<<endl;
    p();
    cout<<"1、商店(购买各种物品)"<<endl;
    p();
    cout<<"2、钱币合成台(合成钱币)"<<endl;
    p();
    cout<<"3、返回新手村"<<endl;
    cout<<"快输入你想去的地方的编号吧!"<<endl;
    int bh5;
    cin>>bh5;
    if (bh5==1)
    {
        s();
        cout<<"您走向商店"<<endl;
        p();
        s();
        p6:cout<<"您可以兑换:"<<endl;
        p();
        cout<<"1、新手剑(攻击+2,攻速+2),5个铁锭"<<endl;
        p();
        cout<<"2、新手头盔(防御+2,血量+2),3个铁锭"<<endl;
        p();
        cout<<"3、新手胸甲(防御+5,血量+5),5个铁锭"<<endl;
        p();
        cout<<"4、新手裤子(防御+4,血量+4),4个铁锭"<<endl;
        p();
        cout<<"5、新手鞋子(防御+3,血量+3),3个铁锭"<<endl;
    	p();
        cout<<"6、离开"<<endl;
        p();
        cout<<"快输入您想购买的物品吧!"<<endl;
        int bh6;
        cin>>bh6;
        if (bh6==1)
        {
            if (panig(5))
            {
                s();
                cout<<"购买成功"<<endl;
                att+=2;
                att_speed+=2;
                iron_ingot-=5;
                sword=true;
                cout<<"您现在有"<<att<<"点攻击力"<<endl;
                cout<<"您现在有"<<att_speed<<"的攻速"<<endl;
                cout<<"您现在有"<<iron_ingot<<"个铁锭"<<endl;
                p();
                p();
                goto p6;
            }else
            {
                s();
                cout<<"您的铁锭不够哦"<<endl;
                p();
                s();
                goto p6;
            }
        }
        else if (bh6==2)
        {
            if (panig(3))
            {
                s();
                cout<<"购买成功"<<endl;
                fang+=2;
                heal+=2;
                iron_ingot-=3;
                helmet=true;
                cout<<"您现在有"<<fang<<"点防御"<<endl;
                cout<<"您现在有"<<heal<<"点血量"<<endl;
                cout<<"您现在有"<<iron_ingot<<"个铁锭"<<endl;
                p();
                p();
                goto p6;
            }else
            {
                s();
                cout<<"您的铁锭不够哦"<<endl;
                p();
                s();
                goto p6;
            }
        }
        else if (bh6==3)
        {
            if (panig(5))
            {
                s();
                cout<<"购买成功"<<endl;
                fang+=5;
                heal+=5;
                iron_ingot-=5;
                chestplate=true;
                cout<<"您现在有"<<fang<<"点防御"<<endl;
                cout<<"您现在有"<<heal<<"点血量"<<endl;
                cout<<"您现在有"<<iron_ingot<<"个铁锭"<<endl;
                p();
                p();
                goto p6;
            }else
            {
                s();
                cout<<"您的铁锭不够哦"<<endl;
                p();
                s();
                goto p6;
            }
        }
        else if (bh6==4)
        {
            if (panig(4))
            {
                s();
                cout<<"购买成功"<<endl;
                fang+=4;
                heal+=4;
                iron_ingot-=4;
                trousers=true;
                cout<<"您现在有"<<fang<<"点防御"<<endl;
                cout<<"您现在有"<<heal<<"点血量"<<endl;
                cout<<"您现在有"<<iron_ingot<<"个铁锭"<<endl;
                p();
                p();
                goto p6;
            }else
            {
                s();
                cout<<"您的铁锭不够哦"<<endl;
                p();
                s();
                goto p6;
            }
        }
        else if (bh6==5)
        {
            if (panig(3))
            {
                s();
                cout<<"购买成功"<<endl;
                fang+=3;
                heal+=3;
                iron_ingot-=3;
                boots=true;
                cout<<"您现在有"<<fang<<"点防御"<<endl;
                cout<<"您现在有"<<heal<<"点血量"<<endl;
                cout<<"您现在有"<<iron_ingot<<"个铁锭"<<endl;
                p();
                p();
                goto p6;
            }else
            {
                s();
                cout<<"您的铁锭不够哦"<<endl;
                p();
                s();
                goto p6;
            }
        }
        else if (bh6==6)
        {
            s();
            cout<<"您返回了铁匠铺"<<endl;
            p();
            s();
            goto p12;
        }
        else
        {
            cout<<"输入有误哦"<<endl;
            p();
            s();
            goto p6;
        }
    }
    else if (bh5==2)
    {
        s();
        cout<<"您走向钱币合成台"<<endl;
        p();
        s();
        p8:cout<<"您想要怎么兑换呢?"<<endl;
        p();
        cout<<"1、铁粒换铁锭(根据MC,比例为1:9)"<<endl;
        p();
        cout<<"2、离开"<<endl;
        p();
        cout<<"输入您想要换的吧!"<<endl;
        cout<<"备注:因为新手村只用到了铁锭故没有加其他的"<<endl;
        int bh7;
        cin>>bh7;
        if (bh7==1)
        {
            cout<<"您想要兑换几个铁粒呢?"<<endl;
            cout<<"您现在有"<<iron<<"个铁粒"<<endl;
            int dh;
            cin>>dh;
            if (dh>iron)
            {
                cout<<"您的铁粒不够哦"<<endl;
                p();
                s();
                goto p8;
            }
            else if (dh%9!=0)
            {
                cout<<"您输入的不是9的倍数哦,会有浪费的!"<<endl;
                cout<<"请重新输入!"<<endl;
                p();
                s();
                goto p8;
            }
            else
            {
                cout<<"兑换成功!"<<endl;
                p();
                iron_ingot+=dh/9;
                iron-=dh;
                cout<<"您现在有"<<iron_ingot<<"个铁锭"<<endl;
                cout<<"您现在有"<<iron<<"个铁粒!"<<endl;
                p();
                p();
                s();
                goto p8;
            }
        }
        else if (bh7==2)
        {
            s();
            cout<<"您走回了铁匠铺"<<endl;
            p();
            s();
            goto p12;
        }
        else
        {
            cout<<"您的输入有误哦"<<endl;
            p();
            s();
            goto p8;
        }
    }
    else if (bh5==3)
    {
        cout<<"您返回了新手村"<<endl;
        s();
        p();
        return;
    }
    else
    {
        s();
        cout<<"您的输入有误哦"<<endl;
        p();
        s();
        goto p8;
    }
    return;
}
void start_sand_town()
{
    if (sword&&helmet&&chestplate&&trousers&&boots)
    {
        cout<<"你成功的毕业了新手村"<<endl;
        p();
        cout<<"通过验证,可以去往沙之镇"<<endl;
        sand=true;
        s();
        return;
    }
    else
    {
        cout<<"您还没有集齐新手村的装备哦"<<endl;
        p();
        sand=false;
        return;
    }
}
void xinshou_village()
{
    cout<<"收集完新手村一套方可毕业新手村。"<<endl;
    p();
    s();
    p10:cout<<"您现在有"<<iron<<"个铁粒"<<endl;
    p();
    s();
    p9:cout<<"您可以去:"<<endl;
    p();
    cout<<"1、养猪场。(推荐新手进入)(已完工)"<<endl;
    p();
    cout<<"2、铁匠铺。(可以购买装备、武器。)(已完工)"<<endl;
    p();
    cout<<"3、前往沙之镇。(继续主线剧情)(还未施工)(需要新手村一套)"<<endl;
    cout<<"是的,新手村只有这点东西。快输入你想去的地方的编号吧!"<<endl;
    p();
    int bh;
    cin>>bh;
    if (bh==1)
    {
        s();
        cout<<"您走去了养猪场。"<<endl;
        p();
        s();
        xinshou_village_pig_farm();
        goto p10;
    }
    else if (bh==2)
    {
        s();
        cout<<"您走去了铁匠铺"<<endl;
        p();
        s();
        xinshou_village_iron_store();
        goto p10;
    }
    else if (bh==3)
    {
        start_sand_town();
        if (sand)
        {
            cout<<"准备传送。。。。。。"<<endl;
            p();
            s();
            cout<<"进入沙之镇"<<endl;
            p();
            s();
            return;
        }
        else
        {
            s();
            goto p9;
        }
    }
    else
    {
        s();
        cout<<"您的输入有误哦"<<endl;
        p();
        s();
        goto p10;
    }
}
void sand_town()
{
	cout<<"欢迎来到沙之镇-Wellcom to sand_town!"<<endl;
	pop();
	cout<<"现在起,按0可查看自己的属性哦"<<endl;
	pop();
	cout<<"输入你想去的地方吧!"<<endl;
	pop();
	p20:cout<<"1、猪人刷怪塔(施工ing)"<<endl;
	cout<<"2、镇长家(未施工)(v1.5以后启用(每日任务))"<<endl;
	cout<<"3、猪王boss(难度较大)(未启用)"<<endl;
	cout<<"4、商店(未施工)"<<endl;
	cout<<"5、灯塔(神秘的交易(v1.5未启用))(通往灯塔镇)"<<endl;
	cout<<"0、查看属性"<<endl;
	cout<<"这次没有硬性规定要买完装备了哦!(但是推荐买齐)"<<endl;
	p();
	int n20;
	cin>>n20;
	    if (n20==1)
	    {
			pop();
			cout<<"您走向猪人刷怪塔"<<endl;
			pop();
		    p25:cout<<"您可以:"<<endl;
			cout<<"1、刷怪(未完成)"<<endl;
			cout<<"2、战利品出售(完成)"<<endl;
			cout<<"3、回去(完成)"<<endl;
			int n21;
			cin>>n21;
			if (n21==3)
			{
				cout<<"您走回沙之镇"<<endl;
				pop();
				goto p20;
			}
			if (n21==2)
			{
				cout<<"您走向战利品出售"<<endl;
				pop();
				p24:cout<<"您可以出售:"<<endl;
				cout<<"1、金粒(拥有"<<gold<<"个)            1铁粒1个"<<endl;
				cout<<"2、金剑(拥有"<<gold_sword<<"把)            3铁粒1把"<<endl;
				cout<<"3、腐肉(拥有"<<meat<<"个)            1铁粒2块"<<endl;
				cout<<"4、回去"<<endl;
				cout<<"选择你要兑换的吧!"<<endl;
				int n22;
				cin>>n22;
				    if (n22==1)
					{
						cout<<"您准备兑换几个金粒?"<<endl;
						pop();
						p22:int n23;
						cin>>n23;
						if (n23>gold)
						{
							cout<<"对不起,输入有误,请重新输入."<<endl;
							goto p22;
						}
						else
						{
							cout<<"兑换成功,"<<n23<<"个铁粒已到账!"<<endl;
							gold-=n23;
							iron+=n23;
							goto p24;
						}
					}
				else
			        if (n22==2)
					{
						cout<<"您准备兑换几把金剑?"<<endl;
						pop();
						p23:int n23;
						cin>>n23;
						if (n23>gold_sword)
						{
							cout<<"对不起,输入有误,请重新输入."<<endl;
							goto p23;
						}
						else
						{
							cout<<"兑换成功,"<<n23*3<<"个铁粒已到账!"<<endl;
							gold_sword-=n23;
							iron+=n23*3;
							goto p24;
						}
					}
				else
				    if (n22==3)
					{
						cout<<"您准备兑换几块腐肉?(偶数哦)"<<endl;
						pop();
						p26:int n23;
						cin>>n23;
						if (n23>meat)
						{
							cout<<"对不起,输入有误,请重新输入."<<endl;
							goto p26;
						}
						else
						{
							cout<<"兑换成功,"<<n23/2<<"个铁粒已到账!"<<endl;
							meat-=n23;
							iron+=n23/2;
							goto p24;
						}
					}
				else
					{
						cout<<"返回猪人刷怪塔ing"<<endl;
						pop();
						goto p25;
					}
				}
			}
		}
int main()
{
    fopen("filename.txt","a+");
    start();
    xinshou_village();
    sand_town();
    return 0;
} //美丽的主程序
原文