Exemplo n.º 1
0
    public void performAttack(Card target, HearthstoneBoard board)
    {
        board.printDebugMessage("attacker: " + this.getReadableName() + " defender: " + target.getReadableName(), HearthstoneBoard.OutputPriority.ATTACKERS);
        if (board.turnbyturn)
        {
            Console.WriteLine("--------------------------------------");
            Console.WriteLine("Attacker: " + this.getReadableName());
            Console.WriteLine("Defender: " + target.getReadableName());
            Console.ReadLine();
        }
        if (board.stopFlag)
        {
            board.attacker         = this;
            board.defender         = target;
            board.finishedWorkFlag = true;
            while (board.stopFlag)
            {
                Thread.Sleep(100);
            }
            board.finishedWorkFlag = false;
            board.stopFlag         = true;
        }
        this.performedAction(new AttackingAction(target), board);
        int returnAttack = target.poisonous ? 9999999 : target.getAttack(board);

        //target.dealDamage(getAttack(board), board);
        causeDamageToTarget(target, board, getAttack(board));
        if (this.dealDamage(returnAttack, board) > 0)
        {
            foreach (Card c in board.getBoardFromMinion(target))
            {
                c.performedAction(new GotKillAction(target), board);
            }
        }


        board.deathCheck();
        //target.deathCheck(board);
        //this.deathCheck(board);



        attackPriority = Card.MAX_PRIORITY;
        board.printDebugMessage("attack perform finished from " + this.getReadableName() + " to " + target.getReadableName(), HearthstoneBoard.OutputPriority.ATTACKERS);
        if (board.printPriority >= HearthstoneBoard.OutputPriority.ATTACKERS)
        {
            board.printState();
        }

        if (board.turnbyturn)
        {
            Console.WriteLine("--------------------------------------");
            board.printState();
            Console.ReadLine();
        }
    }