diff --git a/src/main/java/com/hearthsim/card/Card.java b/src/main/java/com/hearthsim/card/Card.java
index 0effd63ac..99a98426a 100644
--- a/src/main/java/com/hearthsim/card/Card.java
+++ b/src/main/java/com/hearthsim/card/Card.java
@@ -636,11 +636,7 @@ protected HearthTreeNode createRngNodeWithChildren(HearthTreeNode boardState, Co
protected HearthTreeNode createNodeWithChildren(HearthTreeNode boardState, Collection children) {
if (children != null) {
- if (children.size() == 1) {
- boardState = children.stream().findAny().get();
- } else if (children.size() > 1) {
- boardState.addChildren(children);
- }
+ boardState.addChildren(children);
}
return boardState;
}
diff --git a/src/main/java/com/hearthsim/card/minion/Minion.java b/src/main/java/com/hearthsim/card/minion/Minion.java
index 239fa76b2..31d1b5584 100644
--- a/src/main/java/com/hearthsim/card/minion/Minion.java
+++ b/src/main/java/com/hearthsim/card/minion/Minion.java
@@ -624,18 +624,31 @@ public HearthTreeNode summonMinion(PlayerSide targetSide, CharacterIndex targetM
Minion origin;
CharacterIndex originCharacterIndex = toRet.data_.modelForSide(PlayerSide.CURRENT_PLAYER).getIndexForCharacter(this);
- ArrayList children = new ArrayList<>();
- for (CharacterIndex.CharacterLocation characterLocation : toRet.data_) {
+ // Find out if there are going to be more than one target match
+ int numTargets = 0;
+ CharacterIndex.CharacterLocation onlyTargetLocation = null;
+ for (CharacterIndex.CharacterLocation characterLocation : toRet.data_)
if (battlecryOrigin.getBattlecryFilter().targetMatches(PlayerSide.CURRENT_PLAYER, this, characterLocation.getPlayerSide(), characterLocation.getIndex(), toRet.data_)) {
- child = new HearthTreeNode(toRet.data_.deepCopy());
- origin = child.data_.getCharacter(PlayerSide.CURRENT_PLAYER, originCharacterIndex);
- child = origin.useTargetableBattlecry(characterLocation.getPlayerSide(), characterLocation.getIndex(), child);
- if (child != null) {
- children.add(child);
+ ++numTargets;
+ onlyTargetLocation = characterLocation;
+ }
+
+ if (numTargets > 1) {
+ ArrayList children = new ArrayList<>();
+ for (CharacterIndex.CharacterLocation characterLocation : toRet.data_) {
+ if (battlecryOrigin.getBattlecryFilter().targetMatches(PlayerSide.CURRENT_PLAYER, this, characterLocation.getPlayerSide(), characterLocation.getIndex(), toRet.data_)) {
+ child = new HearthTreeNode(toRet.data_.deepCopy());
+ origin = child.data_.getCharacter(PlayerSide.CURRENT_PLAYER, originCharacterIndex);
+ child = origin.useTargetableBattlecry(characterLocation.getPlayerSide(), characterLocation.getIndex(), child);
+ if (child != null) {
+ children.add(child);
+ }
}
}
+ toRet = this.createNodeWithChildren(toRet, children);
+ } else if (numTargets == 1) {
+ toRet = this.useTargetableBattlecry(onlyTargetLocation.getPlayerSide(), onlyTargetLocation.getIndex(), toRet);
}
- toRet = this.createNodeWithChildren(toRet, children);
}
if (wasPlayed) {
diff --git a/src/test/groovy/com/hearthsim/test/groovy/card/classic/minion/KnifeJugglerSpec.groovy b/src/test/groovy/com/hearthsim/test/groovy/card/classic/minion/KnifeJugglerSpec.groovy
index 967fae305..9c44e0bb5 100644
--- a/src/test/groovy/com/hearthsim/test/groovy/card/classic/minion/KnifeJugglerSpec.groovy
+++ b/src/test/groovy/com/hearthsim/test/groovy/card/classic/minion/KnifeJugglerSpec.groovy
@@ -43,6 +43,7 @@ class KnifeJugglerSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def theCard = root.data_.getCurrentPlayer().getHand().get(0)
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root)
+ ret = ret.getChildren().get(0);
expect:
ret != null
diff --git a/src/test/groovy/com/hearthsim/test/groovy/card/classic/spell/DeadlyShotSpec.groovy b/src/test/groovy/com/hearthsim/test/groovy/card/classic/spell/DeadlyShotSpec.groovy
index b759af87a..7c93258a8 100644
--- a/src/test/groovy/com/hearthsim/test/groovy/card/classic/spell/DeadlyShotSpec.groovy
+++ b/src/test/groovy/com/hearthsim/test/groovy/card/classic/spell/DeadlyShotSpec.groovy
@@ -42,6 +42,7 @@ class DeadlyShotSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def theCard = root.data_.getCurrentPlayer().getHand().get(0)
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root)
+ ret = ret.getChildren().get(0);
expect:
ret != null
diff --git a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/BombLobberSpec.groovy b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/BombLobberSpec.groovy
index 792ed8fba..9f794d02f 100644
--- a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/BombLobberSpec.groovy
+++ b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/BombLobberSpec.groovy
@@ -42,6 +42,7 @@ class BombLobberSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def theCard = root.data_.getCurrentPlayer().getHand().get(0)
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root)
+ ret = ret.getChildren().get(0);
expect:
ret != null
diff --git a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/ShadowboxerSpec.groovy b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/ShadowboxerSpec.groovy
index 4c3f00db5..b19f56b6f 100644
--- a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/ShadowboxerSpec.groovy
+++ b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/ShadowboxerSpec.groovy
@@ -45,6 +45,7 @@ class ShadowboxerSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def theCard = root.data_.getCurrentPlayer().getHand().get(0)
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root)
+ ret = ret.getChildren().get(0);
expect:
ret != null
@@ -72,6 +73,7 @@ class ShadowboxerSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def theCard = root.data_.getCurrentPlayer().getHand().get(0)
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root)
+ ret = ret.getChildren().get(0);
expect:
ret != null
diff --git a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/ShipsCannonSpec.groovy b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/ShipsCannonSpec.groovy
index 5fd04d24a..e9752c29b 100644
--- a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/ShipsCannonSpec.groovy
+++ b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/minion/ShipsCannonSpec.groovy
@@ -44,6 +44,7 @@ class ShipsCannonSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def theCard = root.data_.getCurrentPlayer().getHand().get(0)
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root)
+ ret = ret.getChildren().get(0);
expect:
ret != null
diff --git a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/spell/FlamecannonSpec.groovy b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/spell/FlamecannonSpec.groovy
index 09d146bcc..560c53b18 100644
--- a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/spell/FlamecannonSpec.groovy
+++ b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/spell/FlamecannonSpec.groovy
@@ -40,6 +40,7 @@ class FlamecannonSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def theCard = root.data_.getCurrentPlayer().getHand().get(0)
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root)
+ ret = ret.getChildren().get(0);
expect:
ret != null
diff --git a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/weapon/CoghammerSpec.groovy b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/weapon/CoghammerSpec.groovy
index 6110c5366..1725e2110 100644
--- a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/weapon/CoghammerSpec.groovy
+++ b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/weapon/CoghammerSpec.groovy
@@ -64,6 +64,7 @@ class CoghammerSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def theCard = root.data_.getCurrentPlayer().getHand().get(0)
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root)
+ ret = ret.getChildren().get(0);
expect:
ret != null
diff --git a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/weapon/GlaivezookaSpec.groovy b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/weapon/GlaivezookaSpec.groovy
index d7c236318..4da6f6062 100644
--- a/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/weapon/GlaivezookaSpec.groovy
+++ b/src/test/groovy/com/hearthsim/test/groovy/card/goblinsvsgnomes/weapon/GlaivezookaSpec.groovy
@@ -64,6 +64,7 @@ class GlaivezookaSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def theCard = root.data_.getCurrentPlayer().getHand().get(0)
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root)
+ ret = ret.getChildren().get(0);
expect:
ret != null
diff --git a/src/test/java/com/hearthsim/test/minion/TestTheBlackKnight.java b/src/test/java/com/hearthsim/test/minion/TestTheBlackKnight.java
index bd7dd4e68..27c00d483 100644
--- a/src/test/java/com/hearthsim/test/minion/TestTheBlackKnight.java
+++ b/src/test/java/com/hearthsim/test/minion/TestTheBlackKnight.java
@@ -101,34 +101,6 @@ public void test1() throws HSException {
assertFalse(ret == null);
- assertEquals(currentPlayer.getHand().size(), 0);
- assertEquals(currentPlayer.getNumMinions(), 4);
- assertEquals(waitingPlayer.getNumMinions(), 4);
- assertEquals(currentPlayer.getMana(), 4);
- assertEquals(waitingPlayer.getMana(), 10);
- assertEquals(currentPlayer.getHero().getHealth(), 30);
- assertEquals(waitingPlayer.getHero().getHealth(), 30);
-
- assertEquals(currentPlayer.getCharacter(CharacterIndex.MINION_1).getTotalHealth(), 4);
- assertEquals(currentPlayer.getCharacter(CharacterIndex.MINION_2).getTotalHealth(), 3);
- assertEquals(currentPlayer.getCharacter(CharacterIndex.MINION_3).getTotalHealth(), 6);
- assertEquals(currentPlayer.getCharacter(CharacterIndex.MINION_4).getTotalHealth(), 6);
-
- assertEquals(waitingPlayer.getCharacter(CharacterIndex.MINION_1).getTotalHealth(), 1);
- assertEquals(waitingPlayer.getCharacter(CharacterIndex.MINION_2).getTotalHealth(), 4);
- assertEquals(waitingPlayer.getCharacter(CharacterIndex.MINION_3).getTotalHealth(), 2);
- assertEquals(waitingPlayer.getCharacter(CharacterIndex.MINION_4).getTotalHealth(), 7);
-
- assertEquals(currentPlayer.getCharacter(CharacterIndex.MINION_1).getTotalAttack(), 4);
- assertEquals(currentPlayer.getCharacter(CharacterIndex.MINION_2).getTotalAttack(), 3);
- assertEquals(currentPlayer.getCharacter(CharacterIndex.MINION_3).getTotalAttack(), 7);
- assertEquals(currentPlayer.getCharacter(CharacterIndex.MINION_4).getTotalAttack(), 6);
-
- assertEquals(waitingPlayer.getCharacter(CharacterIndex.MINION_1).getTotalAttack(), 3);
- assertEquals(waitingPlayer.getCharacter(CharacterIndex.MINION_2).getTotalAttack(), 5);
- assertEquals(waitingPlayer.getCharacter(CharacterIndex.MINION_3).getTotalAttack(), 2);
- assertEquals(waitingPlayer.getCharacter(CharacterIndex.MINION_4).getTotalAttack(), 7);
-
assertEquals(board.numChildren(), 0);
currentPlayer = ret.data_.getCurrentPlayer();
waitingPlayer = ret.data_.getWaitingPlayer();