package com.hearthsim.card.spellcard.concrete;

import com.hearthsim.card.Card;
import com.hearthsim.card.minion.Minion;
import com.hearthsim.card.spellcard.SpellCard;
import com.hearthsim.event.effect.CardEffectCharacter;
import com.hearthsim.event.MinionFilterTargetedSpell;
import com.hearthsim.exception.HSException;
import com.hearthsim.model.PlayerModel;
import com.hearthsim.model.PlayerSide;
import com.hearthsim.util.tree.HearthTreeNode;

public class CircleOfHealing extends SpellCard {

    private static final byte HEAL_AMOUNT = 4;

    /**
     * Constructor
     *
     * @param hasBeenUsed Whether the card has already been used or not
     */
    @Deprecated
    public CircleOfHealing(boolean hasBeenUsed) {
        this();
        this.hasBeenUsed = hasBeenUsed;
    }

    /**
     * Constructor
     *
     * Defaults to hasBeenUsed = false
     */
    public CircleOfHealing() {
        super();

        this.minionFilter = MinionFilterTargetedSpell.SELF;
    }

    /**
     *
     * Circle of Healing
     *
     * Heals all minions for 4
     *
     *
     *
     * @param side
     * @param boardState The BoardState before this card has performed its action.  It will be manipulated and returned.
     *
     * @return The boardState is manipulated and returned
     */
    @Override
    protected CardEffectCharacter getEffect() {
        if (this.effect == null) {
            this.effect = new CardEffectCharacter() {
                @Override
                public HearthTreeNode applyEffect(PlayerSide originSide, Card origin, PlayerSide targetSide, int targetCharacterIndex, HearthTreeNode boardState) throws HSException {
                    PlayerModel currentPlayer = boardState.data_.modelForSide(PlayerSide.CURRENT_PLAYER);
                    PlayerModel waitingPlayer = boardState.data_.modelForSide(PlayerSide.WAITING_PLAYER);
                    for (Minion minion : currentPlayer.getMinions()) {
                        boardState = minion.takeHealAndNotify(HEAL_AMOUNT, PlayerSide.CURRENT_PLAYER, boardState);
                    }

                    for (Minion minion : waitingPlayer.getMinions()) {
                        boardState = minion.takeHealAndNotify(HEAL_AMOUNT, PlayerSide.WAITING_PLAYER, boardState);
                    }
                    return boardState;
                }
            };
        }
        return this.effect;
    }
}

@@ -157,24 +157,123 @@
 .SpellCard;%0A
+import com.hearthsim.event.MinionFilter;%0Aimport com.hearthsim.event.effect.CardEffectAoeInterface;%0A
 import com.h
@@ -369,16 +369,75 @@
 dSpell;%0A
+import com.hearthsim.event.effect.CardEffectCharacterHeal;%0A
 import c
@@ -646,16 +646,50 @@
 ellCard 
+implements CardEffectAoeInterface 
 %7B%0A%0A    p
@@ -731,16 +731,129 @@
 T = 4;%0A%0A
+    private static final CardEffectCharacter effect = new CardEffectCharacterHeal(CircleOfHealing.HEAL_AMOUNT);%0A%0A
     /**%0A
@@ -1670,1035 +1670,245 @@
     
-if (this.effect == null) %7B%0A            this.effect = new CardEffectCharacter() %7B%0A                @Override%0A                public HearthTreeNode applyEffect(PlayerSide originSide, Card origin, PlayerSide targetSide, int targetCharacterIndex, HearthTreeNode boardState) throws HSException %7B%0A                    PlayerModel currentPlayer = boardState.data_.modelForSide(PlayerSide.CURRENT_PLAYER);%0A                    PlayerModel waitingPlayer = boardState.data_.modelForSide(PlayerSide.WAITING_PLAYER);%0A                    for (Minion minion : currentPlayer.getMinions()) %7B%0A                        boardState = minion.takeHealAndNotify(HEAL_AMOUNT, PlayerSide.CURRENT_PLAYER, boardState);%0A                    %7D%0A%0A                    for (Minion minion : waitingPlayer.getMinions()) %7B%0A                        boardState = minion.takeHealAndNotify(HEAL_AMOUNT, PlayerSide.WAITING_PLAYER, boardState);%0A                    %7D%0A                    return boardState;%0A                %7D%0A            %7D;%0A        %7D%0A        return this.effect
+return this.getAoeEffect();%0A    %7D%0A%0A    @Override%0A    public CardEffectCharacter getAoeEffect() %7B%0A        return CircleOfHealing.effect;%0A    %7D%0A%0A    @Override%0A    public MinionFilter getAoeFilter() %7B%0A        return MinionFilter.ALL_MINIONS
 ;%0A  

Implement Circle of Healing as an Aoe effect