Beispiel #1
0
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Performing action: deathrattle dmg bonus: " + user, HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);

        BoardSide userBoard = board.getBoardFromMinion(user);

        if (userBoard.Count == 1)
        {
            return;
        }


        for (int i = 0; i < times; i++)
        {
            while (true)
            {
                int target = board.getRandomNumber(0, userBoard.Count);
                if (userBoard[target] != user)
                {
                    board.printDebugMessage("Giving damage bonus to " + userBoard[target].getReadableName(), HearthstoneBoard.OutputPriority.INTENSEDEBUG);
                    userBoard[target].addAttack(user.getAttack(board));
                    break;;
                }
            }
        }
    }
Beispiel #2
0
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Performing action: make extra summon: " + user, HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);
        BoardSide userboard = board.getBoardFromMinion(user);

        for (int i = 0; i < userboard.IndexOf(user); i++)
        {
            if (userboard[i].hasEffect(this))
            {
                return;
            }
        }
        if (current < 1)
        {
            current = count;
        }
        else
        {
            Card c = ((CardSpawnedAction)cause).spawnedCard();
            if (c == user)
            {
                return;
            }
            current--;
            board.printDebugMessage("khadgar effect used, count is now " + current, HearthstoneBoard.OutputPriority.INTENSEDEBUG);
            board.addNewMinionToBoard(board.getPlayerFromMinion(user), c.copy().setId(board.getRandomNumber(1, 9999)), board.getPositionFromMinion(c), true);
        }
    }
 //0 = not dead, 1 = dead, 2 = overkill
 public int dealDamage(int damage, HearthstoneBoard board)
 {
     if (divineShield)
     {
         foreach (Card c in board.getBoardFromMinion(this))
         {
             c.performedAction(new DivineShieldLossAction(this), board);
         }
         divineShield = false;
         board.printDebugMessage("Damage taken: 0 (divine shield pop) on " + getReadableName(), HearthstoneBoard.OutputPriority.DAMAGES);
         return(0);
     }
     hp = hp - damage;
     board.printDebugMessage("Damage taken: " + damage + " on " + getReadableName(), HearthstoneBoard.OutputPriority.DAMAGES);
     performedAction(new DamageTakenAction(), board);
     if (hp <= 0)
     {
         board.addToPendingDeath(this);
         if (hp < 0)
         {
             return(2);
         }
         else
         {
             return(1);
         }
     }
     return(0);
 }
Beispiel #4
0
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Performing action: deathrattledivine: " + user, HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);

        BoardSide userBoard = board.getBoardFromMinion(user);

        for (int i = 0; i < times; i++)
        {
            bool stop = true;
            foreach (Card c in userBoard)
            {
                if (c != user && !c.divineShield)
                {
                    board.printDebugMessage("Found minion without divine shield " + c.getReadableName(), HearthstoneBoard.OutputPriority.INTENSEDEBUG);
                    stop = false;
                }
            }
            if (stop)
            {
                return;
            }
            while (true)
            {
                int target = board.getRandomNumber(0, userBoard.Count);
                if (!userBoard[target].divineShield && userBoard[target] != user)
                {
                    board.printDebugMessage("Giving divine shield to " + userBoard[target].getReadableName(), HearthstoneBoard.OutputPriority.INTENSEDEBUG);
                    userBoard[target].setDivineShield(true);
                    break;
                }
            }
        }
    }
Beispiel #5
0
 public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
 {
     board.printDebugMessage("Performing action: deathrattlebuff: " + user.getReadableName(), HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);
     foreach (Card c in board.getBoardFromMinion(user))
     {
         c.addStats(buff, buff);
     }
 }
    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();
        }
    }
 public override void makeUpForReaderError(Card user, HearthstoneBoard board)
 {
     foreach (Card c in board.getBoardFromMinion(user))
     {
         if (c.typeMatches(type) && c != user)
         {
             c.addAttack(-dmg);
         }
     }
 }
 public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
 {
     board.printDebugMessage("Performing action: Mal'ganis hacky SoT effect " + user.getReadableName(), HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);
     foreach (Card c in board.getBoardFromMinion(user))
     {
         if (c != user && c.typeMatches(Card.Type.Demon))
         {
             c.addStats(buff, buff);
         }
     }
 }
 public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
 {
     board.printDebugMessage("Performing action: malganis death debuffer: " + user.getReadableName(), HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);
     foreach (Card c in board.getBoardFromMinion(user))
     {
         if (c != user && c.typeMatches(Card.Type.Demon))
         {
             c.addStats(-buff, -buff);
             if (c.getHp(board) < 1)
             {
                 c.setHp(1);
             }
         }
     }
 }
