public JSONObject toJSON() {
    JSONObject json = new JSONObject();

    json.put("name", name);
    json.put("playerId", playerId);
    json.put("hero", hero.toJSON());
    if (mana != maxMana) json.put("mana", mana);
    if (maxMana > 0) json.put("maxMana", maxMana);
    json.put("deckPos", deckPos);
    if (overload > 0) json.put("overload", overload);
    if (fatigueDamage > 0) json.put("fatigueDamage", fatigueDamage);

    if (minions.size() > 0) {
      JSONArray array = new JSONArray();
      for (Minion minion : minions) {
        array.put(minion.toJSON());
      }
      json.put("minions", array);
    }

    if (hand.size() > 0) {
      JSONArray array = new JSONArray();
      for (Card card : hand) {
        array.put(card.toJSON());
      }
      json.put("hand", array);
    }

    if (numCardsUsed > 0) {
      json.put("numCardsUsed", numCardsUsed);
    }

    return json;
  }
Beispiel #2
0
  public JSONObject toJSON() {
    JSONObject json = new JSONObject();
    json.put("p0_mana", p0_mana_);
    json.put("p1_mana", p1_mana_);
    json.put("p0_maxMana", p0_maxMana_);
    json.put("p1_maxMana", p0_maxMana_);
    json.put("p0_deckPos", p0_deckPos_);
    json.put("p1_deckPos", p1_deckPos_);

    JSONArray p0_minions = new JSONArray();
    for (Minion minion : p0_minions_) p0_minions.put(minion.toJSON());
    json.put("p0_minions", p0_minions);

    JSONArray p1_minions = new JSONArray();
    for (Minion minion : p1_minions_) p1_minions.put(minion.toJSON());
    json.put("p1_minions", p1_minions);

    JSONArray p0_hand = new JSONArray();
    for (Card card : p0_hand_) p0_hand.put(card.toJSON());
    json.put("p0_hand", p0_hand);

    JSONArray p1_hand = new JSONArray();
    for (Card card : p1_hand_) p1_hand.put(card.toJSON());
    json.put("p1_hand", p1_hand);

    json.put("p0_hero", p0_hero_.toJSON());
    json.put("p1_hero", p1_hero_.toJSON());

    json.put("p0_fatigue", p0_fatigueDamage_);
    json.put("p1_fatigue", p1_fatigueDamage_);
    json.put("p0_spellDamage", p0_spellDamage_);
    json.put("p1_spellDamage", p1_spellDamage_);
    return json;
  }
  /**
   * Use the card on the given target
   *
   * <p>Gives all friendly totems +2 health
   *
   * @param thisCardIndex The index (position) of the card in the hand
   * @param playerIndex The index of the target player. 0 if targeting yourself or your own minions,
   *     1 if targeting the enemy
   * @param minionIndex The index of the target minion.
   * @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 HearthTreeNode use_core(
      int targetPlayerIndex,
      Minion targetMinion,
      HearthTreeNode boardState,
      Deck deckPlayer0,
      Deck deckPlayer1,
      boolean singleRealizationOnly)
      throws HSException {
    if (!(targetMinion instanceof Hero) || targetPlayerIndex == 1) {
      return null;
    }

    HearthTreeNode toRet =
        super.use_core(
            targetPlayerIndex,
            targetMinion,
            boardState,
            deckPlayer0,
            deckPlayer1,
            singleRealizationOnly);
    if (toRet != null) {
      for (Minion minion : toRet.data_.getMinions_p0()) {
        if (minion instanceof Totem) {
          minion.setHealth((byte) (2 + minion.getHealth()));
          minion.setMaxHealth((byte) (2 + minion.getMaxHealth()));
        }
      }
    }
    return toRet;
  }
Beispiel #4
0
 /**
  * Checks to see if there are dead minions
  *
  * @return
  */
 public boolean hasDeadMinions() {
   for (Minion minion : p0_minions_) {
     if (minion.getTotalHealth() <= 0) return true;
   }
   for (Minion minion : p1_minions_) {
     if (minion.getTotalHealth() <= 0) {
       return true;
     }
   }
   return false;
 }
