• 英雄联盟对战


    namespace 英雄联盟对战
    {
        class Program
        {
           
            struct player
            {
                public string name;
                public int hp;
                public int gj;
                public int fy;
                public int dj;
                public jn jineng;
                //public wg w;
            }
            struct jn
            {
                public string q;
                public string w;
                public string e;
                public string r;
            }
            //struct wg
            //{
            //    public string name;
            //    public int atk;
            //}

            static void Main(string[] args)
            {
              
               //wg[] wg1=new wg[4];
               //wg1[0].name = "哎呀喂。。。";
               //wg1[0].atk = 100;
             

                player a = new player();
                player b = new player();
                Console.WriteLine("请输入第一个英雄的名字:");
                a.name = Console.ReadLine();
                Console.WriteLine("请输入第二个英雄的名字:");
                b.name = Console.ReadLine();
                Random r =new Random();
                a.hp = r.Next(1, 100) + 5000;
                a.gj = r.Next(1, 100)+100;
                a.fy = r.Next(1, 100);
                a.dj = r.Next(6, 18);
                a.jineng.q = "大玉螺旋丸";
                a.jineng.w = "多重影分身术";
                a.jineng.e = "风遁:螺旋手里剑";
                a.jineng.r = "六道模式";
               
                b.hp = r.Next(1, 100) + 5000;
                b.gj = r.Next(1, 100) + 100;
                b.fy = r.Next(1, 100);
                b.dj = r.Next(6, 18);
                b.jineng.q = "火遁:豪火球之术";
                b.jineng.w = "千鸟";
                b.jineng.e = "天照";
                b.jineng.r = "麒麟";
              

                Console.WriteLine("玩家1的英雄:"+a.name+" 气血:"+a.hp+" 攻击"+a.gj+" 防御:"+a.fy+" 等级:"+a.dj);
                Console.WriteLine("所使用的技能:"+"Q:"+a.jineng.q+" W:"+a.jineng.w+" E:"+a.jineng.e+" R:"+a.jineng.r);
                Console.WriteLine("玩家2的英雄:" + b.name + " 气血:" + b.hp + " 攻击" + b.gj + " 防御:" + b.fy + " 等级:" + b.dj);
                Console.WriteLine("所使用的技能:" + "Q:" + b.jineng.q + " W:" + b.jineng.w + " E:" + b.jineng.e + " R:" + b.jineng.r);
                Console.WriteLine("按任意键开始游戏");
                Console.ReadKey();
                while (true)
                {                   
                    if (a.hp <= 0 && b.hp <= 0)
                    {
                        Console.WriteLine("平局");
                        break;
                    }
                    else if(a.hp<=0)
                    {
                        Console.WriteLine(b.name+"获胜");
                        break;
                    }
                    else if (b.hp <= 0)
                    {
                        Console.WriteLine(a.name + "获胜");
                        break;
                    }
                    else
                    {
                        Random m=new Random();
                        //玩家a攻击玩家b
                    if(m.Next(1,10)>7)  //超过7使用大招
                     {
                         Console.ForegroundColor = ConsoleColor.Green;
                         Console.WriteLine("玩家"+a.name+"使用大技能"+a.jineng.r);
                         b.hp = b.hp - r.Next(300, 400);
                       
                     }
                    else if(m.Next(1,10)>5&&m.Next(1,10)<=7)
                    {
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("玩家"+a.name+"使用小技能"+a.jineng.q);
                        b.hp = b.hp - r.Next(50, 100);
                      
                    }
                    else if (m.Next(1, 10) > 3 && m.Next(1, 10) <= 5)
                    {
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("玩家" + a.name + "使用小技能" + a.jineng.w);
                        b.hp = b.hp - r.Next(50, 150);
                     
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("玩家" + a.name + "使用小技能" + a.jineng.e);
                        b.hp = b.hp - r.Next(100, 200);
                     
                    }
                    if (b.hp < 0)
                    {
                        b.hp = 0;
                    }
                        Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("玩家" + b.name + "的气血剩余为:" + b.hp);

                        //玩家b攻击玩家a
                    if (m.Next(1, 10) > 7)  //超过7使用大招
                    {
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("玩家" + b.name + "使用大技能" + b.jineng.r);
                        a.hp = a.hp - r.Next(300, 400);
                       
                      
                    }
                    else if (m.Next(1, 10) > 5 && m.Next(1, 10) <= 7)
                    {
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("玩家" + b.name + "使用小技能" + b.jineng.q);
                        a.hp =a.hp - r.Next(50, 100);
                      
                       
                    }
                    else if (m.Next(1, 10) > 3 && m.Next(1, 10) <= 5)
                    {
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("玩家" + b.name + "使用小技能" + b.jineng.w);
                        a.hp = a.hp - r.Next(50, 150);
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Gray;
                        Console.WriteLine("玩家" + b.name + "使用小技能" + b.jineng.e);
                       a.hp = a.hp - r.Next(100, 200);
                    }
                    if (a.hp < 0)
                    {
                        a.hp = 0;
                    }
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("玩家" + a.name + "的气血剩余为:" + a.hp);
                    Thread.Sleep(800);
                    }
                    Console.WriteLine();
                }//while的花括号
                   Console.ReadLine();
            }
        }
    }

  • 相关阅读:
    this 指向 及 调用方式
    页面布局上 左 右底部
    Thread Safety线程安全
    sql查删更
    LinuxMysql命令操作数据库
    excel链接sharepoint 用于 Excel 的 Microsoft Power Query
    W7无法更新
    发票点数计算
    sharepoint OWA问题解决
    zend studio 做前端推荐安装的插件
  • 原文地址:https://www.cnblogs.com/lk-kk/p/4404229.html
Copyright © 2020-2023  润新知