コード例 #1
0
 public void Attack(IMonsterCard monster)
 {
     if (this.AttackPoints > monster.AttackPoints)
     {
         // EVENT HERE
     }
 }
コード例 #2
0
        public (MonsterAttribute Attr, int Score) DecideAttributeToPlay(IMonsterCard m)
        {
            Console.WriteLine($"You pulled card {m.Name} ({m.Description})");
            var c = 1;

            Console.WriteLine("Choose your attribute to play...");
            foreach (var stat in m.Stats)
            {
                Console.WriteLine($"{c} - {stat.Key} \t\t\t {stat.Value}");
                c++;
            }

            var choice = Console.ReadKey().KeyChar.ToString();


            if (int.TryParse(choice, out int i))
            {
                return(m.Stats.ToList()[i - 1].Key, m.Stats.ToList()[i - 1].Value);
            }
            else
            {
                Console.WriteLine("Invalid Choice...");
                DecideAttributeToPlay(m);
            }

            return(MonsterAttribute.Earth, 0);
        }
        public ICombatResult Battle(string attackerId, string defenderId, int attackingSide = 1)
        {
            IMonsterCard attacker = GetAttacker(attackerId, attackingSide);
            IMonsterCard defender = GetDefender(defenderId, attackingSide);

            return(BattleCalculator.Attacks((MonsterCard)attacker, (MonsterCard)defender));
        }
コード例 #4
0
        public (MonsterAttribute Attr, int Score) DecideAttributeToPlay(IMonsterCard m)
        {
            //we just play the highest attribute we have - simple
            //pretend to think
            Console.WriteLine("Thinking....");
            Thread.Sleep(3000);
            var attr = m.Stats.Aggregate((l, r) => l.Value > r.Value ? l : r).Key;

            return(attr, m.Stats[attr]);
        }
コード例 #5
0
 public MonsterCardEntity(IMonsterCard card)
 {
     Name              = card.Name;
     Atk               = card.Atk;
     Def               = card.Def;
     Hp                = card.Hp;
     Description       = card.Description;
     CardReference     = card;
     MainCardType      = card.Types.FirstOrDefault().Icon;
     SecondaryCardType = card.Types.Skip(1).FirstOrDefault()?.Icon;
 }
コード例 #6
0
        public static double GetMultiplier(IMonsterCard attacker, IMonsterCard defender)
        {
            var    elements   = attacker.Types;
            double multiplier = 0;

            foreach (var element in elements)
            {
                var tempMultiplier = GetBasicMultiplier(element, defender.Types);
                multiplier += tempMultiplier;
            }

            return((double)(multiplier / elements.Count()));
        }
コード例 #7
0
 public static void ChangeMonsterPoints_Params(IMonsterCard target, int attackBy, int defenseBy)
 {
     target.ChangeAttack(attackBy);
     target.ChangeDefense(defenseBy);
 }
コード例 #8
0
 public PolymorphSides(IMonsterCard leftCard, IMonsterCard rightCard)
 {
     LeftCard  = leftCard;
     RightCard = rightCard;
 }
        public void Player2PlayCard(string cardId)
        {
            IMonsterCard card = GetCardFromDeck(cardId, playerNum: 2) as IMonsterCard;

            Player2CardsOnBoard.PlayCardOnBoard(card);
        }