示例#1
0
        public void DeadChop(Monster monster)
        {
            int attack = this.atk * 2;

            monster.OnDamage(attack);
        }
示例#2
0
        static void Main(string[] args)
        {
            //string.Format()字符串格式化输出
            //相当于console,writeline
            //而string.Format()是返回以一个字符串
            #region 属性
            Random  d6      = new Random();
            Player  p1      = new Player("footman", d6.Next(100, 201), d6.Next(120, 201), 1000, 1000);
            Weapon  weapon  = new Weapon("火之高兴", 100, 100, 300);
            Monster monster = new Monster("奥妮克希亚", d6.Next(150, 401), d6.Next(200, 301), 2000, 2000);
            p1.Equip(weapon);



            #region 过程
            //while (true)
            //{

            //    ShowInfo(p1, monster);
            //    Console.SetCursorPosition(0, 7);
            //    Console.WriteLine("                                                                                        ");
            //    Console.SetCursorPosition(0, 7);
            //    Console.WriteLine("1,普通攻击\t2.致命打击");
            //    char input = Console.ReadKey(true).KeyChar;
            //    if (input == '1')
            //    {
            //        Console.SetCursorPosition(0, 7);
            //        p1.Attack(monster);
            //        Console.WriteLine("{0}攻击了{1}", p1.GetName(), monster.GetName());
            //    }
            //    else
            //    {
            //        Console.SetCursorPosition(0, 7);
            //        p1.DeadChop(monster);
            //        Console.WriteLine("{0}使用了致命打击,攻击了{1}", p1.GetName(), monster.GetName());
            //    }


            //    ShowInfo(p1, monster);
            //    Console.ReadKey(true);


            //    monster.Attack(p1);
            //    Console.SetCursorPosition(0, 7);
            //    Console.WriteLine("                                                                                        ");
            //    Console.SetCursorPosition(0, 7);
            //    Console.WriteLine("{0}攻击了{1}", monster.GetName(), p1.GetName());
            //    ShowInfo(p1, monster);
            //    Console.ReadKey(true);
            //}
            #endregion

            //p1.Atk = -1000;
            //Console.WriteLine(p1.Atk);
            #endregion

            #region 属性题1
            //Student zhangsan = new Student("张三", "男", 20, 80, 85);
            //Student lisi = new Student("李四", "女", 19, 85, 90);
            //Student xiaoming = new Student("小明", " ", 200, 200, -100);


            //zhangsan.SayHello();
            //zhangsan.SayGrade();
            //lisi.SayHello();
            //lisi.SayGrade();
            //xiaoming.SayHello();
            //xiaoming.SayGrade();
            #endregion

            #region 静态类
            Monster monster1 = new Monster("胡德");
            Monster monster2 = new Monster("索米");
            Monster monster3 = new Monster("RFB");

            for (int i = 0; i < 10; i++)
            {
                new Monster(string.Format("哥布林{0}号", i));
            }

            Console.WriteLine(MonsterControler.Instance.monsters.Length);
            MonsterControler.Instance.LeiPu();


            #endregion
        }
示例#3
0
 public void Attack(Monster monster)
 {
     monster.OnDamage(this.atk);
 }