Beispiel #5
0
 @Override
 public EffectCharacter<Minion> getBattlecryEffect() {
   return (PlayerSide targetSide,
       CharacterIndex targetCharacterIndex,
       HearthTreeNode boardState) -> {
     Minion targetCharacter = boardState.data_.getCharacter(targetSide, targetCharacterIndex);
     Voljin.this.setHealth(targetCharacter.getHealth());
     Voljin.this.setMaxHealth(targetCharacter.getMaxHealth());
     targetCharacter.setHealth((byte) 2);
     targetCharacter.setMaxHealth((byte) 2);
     return boardState;
   };
 }
Beispiel #6
0
  public void startTurn(Deck deckPlayer0, Deck deckPlayer1) throws HSException {
    this.resetHand();
    this.resetMinions();

    for (Minion targetMinion : p0_minions_) {
      try {
        targetMinion.startTurn(0, this, deckPlayer0, deckPlayer1);
      } catch (HSInvalidPlayerIndexException e) {
        e.printStackTrace();
      }
    }
    for (Minion targetMinion : p1_minions_) {
      try {
        targetMinion.startTurn(1, this, deckPlayer0, deckPlayer1);
      } catch (HSInvalidPlayerIndexException e) {
        e.printStackTrace();
      }
    }
    ArrayList<Minion> toRemove = new ArrayList<Minion>();
    for (Minion targetMinion : p0_minions_) {
      if (targetMinion.getTotalHealth() <= 0) toRemove.add(targetMinion);
    }
    for (Minion minion : toRemove) p0_minions_.remove(minion);

    toRemove.clear();
    for (Minion targetMinion : p1_minions_) {
      if (targetMinion.getTotalHealth() <= 0) toRemove.add(targetMinion);
    }
    for (Minion minion : toRemove) p1_minions_.remove(minion);
  }
Beispiel #7
0
  public void endTurn(Deck deckPlayer0, Deck deckPlayer1) throws HSInvalidPlayerIndexException {
    p0_hero_.endTurn(0, this, deckPlayer0, deckPlayer1);
    p1_hero_.endTurn(1, this, deckPlayer0, deckPlayer1);
    for (int index = 0; index < p0_minions_.size(); ++index) {
      Minion targetMinion = p0_minions_.get(index);
      try {
        targetMinion.endTurn(0, this, deckPlayer0, deckPlayer1);
      } catch (HSException e) {
        e.printStackTrace();
      }
    }
    for (int index = 0; index < p1_minions_.size(); ++index) {
      Minion targetMinion = p1_minions_.get(index);
      try {
        targetMinion.endTurn(1, this, deckPlayer0, deckPlayer1);
      } catch (HSException e) {
        e.printStackTrace();
      }
    }

    ArrayList<Minion> toRemove = new ArrayList<Minion>();
    for (Minion targetMinion : p0_minions_) {
      if (targetMinion.getTotalHealth() <= 0) toRemove.add(targetMinion);
    }
    for (Minion minion : toRemove) p0_minions_.remove(minion);

    toRemove.clear();
    for (Minion targetMinion : p1_minions_) {
      if (targetMinion.getTotalHealth() <= 0) toRemove.add(targetMinion);
    }
    for (Minion minion : toRemove) p1_minions_.remove(minion);
  }
Beispiel #8
0
 /**
  * Place a minion onto the board. Does not trigger any events.
  *
  * <p>This is a function to place a minion on the board. Use this function only if you want no
  * events to be trigger upon placing the minion.
  *
  * @param minion The minion to be placed on the board. The minion is placed on the right-most
  *     space.
  * @throws HSInvalidPlayerIndexException
  */
 public void placeMinion(int playerIndex, Minion minion) throws HSInvalidPlayerIndexException {
   minion.isInHand(false);
   if (playerIndex == 0) p0_minions_.add(minion);
   else if (playerIndex == 1) p1_minions_.add(minion);
   else throw new HSInvalidPlayerIndexException();
   this.allMinionsFIFOList_.add(new MinionPlayerIDPair(minion, playerIndex));
 }
Beispiel #9
0
        @Override
        public boolean targetMatches(
            PlayerSide originSide,
            Card origin,
            PlayerSide targetSide,
            Minion targetCharacter,
            BoardModel board) {
          if (!super.targetMatches(originSide, origin, targetSide, targetCharacter, board)) {
            return false;
          }

          if (targetCharacter.getHealth() == targetCharacter.getMaxHealth()) {
            return false;
          }

          return true;
        }