Beispiel #10
0
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Performing action: kangorssummon: " + user, HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);
        int       currentCount  = count;
        BoardSide current       = board.getBoardFromMinion(user);
        int       counterBcLazy = 0;

        for (int i = 0; i < current.graveyard.Count && currentCount > 0; i++)
        {
            if (Card.typesMatches(current.graveyard[i].type, Card.Type.Mech))
            {
                board.addNewMinionToBoard(board.getPlayerFromMinion(user), current.graveyard[i].revive().setAttackPriority(user.attackPriority), board.getPositionFromMinion(user) + counterBcLazy, true);
                counterBcLazy++;
                currentCount--;
            }
        }
    }
    public void causeDamageToTarget(Card target, HearthstoneBoard board, int damage)
    {
        if (poisonous)
        {
            damage = 999999;
        }
        int res = target.dealDamage(damage, board);

        if (res == 2)
        {
            performedAction(new OverKillAction(), board);
        }
        if (res > 0)
        {
            foreach (Card c in board.getBoardFromMinion(this))
            {
                c.performedAction(new GotKillAction(this), board);
            }
        }
    }
Beispiel #12
0
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Double deathrattle on: " + ((CardKilledAction)cause).killedCard().getReadableName(), HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);
        BoardSide userboard = board.getBoardFromMinion(user);

        for (int i = 0; i < userboard.IndexOf(user); i++)
        {
            if (userboard[i].hasEffect(this))
            {
                return;
            }
        }
        //Hack for making mal'ganis. Inte så snyggt men men
        if (((CardKilledAction)cause).killedCard().getName().Equals("Mal'Ganis"))
        {
            return;
        }


        for (int i = 0; i < times; i++)
        {
            ((CardKilledAction)cause).killedCard().performedAction(new DeadAction(), board);
        }
    }
Beispiel #13
0
    public override void doAction(Action cause, Card user, HearthstoneBoard board, List <Card> alwaysUse)
    {
        board.printDebugMessage("Performing action: start of turn fire: " + user, HearthstoneBoard.OutputPriority.EFFECTTRIGGERS);
        BoardSide opponentBoard = board.getOpponentBoardFromMinion(user);
        BoardSide current       = board.getBoardFromMinion(user);
        int       counter       = 0;

        foreach (Card c in current)
        {
            if (c.typeMatches(Card.Type.Dragon))
            {
                counter++;
            }
        }
        for (int i = 0; i < times; i++)
        {
            if (opponentBoard.Count == 0)
            {
                return;
            }
            int target = board.getRandomNumber(0, opponentBoard.Count);
            if (board.stopFlag)
            {
                board.attacker         = user;
                board.defender         = opponentBoard[target];
                board.finishedWorkFlag = true;
                while (board.stopFlag)
                {
                    Thread.Sleep(100);
                }
                board.finishedWorkFlag = false;
                board.stopFlag         = true;
            }
            user.causeDamageToTarget(opponentBoard[target], board, counter);
        }
    }
    public int getAttack(HearthstoneBoard board)
    {
        foreach (Card c in board.getAdjacents(this))
        {
            c.performAdjacantEffects(this, board);
        }
        foreach (Card c in board.getBoardFromMinion(this))
        {
            if (c != this)
            {
                c.performedAction(new CardLookingForAtkBonusAction(this), board);
            }
        }
        performedAction(new GetDamageAction(), board);
        int result = attack + tempAttackBonus;

        board.printDebugMessage("damagebonus: " + tempAttackBonus + "on " + getReadableName(), HearthstoneBoard.OutputPriority.COMMUNICATION);
        tempAttackBonus = 0;
        if (board.DeathwingPlayer > 0)
        {
            result += 2;
        }
        return(result);
    }