Esempio n. 1
0
        /// <summary>
        /// 如果玩家选择了使用技能,进入
        /// </summary>
        /// <returns></returns>
        public static int jineng()
        {
            //用来判断是否在战斗中查看技能,如果是真,查看技能后就不返回到选择页面
            panduan = false;
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\n\t请选择按键进行释放技能");
            Console.ForegroundColor = ConsoleColor.White;
            //声明一个变量保存技能伤害值,用于返回
            int shanghai = 0;

            //判断玩家选择的角色
            if (Program.Enum_GamePlayerRoles == Enum_GameRoles.Enum_Warrior)
            {
                //展示技能(战士)
                WarriorSkill.WarriorSkillShow();
                //判断输入的是否正确,正确就退出
                while (true)
                {
                    ConsoleKeyInfo Downkey1 = Console.ReadKey(true);
                    if (Downkey1.Key.Equals(ConsoleKey.D1) || Downkey1.Key.Equals(ConsoleKey.NumPad1))
                    {
                        Console.WriteLine("\n\t您选择的是刃风技能");
                        //将这个技能的伤害值返回
                        shanghai = 78;
                        break;
                    }
                    else if (Downkey1.Key.Equals(ConsoleKey.D2) || Downkey1.Key.Equals(ConsoleKey.NumPad2))
                    {
                        //判断输入的是否大于技能列表含有的技能
                        if (WarriorSkill.DicSkillWarrior.Count >= 2)
                        {
                            Console.WriteLine("\n\t您选择的是震天技能");
                            // 将这个技能的伤害值返回
                            shanghai = 226;
                            break;
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Thread.Sleep(500);
                            Console.WriteLine("\n\t很抱歉,您输入的有误,您还没有学习此技能");
                            Console.ForegroundColor = ConsoleColor.White;
                        }
                    }
                    else if (Downkey1.Key.Equals(ConsoleKey.D3) || Downkey1.Key.Equals(ConsoleKey.NumPad3))
                    {
                        if (WarriorSkill.DicSkillWarrior.Count >= 3)
                        {
                            Console.WriteLine("\n\t您选择的是必杀技能");
                            // 将这个技能的伤害值返回
                            shanghai = 426;
                            break;
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Thread.Sleep(500);
                            Console.WriteLine("\n\t很抱歉,您输入的有误,您还没有学习此技能");
                            Console.ForegroundColor = ConsoleColor.White;
                        }
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Thread.Sleep(500);
                        Console.WriteLine("\n\t很抱歉,您输入的有误,该技能不存在");
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                }
            }
            //如果玩家选择角色是法师进入
            else
            {
                //展示技能(法师)
                WizardSkill.WizardSkillShow();
                //判断输入的是否正确,正确就退出
                ConsoleKeyInfo Downkey1 = Console.ReadKey(true);
                while (true)
                {
                    if (Downkey1.Key.Equals(ConsoleKey.D1) || Downkey1.Key.Equals(ConsoleKey.NumPad1))
                    {
                        Console.WriteLine("\n\t您选择的是裂痕技能");
                        //将这个技能的伤害值返回
                        shanghai = 128;
                        break;
                    }
                    else if (Downkey1.Key.Equals(ConsoleKey.D2) || Downkey1.Key.Equals(ConsoleKey.NumPad2))
                    {
                        if (WizardSkill.DicSkillWizard.Count >= 2)
                        {
                            Console.WriteLine("\n\t您选择的是地狱火技能");
                            //将这个技能的伤害值返回
                            shanghai = 268;
                            break;
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Thread.Sleep(500);
                            Console.WriteLine("\n\t很抱歉,您输入的有误,您还没有学习此技能");
                            Console.ForegroundColor = ConsoleColor.White;
                        }
                    }
                    else if (Downkey1.Key.Equals(ConsoleKey.D3) || Downkey1.Key.Equals(ConsoleKey.NumPad3))
                    {
                        if (WizardSkill.DicSkillWizard.Count >= 3)
                        {
                            Console.WriteLine("\n\t您选择的是诱惑之光技能");
                            //将这个技能的伤害值返回
                            shanghai = 328;
                            break;
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                            Thread.Sleep(500);
                            Console.WriteLine("\n\t很抱歉,您输入的有误,您还没有学习此技能");
                            Console.ForegroundColor = ConsoleColor.White;
                        }
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Thread.Sleep(500);
                        Console.WriteLine("\n\t很抱歉,您输入的有误,该技能不存在");
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                }
            }
            //将技能伤害值返回
            return(shanghai);
        }
Esempio n. 2
0
 /// <summary>
 /// 提示玩家选择,1.开始战斗 2.进入商城 3.查看当前属性
 /// </summary>
 public static void GameChoice()
 {
     //清除所有生成的怪物
     ComputerRoles.ListComputerRoles.Clear();
     //判断玩家的等级是否等于5级,如果等于5级就解锁新场景
     if (_RolesWarrior.Grade == 5 || _RolesWizard.Grade == 5)
     {
         //判断是否解锁过新场景,如果解锁过,就不再次解锁
         if (PGrade == 1)
         {
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("\n\t**************解锁场景失落的古城**************");
             Console.ForegroundColor = ConsoleColor.White;
             Console.WriteLine("\n\t解锁新怪物 叛军  BOSS:变异的军人 ");
             //进入场景后,用于判断玩家等级是否升级的计数器进行增加
             PGrade++;
         }
     }
     //判断玩家选择角色,在玩家每次战斗结束后,恢复玩家血量
     if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Warrior)
     {
         //恢复战士的HP
         _RolesWarrior.Hp = HPTemp;
     }
     else if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Wizard)
     {
         //恢复法师的HP
         _RolesWizard.Hp = HPTempWizard;
     }
     //加载延时,模仿真实游戏加载
     Thread.Sleep(500);
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine("\n\n\t\t* * * * * * * * *欢迎回来\t" + _PlayerRoles.Name);
     Console.ForegroundColor = ConsoleColor.White;
     //进入一个死循环,用于判断玩家的选择是否是给出的选择,如果不是则不退出,如果是则执行相对应的函数
     while (true)
     {
         Thread.Sleep(400);
         Console.ForegroundColor = ConsoleColor.White;
         Console.WriteLine("\n\t请选择您要进行的操作  \n\n\t1.进入战斗  2.进入商城  \n\n\t3.查看当前属性  4.查看当前背包物品  \n\n\t5.技能查看   6.技能学习");
         //判断玩家的按键,获得玩家选择
         ConsoleKeyInfo Downkey1 = Console.ReadKey(true);
         if (Downkey1.Key.Equals(ConsoleKey.D1) || Downkey1.Key.Equals(ConsoleKey.NumPad1))
         {
             //判断玩家选择角色,然后进行判断,在战斗前存储玩家Hp,用于在战斗结束后恢复
             if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Warrior)
             {
                 //保存战士的HP
                 HPTemp = _RolesWarrior.Hp;
             }
             else if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Wizard)
             {
                 //保存法师的HP
                 HPTempWizard = _RolesWizard.Hp;
             }
             Thread.Sleep(400);
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("\n\t**************您选择的是进入战斗");
             Console.ForegroundColor = ConsoleColor.White;
             //加载动画
             Load();
             //进入战斗场景
             Combat();
             break;
         }
         else if (Downkey1.Key.Equals(ConsoleKey.D2) || Downkey1.Key.Equals(ConsoleKey.NumPad2))
         {
             Thread.Sleep(400);
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("\n\t**************您选择的是进入商城");
             Console.ForegroundColor = ConsoleColor.White;
             //加载动画
             Load();
             _WeaponStore.PanDuan();
             break;
         }
         else if (Downkey1.Key.Equals(ConsoleKey.D3) || Downkey1.Key.Equals(ConsoleKey.NumPad3))
         {
             Thread.Sleep(400);
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("\n\t**************您选择的是查看当前属性");
             Console.ForegroundColor = ConsoleColor.White;
             //加载动画
             Load();
             //根据玩家选择的是法师还是战士,展示不同的属性
             if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Warrior)
             {
                 //战士的角色信息展示
                 GameRolesManager.Information(_PlayerRoles.Name, _RolesWarrior.Hp, _RolesWarrior.Attack, _RolesWarrior.Defense, _RolesWarrior.Experience, _RolesWarrior.Money, _RolesWarrior.Grade);
             }
             else if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Wizard)
             {
                 //法师的角色信息展示
                 GameRolesManager.Information(_PlayerRoles.Name, _RolesWizard.Hp, _RolesWizard.Attack, _RolesWizard.Defense, _RolesWizard.Experience, _RolesWizard.Money, _RolesWizard.Grade);
             }
             break;
         }
         else if (Downkey1.Key.Equals(ConsoleKey.D4) || Downkey1.Key.Equals(ConsoleKey.NumPad4))
         {
             Thread.Sleep(400);
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("\n\t**************您选择的是查看背包");
             Console.ForegroundColor = ConsoleColor.White;
             //加载动画
             Load();
             _PlayerPackage.PackageToUp();
             break;
         }
         else if (Downkey1.Key.Equals(ConsoleKey.D5) || Downkey1.Key.Equals(ConsoleKey.NumPad5))
         {
             Thread.Sleep(400);
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("\n\t**************您选择的是查看技能");
             Console.ForegroundColor = ConsoleColor.White;
             //加载动画
             Load();
             //根据玩家选择的是法师还是战士,展示不同的技能
             if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Warrior)
             {
                 //战士的技能列表
                 WarriorSkill.WarriorSkillShow();
             }
             else if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Wizard)
             {
                 //法师的技能列表
                 WizardSkill.WizardSkillShow();
             }
             break;
         }
         else if (Downkey1.Key.Equals(ConsoleKey.D6) || Downkey1.Key.Equals(ConsoleKey.NumPad6))
         {
             Thread.Sleep(400);
             Console.ForegroundColor = ConsoleColor.Red;
             Console.WriteLine("\n\t**************您选择的是学习技能");
             Console.ForegroundColor = ConsoleColor.White;
             //加载动画
             Load();
             //根据玩家选择的是法师还是战士,学习不同的技能
             if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Warrior)
             {
                 WarriorSkill.StartWarriorSkill();
                 //战士的技能学习
             }
             else if (Enum_GamePlayerRoles == Enum_GameRoles.Enum_Wizard)
             {
                 WizardSkill.StartWizardSkill();
                 //法师的技能学习
             }
             break;
         }
         //选择错误就提示错误,并回到开头,重新选择
         else
         {
             Console.ForegroundColor = ConsoleColor.Red;
             Thread.Sleep(500);
             Console.WriteLine("\n\t**************很抱歉,您输入的有误,当前选择不存在");
         }
     }
 }