예제 #1
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);
  }
예제 #2
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);
  }
예제 #3
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;
 }