Beispiel #1
0
    public bool doStartOfTurnEffect(HearthstoneBoard board)
    {
        board.printDebugMessage("Doing start of turn effect on board with count " + Count, HearthstoneBoard.OutputPriority.INTENSEDEBUG);
        if (Count == 0)
        {
            return(false);
        }
        int c = 0;

        while (c < Count)
        {
            if (this[c].attackPriority != Card.MAX_PRIORITY)
            {
                this[c].attackPriority = Card.MAX_PRIORITY;
                if (this[c].hasStartofTurnEffect())
                {
                    this[c].performedAction(new StartofCombatAction(), board);
                    board.deathCheck();
                    return(true);
                }
            }
            c++;
        }
        return(false);
    }
    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();
        }
    }