Beispiel #10
0
 public ArrayList<Integer> getAttackableMinions_p1() {
   ArrayList<Integer> toRet = new ArrayList<Integer>();
   boolean hasTaunt = false;
   for (final Minion minion : p1_minions_) {
     hasTaunt = hasTaunt || minion.getTaunt();
   }
   if (!hasTaunt) {
     toRet.add((Integer) 0);
     int counter = 1;
     for (Iterator<Minion> iter = p1_minions_.iterator(); iter.hasNext(); iter.next()) {
       toRet.add((Integer) counter);
       counter++;
     }
     return toRet;
   } else {
     int counter = 1;
     for (Minion aP1_minions_ : p1_minions_) {
       if (aP1_minions_.getTaunt()) toRet.add(counter);
       counter++;
     }
     return toRet;
   }
 }
  @Before
  public void setup() throws HSException {
    board = new HearthTreeNode(new BoardState());

    Minion minion0_0 = new Minion("" + 0, mana, attack0, health0, attack0, health0, health0);
    Minion minion0_1 =
        new Minion("" + 0, mana, attack0, (byte) (health1 - 1), attack0, health1, health1);
    Minion minion1_0 = new Minion("" + 0, mana, attack0, health0, attack0, health0, health0);
    Minion minion1_1 =
        new Minion("" + 0, mana, attack0, (byte) (health1 - 1), attack0, health1, health1);
    Minion minion1_2 = new Abomination();

    minion1_2.setHealth((byte) 1);

    board.data_.placeMinion(0, minion0_0);
    board.data_.placeMinion(0, minion0_1);

    board.data_.placeMinion(1, minion1_0);
    board.data_.placeMinion(1, minion1_1);
    board.data_.placeMinion(1, minion1_2);

    Card cards[] = new Card[10];
    for (int index = 0; index < 10; ++index) {
      cards[index] = new TheCoin();
    }

    deck = new Deck(cards);

    Minion fb = new ElvenArcher();
    board.data_.placeCard_hand_p0(fb);

    board.data_.setMana_p0((byte) 7);
    board.data_.setMana_p1((byte) 4);

    board.data_.setMaxMana_p0((byte) 7);
    board.data_.setMaxMana_p1((byte) 4);
  }
Beispiel #12
0
 /**
  * Reset all minions to clear their has_attacked state.
  *
  * <p>Call this function at the beginning of each turn
  */
 public void resetMinions() {
   p0_hero_.hasAttacked(false);
   p0_hero_.hasBeenUsed(false);
   p1_hero_.hasAttacked(false);
   p1_hero_.hasBeenUsed(false);
   for (Minion minion : p0_minions_) {
     minion.hasAttacked(false);
     minion.hasBeenUsed(false);
   }
   for (Minion minion : p1_minions_) {
     minion.hasAttacked(false);
     minion.hasBeenUsed(false);
   }
 }
