这是我改编的代码(极小部分非原创)
本来是想把原来神犇的网址放上来的
回去找发现找不到了……
一二部由于功能少就不放了
如果喜欢请留下点赞和评论~
不多说,上代码!
#include "heads.h"
#include "io.h"
typedef long long ll;
string weapon[10] = {"木剑" , "石剑" , "铁剑" , "钻石剑" , "下界合金剑" , "寰宇支配之剑" , "乱码剑" , "五彩斑斓剑" , "深渊剑" , "氪金萝莉"};
string skillname[8] = {"无技能","狂暴旋风","雷霆万钧","冰封千里","阴晦之气","金锋之光","烈火涅槃","狂啸之怒"};
string skilleffect[8] = {"无","无","无","无","阴晦","耀光","涅槃","怒吼"};
string skille[8] = {"无","无","无","无","攻击减100000","攻击减200000","加血30000","下一次砍击加100000伤害"};
int s1=0,s2=0,s3=0,s4=0,s5=0,s6=0,s7=0;
int skillnum = 0;
int skillenergy[8] = {0,5,15,10,7,8,6,6};
int skillatk[8] = {0,500,1500,1000,0,0,0,0};
int skilln = 0;
void fightmainban () {
puts ("-----------------------------------------------");
puts (" 选择行动 ");
puts (" 1、砍击 2、刺击 3、回血 4、逃跑 5、技能");
puts ("-----------------------------------------------");
}
void skillmianban (int num){
if (num = 0){
puts ("-----------------------------------------------");
puts (" 你没有技能可选择 ");
puts ("-----------------------------------------------");
}
else{
puts ("-----------------------------------------------------------");
puts (" 选择技能 ");
puts ("1、狂暴旋风 2、雷霆万钧 3、冰封千里 4、阴晦之气 5、金锋之光");
puts ("6、烈火涅槃 7、狂啸之怒");
puts ("-----------------------------------------------------------");
}
}
void mianban (int page){
if (page==1){
print("",0xF8,0,0,1);
print(" ",0xF8,0,1,0);
print("",0xF8,0,2,0);
print("",0xF8,0,3,1);
print(" ",0xF8,0,4,1);
print("",0xF8,0,4,0);
print(" ",0xF8,0,5,0);
print("",0xF8,0,6,1);
print("",0xF8,28,4,0);
}
else{
puts("6、抽奖 7、指令 8、进入村庄");
}
}
COORD gets_font_size()
{
COORD font_size;
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
/* 字体信息 */
struct CONSOLE_FONT
{
DWORD index;
COORD dim;
} cfi;
typedef COORD (WINAPI *PROCGETCONSOLEFONTSIZE)(HANDLE, DWORD);
typedef BOOL (WINAPI *PROCGETCURRENTCONSOLEFONT)(HANDLE, BOOL, struct CONSOLE_FONT*);
HMODULE hKernel32 = GetModuleHandle("kernel32");
PROCGETCONSOLEFONTSIZE GetConsoleFontSize = (PROCGETCONSOLEFONTSIZE)GetProcAddress(hKernel32,"GetConsoleFontSize");
PROCGETCURRENTCONSOLEFONT GetCurrentConsoleFont = (PROCGETCURRENTCONSOLEFONT)GetProcAddress(hKernel32,"GetCurrentConsoleFont");
GetCurrentConsoleFont(handle, FALSE, &cfi); /* 获取当前字体索引信息 */
font_size = GetConsoleFontSize(handle, cfi.index); /* 获取当前字体宽高信息[字符宽度及高度所占像素数] */
return font_size;
}
/*******************************************************************************
* 最大化展示控制台窗口
******************************************************************************/
void full_screen()
{
HWND hwnd = GetForegroundWindow();
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); /* 标准输出缓冲区句柄 */
int cx = GetSystemMetrics(SM_CXSCREEN); /* 屏幕宽度 */
int cy = GetSystemMetrics(SM_CYSCREEN); /* 屏幕高度 */
COORD size = gets_font_size();
char cmd[32] = { 0 };
sprintf(cmd, "MODE CON: COLS=%d LINES=%d", cx / size.X, cy / size.Y);
system(cmd);
SetWindowPos(hwnd, HWND_TOP, 0, 0, cx, cy, 0);
}
int main () {
system("color f0");
full_screen();
SetConsoleTitle("GAR 3:末日新生");
srand ((unsigned)time (NULL));
int chance = 2 , bloodchance = 2 , pricechange = 2 , hotal = 500 , tmpblood;
string s;
ll blood1 = 300000 , atk1 = 300000 , wep = 0;
ll atk , blood , equipment , money = 0 , experience = 0;
print(" 出品------------------>",0xF8,0,0,10);
print("",0xF8,0,1,10);
print("",0xF8,0,2,10);
print("",0xF8,15,1,0);
HANDLE handle = ::GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(handle, &csbi);
SetConsoleTextAttribute(handle, 0xF9);
WORD colorOld = csbi.wAttributes;
s=getstr(16);
SetConsoleTextAttribute(handle, colorOld);
if (s == "GARS" || s == "机械贾瑞斯"|| s == "xxz") {
atk = 99999999;
blood = 99999999;
equipment = 99999999;
money = 99999999999;
experience = 999999999;
}
else if (s == "GARK" || s == "机械贾卡斯"||s=="zxy") {
atk = 9999999;
blood = 99999999;
equipment = 99999999;
money = 999999999;
experience = 999999999;
}
else {
atk = rand () % 10 + 99900;
blood = rand () % 9 + 50000;
equipment = rand ();
tmpblood = blood;
}
int bl = 2;
bool killed = false;
blood += equipment;
char buff[150];
sprintf(buff," %lld %lld %d \n",s.c_str(),atk,blood,equipment,experience);
print(buff,0xF8,0,3,10);
char opt;
while (1) {
i: Sleep(2000);
system("cls");
if (killed) blood = tmpblood;
int i = 1,page = 1;
mianban (page);
HANDLE handle = ::GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(handle, &csbi);
SetConsoleTextAttribute(handle, 0xF9);
WORD colorOld = csbi.wAttributes;
opt=getch();
putch(opt);
SetConsoleTextAttribute(handle, colorOld);
print("",0xF8,0,7,0);
if (opt == '1') {
int energy=0;
while (1) {
int blood1 = rand () % 10 + 50000;
int atk1 = rand () % 9 + 2000;
int jiacheng = 0;
cout << "NPC血量=" << blood1 << ". 攻击力=" << atk1 << endl;
cout << "第" << i << "回合" << endl;
cout << "请问" << s << "要干什么?" << endl;
fightmainban ();
int k;
cin >> k;
if (k == 1) {
int tmp = rand () % 10;
if(jiacheng = 0){
if (tmp < 4) {
blood1 -= (atk * 2);
cout << s << "使用附魔钻石剑砍击" << endl;
cout << "NPC" << "还剩" << blood1 << "血" << endl;
energy+=4;
}
else {
blood1 -= atk;
cout << s << "使用" << weapon[wep] << "砍击" << "NPC" << endl;
cout << "NPC" << "还剩" << blood1 << "血" << endl;
energy+=2;
}
}
else{
skillnum = 7;
blood1 -= atk+100000;
cout << s <<"使用" << weapon[wep] << "砍击" << "NPC" << endl;
cout << s <<"因" << skilleffect[skillnum] << "效果加成,攻击+100000" < 0) {
blood += 10;
bl -- ;
cout << s << "加10滴血" << endl;
}
if (k == 4) {
int tmp = rand () % 10;
if (tmp <= 4) {
cout << s << "逃跑了" << endl;
cout << "NPC" << "胜利" << endl;
money -= 10;
break;
}
else{
cout<>sf;
if(sf = 1){
if (s1=1){
skillnum = 1;
if(energy<5){
cout<<"能量不足!"<> op;
if (op == 0) goto i;
if (op == 1 && money >= 10) atk += 30 , money -= 10 , wep = 1;
else if (money < 10) {
puts ("没钱!!!");
goto i;
}
if (op == 2 && money >= 50) atk += 500 , money -= 50 , wep = 2;
else if (money < 50) {
puts ("没钱!!!");
goto i;
}
if (op == 3 && money >= 200) atk += 1000 , money -= 200 , wep = 3;
else if (money < 200) {
puts ("没钱!!!");
goto i;
}
if (op == 4 && money >= 500) atk += 2000 , money -= 500 , wep = 4;
else if (money < 500) {
puts ("没钱!!!");
goto i;
}
if (op == 5 && money >= 30) blood += 200 , money -= 30;
else if (money < 30) {
puts ("没钱!!!");
goto i;
}
if (op == 6 && money >= 100) blood += 7000 , money -= 100;
else if (money < 100) {
puts ("没钱!!!");
goto i;
}
if (op == 7 && money >= 500) blood += 10000 , money -= 500;
else if (money < 500) {
puts ("没钱!!!");
goto i;
}
if (op == 8 && money >= 1000) blood += 30000 , money -= 1000;
else if (money < 1000) {
puts ("没钱!!!");
goto i;
}
if (op == 9 && money >= 200000) atk += 20000 , money -= 200000 , wep = 6;
else if (money < 200000) {
puts ("没钱!!!");
goto i;
}
if (op == 10 && money >= 300000) atk += 30000 , money -= 300000 , wep = 7;
else if (money < 300000) {
puts ("没钱!!!");
goto i;
}
if (op == 11 && money >= 400000) atk += 40000 , money -= 400000 , wep = 8;
else if (money < 400000) {
puts ("没钱!!!");
goto i;
}
if (op == 12 && money >= 500000) atk += 50000 , money -= 500000 , wep = 9;
else if (money < 500000) {
puts ("没钱!!!");
goto i;
}
if (op == 13){
puts("你氪不起......");
}
if (op == 14 && money >=50000) s4 = 1 , money -= 50000;
else if (money < 50000){
puts ("没钱!!!");
goto i;
}
if (op == 15 && money >= 60000) s5 = 1 , money -= 60000;
else if (money < 60000){
puts ("没钱!!!");
goto i;
}
puts ("已穿上装备");
}
if (opt == '3') {
puts ("选择工作");
puts ("1、清理 2分钟5钻石");
puts ("2、撸树 2分钟20钻石");
puts ("3、挖矿 2分钟50钻石");
puts ("4、保卫村庄 2分钟70钻石");
int y;
cin >> y;
if (y == 1 && experience >= 10) {
puts ("输入工作时间");
int times;
cin >> times;
cout << "工作中......" << endl;
Sleep (times * 60000);
money += (times / 2) * 20;
experience+=(times/2)*2;
cout << "你现在有:" << money << "钻石" << endl;
cout<<"你的经验为:"<= 20) {
puts ("输入工作时间");
int times;
cin >> times;
cout << "工作中......" << endl;
Sleep (times * 60000);
money += (times / 2) * 50;
experience+=(times/2)*4;
cout << "你现在有:" << money << "钻石" << endl;
cout<<"你的经验为:"<= 50) {
puts ("输入工作时间");
int times;
cin >> times;
cout << "工作中......" << endl;
Sleep (times * 60000);
experience+=(times / 2)*6;
money += (times / 2) * 5;
cout << "你现在有:" << money << "钻石" << endl;
cout << "你的经验为:"<= 100) {
puts ("输入工作时间");
int times;
cin >> times;
cout << "工作中......" << endl;
Sleep (times * 60000);
experience+=(times / 2) * 8;
money += (times / 2) * 70;
cout << "你现在有:" << money << "钻石" << endl;
cout << "你的经验为:" << experience << endl;
goto i;
}
else if (y == 4 && experience < 100) {
puts ("资格不足");
goto i;
}
}
if (opt == '4') {
blood1*=20;
atk1*=20;
int miss = rand()%10;
int energy = 0;
int jiacheng = 0;
string boss = "凋零风暴";
while (1) {
cout << boss << "血量=" << blood1 << ". 攻击力=" << atk1 << endl;
cout << "第" << i << "回合" << endl;
cout<<"能量:"<> k;
if (k == 1) {
int tmp = rand () % 10;
if(jiacheng = 0){
if (tmp < 4) {
blood1 -= (atk * 2);
cout << s << "使用附魔钻石剑砍击" << endl;
cout << boss << "还剩" << blood1 << "血" << endl;
energy+=4;
}
else {
blood1 -= atk;
cout << s << "使用" << weapon[wep] << "砍击" << "NPC" << endl;
cout << boss << "还剩" << blood1 << "血" << endl;
energy+=2;
}
}
else{
skillnum = 7;
blood1 -= atk+100000;
cout << s <<"使用" << weapon[wep] << "砍击" << boss << endl;
cout << s <<"因" << skilleffect[skillnum] << "效果加成,攻击+100000" <=5){
if(miss>3){
blood1-=atk*3;
energy-=5;
cout< 0) {
blood += 10;
bl -- ;
cout << s << "加10滴血" << endl;
}
if (k == 4) {
int tmp = rand () % 10;
if (tmp <= 4) {
cout << s << "逃跑了" << endl;
cout << boss << "胜利" << endl;
money -= 10;
energy = 0;
break;
}else{
cout << s << "没能逃掉"<>sf;
if(sf == 1){
if (s1==1){
skillnum = 1;
if(sf==1&&energy<5){
cout<<"能量不足!"<>yn;
if(yn == "1"){
if(money<50){
cout<<"钻石不足!";
}else{
money -= 50;
if(g<=5){
cout<<"获得技能:狂暴旋风!"<5&&g<=7){
cout<<"获得:氪金萝莉!运气爆棚!"<7&&g<=10){
cout<<"获得技能:雷霆万钧!运气可以!"<10&&g<=20){
cout<<"获得500钻石!"<20&&g<=24){
cout<<"获得技能:冰封千里!"<24&&g<=30){
cout<<"获得1000钻石!"<30&&g<=33){
cout<<"血量+10000!运气可以啊!"<33&&g<=40||g>45&&g<=50){
cout<<"运气不佳......什么也没抽到......"<40&&g<=45){
cout<<"隐藏大奖!!!炸弹!!!血量-5000!!!"<> zl;
if (zl == "GAR:末日机械万岁!!!"){
cout<<"指令输入成功!已开启内部指令模式!"<>GARzl;
if(GARzl=="money+++"){
cout << "输入密码:"<> GARpassword;
if(GARpassword == "xuxinzhe666"){
cout<<"认证成功!!!"<>GARm;
money+=GARm;
puts("添加成功!!!");
}else{
puts("呵,不知道密码还想用");
}
}
if(GARzl=="leave"){
return 0;
}
if(GARzl=="blood+++"){
cout << "输入密码:"<> GARpassword;
if(GARpassword == "xuxinzhe666"){
cout<<"认证成功!!!"<>GARm;
blood+=GARm;
puts("添加成功!!!");
}else{
puts("呵,不知道密码还想用");
}
}
if(GARzl=="atk+++"){
cout << "输入密码:"<> GARpassword;
if(GARpassword == "xuxinzhe666"){
cout<<"认证成功!!!"<>GARm;
atk+=GARm;
puts("添加成功!!!");
}else{
puts("呵,不知道密码还想用");
}
}
if(GARzl=="top-ups"){
cout << "输入密码:"<> GARpassword;
if(GARpassword == "xuxinzhe666"){
cout<<"认证成功!!!"< 0) {
int ran = rand ();
if (ran % 5 == 0) {
atk1 *= 0.97;
blood1 *= 0.97;
cout << "目前boss攻击力:" << atk1 << "血量:" << blood1 << endl;
chance -- ;
goto i;
}
else {
puts ("真不走运......");
goto i;
}
}
if (zl == "atk++" && s == "GARS" || zl == "atk++" && s == "xxz") {
string password;
puts("请输入密码:");
cin>>password;
if(password=="xuxinzhe666"){
puts("认证成功!");
atk += 1000;
blood += 10000;
}else{
puts("你不是作者!!!!!!");
}
cout << "现在血量:" << atk << " 防御力:" << blood << endl;
goto i;
}
else if (zl == "atk++" && s != "GARS" || zl == "atk++" && s != "GARS") {
puts ("你不是作者!!!!!!");
goto i;
}
if (zl == "blood++" && bloodchance <= 0) {
puts ("你是不是以为这是无限次数的?");
goto i;
}
if (zl == "blood++" && bloodchance > 0) {
blood += 900;
cout << "现在血量:" << blood;
bloodchance -- ;
goto i;
}
if (zl == "cut_price" && pricechange <= 0) {
puts ("你是不是以为这是无限次数的?");
goto i;
}
if (zl == "cut_price" && pricechange > 0) {
int price = rand () % 10;
if (price <= 4) {
hotal *= 0.8;
cout << "现在钱数:" << hotal << endl;
pricechange -- ;
goto i;
}
else {
puts ("真不走运......");
goto i;
}
}
}
if (opt == '8') {
puts ("欢迎来到村庄!");
puts ("住宿一次500钻石,血量+5000");
puts ("修炼一次500钻石,攻击力+5000,可能获得烈火涅槃和狂啸之怒技能");
puts ("住店输入1,修炼输入2");
int o;
cin >> o;
if (o == 1 && money >= 500) {
puts ("好好睡吧......");
blood += 5000;
money -= 500;
Sleep (3000);
puts ("第二天了");
goto i;
}
else if (o == 1 && money < 500) {
puts ("你似乎没钱呢?");
goto i;
}
else {
puts ("下次再来!!!!");
goto i;
}
if (o == 2 && money >= 500) {
puts ("嘿!呼!呀!");
atk += 5000;
money -= 500;
Sleep (3000);
puts ("一天过去了......");
int xiulian = rand()%30;
if(xiulian<13&&xiulian>=10){
puts ("你修得了烈火涅槃!");
s6 = 1;
}
if(xiulian>25&&xiulian<=27){
puts ("你修得了狂啸之怒!");
s7 = 1;
}
goto i;
}
else if (o == 2 && money < 500) {
puts ("你似乎没钱呢?");
goto i;
}
else {
puts ("下次再来!!!!");
goto i;
}
}
}
return 0;
}
heads.h头文件:
#pragma once
#include
#include
#include
#include
using namespace std;
io.h头文件:
#include "heads.h"
int toint(char ch)
{
if(ch>='0'&&ch<='9')
return ch-'0';
return ch-'A'+10;
}
int stoint(string str)
{
int ans=0;
for(int i=0;i=0&&y>=0)
{
COORD pos={x,y};
SetConsoleCursorPosition(handle,pos);
}
SetConsoleTextAttribute(handle, color);
for(int i=0;i')
c--;
if(a[i]=='&')
{
b+=a[i];
i++;
}
b+=a[i];
}while(c!=0);
b.erase(b.size()-1,1);
WORD adder;
adder=toint(ch1)*16+toint(ch2);
print(b,adder,-1,-1,wait);
continue;
}
}
else
{
if(a[i]=='&')
i++;
printf("%c",a[i]);
}
Sleep(wait);
}
SetConsoleTextAttribute(handle, colorOld);
}
string getstr(int lenth)
{
char ch;
string input="";
while(ch=getchar(),ch!='\n'&&input.size()
制作不易,希望您喜欢
我的博客:GARS 的博客