using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class RpgGame { public string user ; public int atk; public int def; public int hp; #region/登录 public void Login() { Console.WriteLine("请输入用户名:"); user = Console.ReadLine(); Console.WriteLine("请输入密码:"); string pasword = Console.ReadLine(); Console.Clear(); Console.WriteLine("欢迎来到另类西游!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } #endregion #region/游戏背景 public void Background() { Console.WriteLine("话说五百年前,有一石猴习得七十二般变化,获大神通"); Console.WriteLine("打上了三十三重天,推了凌霄殿,大闹了天宫"); Console.WriteLine("后请西天如来出手,将其镇压在五指山下,转眼五百年已过"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } #endregion #region/阵营选择 public int Selectedrole() { Console.WriteLine("你重生到了五百年后,现在请选择自己的阵营:"); Console.WriteLine("1.妖界阵营"); Console.WriteLine("2.佛界阵营"); Console.WriteLine("3.神界阵营"); char role = Console.ReadKey().KeyChar; Console.Clear(); switch (role) { case'1': Console.WriteLine("您选择了妖界阵营,将进入游戏主线"); return 1; break; case '2': Console.WriteLine("您选择了佛界阵营,将进入游戏主线"); return 2; break; case '3': Console.WriteLine("您选择了神界阵营,将进入游戏主线"); return 3; break; default : Console.WriteLine("请选择正确的阵营"); return 4; break; } } #endregion #region/自身属性和主线任务 public void Monst() { Console.WriteLine("您当前的属性为: 攻击力 15 , 防御力 15 , 血量200"); atk = 15; def = 15; hp = 200; Console.WriteLine("五百年已过,如来当年的封印已经松动,身为妖界的新生一代,你要去五指山"); Console.WriteLine("主线:救出妖王石猴,活着回来!"); Console.WriteLine("1.杀死隐藏在暗处准备趁妖王石猴最虚弱时,暗害妖王的神界神将"); Console.WriteLine("2.杀死趁机奴役妖王的如来弟子转世的金蝉子"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } public void Buddha() { Console.WriteLine("您当前的属性为: 攻击力 25 , 防御力 10 , 血量100"); atk = 25; def = 10; hp = 100; Console.WriteLine("五百年已过,如来当年的封印已经松动,身为神界未来的神将,你要去五指山"); Console.WriteLine("主线:带着石猴的元婴回来!"); Console.WriteLine("1.杀死前来准备营救石猴的妖精"); Console.WriteLine("2.杀死趁机奴役妖王的如来弟子转世的金蝉子"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } public void God() { Console.WriteLine("恭喜您获得隐藏唯一职业:金蝉子"); Console.WriteLine("恭喜您获得菩萨赐下的唯一武器:锦斓袈裟(对100米范围内的敌人进行无差别毁灭攻击--只能使用一次)"); Console.WriteLine("您当前的属性为: 攻击力 25 , 防御力 15, 血量150"); atk = 25; def = 15; hp = 150; Console.WriteLine("五百年已过,如来当年的封印已经松动,身为佛门大能金蝉子的转世,你将重回西天,将佛的荣光带入这片世界"); Console.WriteLine("主线:奴役妖王石猴,让他护卫你回到西天"); Console.WriteLine("1.杀死前来准备营救石猴的妖精"); Console.WriteLine("2.杀死暗害石猴的神界神将"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } #endregion #region/分支事件 public int Plot() { Console.WriteLine("路上遇到了一个老猎户,去问问五指山怎么走!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine(user+":老人家!请问五指山怎么走?"); Console.WriteLine("猎户:五指山,这我倒是知道,但我凭什么告诉你啊!"); Console.WriteLine(user+"我这里有一些银两,只有你告诉我,我就送你了"); Console.WriteLine("没想到还能碰到条大鱼,把银两留下,爷爷今天高兴,放你一条狗命"); Console.WriteLine(user+"你莫要自误!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("选择解决方法:"); Console.WriteLine("1.留下银两"); Console.WriteLine("2.杀死他"); char select = Console.ReadKey().KeyChar; switch(select) { case'1': return 1; break; case '2': return 2; break; default: return 3; break; } } public void Select1() { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine(user + ":小小银两,不成敬意,希望你能告诉我五指山怎么走"); Console.WriteLine("猎户:算你识相,爷爷心情好,告诉你,五指山在此地往西五十里地的地方"); } public void Select2() { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int blood = 60; int hurt = 0; Console.WriteLine(user+":找死!"); Console.WriteLine("猎户:攻击 5 , 防御 5 , 血量 60"); while (blood >10) { hurt = atk - 5; blood = blood - hurt; Console.WriteLine("本次攻击造成" + hurt + "点伤害------猎户当前血量为:" + blood); Console.WriteLine("猎户对您造成0点伤害----您当前的血量为:"+hp); } Console.WriteLine("猎户:大人,我错了放我一条生路!"); Console.WriteLine(user+"放你可以,说,五指山在哪儿!"); Console.WriteLine("猎户:五指山在此地往东三百里的地方!"); Console.WriteLine("请选择是否放了他"); Console.WriteLine("1.放了他,赶去五指山"); Console.WriteLine("2.杀了他,赶去五指山"); Console.ReadKey(); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("猎户告诉了你错误的地址,你在另外两派人马争夺后,才匆匆赶到,看着一片废墟,心痛不已"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("您未能完成自己的主线任务,游戏失败!"); } #endregion #region/妖界阵营的主线任务 public void Plot_Monst_Select1() { int i=0; int buddha_atk = 20; int buddha_def = 5; int buddha_hp = 100; int God_atk = 25; int GOd_def = 5; int God_hp = 120; Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("你按着猎户指的方向来到了五指山"); Console.WriteLine("突然你发现了神界的神将鬼鬼祟祟的前来,你是否选择发动攻击"); Console.WriteLine("1.发动攻击"); Console.WriteLine("2.等等再看"); char select = Console.ReadKey().KeyChar; switch (select) { case '1' : i = 1; break; case '2': i = 2; break; default: Console.WriteLine("您输入的指令不正确,游戏失败!"); i = 3; break; } if(select=='1') { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int buddha_hurt=0; int hurt = 0; Console.WriteLine("您对神将率先放到攻击!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); while (buddha_hp >= 0) { buddha_hurt = atk - buddha_def; buddha_hp = buddha_hp - buddha_hurt; if (buddha_hp < 0) buddha_hp = 0; Console.WriteLine("本次攻击造成" + buddha_hurt + "点伤害------神将当前血量为:" + buddha_hp); hurt = buddha_atk - def; hp = hp - hurt; Console.WriteLine("神将对您造成了" + hurt + "点伤害----您当前血量为:" + hp); } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("您成功击杀了神将!"); Console.WriteLine("LIVE UP "); Console.WriteLine("您当前的属性: 攻击20 , 防御20 ,血量210"); atk = 20; def = 20; hp = 210; } else if (select == '2') { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int buddha_hurt = 0; int hurt = 0; Console.WriteLine("神将对您发动了攻击"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); while (buddha_hp >= 0) { hurt = buddha_atk - def; hp = hp - hurt; Console.WriteLine("神将对您造成了" + hurt + "点伤害----您当前血量为:" + hp); buddha_hurt = atk - buddha_def; buddha_hp = buddha_hp - buddha_hurt; if (buddha_hp < 0) buddha_hp = 0; Console.WriteLine("本次攻击造成" + buddha_hurt + "点伤害------神将当前血量为:" + buddha_hp); } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("您成功击杀了神将!"); Console.WriteLine("LIVE UP "); Console.WriteLine("您当前的属性: 攻击20 , 防御20 ,血量210"); atk = 20; def = 20; hp = 210; } else { Console.WriteLine("请关闭游戏!"); Console.ReadKey(); while (true) { } } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("杀死了神将,你觉得自己变的更强了"); Console.WriteLine("你发现了一个光头和尚,仔细看看原来是‘金蝉子’转世"); Console.WriteLine("‘金蝉子’发现了你,你想着先下手为强,攻击了他!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int god_hurt = 0; int hurt2 = 0; while (God_hp <= 0) { god_hurt = atk - GOd_def; God_hp = God_hp - god_hurt; if (God_hp < 0) God_hp = 0; Console.WriteLine("本次攻击造成" + god_hurt + "点伤害------‘金蝉子’当前血量为:" + God_hp); hurt2 = God_atk - def; hp = hp - hurt2; Console.WriteLine("神将对您造成了" + hurt2 + "点伤害----您当前血量为:" + hp); } Console.WriteLine("您成功击杀了金蝉子!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("在五指山下你救出了虚弱的妖王石猴,带着他回到了妖界"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("游戏胜利!"); Console.ReadKey(); } #endregion #region/神界阵营的主线任务 public void Plot_Buddha_Select1() { int i = 0; int monst_atk = 20; int monst_def = 5; int monst_hp = 100; int God_atk = 25; int GOd_def = 5; int God_hp = 120; Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("你按着猎户指的方向来到了五指山"); Console.WriteLine("突然你发现了妖界的小妖鬼鬼祟祟的前来,你是否选择发动攻击"); Console.WriteLine("1.发动攻击"); Console.WriteLine("2.等等再看"); char select = Console.ReadKey().KeyChar; switch (select) { case '1': i = 1; break; case '2': i = 2; break; default: Console.WriteLine("您输入的指令不正确,游戏失败!"); i = 3; break; } if (i == 1) { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int monst_hurt = 0; int hurt = 0; Console.WriteLine("您对小妖率先放到攻击!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); while (monst_hp > 0) { monst_hurt = atk - monst_def; monst_hp = monst_hp - monst_hurt; if (monst_hp < 0) monst_hp = 0; Console.WriteLine("本次攻击造成" + monst_hurt + "点伤害------小妖当前血量为:" + monst_hp); hurt = monst_atk - def; hp = hp - hurt; Console.WriteLine("小妖对您造成了" + hurt + "点伤害----您当前血量为:" + hp); } Console.WriteLine("您成功击杀了小妖!"); Console.WriteLine("LIVE UP "); Console.WriteLine("您当前的属性: 攻击35 , 防御15 ,血量110"); atk = 35; def = 15; hp = 110; } if (i == 2) { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int monst_hurt = 0; int hurt = 0; Console.WriteLine("小妖对您发动了攻击"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); while (monst_hp > 0) { hurt = monst_atk - def; hp = hp - hurt; Console.WriteLine("小妖对您造成了" + hurt + "点伤害----您当前血量为:" + hp); monst_hurt = atk - monst_def; monst_hp = monst_hp - monst_hurt; if (monst_hp < 0) monst_hp = 0; Console.WriteLine("本次攻击造成" + monst_hurt + "点伤害------小妖当前血量为:" + monst_hp); } Console.WriteLine("您成功击杀了小妖!"); Console.WriteLine("LIVE UP "); Console.WriteLine("您当前的属性: 攻击35 , 防御15 ,血量110"); atk = 35; def = 15; hp = 110; } else { Console.WriteLine("请关闭游戏!"); Console.ReadKey(); while (true) { } } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("杀死了小妖,你觉得自己变的更强了"); Console.WriteLine("你发现了一个光头和尚,仔细看看原来是‘金蝉子’转世"); Console.WriteLine("‘金蝉子’发现了你,你想着先下手为强,攻击了他!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int god_hurt = 0; int hurt2 = 0; while (God_hp <= 0) { god_hurt = atk - GOd_def; God_hp = God_hp - god_hurt; if (God_hp < 0) God_hp = 0; Console.WriteLine("本次攻击造成" + god_hurt + "点伤害------‘金蝉子’当前血量为:" + God_hp); hurt2 = God_atk - def; hp = hp - hurt2; Console.WriteLine("神将对您造成了" + hurt2 + "点伤害----您当前血量为:" + hp); } Console.WriteLine("您成功击杀了金蝉子!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("在五指山下你趁着石猴虚弱,抽了他的元婴,废了他的道行,回去交差"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("游戏胜利!"); } #endregion #region/佛门阵营的主线任务 public void Plot_God_Select1() { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("你慢慢的赶过来,发现了一个小妖和神将打了起来"); Console.WriteLine("你走过去想劝和,没想到他们一起攻击你,无奈你想起了菩萨赐的‘锦斓袈裟’,纠结是否使用"); Console.WriteLine("1.使用"); Console.WriteLine("2.继续劝和"); char select = Console.ReadKey().KeyChar; Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); switch (select) { case '1': Console.WriteLine("你使用了唯一道具,打死了小妖和神将!"); Console.WriteLine("成功奴役了石猴"); Console.WriteLine("游戏胜利!"); break; default: Console.WriteLine("你被小妖和神将合力打死"); Console.WriteLine("游戏失败!"); break; } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } #endregion } class Program { static void Main(string[] args) { RpgGame game = new RpgGame(); game.Login(); game.Background(); int i = game.Selectedrole(); if (i == 1) { game.Monst(); int k = game.Plot(); if (k == 1) { game.Select1(); game.Plot_Monst_Select1(); } else if (k == 2) { game.Select2(); } else { Console.WriteLine("游戏失败! 请重启游戏"); Console.ReadKey(); } } else if (i == 2) { game.God(); int k = game.Plot(); if (k == 1) { game.Select1(); game.Plot_God_Select1(); } else if (k == 2) { game.Select2(); } else { Console.WriteLine("游戏失败! 请重启游戏"); Console.ReadKey(); } } else if (i == 3) { game.Buddha(); int k = game.Plot(); if (k == 1) { game.Select1(); game.Plot_Buddha_Select1(); } else if (k == 2) { game.Select2(); } else { Console.WriteLine("游戏失败! 请重启游戏"); Console.ReadKey(); } } else { Console.WriteLine("游戏失败! 请重启游戏"); Console.ReadKey(); } } }}
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class RpgGame { public string user ; public int atk; public int def; public int hp; #region/登录 public void Login() { Console.WriteLine("请输入用户名:"); user = Console.ReadLine(); Console.WriteLine("请输入密码:"); string pasword = Console.ReadLine(); Console.Clear(); Console.WriteLine("欢迎来到另类西游!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } #endregion #region/游戏背景 public void Background() { Console.WriteLine("话说五百年前,有一石猴习得七十二般变化,获大神通"); Console.WriteLine("打上了三十三重天,推了凌霄殿,大闹了天宫"); Console.WriteLine("后请西天如来出手,将其镇压在五指山下,转眼五百年已过"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } #endregion #region/阵营选择 public int Selectedrole() { Console.WriteLine("你重生到了五百年后,现在请选择自己的阵营:"); Console.WriteLine("1.妖界阵营"); Console.WriteLine("2.佛界阵营"); Console.WriteLine("3.神界阵营"); char role = Console.ReadKey().KeyChar; Console.Clear(); switch (role) { case'1': Console.WriteLine("您选择了妖界阵营,将进入游戏主线"); return 1; break; case '2': Console.WriteLine("您选择了佛界阵营,将进入游戏主线"); return 2; break; case '3': Console.WriteLine("您选择了神界阵营,将进入游戏主线"); return 3; break; default : Console.WriteLine("请选择正确的阵营"); return 4; break; } } #endregion #region/自身属性和主线任务 public void Monst() { Console.WriteLine("您当前的属性为: 攻击力 15 , 防御力 15 , 血量200"); atk = 15; def = 15; hp = 200; Console.WriteLine("五百年已过,如来当年的封印已经松动,身为妖界的新生一代,你要去五指山"); Console.WriteLine("主线:救出妖王石猴,活着回来!"); Console.WriteLine("1.杀死隐藏在暗处准备趁妖王石猴最虚弱时,暗害妖王的神界神将"); Console.WriteLine("2.杀死趁机奴役妖王的如来弟子转世的金蝉子"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } public void Buddha() { Console.WriteLine("您当前的属性为: 攻击力 25 , 防御力 10 , 血量100"); atk = 25; def = 10; hp = 100; Console.WriteLine("五百年已过,如来当年的封印已经松动,身为神界未来的神将,你要去五指山"); Console.WriteLine("主线:带着石猴的元婴回来!"); Console.WriteLine("1.杀死前来准备营救石猴的妖精"); Console.WriteLine("2.杀死趁机奴役妖王的如来弟子转世的金蝉子"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } public void God() { Console.WriteLine("恭喜您获得隐藏唯一职业:金蝉子"); Console.WriteLine("恭喜您获得菩萨赐下的唯一武器:锦斓袈裟(对100米范围内的敌人进行无差别毁灭攻击--只能使用一次)"); Console.WriteLine("您当前的属性为: 攻击力 25 , 防御力 15, 血量150"); atk = 25; def = 15; hp = 150; Console.WriteLine("五百年已过,如来当年的封印已经松动,身为佛门大能金蝉子的转世,你将重回西天,将佛的荣光带入这片世界"); Console.WriteLine("主线:奴役妖王石猴,让他护卫你回到西天"); Console.WriteLine("1.杀死前来准备营救石猴的妖精"); Console.WriteLine("2.杀死暗害石猴的神界神将"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } #endregion #region/分支事件 public int Plot() { Console.WriteLine("路上遇到了一个老猎户,去问问五指山怎么走!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine(user+":老人家!请问五指山怎么走?"); Console.WriteLine("猎户:五指山,这我倒是知道,但我凭什么告诉你啊!"); Console.WriteLine(user+"我这里有一些银两,只有你告诉我,我就送你了"); Console.WriteLine("没想到还能碰到条大鱼,把银两留下,爷爷今天高兴,放你一条狗命"); Console.WriteLine(user+"你莫要自误!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("选择解决方法:"); Console.WriteLine("1.留下银两"); Console.WriteLine("2.杀死他"); char select = Console.ReadKey().KeyChar; switch(select) { case'1': return 1; break; case '2': return 2; break; default: return 3; break; } } public void Select1() { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine(user + ":小小银两,不成敬意,希望你能告诉我五指山怎么走"); Console.WriteLine("猎户:算你识相,爷爷心情好,告诉你,五指山在此地往西五十里地的地方"); } public void Select2() { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int blood = 60; int hurt = 0; Console.WriteLine(user+":找死!"); Console.WriteLine("猎户:攻击 5 , 防御 5 , 血量 60"); while (blood >10) { hurt = atk - 5; blood = blood - hurt; Console.WriteLine("本次攻击造成" + hurt + "点伤害------猎户当前血量为:" + blood); Console.WriteLine("猎户对您造成0点伤害----您当前的血量为:"+hp); } Console.WriteLine("猎户:大人,我错了放我一条生路!"); Console.WriteLine(user+"放你可以,说,五指山在哪儿!"); Console.WriteLine("猎户:五指山在此地往东三百里的地方!"); Console.WriteLine("请选择是否放了他"); Console.WriteLine("1.放了他,赶去五指山"); Console.WriteLine("2.杀了他,赶去五指山"); Console.ReadKey(); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("猎户告诉了你错误的地址,你在另外两派人马争夺后,才匆匆赶到,看着一片废墟,心痛不已"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("您未能完成自己的主线任务,游戏失败!"); } #endregion #region/妖界阵营的主线任务 public void Plot_Monst_Select1() { int i=0; int buddha_atk = 20; int buddha_def = 5; int buddha_hp = 100; int God_atk = 25; int GOd_def = 5; int God_hp = 120; Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("你按着猎户指的方向来到了五指山"); Console.WriteLine("突然你发现了神界的神将鬼鬼祟祟的前来,你是否选择发动攻击"); Console.WriteLine("1.发动攻击"); Console.WriteLine("2.等等再看"); char select = Console.ReadKey().KeyChar; switch (select) { case '1' : i = 1; break; case '2': i = 2; break; default: Console.WriteLine("您输入的指令不正确,游戏失败!"); i = 3; break; } if(select=='1') { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int buddha_hurt=0; int hurt = 0; Console.WriteLine("您对神将率先放到攻击!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); while (buddha_hp >= 0) { buddha_hurt = atk - buddha_def; buddha_hp = buddha_hp - buddha_hurt; if (buddha_hp < 0) buddha_hp = 0; Console.WriteLine("本次攻击造成" + buddha_hurt + "点伤害------神将当前血量为:" + buddha_hp); hurt = buddha_atk - def; hp = hp - hurt; Console.WriteLine("神将对您造成了" + hurt + "点伤害----您当前血量为:" + hp); } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("您成功击杀了神将!"); Console.WriteLine("LIVE UP "); Console.WriteLine("您当前的属性: 攻击20 , 防御20 ,血量210"); atk = 20; def = 20; hp = 210; } else if (select == '2') { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int buddha_hurt = 0; int hurt = 0; Console.WriteLine("神将对您发动了攻击"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); while (buddha_hp >= 0) { hurt = buddha_atk - def; hp = hp - hurt; Console.WriteLine("神将对您造成了" + hurt + "点伤害----您当前血量为:" + hp); buddha_hurt = atk - buddha_def; buddha_hp = buddha_hp - buddha_hurt; if (buddha_hp < 0) buddha_hp = 0; Console.WriteLine("本次攻击造成" + buddha_hurt + "点伤害------神将当前血量为:" + buddha_hp); } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("您成功击杀了神将!"); Console.WriteLine("LIVE UP "); Console.WriteLine("您当前的属性: 攻击20 , 防御20 ,血量210"); atk = 20; def = 20; hp = 210; } else { Console.WriteLine("请关闭游戏!"); Console.ReadKey(); while (true) { } } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("杀死了神将,你觉得自己变的更强了"); Console.WriteLine("你发现了一个光头和尚,仔细看看原来是‘金蝉子’转世"); Console.WriteLine("‘金蝉子’发现了你,你想着先下手为强,攻击了他!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int god_hurt = 0; int hurt2 = 0; while (God_hp <= 0) { god_hurt = atk - GOd_def; God_hp = God_hp - god_hurt; if (God_hp < 0) God_hp = 0; Console.WriteLine("本次攻击造成" + god_hurt + "点伤害------‘金蝉子’当前血量为:" + God_hp); hurt2 = God_atk - def; hp = hp - hurt2; Console.WriteLine("神将对您造成了" + hurt2 + "点伤害----您当前血量为:" + hp); } Console.WriteLine("您成功击杀了金蝉子!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("在五指山下你救出了虚弱的妖王石猴,带着他回到了妖界"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("游戏胜利!"); Console.ReadKey(); } #endregion #region/神界阵营的主线任务 public void Plot_Buddha_Select1() { int i = 0; int monst_atk = 20; int monst_def = 5; int monst_hp = 100; int God_atk = 25; int GOd_def = 5; int God_hp = 120; Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("你按着猎户指的方向来到了五指山"); Console.WriteLine("突然你发现了妖界的小妖鬼鬼祟祟的前来,你是否选择发动攻击"); Console.WriteLine("1.发动攻击"); Console.WriteLine("2.等等再看"); char select = Console.ReadKey().KeyChar; switch (select) { case '1': i = 1; break; case '2': i = 2; break; default: Console.WriteLine("您输入的指令不正确,游戏失败!"); i = 3; break; } if (i == 1) { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int monst_hurt = 0; int hurt = 0; Console.WriteLine("您对小妖率先放到攻击!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); while (monst_hp > 0) { monst_hurt = atk - monst_def; monst_hp = monst_hp - monst_hurt; if (monst_hp < 0) monst_hp = 0; Console.WriteLine("本次攻击造成" + monst_hurt + "点伤害------小妖当前血量为:" + monst_hp); hurt = monst_atk - def; hp = hp - hurt; Console.WriteLine("小妖对您造成了" + hurt + "点伤害----您当前血量为:" + hp); } Console.WriteLine("您成功击杀了小妖!"); Console.WriteLine("LIVE UP "); Console.WriteLine("您当前的属性: 攻击35 , 防御15 ,血量110"); atk = 35; def = 15; hp = 110; } if (i == 2) { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int monst_hurt = 0; int hurt = 0; Console.WriteLine("小妖对您发动了攻击"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); while (monst_hp > 0) { hurt = monst_atk - def; hp = hp - hurt; Console.WriteLine("小妖对您造成了" + hurt + "点伤害----您当前血量为:" + hp); monst_hurt = atk - monst_def; monst_hp = monst_hp - monst_hurt; if (monst_hp < 0) monst_hp = 0; Console.WriteLine("本次攻击造成" + monst_hurt + "点伤害------小妖当前血量为:" + monst_hp); } Console.WriteLine("您成功击杀了小妖!"); Console.WriteLine("LIVE UP "); Console.WriteLine("您当前的属性: 攻击35 , 防御15 ,血量110"); atk = 35; def = 15; hp = 110; } else { Console.WriteLine("请关闭游戏!"); Console.ReadKey(); while (true) { } } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("杀死了小妖,你觉得自己变的更强了"); Console.WriteLine("你发现了一个光头和尚,仔细看看原来是‘金蝉子’转世"); Console.WriteLine("‘金蝉子’发现了你,你想着先下手为强,攻击了他!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); int god_hurt = 0; int hurt2 = 0; while (God_hp <= 0) { god_hurt = atk - GOd_def; God_hp = God_hp - god_hurt; if (God_hp < 0) God_hp = 0; Console.WriteLine("本次攻击造成" + god_hurt + "点伤害------‘金蝉子’当前血量为:" + God_hp); hurt2 = God_atk - def; hp = hp - hurt2; Console.WriteLine("神将对您造成了" + hurt2 + "点伤害----您当前血量为:" + hp); } Console.WriteLine("您成功击杀了金蝉子!"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("在五指山下你趁着石猴虚弱,抽了他的元婴,废了他的道行,回去交差"); Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("游戏胜利!"); } #endregion #region/佛门阵营的主线任务 public void Plot_God_Select1() { Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); Console.WriteLine("你慢慢的赶过来,发现了一个小妖和神将打了起来"); Console.WriteLine("你走过去想劝和,没想到他们一起攻击你,无奈你想起了菩萨赐的‘锦斓袈裟’,纠结是否使用"); Console.WriteLine("1.使用"); Console.WriteLine("2.继续劝和"); char select = Console.ReadKey().KeyChar; Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); switch (select) { case '1': Console.WriteLine("你使用了唯一道具,打死了小妖和神将!"); Console.WriteLine("成功奴役了石猴"); Console.WriteLine("游戏胜利!"); break; default: Console.WriteLine("你被小妖和神将合力打死"); Console.WriteLine("游戏失败!"); break; } Console.WriteLine("...按任意键继续"); Console.ReadKey(); Console.Clear(); } #endregion } class Program { static void Main(string[] args) { RpgGame game = new RpgGame(); game.Login(); game.Background(); int i = game.Selectedrole(); if (i == 1) { game.Monst(); int k = game.Plot(); if (k == 1) { game.Select1(); game.Plot_Monst_Select1(); } else if (k == 2) { game.Select2(); } else { Console.WriteLine("游戏失败! 请重启游戏"); Console.ReadKey(); } } else if (i == 2) { game.God(); int k = game.Plot(); if (k == 1) { game.Select1(); game.Plot_God_Select1(); } else if (k == 2) { game.Select2(); } else { Console.WriteLine("游戏失败! 请重启游戏"); Console.ReadKey(); } } else if (i == 3) { game.Buddha(); int k = game.Plot(); if (k == 1) { game.Select1(); game.Plot_Buddha_Select1(); } else if (k == 2) { game.Select2(); } else { Console.WriteLine("游戏失败! 请重启游戏"); Console.ReadKey(); } } else { Console.WriteLine("游戏失败! 请重启游戏"); Console.ReadKey(); } } }}