Beispiel #13
0
 @Override
 public int hashCode() {
   int hs = p0_hand_.size();
   if (hs < 0) hs = 0;
   int res = hs + p0_minions_.size() * 10 + p1_minions_.size() * 100;
   res += (p0_mana_ <= 0 ? 0 : (p0_mana_ - 1) * 1000);
   res += ((p0_hero_.getHealth() + p1_hero_.getHealth()) % 100) * 10000;
   int th = 0;
   if (hs > 0) {
     Card cc = p0_hand_.get(0);
     try {
       Minion mm = (Minion) cc;
       th += (cc.hasBeenUsed() ? 1 : 0) + mm.getAttack() + mm.getHealth() + cc.getMana();
     } catch (ClassCastException e) {
       th += (cc.hasBeenUsed() ? 1 : 0) + cc.getMana();
     }
   }
   if (hs > 1) {
     Card cc = p0_hand_.get(1);
     try {
       Minion mm = (Minion) cc;
       th += (cc.hasBeenUsed() ? 1 : 0) + mm.getAttack() + mm.getHealth() + cc.getMana();
     } catch (ClassCastException e) {
       th += (cc.hasBeenUsed() ? 1 : 0) + cc.getMana();
     }
   }
   res += (th % 10) * 1000000;
   int mh0 = 0;
   if (p0_minions_.size() > 0) {
     mh0 += p0_minions_.get(0).getHealth();
   }
   if (p0_minions_.size() > 1) {
     mh0 += p0_minions_.get(1).getHealth();
   }
   res += (mh0 % 100) * 10000000;
   int mh1 = 0;
   if (p1_minions_.size() > 0) {
     mh1 += p1_minions_.get(0).getHealth();
   }
   if (p1_minions_.size() > 1) {
     mh1 += p1_minions_.get(1).getHealth();
   }
   res += (mh1 % 20) * 100000000;
   return res;
 }
  // TODO Unused?
  public HearthTreeNode perform(HearthTreeNode boardState) throws HSException {
    HearthTreeNode toRet = boardState;
    PlayerModel actingPlayer =
        actionPerformerPlayerSide != null
            ? boardState.data_.modelForSide(actionPerformerPlayerSide)
            : null;
    PlayerModel targetPlayer =
        targetPlayerSide != null ? boardState.data_.modelForSide(targetPlayerSide) : null;

    switch (verb_) {
      case USE_CARD:
        {
          Card card = actingPlayer.getHand().get(cardOrCharacterIndex_);
          toRet = card.useOn(targetPlayerSide, targetCharacterIndex, toRet);
        }
        break;
      case HERO_ABILITY:
        {
          Hero hero = actingPlayer.getHero();
          Minion target = targetPlayer.getCharacter(targetCharacterIndex);
          toRet = hero.useHeroAbility(targetPlayerSide, target, toRet);
        }
        break;
      case ATTACK:
        {
          Minion attacker =
              actingPlayer.getCharacter(CharacterIndex.fromInteger(cardOrCharacterIndex_));
          toRet = attacker.attack(targetPlayerSide, targetCharacterIndex, toRet);
        }
        break;
      case UNTARGETABLE_BATTLECRY:
        {
          Minion minion =
              actingPlayer.getCharacter(CharacterIndex.fromInteger(cardOrCharacterIndex_));
          toRet = minion.useUntargetableBattlecry(targetCharacterIndex, toRet);
          break;
        }
      case TARGETABLE_BATTLECRY:
        {
          Minion minion =
              actingPlayer.getCharacter(CharacterIndex.fromInteger(cardOrCharacterIndex_));
          toRet = minion.useTargetableBattlecry(targetPlayerSide, targetCharacterIndex, toRet);
          break;
        }
      case START_TURN:
        {
          toRet = new HearthTreeNode(Game.beginTurn(boardState.data_.deepCopy()));
          break;
        }
      case END_TURN:
        {
          toRet = new HearthTreeNode(Game.endTurn(boardState.data_.deepCopy()).flipPlayers());
          break;
        }
      case DO_NOT_USE_CARD:
        {
          for (Card c : actingPlayer.getHand()) {
            c.hasBeenUsed(true);
          }
          break;
        }
      case DO_NOT_ATTACK:
        {
          for (Minion minion : actingPlayer.getMinions()) {
            minion.hasAttacked(true);
          }
          actingPlayer.getHero().hasAttacked(true);
          break;
        }
      case DO_NOT_USE_HEROPOWER:
        {
          actingPlayer.getHero().hasBeenUsed(true);
          break;
        }
      case RNG:
        {
          // We need to perform the current state again if the children don't exist yet. This can
          // happen in certain replay scenarios.
          // Do not do this if the previous action was *also* RNG or we will end up in an infinite
          // loop.
          if (toRet.isLeaf() && boardState.getAction().verb_ != Verb.RNG) {
            boardState.data_.getCurrentPlayer().addNumCardsUsed((byte) -1); // do not double count
            toRet = boardState.getAction().perform(boardState);
          }
          // RNG has declared this child happened
          toRet = toRet.getChildren().get(cardOrCharacterIndex_);
          break;
        }
      case DRAW_CARDS:
        {
          // Note, this action only supports drawing cards from the deck. Cards like Ysera or
          // Webspinner need to be implemented using RNG children.
          for (int indx = 0; indx < cardOrCharacterIndex_; ++indx) {
            actingPlayer.drawNextCardFromDeck();
          }
          break;
        }
    }
    return toRet;
  }
