Exemplo n.º 1
0
 public static void Attack(RoleCard attacker, RoleCard defender)
 {
     int damage = attacker.ATK - defender.DEF;
     if (damage > 0)
     {
         defender.HP -= damage;
     }
     // 依据五行相生相克
     // 金攻击木或者木攻击金,木都会受到1点伤害。
     // 金攻击水或者水攻击金,水都会回复1点生命,
     if (Ke(attacker.Element, defender.Element))
     {
         defender.HP--;
     }
     else if (Ke(defender.Element, attacker.Element))
     {
         attacker.HP--;
     }
     if (Shen(attacker.Element, defender.Element))
     {
         defender.HP++;
     }
     else if (Shen(defender.Element, attacker.Element))
     {
         attacker.HP++;
     }
 }
Exemplo n.º 2
0
        private void AddCard(RoleCard card, CozyCardImage cardImage)
        {
            IsModified = true;

            CardImageDictionary[card.Id] = cardImage;
            ListOfRoleCardList[(int)card.Level].Add(card);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            RoleCard card1 = new RoleCard()
            {
                Id = 1,
                Name = "王文撸",
                Desc = "card1",
                Element = Enum.FiveLine.Gold,
                HP = 10,
                ATK = 2,
                DEF = 1
            };
            RoleCard card2 = new RoleCard()
            {
                Id = 2,
                Name = "愤怒的泡面",
                Desc = @"泡面那么受欢迎并不是因为它有多么好吃,只是因为它适合一个人吃。",
                Element = Enum.FiveLine.Wood,
                HP = 10,
                ATK = 3,
                DEF = 1,
                Level = Enum.RoleCardLevel.Level2,
            };

            RoleCard r1 = (RoleCard)card1.Clone();
            RoleCard r2 = (RoleCard)card2.Clone();

            bool b = false;
            while (RoleCardLogic.IsAlive(r1) && RoleCardLogic.IsAlive(r2))
            {
                if (b)
                {
                    Console.WriteLine("{0} attack {1}", r1.Name, r2.Name);
                    RoleCardLogic.Attack(r1, r2);
                    Console.WriteLine("撸撸.hp={0} 泡面.hp={1}\n", r1.HP, r2.HP);
                }
                else
                {
                    Console.WriteLine("{0} attack {1}", r2.Name, r1.Name);
                    RoleCardLogic.Attack(r2, r1);
                    Console.WriteLine("撸撸.hp={0} 泡面.hp={1}\n", r1.HP, r2.HP);
                }
                b = !b;
            }
        }
Exemplo n.º 4
0
 public CardCreateEventArgs(RoleCard card, CozyCardImage cardimage)
 {
     Card = card;
     CardImage = cardimage;
 }
Exemplo n.º 5
0
 public static bool IsAlive(RoleCard role)
 {
     return role.HP > 0;
 }
Exemplo n.º 6
0
 public static void Attack(RoleCard attacker, RoleCard defender)
 {
     RoleCardAttack.Attack(attacker, defender);
 }
Exemplo n.º 7
0
 public void Clear()
 {
     BeginModify();
     RoleCard    = new RoleCard();
     Images      = new CozyCardImage();
     EndModify();
 }