Skip to content

Commit

Permalink
Merge pull request #1 from oyachai/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
Rutnar committed Jun 15, 2015
2 parents 9b38e8c + 5679657 commit 382f8e6
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ public ManaWyrm() {
@Override
public HearthTreeNode onCardPlayBegin(PlayerSide thisCardPlayerSide, PlayerSide cardUserPlayerSide, Card usedCard,
HearthTreeNode boardState, boolean singleRealizationOnly) {
if (this.isInHand()) {
return boardState;
}
if (cardUserPlayerSide == thisCardPlayerSide && usedCard instanceof SpellCard) {
this.addAttack((byte)1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public UnboundElemental() {

@Override
public HearthTreeNode onCardPlayBegin(PlayerSide thisCardPlayerSide, PlayerSide cardUserPlayerSide, Card usedCard, HearthTreeNode boardState, boolean singleRealizationOnly) {
if (this.isInHand()) {
return boardState;
}
if (usedCard != this && thisCardPlayerSide == cardUserPlayerSide && usedCard.triggersOverload()) {
boardState = UnboundElemental.effect.applyEffect(cardUserPlayerSide, usedCard, thisCardPlayerSide, this, boardState);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public ManaAddict() {

public HearthTreeNode onCardPlayBegin(PlayerSide thisCardPlayerSide, PlayerSide cardUserPlayerSide, Card usedCard,
HearthTreeNode boardState, boolean singleRealizationOnly) {
if (this.isInHand()) {
return boardState;
}
if (cardUserPlayerSide == thisCardPlayerSide && usedCard instanceof SpellCard) {
ManaAddict.effect.applyEffect(cardUserPlayerSide, usedCard, thisCardPlayerSide, this, boardState);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ManaAddictSpec extends CardSpec {
mana(9)
}
waitingPlayer {
field([[minion: ManaAddict]]) //This Questing Adventurer should not be buffed
field([[minion: ManaAddict]]) //This Mana Addict should not be buffed
mana(9)
}
}
Expand All @@ -28,13 +28,13 @@ class ManaAddictSpec extends CardSpec {

def copiedBoard = startingBoard.deepCopy()
def target = root.data_.modelForSide(CURRENT_PLAYER).getCharacter(0)
def manaWyrm = root.data_.getCurrentPlayer().getHand().get(0)
def ret = manaWyrm.useOn(CURRENT_PLAYER, target, root, null, null)
def manaAddict = root.data_.getCurrentPlayer().getHand().get(0)
def ret = manaAddict.useOn(CURRENT_PLAYER, target, root)

def board2 = new HearthTreeNode(root.data_.deepCopy())
def theCoin = board2.data_.getCurrentPlayer().getHand().get(0)
def coinTarget = board2.data_.modelForSide(CURRENT_PLAYER).getCharacter(0)
def ret2 = theCoin.useOn(CURRENT_PLAYER, coinTarget, board2, null, null)
def ret2 = theCoin.useOn(CURRENT_PLAYER, coinTarget, board2)

expect:
assertFalse(ret == null);
Expand All @@ -57,4 +57,38 @@ class ManaAddictSpec extends CardSpec {
}

}


def "playing a spell card with a Mana Addict in the hand"() {

def startingBoard = new BoardModelBuilder().make {
currentPlayer {
hand([ManaAddict, TheCoin])
mana(9)
}
waitingPlayer {
field([[minion: ManaAddict]]) //This Mana Addict should not be buffed
mana(9)
}
}

def root = new HearthTreeNode(startingBoard)
def copiedBoard = startingBoard.deepCopy()

def board2 = new HearthTreeNode(root.data_.deepCopy())
def theCoin = board2.data_.getCurrentPlayer().getHand().get(1)
def coinTarget = board2.data_.modelForSide(CURRENT_PLAYER).getCharacter(0)
def ret2 = theCoin.useOn(CURRENT_PLAYER, coinTarget, board2)

expect:
assertFalse(ret2 == null);
assertBoardDelta(copiedBoard, ret2.data_) {
currentPlayer {
removeCardFromHand(TheCoin)
mana(10)
numCardsUsed(1)
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ManaWyrmSpec extends CardSpec {
mana(9)
}
waitingPlayer {
field([[minion: ManaWyrm]]) //This Questing Adventurer should not be buffed
field([[minion: ManaWyrm]]) //This Mana Wyrm should not be buffed
mana(9)
}
}
Expand All @@ -29,12 +29,12 @@ class ManaWyrmSpec extends CardSpec {
def copiedBoard = startingBoard.deepCopy()
def target = root.data_.modelForSide(CURRENT_PLAYER).getCharacter(0)
def manaWyrm = root.data_.getCurrentPlayer().getHand().get(0)
def ret = manaWyrm.useOn(CURRENT_PLAYER, target, root, null, null)
def ret = manaWyrm.useOn(CURRENT_PLAYER, target, root)

def board2 = new HearthTreeNode(root.data_.deepCopy())
def theCoin = board2.data_.getCurrentPlayer().getHand().get(0)
def coinTarget = board2.data_.modelForSide(CURRENT_PLAYER).getCharacter(0)
def ret2 = theCoin.useOn(CURRENT_PLAYER, coinTarget, board2, null, null)
def ret2 = theCoin.useOn(CURRENT_PLAYER, coinTarget, board2)

expect:
assertFalse(ret == null);
Expand All @@ -55,6 +55,37 @@ class ManaWyrmSpec extends CardSpec {
numCardsUsed(2)
}
}
}


def "playing a spell card with a Mana Wyrm in the hand"() {

def startingBoard = new BoardModelBuilder().make {
currentPlayer {
hand([ManaWyrm, TheCoin])
mana(9)
}
waitingPlayer {
field([[minion: ManaWyrm]]) //This Mana Wyrm should not be buffed
mana(9)
}
}

def root = new HearthTreeNode(startingBoard)

def copiedBoard = startingBoard.deepCopy()
def target = root.data_.modelForSide(CURRENT_PLAYER).getCharacter(0)
def theCoin = root.data_.getCurrentPlayer().getHand().get(1)
def ret = theCoin.useOn(CURRENT_PLAYER, target, root)

expect:
assertFalse(ret == null);
assertBoardDelta(copiedBoard, ret.data_) {
currentPlayer {
removeCardFromHand(TheCoin)
mana(10)
numCardsUsed(1)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.hearthsim.test.groovy.card.classic.minion

import com.hearthsim.card.basic.spell.HolySmite
import com.hearthsim.card.basic.spell.TheCoin
import com.hearthsim.card.classic.minion.common.ManaWyrm
import com.hearthsim.card.classic.minion.common.UnboundElemental
import com.hearthsim.card.classic.spell.common.LightningBolt
import com.hearthsim.card.classic.spell.rare.LavaBurst
Expand All @@ -22,6 +24,7 @@ class UnboundElementalSpec extends CardSpec {
def setup() {
startingBoard = new BoardModelBuilder().make {
currentPlayer {
hand([UnboundElemental, TheCoin])
field([[minion: UnboundElemental]])
mana(10)
}
Expand Down

0 comments on commit 382f8e6

Please sign in to comment.