Beispiel #1
0
        public override void TakeTurn(IBoardGame gameBoard)
        {
            if (!this.CanTakeTurn)
            {
                return;
            }

            // hard code in specific abilities depending on the monster
            var cleanupTurn = new CleanupTurn(this);
            cleanupTurn.Cleanup();

            // simply attack right now
            var humanPlayers = gameBoard.GetHumanPlayers().ToList();
            var humanToAttack = new RandomPlayer().TargetPlayer(humanPlayers);

            if (humanToAttack < 0)
            {
                return;
            }

            var humanPlayer = humanPlayers[humanToAttack];
            var attackAmount = new StaticAmount().AttackAmount();
            var attackParameters = new AttackParameters
                                       {
                                           AdjustedAmount = attackAmount,
                                           OriginalAmount = attackAmount,
                                           PlayerAttacking = this,
                                           PlayerBeingAttacked = humanPlayer
                                       };

            humanPlayer.TakeDamage(gameBoard, attackParameters);

            GameLogger.LogFormat("{0} gave {1} damage to {2}", this.Name, attackAmount, attackParameters.ReportPlayersBeingAttacked());
        }
Beispiel #2
0
        public override void TakeTurn(IBoardGame gameBoard)
        {
            if (!this.CanTakeTurn)
            {
                return;
            }

            // perform discard cards
            var discardCards = new DiscardCards(this);
            discardCards.Discard();

            // perform draw
            this.DrawCard(gameBoard);

            if (this.CurrentCards.Any())
            {
                // use a card that's not defensive
                var nonDefensiveInstantCards = this.CurrentCards.Where(card1 => !card1.IsDefensiveInstant).ToList();
                var randCardIdx = Randomizer.GetRandomValue(0, nonDefensiveInstantCards.Count() - 1);
                var card = nonDefensiveInstantCards.ElementAt(randCardIdx);
                card.Use();
                this.CurrentCards.RemoveAt(randCardIdx);
            }

            // cleanup
            var cleanupTurn = new CleanupTurn(this);
            cleanupTurn.Cleanup();
        }