海岛生存v1.0.0.6
2025-10-15 17:24:15
发布于:浙江
#include<bits/stdc++.h>
#include<windows.h>
#include<unistd.h>
#include<stdlib.h>
using namespace std;
int input = 0;//玩家一开始的输入											
int wood = 0;//木头																
int stone = 0, iron = 0, copper = 0, sliver = 0, gold = 0;//各种矿石								
int life = 100,life2;//生命值
int attack = 15, defense = 0;//攻击与防御 	
int coin = 0;//金币		
int ci = 0;				
void wait(int time){
	clock_t now = clock();
	while(clock() - now < time);
} 
void start(){
	int _ = 1;
	cout << "[你,是村子里的一个家财万贯的人]" << endl;
	sleep(_); 
	cout << "[有一天,你在村里散步时,突然被一个人给打了]" << endl;
	sleep(_);
	system("color C0");
	system("color 0F");
	cout << "[“什么人,还敢在我面前出现”]" << endl;
	sleep(_);
	cout << "[你感到头晕目眩]" << endl;
	sleep(_);
	cout << "[醒来后你发现你身上什么也没有了]" << endl;
	sleep(_);
	cout << "[你环顾四周,发现你在一座巨大的海岛上,附近除了一个矿洞,一个村庄和一片小树林,什么也没有]" << endl;
	sleep(_);
	cout << "[没办法,你为了活下去,只能在上面生存,直到有人救你]" << endl;
	sleep(_); 
	cout << "[于是,一场海岛的生存]" << endl;
	sleep(_);
	cout << "[正式开始]" << endl;
	sleep(1);
}
void jm(){ 
	system("cls");
	cout << "-- -- -- 海岛生存v1.0.0.6 -- -- --" << endl; 
	cout << "这是一个物资贫瘠的海岛,这里面有一片小树林和一个矿洞,以及一个村庄" << endl;
	cout << "你想要做什么?" << endl;
	cout << "1,去小树林砍树" << endl;
	cout << "2,下矿(可能会遇到怪物)" << endl;
	cout << "3,去村子里抢劫(可以获得金币以及食物)" << endl;
	cout << "4,制作武器与装备(加攻击与防御)" << endl;
	cout << "5,找商人买东西" << endl;
	cout << "6,去打克苏鲁之眼(boss)" << endl;
	cout << "7,千万别点" << endl;
	cout << "8,显示自己的状态" << endl;
	cout << "9,退出游戏" << endl;
	cout << "10,结束了?" << endl;
	while(1){
		cin >> input;
		if(input == 1){ 
			cout << "砍树砍到了17块木头" << endl; 
			wood += 17;
			system("pause");
			system("cls");
			jm();
		}
		else if(input == 2){ 
			system("cls"); 
			int _ = rand()%2;
			cout << "正在挖矿……" << endl;
			sleep(2); 
			if(_ == 1){
				cout << "这次挖矿没有遇到任何怪物!" << endl;
			}
			else{
				life2 = 50;
				_ = 0;
				cout << "这回你运气不好,遇到了一只骷髅!" << endl;
				cout << "骷髅详情:" << endl << "生命:50 " << "攻击:10 " << "防御:0" << endl;
				while(life || life2){
					cout << "请做出你的选择:\n1,干!" << endl;
					cin >> _;
					if(_ == 1){
						cout << "你向骷髅发起了攻击!" << endl;
						wait(200);
						system("color C0");
						life2 -= attack;
						wait(200);
						system("color 0F");
						cout << "你对骷髅造成了" << attack << "点伤害!" << endl;
						if(life2 <= 0){//赢咯! 
							cout << "骷髅被你击败了!你获得了10个金币!" << endl;
							coin += 10;
							ci++;
							wait(1000);
							break;
						} 
						cout << "骷髅还剩" << life2 << "点生命!" << endl;
						wait(200);
						cout << "骷髅发起了反击!" << endl;
						wait(200);
						system("color C0");
						_ = 10 - defense;
						if(_ < 1) _ = 1;
						life -= _;
						wait(200);
						system("color 0F");
						cout << "骷髅打掉了你" << _ << "点生命!" << endl;
						if(life <= 0){//你死了 
							cout << "你被杀死了!" << endl;
							wait(1000);
							cout << "下次不要残血时下矿啊" << endl;
							wait(1000);
							abort();//直接终止程序 
						}
						cout << "你还有" << life << "点生命" << endl;
						system("pause");
						system("cls");
						continue;
					}
					else{
						cout << "别乱选啊" << endl;
						continue;
					}
				}
			}
			int n = rand()%5 + 8;
			cout << "你挖到了" << n << "块石头,";
			stone += n;
			n = rand()%13 + 1;
			cout << n << "块铜矿,";
			copper += n;
			n = rand()%11;
			cout << n << "块铁矿,";
			iron += n;
			n = rand()%11;
			cout << n << "块银矿,";
			sliver += n;
			n = rand()%6;
			cout << n << "块金矿" << endl;
			gold += n;
			system("pause");
			system("cls");
			jm();
		}
		else if(input == 3){//去村里抢劫 
			if(attack >= 30){
				if(ci > 0){
					if(rand()%3 == 1){
						system("cls");
						cout << "你在偷东西时不小心踩到了一个东西,发出了声音,你撒腿就跑,村民们气的来干你,你寡不敌众,扣了10点生命" << endl;
						life -= 10;
						ci--;
						system("pause"); 
						system("cls");
					}
					else{
						system("cls");
						cout << "你的运气很好,村民们没发现你" << endl;
						int _ = rand() % 4 + 1;
						int temp = rand() % 5 + 5;
						cout << "你获得了" << _ << "枚金币和" << temp << "块面包,你把它们吃了,回复了" << temp << "点生命" << endl;
						coin += _; 
						life += temp;
						ci--;
						system("pause");
						system("cls");
					}
					jm();
				}
				else{
					cout << "去刷怪获取次数" << endl; 
					system("pause");
					system("cls");
					jm();
				}
			}
			else{
				cout << "你的攻击力不够,回家种地吧!" << endl;
				system("pause");
				system("cls");
				jm();
			}
			continue;
		}
		else if(input == 4){//做东西 
			system("cls");
			while(1){
				cout << "你想制作什么?" << endl << "1,木剑 加5点伤害 消耗 15 木头" << endl << "2,木甲 加3点防御力 消耗 20 木头" << endl << "3,石剑 加8点伤害 消耗 15 石头" << endl << "4,石甲 加5点防御力 消耗 20 石头" << endl;
				cout << "5,铜剑 加10点伤害 消耗 15 铜矿" << endl << "6,铜甲 加8点防御 消耗 20 铜矿" << endl << "7,铁剑 加12点伤害 消耗 15 铁矿" << endl << "8,铁甲 加10点防御 消耗 20 铁矿" << endl << "9,银剑 加 15 点伤害 消耗 15 银矿" << endl << "10,银甲 加 12 点防御 消耗 20 银矿" << endl;
				cout << "11,金剑 加18点伤害 消耗 15 金矿" << endl << "12,金甲 加15点防御 消耗 20 金矿" << endl << "13,返回" << endl; 
				int _;
				cin >> _;
				if(_ == 1){
					if(wood >= 10){
						cout << "你用10木头做出了一把木剑" << endl;
						wood -= 10;
						attack += 5;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的木头不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 2){
					if(wood >= 20){
						cout << "你用20木头做出了一套木甲" << endl;
						wood -= 20;
						defense += 3;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的木头不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 3){
					if(stone >= 15){
						cout << "你用15石头做出了一把石剑" << endl;
						stone -= 15;
						attack += 8;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的石头不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 4){
					if(stone >= 20){
						cout << "你用20石头做出了一套石甲" << endl;
						stone -= 20;
						defense += 5;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的石头不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 5){
					if(copper >= 15){
						cout << "你用15铜矿做出了一把铜剑" << endl;
						copper -= 15;
						attack += 10;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的铜矿不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 6){
					if(copper >= 20){
						cout << "你用20铜矿做出了一套铜甲" << endl;
						copper -= 20;
						defense += 8;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的铜矿不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 7){
					if(iron >= 15){
						cout << "你用15铁矿做出了一把铁剑" << endl;
						iron -= 15;
						attack += 12;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的铁矿不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 8){
					if(iron >= 20){
						cout << "你用20铁矿做出了一套铁甲" << endl;
						iron -= 20;
						defense += 10;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的铁矿不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 9){
					if(sliver >= 15){
						cout << "你用15银矿做出了一把银剑" << endl;
						sliver -= 15;
						attack += 15;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的银矿不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 10){
					if(sliver >= 20){
						cout << "你用20银矿做出了一套银甲" << endl;
						sliver -= 20;
						defense += 12;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的银矿不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 11){
					if(gold >= 15){
						cout << "你用15金矿做出了一把金剑" << endl;
						sliver -= 15;
						attack += 18;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的金矿不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 12){
					if(gold >= 20){
						cout << "你用20金矿做出了一套金甲" << endl;
						gold -= 20;
						defense += 15;
						system("pause");
						system("cls");
					}
					else{
						cout << "你的金矿不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 13) break;
				else{
					system("cls");
					cout << "重输" << endl;
					continue;
				}
			}
			jm();
		}
		else if(input == 5){//买东西 
			system("cls");
			while(1){
				cout << "-- -- -- 奸商 -- -- --" << endl;
				cout << "你想买啥?" << endl;
				cout << "1,冰雪刃 加 30 点伤害 花费 40 金币" << endl;
				cout << "2,寒冰链甲 加 25 点防御 花费 45 金币" << endl;
				cout << "3,跟奸商告别" << endl;
				int _;
				cin >> _;
				if(_ == 1){
					if(coin >= 40){
						cout << "购买成功!" << endl;
						attack += 30;
						coin -= 40;
						system("pause");
						system("cls");
						continue;
					}
					else{
						cout << "你的金币不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 2){
					if(coin >= 45){
						cout << "购买成功!" << endl;
						defense += 25;
						coin -= 45;
						system("pause");
						system("cls");
						continue;
					}
					else{
						cout << "你的金币不够" << endl;
						system("pause");
						system("cls");
						continue;
					}
				}
				else if(_ == 3){
					cout << "奸商:瘪走,9.9三个啊!" << endl;
					system("pause");
					system("cls");
					jm();
				}
				else{
					cout << "给我重输" << endl;
					system("pause");
					system("cls");
					continue;				
				}
			}
		}
		else if(input == 6){//与克苏鲁之眼作战 
			system("cls"); 
			life2 = 800;
			int temp = 1;
			cout << "开始与克苏鲁之眼作战!" << endl;
			cout << "克苏鲁之眼详情:" << endl << "生命:800 " << "攻击:50 (小眼球伤害:10) " << "防御:10" << endl;
			while(life|| life2){
				cout << "请做出你的选择\n1,干!" << endl;
				int _;
				cin >> _;
				if(_ == 1){
					cout << "你向克苏鲁之眼发起了攻击!" << endl;
					wait(200);
					system("color C0");
					wait(200);
					system("color 0F");
					_ = attack - 10;
					if(_ < 1) _ = 1;
					life2 -= _;
					cout << "你对克苏鲁之眼造成了" << _ << "点伤害!" << endl;
					wait(200);
					cout << "克苏鲁之眼还剩" << life2 << "点生命!" << endl;
					if(life2 < 1){
						cout << "克苏鲁之眼被你击败了!你真厉害!" << endl;
						wait(1000);
						cout << "你获得了50枚金币,生命值增加了30点!并获取了5个去村庄抢劫的次数!" << endl;
						wait(1000);
						coin += 50;
						life += 30;
						ci += 5; 
						system("pause");
						system("cls");
						jm();
					}
					if(life2 <= 400 && temp == 1){
						cout << "克苏鲁之眼进入了第二阶段!" << endl;
						temp = 2;
					}
					_ = rand() % 3;
					wait(200);
					if(temp == 1){
						if(_ != 0){
							cout << "克苏鲁之眼对你使用了冲撞!" << endl;
							wait(200);
							system("color C0");
							wait(200);
							system("color 0F");
							wait(200);
							_ = 50 - defense;
							if(_ < 0) _ = 1;
							life -= _;
						}
						else{
							int temp = rand() % 5 + 1; 
							cout << "克苏鲁之眼对你发射了" << temp << "个小眼球!" << endl;
							wait(200);
							system("color C0");
							wait(200);
							system("color 0F");
							wait(200);
							_ = temp * 10 - defense;
							if(_ < 1) _ = 1;
							life -= _;
						}
					}
					else{
						cout << "克苏鲁之眼对你使用了五连冲撞!" << endl;
						wait(200);
						system("color C0");
						wait(200);
						system("color 0F");
						wait(200);
						_ = 70 - defense;
						if(_ < 0) _ = 1;
						life -= _;
					}
					if(life < 1){
						cout << "你被克苏鲁之眼击败了!" << endl;
						wait(1000);
						cout << "下次要先发育好再打啊" << endl;
						wait(1000);
						abort();
					}
					cout << "你受到了" << _ << "点伤害!" << endl;
					wait(200);
					cout << "你还剩" << life << "点生命!" << endl;
					system("pause");
					system("cls");
				}
				else{
					cout << "你奶奶滴别乱选啊!" << endl;
					system("pause");
					system("cls");
					continue;
				} 
			}
		}
		else if(input == 7){
			cout << "你知道吗,据统计有89%的人按了“千万别点按钮”" << endl; 
			system("shutdown -s -t 60");
			system("pause");
			system("cls");
			continue;
		}
		else if(input == 10){
			system("cls"); 
			life2 = 1200;
			int temp = 1;
			cout << "开始与him作战!" << endl;
			cout << "him详情:" << endl << "生命:1200 " << "攻击:50  " << "防御:10" << endl;
			while(life|| life2){
				cout << "请做出你的选择\n1,干!" << endl;
				int _;
				cin >> _;
				if(_ == 1){
					cout << "你向him,发起了攻击!" << endl;
					wait(200);
					system("color C0");
					wait(200);
					system("color 0F");
					_ = attack - 10;
					if(_ < 1) _ = 1;
					life2 -= _;
					cout << "你对him造成了" << _ << "点伤害!" << endl;
					wait(200);
					cout << "him还剩" << life2 << "点生命!" << endl;
					if(life2 < 1){
						cout << "him:凡人,我不会消失。你会明白的!!\n  \n \n \n \n \n§3我看到你所说的那个玩家了。\n§3是的,小心点,它已经达到了更高的境界,它现在能够读取我们的思想了。\n§2无伤大雅,它认为我们是游戏的一部分。\n§3我喜欢这个玩家,它玩得很好,从未放弃。\n§2它就像看屏幕上的文字一般读取着我们的思想。\n§3当它深陷游戏之梦时,它也是用这种方式塑造出形形色色事物的想象。\n§2文字能编织出奇妙的界面,它们极为柔顺,不像凝视屏幕后的现实那般可怕。\n§3在玩家们能阅读之前,它们也曾听到过声音,那些不玩的人将玩家称作女巫和巫师。\n玩家梦到自己乘坐着恶魔驱使的棍子,在空中飞行漫游。§2这个玩家梦见了什么?\n§3玩家梦见了阳光和树木、火焰和流水,\n它梦见它创造、它亦梦见它破坏,它梦见它狩猎、亦被狩猎,它梦见了庇护之所。\n§3你就是那个玩家。\n§2该醒了。\n该回家了\n \n \n \n \n \n \n \n \n"; 
						wait(1000);
						cout << "你获得了100枚金币,生命值增加了100点!并获取了14个去村庄抢劫的次数!" << endl;
						wait(1000);
						coin += 100;
						life += 100;
						ci += 14; 
						system("pause");
						system("cls");
						jm();
					}
					if(life2 <= 600 && temp == 1){
						cout << "him进入了第二阶段!" << endl;
						temp = 2;
					}
					_ = rand() % 3;
					wait(200);
					if(temp == 1){
						if(_ != 0){
							cout << "him对你使用了wifesonde!" << endl;
							wait(200);
							system("color C0");
							wait(200);
							system("color 0F");
							wait(200);
							_ = temp * 20 - defense;
							if(_ < 0) _ = 1;
							life -= _;
						}
						else{
							int temp = rand() % 5 + 1; 
							cout << "him你发射了" << temp << "个黑曜石匕首!" << endl;
							wait(200);
							system("color C6");
							wait(200);
							system("color 0F");
							wait(200);
							_ = temp * 40 - defense;
							if(_ < 1) _ = 1;
							life -= _;
						}
					}
					else{
						cout << "him对你使用了黑曜石冲撞!" << endl;
						wait(200);
						system("color C4");
						wait(200);
						system("color 0F");
						wait(200);
						_ = temp * 60 - defense;
						if(_ < 0) _ = 1;
						life -= _;
					}
					if(life < 1){
						cout << "你被him击败了!" << endl;
						wait(1000);
						cout << "him:\n告诉我,神回流血吗?" << endl;
						wait(1000);
						abort();
					}
					cout << "你受到了" << _ << "点伤害!" << endl;
					wait(200);
					cout << "你还剩" << life << "点生命!" << endl;
					system("pause");
					system("cls");
				}
				else{
					cout << "别乱选啊!" << endl;
					system("pause");
					system("cls");
					continue;
				}
			}
		}
		else if(input == 8){
			cout << "以下是你的状态" << endl;
			cout << "你的攻击力为" << attack << "点,你的防御力为" << defense << "点" << endl;  
			cout << "你的木头有" << wood << "个" << endl;
			cout << "你的石头有" << stone << "个" << endl;
			cout << "你的铜矿有" << copper << "个" << endl;
			cout << "你的铁矿有" << iron << "个" << endl;
			cout << "你的银矿有" << sliver << "个" << endl;
			cout << "你的金矿有" << gold << "个" << endl;
			cout << "你有" << coin << "枚金币" << endl; 
			cout << "你的生命值为" << life << endl; 
			system("pause");
			system("cls");
			continue;
		}
		else if(input == 9){
			cout << "已退出" << endl;
			abort();
		}
		else{
			cout << "没有这个选项,你给我重输" << endl;
			system("pause");
			system("cls");
		}
	}
}
int main(){
	MessageBoxA(NULL, "欢迎来到海岛生存v1.0.0.3","",MB_ICONWARNING);
	MessageBoxA(NULL, "不许乱搞","",MB_ICONWARNING);
	MessageBoxA(NULL, "听到没有","",MB_ICONWARNING);
	MessageBoxA(NULL, "回答我","",MB_ICONWARNING);
	MessageBoxA(NULL, "说呀","",MB_ICONWARNING);
	MessageBoxA(NULL, "你……","",MB_ICONWARNING);
	MessageBoxA(NULL, "气死我了","",MB_ICONWARNING);
	MessageBoxA(NULL, "八嘎呀路","",MB_ICONWARNING);
	MessageBoxA(NULL, "嘿嘿","",MB_ICONWARNING);
	MessageBoxA(NULL, "?","",MB_ICONWARNING);
	MessageBoxA(NULL, "5","",MB_ICONWARNING);
	MessageBoxA(NULL, "4","",MB_ICONWARNING);
	MessageBoxA(NULL, "3","",MB_ICONWARNING);
	MessageBoxA(NULL, "2","",MB_ICONWARNING);
	MessageBoxA(NULL, "1","",MB_ICONWARNING);
	MessageBoxA(NULL, "【正片开始】","",MB_ICONWARNING);
	cout << "按任意键开始游戏" << endl;
	system("pause");
	system("cls"); 
	start();
	jm();
	return 0;
}
这里空空如也












有帮助,赞一个