public static void Turn(Monstor monstor) { Random random = new Random(); int choose = random.Next(1, 2); switch (choose) { case 1: int damage = Battle.AttackDamage(monstor.dreamattack); Battle.BattleInformation(monstor.name, Player.Instance().name, damage); Player.Instance().hp -= damage; Player.Instance().Show(); break; case 2: Skill monsterskill; int a = random.Next(1, 2); //选择技能类型 if (a == 1) { a = random.Next(1, Program.monsterskilltype1maxnumber); monsterskill = GameRes.skill[a + 10]; } else { a = random.Next(1, Program.monsterskilltype2maxnumber); monsterskill = GameRes.skill[a + 20]; } int skilleffect = Skill.UsingSkill(ref monstor, monsterskill, monstor.dreamattack); if (monsterskill.type == 1) { //使用伤害性技能 Player.Instance().hp -= skilleffect; Battle.BattleInformation(monstor.name, Player.Instance().name, skilleffect); } else { //调用辅助类技能 Battle.BattleInformation(monstor.name, Player.Instance().name, skilleffect, 2, monsterskill.describe); } Player.Instance().Show(); break; }//1为使用平A 2为技能 }
} //展示勇者属性 public void Turn(ref Monstor monstor) { GameHelper.Talking(Player.Instance().name, "这次决定很重要……我想——"); GameHelper.Talking("1.那就普通攻击吧!", "2.利用梦之精华释放技能好了", false); int a = int.Parse(Console.ReadLine()); GameHelper.TalkingEnd(); int skilleffect; switch (a) { case 1: int damage = Battle.AttackDamage(Player.Instance().dreamsword.dreamattack); Battle.BattleInformation(Player.Instance().name, monstor.name, damage); monstor.hp -= damage; Player.Instance().Show(); break; case 2: GameHelper.Talking("", "那这次就决定是技能——", false); int skillid = int.Parse(Console.ReadLine()) - 1; //从技能1到技能4选择 GameHelper.TalkingEnd(); if (Skill.IfSkill(Player.Instance().playerskill[skillid])) //技能释放成功 { skilleffect = Skill.UsingSkill(ref monstor, Player.Instance().playerskill[skillid], dreamsword.dreamattack); if (Instance().playerskill[skillid].type == 1) { //使用伤害性技能 monstor.hp -= skilleffect; Battle.BattleInformation(Player.Instance().name, monstor.name, skilleffect); } else { //调用辅助类技能 Battle.BattleInformation(Player.Instance().name, monstor.name, skilleffect, 2, Player.Instance().playerskill[skillid].describe); } Player.Instance().Show(); } break; }//1为使用平A 2为技能 }
public static void Show(Monstor monstor) { int x = 30, y = 4; Console.SetCursorPosition(x, y); Console.WriteLine("怪物信息一览: "); Console.SetCursorPosition(x, y + 1); Console.ReadKey(true); Console.SetCursorPosition(x, y + 2); Console.WriteLine("怪物名称: " + monstor.name); Console.SetCursorPosition(x, y + 3); Console.ReadKey(true); Console.SetCursorPosition(x, y + 4); Console.WriteLine("怪物所携带梦之精华: " + monstor.dream); Console.SetCursorPosition(x, y + 5); Console.ReadKey(true); Console.SetCursorPosition(x, y + 6); Console.WriteLine("怪物生命值 : ???"); Console.SetCursorPosition(x, y + 7); Console.ReadKey(true); Console.SetCursorPosition(x, y + 8); Console.WriteLine("怪物攻击力 : ???"); }
public static bool BattleFighting(ref Monstor monstor, int xh = 0) { bool dreamoff = false;//默认返回没有进入梦之地 int duihuacishu = 0; GameHelper.Talking(monstor.name, monstor.beforefight); Console.ReadKey(true); GameHelper.Talking(Player.Instance().name, monstor.playeranswer); Monstor.Show(monstor); GameHelper.TalkingEnd(); bool winorlose = false;//失败时会不断挑战 int hp = Player.Instance().hp; int dream = Player.Instance().dream; while (winorlose != true) { while (monstor.hp >= 0 && Player.Instance().hp > 0) { Player.Instance().Turn(ref monstor); Monstor.Turn(monstor); Player.Instance().Show(); duihuacishu++; if (duihuacishu % 2 == 0 && duihuacishu < 8) //每隔一段时间触发对话 { int j = xh + 4; for (; xh < j; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } } } if (Player.Instance().hp <= 0) { winorlose = false; winorlose = WinOrLose(winorlose); Player.ReSet(hp, dream); } else { winorlose = true; } } if (monstor.id % 2 != 0 && monstor.id <= 4) { GameHelper.Talking("", "是时候给予致命一击了!"); GameHelper.TalkingEnd(); GameHelper.Talking("1.给予致命一击,收割大量梦之精华!", "2.够了吧……不知道为什么,忍不下心来……", false); int choose = int.Parse(Console.ReadLine()); if (choose == 1) { Player.Instance().dream += monstor.dream += 20; Player.Instance().hp += 20; GameHelper.Talking("", "战斗结束! ", false); Console.ReadKey(true); GameHelper.TalkingEnd(); Player.Instance().Show(); Monstor.ShowEnd(); } else { Player.Instance().dream += (monstor.dream / 4); Player.Instance().hp += 40; Console.SetCursorPosition(50, 39); Console.ReadKey(true); Player.Instance().Show(); Monstor.ShowEnd(); dreamoff = true; } } return(dreamoff); }
public static bool LoadGameRes() { XmlDocument xml = new XmlDocument(); const string ResPath = @"C:\The World\TheWorld.xml"; XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreComments = true;//忽略文档里面的注释 try { xml.Load(ResPath); XmlNode root = xml.SelectSingleNode("TheWorld"); XmlNode role = root.SelectSingleNode("hero"); Player.Instance().hp = int.Parse(role.Attributes["hp"].Value); Player.Instance().id = int.Parse(role.Attributes["id"].Value); Player.Instance().dream = int.Parse(role.Attributes["dream"].Value); Player.Instance().luck = int.Parse(role.Attributes["luck"].Value); Player.Instance().name = role.Attributes["name"].Value; Player.Instance().crit = int.Parse(role.Attributes["crit"].Value); XmlNodeList list = root.SelectNodes("weapon"); foreach (XmlNode wq in list) { Weapon _weapon = new Weapon(); _weapon.level = int.Parse(wq.Attributes["level"].Value); _weapon.name = wq.Attributes["name"].Value; _weapon.dreamattack = int.Parse(wq.Attributes["dreamattack"].Value); _weapon.experience = int.Parse(wq.Attributes["experience"].Value); weapon.Add(_weapon.level, _weapon); } Player.Instance().dreamsword = weapon[1]; list = root.SelectNodes("skill"); foreach (XmlNode jn in list) { Skill _skill = new Skill(); _skill.id = int.Parse(jn.Attributes["id"].Value); _skill.name = jn.Attributes["name"].Value; _skill.damage = int.Parse(jn.Attributes["damage"].Value); _skill.dream = int.Parse(jn.Attributes["dream"].Value); _skill.describe = jn.Attributes["describe"].Value; _skill.type = int.Parse(jn.Attributes["type"].Value); skill.Add(_skill.id, _skill); } list = root.SelectNodes("monstor"); foreach (XmlNode gw in list) { Monstor _monstor = new Monstor(); _monstor.id = int.Parse(gw.Attributes["id"].Value); _monstor.name = gw.Attributes["name"].Value; _monstor.hp = int.Parse(gw.Attributes["hp"].Value); _monstor.dream = int.Parse(gw.Attributes["dream"].Value); _monstor.dreamattack = int.Parse(gw.Attributes["dreamattack"].Value); _monstor.beforefight = gw.Attributes["beforefight"].Value; _monstor.playeranswer = gw.Attributes["playeranswer"].Value; monstor.Add(_monstor.id, _monstor); } xml.Load(@"C:\The World\Text.xml"); root = xml.SelectSingleNode("Text"); list = root.SelectNodes("wb"); foreach (XmlNode dh in list) { Dialogue _dialogue = new Dialogue(); _dialogue.id = int.Parse(dh.Attributes["id"].Value); _dialogue.text = dh.Attributes["text"].Value; _dialogue.name = dh.Attributes["name"].Value; dialogue.Add(_dialogue.id, _dialogue); } //角色技能初始化 int x = 0; for (int i = 1; i < Player.Instance().skillamount * 2; i += 2) //技能初始载入 { Player.Instance().playerskill[x++] = GameRes.skill[i]; } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception e) { Console.WriteLine(e); return(false); } #pragma warning restore CA1031 // Do not catch general exception types return(true); } //加载xml文件
public static void StartGame() { Console.ForegroundColor = ConsoleColor.Red; TextRain("The World . "); TextRain("世 界 因 ________ 而 改 变。", 75, 24); TextRain("The World . ", 85, 25); Console.Clear(); Console.ForegroundColor = ConsoleColor.White; #region 序章 int xh; int choose; int truth = 0; for (xh = Program.scene0_start; xh < Program.scene0_end; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); if (xh == 5) { GameHelper.Talking("1.让世界长存——", " 2.让世界破灭——", false); Console.ReadKey(true); } } TalkingEnd(); xh = 100; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); xh++; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); #region 择分支的粗略实现;选择1 xh++; GameHelper.Talking("1.你是谁?", " 2.我这是在哪里?", false); choose = int.Parse(Console.ReadLine()); if (choose == 1) { xh = 110; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); xh++; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } else { xh = 120; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } #endregion for (xh = 130; xh <= 135; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); if (xh == 132) { GameHelper.Talking("1.那我是谁?", "2.我是,一个勇者?", false); Console.ReadKey(true); } } GameHelper.Talking("1.魔王?我要怎么打败他?", "2.什么,魔王!我要怎么打败他?", false); choose = int.Parse(Console.ReadLine()); if (choose == 1) { xh = 140; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); xh++; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); xh++; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } for (xh = 150; xh <= 176; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } Player.Instance().Show();//音效呲呲 //每章开头与结尾询问是否升级武器、技能(30精华一个) //战斗前 简单介绍勇者西行时在想的事情 //遇到敌人 第一选择比如跳开攻击或者迎接攻击,影响战斗状态 //战斗中敌人会说话,勇者做出对应的回应(暂不设选择分支) //战斗结束勇者选择进入梦境(即梦中梦)就能进一步了解这个世界的秘密 //如此循环2章,进入终章 //终章故事十分精彩,争取插入BGM. #endregion #region 第一章 Monstor monstor = GameRes.monstor[1]; for (xh = 200; xh <= 208; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); }//战斗前 if (Battle.BattleFighting(ref monstor, 210))//进入梦境了 { truth++;//最终结局要求 for (xh = 240; xh <= 264; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); if (xh == 249) { GameHelper.Talking("1.坐下", "2.有点累了……", false); choose = int.Parse(Console.ReadLine()); } }//梦境战斗前 monstor = GameRes.monstor[2]; Battle.BattleFighting(ref monstor, 270); for (xh = 282; xh <= 286; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); choose = int.Parse(Console.ReadLine()); switch (choose) { case 1: for (xh = 310; xh <= 317; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } break; case 2: xh = 288; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); break; case 3: xh = 290; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); break; } if (choose != 1) { for (xh = 291; xh <= 306; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } } //梦境战斗结束 } //默认胜利 #region 升级模块 GameHelper.Talking(" ", "梦之剑开始散发出粉红色的光芒,我似乎明白了应该做什么了"); Console.ReadKey(true); GameHelper.Talking("勇者", "所以我1.升级梦之剑2.升级梦之剑携带的战斗技能3.下次吧", false); choose = int.Parse(Console.ReadLine()); if (choose == 1) { Weapon.LevelUp(); } else if (choose == 2) { GameHelper.Talking("要升级哪一个技能呢?", "技能1 技能2 技能3 技能4(每个技能只可以升级一次)", false); choose = int.Parse(Console.ReadLine()); Skill.LevelUp(ref Player.Instance().playerskill[choose - 1]); }//升级技能或者武器 Player.Instance().Show(); #endregion for (xh = 320; xh <= 332; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } #endregion #region 第二章 Player.Sleep(); for (xh = 400; xh <= 409; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } monstor = GameRes.monstor[3]; //与第三个怪物战斗 if (Battle.BattleFighting(ref monstor, 420)) //战斗对话420-431 { //如果进入梦境 truth++; //最终结局要求 int max = 494; #region 升级模块 GameHelper.Talking(" ", "梦之剑开始散发出粉红色的光芒,我似乎明白了应该做什么了"); Console.ReadKey(true); GameHelper.Talking("勇者", "所以我 1.升级梦之剑 2.升级梦之剑携带的战斗技能 3.下次吧", false); choose = int.Parse(Console.ReadLine()); if (choose == 1) { Weapon.LevelUp(); } else if (choose == 2) { GameHelper.Talking("要升级哪一个技能呢?", "技能1 技能2 技能3 技能4(每个技能只可以升级一次)", false); choose = int.Parse(Console.ReadLine()); Skill.LevelUp(ref Player.Instance().playerskill[choose - 1]); }//升级技能或者武器 Player.Instance().Show(); #endregion for (xh = 460; xh <= max; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); if (xh == 478) { choose = int.Parse(Console.ReadLine()); if (choose == 1) { xh++; max = 484; } else { xh = 489; } } } for (xh = 500; xh <= 549; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); if (xh == 538) { GameHelper.Talking("1.我亲自建造了这个世界?", "2.我在不断进行杀戮?", false); choose = int.Parse(Console.ReadLine()); } } monstor = GameRes.monstor[4]; Battle.BattleFighting(ref monstor, 550); max = 604; for (xh = 562; xh <= max; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); if (xh == 565) { GameHelper.Talking("1.魔王的蛊惑真是越来越多了,还是不看为好。", "2.稍微好奇一点应该不会怎么样吧……", false); choose = int.Parse(Console.ReadLine()); if (choose == 1) { max = 569; } else { xh = 569; truth++;//最终结局要求 } } } } else { for (xh = 440; xh <= 457; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); }//第一部分对话 } //上方战斗全部结束了 Player.Sleep(); for (xh = 604; xh <= 613; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } #region 升级模块 GameHelper.Talking(" ", "梦之剑开始散发出粉红色的光芒,我似乎明白了应该做什么了"); Console.ReadKey(true); GameHelper.Talking("勇者", "所以我 1.升级梦之剑 2.升级梦之剑携带的战斗技能 3.下次吧", false); choose = int.Parse(Console.ReadLine()); if (choose == 1) { Weapon.LevelUp(); } else if (choose == 2) { GameHelper.Talking("要升级哪一个技能呢?", "技能1 技能2 技能3 技能4(每个技能只可以升级一次)", false); choose = int.Parse(Console.ReadLine()); Skill.LevelUp(ref Player.Instance().playerskill[choose - 1]); }//升级技能或者武器 Player.Instance().Show(); #endregion for (xh = 614; xh <= 617; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } #endregion #region 第三章后续添加 //Battle.BattleFighting(1); #endregion #region 终章 for (xh = 620; xh <= 645; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); if (xh == 633) { monstor = GameRes.monstor[5]; Battle.BattleFighting(ref monstor, 020); #region 升级模块 GameHelper.Talking(" ", "梦之剑开始散发出粉红色的光芒,我似乎明白了应该做什么了"); Console.ReadKey(true); GameHelper.Talking("勇者", "所以我 1.升级梦之剑 2.升级梦之剑携带的战斗技能 3.下次吧", false); choose = int.Parse(Console.ReadLine()); if (choose == 1) { Weapon.LevelUp(); } else if (choose == 2) { GameHelper.Talking("要升级哪一个技能呢?", "技能1 技能2 技能3 技能4(每个技能只可以升级一次)", false); choose = int.Parse(Console.ReadLine()); Skill.LevelUp(ref Player.Instance().playerskill[choose - 1]); }//升级技能或者武器 Player.Instance().Show(); #endregion } else if (xh == 634) { monstor = GameRes.monstor[6]; Battle.BattleFighting(ref monstor, 020); #region 升级模块 GameHelper.Talking(" ", "梦之剑开始散发出粉红色的光芒,我似乎明白了应该做什么了"); Console.ReadKey(true); GameHelper.Talking("勇者", "所以我 1.升级梦之剑 2.升级梦之剑携带的战斗技能 3.下次吧", false); choose = int.Parse(Console.ReadLine()); if (choose == 1) { Weapon.LevelUp(); } else if (choose == 2) { GameHelper.Talking("要升级哪一个技能呢?", "技能1 技能2 技能3 技能4(每个技能只可以升级一次)", false); choose = int.Parse(Console.ReadLine()); Skill.LevelUp(ref Player.Instance().playerskill[choose - 1]); }//升级技能或者武器 Player.Instance().Show(); #endregion } } //开始结局真相选择,xh=646 GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text, false); choose = int.Parse(Console.ReadLine()); if (choose == 1) { //魔王路线开启 monstor = GameRes.monstor[8]; for (xh = 650; xh <= 673; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); if (xh == 659 || xh == 656) { choose = int.Parse(Console.ReadLine()); } else { Console.ReadKey(true); } }//战斗前夕 monstor.hp = Player.Instance().hp; monstor.dream = Player.Instance().dream; monstor.dreamattack = Player.Instance().dreamsword.dreamattack; //属性互换 Player.Instance().hp = 3000; Player.Instance().dream = 5000; Player.Instance().dreamsword = GameRes.weapon[5]; Player.Instance().playerskill[0] = GameRes.skill[2]; Player.Instance().playerskill[1] = GameRes.skill[4]; Player.Instance().playerskill[2] = GameRes.skill[6]; Player.Instance().playerskill[3] = GameRes.skill[8]; GameHelper.Talking("勇者", "这场战斗的胜者必定是我!"); Player.Instance().Show(); Battle.BattleFighting(ref monstor, 680); for (xh = 700; xh <= 726; xh++) { //魔王结局 GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } Console.ForegroundColor = ConsoleColor.Red; //xh=727 GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); //魔王结局结束 } else if (choose == 2) { //勇者路线开启 monstor = GameRes.monstor[8]; //战斗前夕 for (xh = 750; xh <= 761; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); if (xh == 753) { choose = int.Parse(Console.ReadLine()); if (choose == 2) { xh = 754; } } else { Console.ReadKey(true); } if (xh == 756) { int ij; for (ij = 321; ij <= 325; ij++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } for (ij = 614; ij <= 617; ij++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } } if (xh == 757) { for (int i = 0; i <= 9; i++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } } //以上为回忆杀 } //正式战斗 Battle.BattleFighting(ref monstor, 770); //第二形态 for (xh = 782; xh <= 796; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } monstor = GameRes.monstor[9]; Battle.BattleFighting(ref monstor, 800); for (xh = 821; xh <= 838; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } Console.ForegroundColor = ConsoleColor.Red; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); Console.ForegroundColor = ConsoleColor.White; for (xh = 840; xh <= 861; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } Console.ForegroundColor = ConsoleColor.Red; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); Console.ForegroundColor = ConsoleColor.White; //勇者路线完 } else if (truth == 3) { //真相路线开启 for (xh = 900; xh <= 1038; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); if (xh == 908) { choose = int.Parse(Console.ReadLine()); if (choose == 2) { xh = 910; } } else if (xh == 915) { choose = int.Parse(Console.ReadLine()); if (choose == 1) { xh = 916; } } else if (xh == 919) { choose = int.Parse(Console.ReadLine()); if (choose == 2) { xh = 920; } } else if (xh == 942) { choose = int.Parse(Console.ReadLine()); if (choose == 2) { xh = 943; } } else if (xh == 945) { choose = int.Parse(Console.ReadLine()); if (choose == 2) { xh = 946; } } else if (xh == 955) { Console.ReadKey(true); for (int i = 528; i <= 549; i++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } } else if (xh == 957) { choose = int.Parse(Console.ReadLine()); if (choose == 2) { xh = 958; } } else if (xh == 960) { choose = int.Parse(Console.ReadLine()); } else if (xh == 973) { Console.ReadKey(true); for (int i = 158; i <= 160; i++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } for (int i = 424; i <= 427; i++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } } else if (xh == 977) { choose = int.Parse(Console.ReadLine()); if (choose == 1) { xh = 978; } } else if (xh == 1028) { Console.ReadKey(true); Console.ForegroundColor = ConsoleColor.Red; xh++; GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true);; Console.ForegroundColor = ConsoleColor.White; } else { Console.ReadKey(true); } } monstor = GameRes.monstor[10]; Battle.BattleFighting(ref monstor, 1040); for (xh = 1070; xh <= 1084; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } //真相路线暂时完结 } else { //魔王路线开启 monstor = GameRes.monstor[8]; for (xh = 650; xh <= 673; xh++) { GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); if (xh == 659 || xh == 656) { choose = int.Parse(Console.ReadLine()); } else { Console.ReadKey(true); } }//战斗前夕 monstor.hp = Player.Instance().hp; monstor.dream = Player.Instance().dream; monstor.dreamattack = Player.Instance().dreamsword.dreamattack; //属性互换 Player.Instance().hp = 3000; Player.Instance().dream = 5000; Player.Instance().dreamsword = GameRes.weapon[5]; Player.Instance().playerskill[0] = GameRes.skill[2]; Player.Instance().playerskill[1] = GameRes.skill[4]; Player.Instance().playerskill[2] = GameRes.skill[6]; Player.Instance().playerskill[3] = GameRes.skill[8]; GameHelper.Talking("勇者", "这场战斗的胜者必定是我!"); Player.Instance().Show(); Battle.BattleFighting(ref monstor, 680); for (xh = 700; xh <= 726; xh++) { //魔王结局 GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); } Console.ForegroundColor = ConsoleColor.Red; //xh=727 GameHelper.Talking(GameRes.dialogue[xh].name, GameRes.dialogue[xh].text); Console.ReadKey(true); //魔王结局结束 } Console.ForegroundColor = ConsoleColor.Green; TextRain("The World . "); TextRain("世 界 因 ________ 而 改 变。", 75, 24); TextRain("The World . ", 85, 25); Console.Clear(); Console.ForegroundColor = ConsoleColor.Blue; for (xh = 2000; xh <= 2005; xh++) { TextRain(GameRes.dialogue[xh].text); Console.Clear(); } #endregion }
}//调用字典数据升级属性 public static int UsingSkill(ref Monstor monstor, Skill skill, int dreamattack) {//只产生效果,技能具体伤害扣减由turn()决定 Random random = new Random(); float a = (float)(random.Next(80, 120)) / 100.0f; if (skill.id <= 8) //勇者使用技能 { if (skill.type == 1) //造成伤害并触发特效 { if (skill.id == 4) //特殊情况 { Player.Instance().luck += Player.Instance().dreamsword.level * 2; //此处加入音效,luck !up! return((int)((dreamattack * a + skill.damage) * a)); } else { //普通情况 return((int)((dreamattack * a + skill.damage) * a)); } } else //type==2且处于玩家技能序列 { Player.Instance().dream -= skill.dream; int effect = (int)((Player.Instance().luck / 9) * a); switch (skill.id) { case 5: Player.Instance().hp += effect -= 10; break; case 6: Player.Instance().hp += effect; monstor.dreamattack -= Player.Instance().dreamsword.level; break; case 7: Player.Instance().dream += effect; Player.Instance().hp -= effect; break; case 8: effect += 10; Player.Instance().dream += effect * 2; Player.Instance().hp -= effect; break; } //触发技能特效 return(0); } } else //使用对象为怪物 { if (skill.type == 1) //造成伤害同时有特效的技能 { int damage = (int)((dreamattack * a + skill.damage) * a); monstor.dream -= skill.dream; switch (skill.id - 10) //触发技能特效 { case 1: Player.Instance().dream -= skill.dream; break; case 2: monstor.hp += (damage / 2); break; } return(damage); } else //触发技能不造成伤害,只有特效type==2 { switch (skill.id - 20) { case 1: monstor.dreamattack += monstor.id; break; case 2: monstor.dreamattack += monstor.id / 2; monstor.hp += monstor.id * 2; break; case 3: Player.Instance().luck -= monstor.id; break; } return(0); } } }