package com.hearthsim.card.minion.concrete;

import com.hearthsim.card.minion.Minion;
import com.hearthsim.card.minion.MinionSummonedInterface;
import com.hearthsim.model.PlayerSide;
import com.hearthsim.util.tree.CardDrawNode;
import com.hearthsim.util.tree.HearthTreeNode;

public class StarvingBuzzard extends Minion implements MinionSummonedInterface {

    public StarvingBuzzard() {
        super();
    }

    /**
     *
     * Called whenever a minion is summoned on the board
     *
     * The buzzard draws a card whenever a Beast is placed on the battlefield
     *
     *
     * @param thisMinionPlayerSide
     * @param summonedMinionPlayerSide
     * @param summonedMinion The summoned minion
     * @param boardState The BoardState before this card has performed its action.  It will be manipulated and returned.
     * @param deckPlayer0 The deck of player0    @return The boardState is manipulated and returned
     * */
    @Override
    public HearthTreeNode minionSummonEvent(
            PlayerSide thisMinionPlayerSide,
            PlayerSide summonedMinionPlayerSide,
            Minion summonedMinion,
            HearthTreeNode boardState) {
        if (summonedMinionPlayerSide == PlayerSide.WAITING_PLAYER || thisMinionPlayerSide == PlayerSide.WAITING_PLAYER)
            return boardState;

        HearthTreeNode toRet = boardState;
        if (summonedMinion.getTribe() == MinionTribe.BEAST) { //TODO: this might be wrong..
            if (toRet instanceof CardDrawNode) {
                ((CardDrawNode) toRet).addNumCardsToDraw(1);
            } else {
                toRet = new CardDrawNode(toRet, 1); //draw one card
            }
        }

        return toRet;
    }
}

@@ -137,16 +137,130 @@
 erface;%0A
+import com.hearthsim.event.effect.CardEffectCharacter;%0Aimport com.hearthsim.event.effect.CardEffectCharacterDraw;%0A
 import c
@@ -465,16 +465,103 @@
 face %7B%0A%0A
+    private static final CardEffectCharacter effect = new CardEffectCharacterDraw(1);%0A%0A
     publ
@@ -1664,208 +1664,116 @@
     
-if (
 toRet 
-instanceof CardDrawNode) %7B%0A                ((CardDrawNode) toRet).addNumCardsToDraw(1);%0A            %7D else %7B%0A                toRet = new CardDrawNode(toRet, 1); //draw one card%0A            %7D
+= StarvingBuzzard.effect.applyEffect(thisMinionPlayerSide, this, thisMinionPlayerSide, 0, boardState);
 %0A   

Convert Starving Buzzard to effect pattern