Beispiel #15
0
  @Test
  public void test0() throws HSException {

    // null case
    Minion target = board.data_.getCharacter(1, 0);
    Minion minion = board.data_.getMinion_p0(0);
    HearthTreeNode ret = minion.attack(1, target, board, deck, null);

    assertFalse(ret == null);
    assertEquals(board.data_.getNumCards_hand(), 1);
    assertEquals(board.data_.getNumMinions_p0(), 2);
    assertEquals(board.data_.getNumMinions_p1(), 2);
    assertEquals(board.data_.getMana_p0(), 8);
    assertEquals(board.data_.getMana_p1(), 8);
    assertEquals(board.data_.getHero_p0().getHealth(), 30);
    assertEquals(board.data_.getHero_p1().getHealth(), 28);
    assertEquals(board.data_.getMinion_p0(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p0(1).getHealth(), 7);
    assertEquals(board.data_.getMinion_p1(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p1(1).getHealth(), 7);

    assertEquals(board.data_.getMinion_p0(0).getTotalAttack(), 2);
    assertEquals(board.data_.getMinion_p0(1).getTotalAttack(), 7);
    assertEquals(board.data_.getMinion_p1(0).getTotalAttack(), 2);
    assertEquals(board.data_.getMinion_p1(1).getTotalAttack(), 7);

    target = board.data_.getCharacter(1, 0);
    Hero hero = board.data_.getHero_p0();
    ret = hero.useHeroAbility(1, target, board, deck, null);
    assertEquals(board.data_.getNumCards_hand(), 1);
    assertEquals(board.data_.getNumMinions_p0(), 2);
    assertEquals(board.data_.getNumMinions_p1(), 2);
    assertEquals(board.data_.getMana_p0(), 6);
    assertEquals(board.data_.getMana_p1(), 8);
    assertEquals(board.data_.getHero_p0().getHealth(), 30);
    assertEquals(board.data_.getHero_p1().getHealth(), 26);
    assertEquals(board.data_.getMinion_p0(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p0(1).getHealth(), 7);
    assertEquals(board.data_.getMinion_p1(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p1(1).getHealth(), 7);

    assertEquals(board.data_.getMinion_p0(0).getTotalAttack(), 2);
    assertEquals(board.data_.getMinion_p0(1).getTotalAttack(), 7);
    assertEquals(board.data_.getMinion_p1(0).getTotalAttack(), 2);
    assertEquals(board.data_.getMinion_p1(1).getTotalAttack(), 7);

    minion.hasAttacked(false);
    target = board.data_.getCharacter(1, 2);
    ret = minion.attack(1, target, board, deck, null);
    assertEquals(board.data_.getNumCards_hand(), 1);
    assertEquals(board.data_.getNumMinions_p0(), 1);
    assertEquals(board.data_.getNumMinions_p1(), 2);
    assertEquals(board.data_.getMana_p0(), 6);
    assertEquals(board.data_.getMana_p1(), 8);
    assertEquals(board.data_.getHero_p0().getHealth(), 30);
    assertEquals(board.data_.getHero_p1().getHealth(), 26);
    assertEquals(board.data_.getMinion_p0(0).getHealth(), 7);
    assertEquals(board.data_.getMinion_p1(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p1(1).getHealth(), 5);

    assertEquals(board.data_.getMinion_p0(0).getTotalAttack(), 6);
    assertEquals(board.data_.getMinion_p1(0).getTotalAttack(), 2);
    assertEquals(board.data_.getMinion_p1(1).getTotalAttack(), 7);

    minion.hasAttacked(false);
    target = board.data_.getCharacter(1, 2);
    ret = hero.useHeroAbility(1, target, board, deck, null);
    assertTrue(ret == null);
    assertEquals(board.data_.getNumCards_hand(), 1);
    assertEquals(board.data_.getNumMinions_p0(), 1);
    assertEquals(board.data_.getNumMinions_p1(), 2);
    assertEquals(board.data_.getMana_p0(), 6);
    assertEquals(board.data_.getMana_p1(), 8);
    assertEquals(board.data_.getHero_p0().getHealth(), 30);
    assertEquals(board.data_.getHero_p1().getHealth(), 26);
    assertEquals(board.data_.getMinion_p0(0).getHealth(), 7);
    assertEquals(board.data_.getMinion_p1(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p1(1).getHealth(), 5);

    assertEquals(board.data_.getMinion_p0(0).getTotalAttack(), 6);
    assertEquals(board.data_.getMinion_p1(0).getTotalAttack(), 2);
    assertEquals(board.data_.getMinion_p1(1).getTotalAttack(), 7);
  }
 public byte getSpellDamage() {
   byte spellDamage = 0;
   for (Minion minion : minions) spellDamage += minion.getSpellDamage();
   return spellDamage;
 }
  @Test
  public void test2() throws HSInvalidPlayerIndexException {

    // null case
    Card theCard = board.data_.getCard_hand_p0(0);
    HearthTreeNode ret = theCard.useOn(0, 0, 3, board, deck, null);

    assertFalse(ret == null);
    assertEquals(board.data_.getNumCards_hand(), 0);
    assertEquals(board.data_.getNumMinions_p0(), 3);
    assertEquals(board.data_.getNumMinions_p1(), 3);
    assertEquals(board.data_.getMana_p0(), 5);
    assertEquals(board.data_.getMana_p1(), 8);
    assertEquals(board.data_.getHero_p0().getHealth(), 30);
    assertEquals(board.data_.getHero_p1().getHealth(), 30);
    assertEquals(board.data_.getMinion_p0(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p0(1).getHealth(), 7);
    assertEquals(board.data_.getMinion_p0(2).getHealth(), 1);
    assertEquals(board.data_.getMinion_p1(0).getHealth(), 1);
    assertEquals(board.data_.getMinion_p1(1).getHealth(), 2);
    assertEquals(board.data_.getMinion_p1(2).getHealth(), 7);

    assertEquals(board.data_.getMinion_p0(0).getAttack(), 2);
    assertEquals(board.data_.getMinion_p0(1).getAttack(), 7);
    assertEquals(board.data_.getMinion_p0(2).getAttack(), 4);
    assertEquals(board.data_.getMinion_p1(0).getAttack(), 4);
    assertEquals(board.data_.getMinion_p1(1).getAttack(), 2);
    assertEquals(board.data_.getMinion_p1(2).getAttack(), 7);

    assertTrue(board.data_.getMinion_p1(0).getDivineShield());
    assertTrue(board.data_.getMinion_p0(2).getDivineShield());

    // ------------------------------------------------------------
    // Attacking with divine shield vs Hero, divine shield should
    // stay on
    // ------------------------------------------------------------
    Minion m0 = board.data_.getMinion_p0(2);
    m0.hasAttacked(false);
    ret = m0.attack(3, 1, 0, board, deck, null);

    assertEquals(board.data_.getNumCards_hand(), 0);
    assertEquals(board.data_.getNumMinions_p0(), 3);
    assertEquals(board.data_.getNumMinions_p1(), 3);
    assertEquals(board.data_.getMana_p0(), 5);
    assertEquals(board.data_.getMana_p1(), 8);
    assertEquals(board.data_.getHero_p0().getHealth(), 30);
    assertEquals(board.data_.getHero_p1().getHealth(), 26);
    assertEquals(board.data_.getMinion_p0(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p0(1).getHealth(), 7);
    assertEquals(board.data_.getMinion_p0(2).getHealth(), 1);
    assertEquals(board.data_.getMinion_p1(0).getHealth(), 1);
    assertEquals(board.data_.getMinion_p1(1).getHealth(), 2);
    assertEquals(board.data_.getMinion_p1(2).getHealth(), 7);

    assertEquals(board.data_.getMinion_p0(0).getAttack(), 2);
    assertEquals(board.data_.getMinion_p0(1).getAttack(), 7);
    assertEquals(board.data_.getMinion_p0(2).getAttack(), 4);
    assertEquals(board.data_.getMinion_p1(0).getAttack(), 4);
    assertEquals(board.data_.getMinion_p1(1).getAttack(), 2);
    assertEquals(board.data_.getMinion_p1(2).getAttack(), 7);

    assertTrue(board.data_.getMinion_p1(0).getDivineShield());
    assertTrue(board.data_.getMinion_p0(2).getDivineShield());

    // ------------------------------------------------------------
    // Attacking with divine shield
    // ------------------------------------------------------------
    Minion m1 = board.data_.getMinion_p0(2);
    m1.hasAttacked(false);
    ret = m1.attack(3, 1, 3, board, deck, null);

    assertEquals(board.data_.getNumCards_hand(), 0);
    assertEquals(board.data_.getNumMinions_p0(), 3);
    assertEquals(board.data_.getNumMinions_p1(), 3);
    assertEquals(board.data_.getMana_p0(), 5);
    assertEquals(board.data_.getMana_p1(), 8);
    assertEquals(board.data_.getHero_p0().getHealth(), 30);
    assertEquals(board.data_.getHero_p1().getHealth(), 26);
    assertEquals(board.data_.getMinion_p0(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p0(1).getHealth(), 7);
    assertEquals(board.data_.getMinion_p0(2).getHealth(), 1);
    assertEquals(board.data_.getMinion_p1(0).getHealth(), 1);
    assertEquals(board.data_.getMinion_p1(1).getHealth(), 2);
    assertEquals(board.data_.getMinion_p1(2).getHealth(), 3);

    assertEquals(board.data_.getMinion_p0(0).getAttack(), 2);
    assertEquals(board.data_.getMinion_p0(1).getAttack(), 7);
    assertEquals(board.data_.getMinion_p0(2).getAttack(), 4);
    assertEquals(board.data_.getMinion_p1(0).getAttack(), 4);
    assertEquals(board.data_.getMinion_p1(1).getAttack(), 2);
    assertEquals(board.data_.getMinion_p1(2).getAttack(), 7);

    assertTrue(board.data_.getMinion_p1(0).getDivineShield());
    assertFalse(board.data_.getMinion_p0(2).getDivineShield());

    // ------------------------------------------------------------
    // Being attacked with a divine shield
    // ------------------------------------------------------------
    Minion m2 = board.data_.getMinion_p0(1);
    m2.hasAttacked(false);
    ret = m2.attack(2, 1, 1, board, deck, null);

    assertEquals(board.data_.getNumCards_hand(), 0);
    assertEquals(board.data_.getNumMinions_p0(), 3);
    assertEquals(board.data_.getNumMinions_p1(), 3);
    assertEquals(board.data_.getMana_p0(), 5);
    assertEquals(board.data_.getMana_p1(), 8);
    assertEquals(board.data_.getHero_p0().getHealth(), 30);
    assertEquals(board.data_.getHero_p1().getHealth(), 26);
    assertEquals(board.data_.getMinion_p0(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p0(1).getHealth(), 3);
    assertEquals(board.data_.getMinion_p0(2).getHealth(), 1);
    assertEquals(board.data_.getMinion_p1(0).getHealth(), 1);
    assertEquals(board.data_.getMinion_p1(1).getHealth(), 2);
    assertEquals(board.data_.getMinion_p1(2).getHealth(), 3);

    assertEquals(board.data_.getMinion_p0(0).getAttack(), 2);
    assertEquals(board.data_.getMinion_p0(1).getAttack(), 7);
    assertEquals(board.data_.getMinion_p0(2).getAttack(), 4);
    assertEquals(board.data_.getMinion_p1(0).getAttack(), 4);
    assertEquals(board.data_.getMinion_p1(1).getAttack(), 2);
    assertEquals(board.data_.getMinion_p1(2).getAttack(), 7);

    assertFalse(board.data_.getMinion_p1(0).getDivineShield());
    assertFalse(board.data_.getMinion_p0(2).getDivineShield());

    // ------------------------------------------------------------
    // Being attacked with a divine shield that wore off
    // ------------------------------------------------------------
    Minion m3 = board.data_.getMinion_p0(2);
    m3.hasAttacked(false);
    ret = m3.attack(3, 1, 3, board, deck, null);

    assertEquals(board.data_.getNumCards_hand(), 0);
    assertEquals(board.data_.getNumMinions_p0(), 2);
    assertEquals(board.data_.getNumMinions_p1(), 2);
    assertEquals(board.data_.getMana_p0(), 5);
    assertEquals(board.data_.getMana_p1(), 8);
    assertEquals(board.data_.getHero_p0().getHealth(), 30);
    assertEquals(board.data_.getHero_p1().getHealth(), 26);
    assertEquals(board.data_.getMinion_p0(0).getHealth(), 2);
    assertEquals(board.data_.getMinion_p0(1).getHealth(), 3);
    assertEquals(board.data_.getMinion_p1(0).getHealth(), 1);
    assertEquals(board.data_.getMinion_p1(1).getHealth(), 2);

    assertEquals(board.data_.getMinion_p0(0).getAttack(), 2);
    assertEquals(board.data_.getMinion_p0(1).getAttack(), 7);
    assertEquals(board.data_.getMinion_p1(0).getAttack(), 4);
    assertEquals(board.data_.getMinion_p1(1).getAttack(), 2);

    assertFalse(board.data_.getMinion_p1(0).getDivineShield());
  }