-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from Hofls/master
Implemented Core Rager
- Loading branch information
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/java/com/hearthsim/card/blackrockmountain/minion/rare/CoreRager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.hearthsim.card.blackrockmountain.minion.rare; | ||
|
||
import com.hearthsim.card.CharacterIndex; | ||
import com.hearthsim.card.minion.Minion; | ||
import com.hearthsim.card.minion.MinionBattlecryInterface; | ||
import com.hearthsim.event.effect.EffectCharacter; | ||
import com.hearthsim.model.PlayerModel; | ||
import com.hearthsim.model.PlayerSide; | ||
import com.hearthsim.util.tree.HearthTreeNode; | ||
|
||
public class CoreRager extends Minion implements MinionBattlecryInterface { | ||
|
||
public CoreRager() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public EffectCharacter getBattlecryEffect() { | ||
return new EffectCharacter<Minion>() { | ||
@Override | ||
public HearthTreeNode applyEffect(PlayerSide targetSide, CharacterIndex targetCharacterIndex, HearthTreeNode boardState) { | ||
PlayerModel currentPlayer = boardState.data_.modelForSide(PlayerSide.CURRENT_PLAYER); | ||
if (currentPlayer.getHand().size() == 0) { | ||
CoreRager.this.setAttack((byte) (CoreRager.this.getAttack() + 3)); | ||
CoreRager.this.setHealth((byte) (CoreRager.this.getHealth() + 3)); | ||
CoreRager.this.setMaxHealth((byte) (CoreRager.this.getMaxHealth() + 3)); | ||
} | ||
return boardState; | ||
} | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/test/groovy/com/hearthsim/test/groovy/card/blackrockmountain/minion/CoreRagerSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.hearthsim.test.groovy.card.blackrockmountain.minion | ||
|
||
import com.hearthsim.card.CharacterIndex | ||
import com.hearthsim.card.blackrockmountain.minion.rare.CoreRager | ||
import com.hearthsim.model.BoardModel | ||
import com.hearthsim.test.groovy.card.CardSpec | ||
import com.hearthsim.test.helpers.BoardModelBuilder | ||
import com.hearthsim.util.tree.HearthTreeNode | ||
|
||
import static com.hearthsim.model.PlayerSide.CURRENT_PLAYER | ||
|
||
class CoreRagerSpec extends CardSpec { | ||
|
||
HearthTreeNode root | ||
BoardModel startingBoard | ||
|
||
def "gain +3/+3 when hand is empty"() { | ||
|
||
startingBoard = new BoardModelBuilder().make { | ||
currentPlayer { | ||
hand([CoreRager]) | ||
mana(10) | ||
} | ||
waitingPlayer { | ||
mana(10) | ||
} | ||
} | ||
|
||
root = new HearthTreeNode(startingBoard) | ||
def copiedBoard = startingBoard.deepCopy() | ||
def theCard = root.data_.getCurrentPlayer().getHand().get(0) | ||
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root) | ||
|
||
expect: | ||
ret != null; | ||
|
||
assertBoardDelta(copiedBoard, ret.data_) { | ||
currentPlayer { | ||
playMinion(CoreRager) | ||
mana(6) | ||
numCardsUsed(1) | ||
updateMinion(CharacterIndex.MINION_1, [deltaHealth: 3, deltaAttack: 3, deltaMaxHealth: 3]) | ||
} | ||
} | ||
|
||
} | ||
|
||
def "no gain when hand is not empty"() { | ||
|
||
startingBoard = new BoardModelBuilder().make { | ||
currentPlayer { | ||
hand([CoreRager, CoreRager]) | ||
mana(10) | ||
} | ||
waitingPlayer { | ||
mana(10) | ||
} | ||
} | ||
|
||
root = new HearthTreeNode(startingBoard) | ||
def copiedBoard = startingBoard.deepCopy() | ||
def theCard = root.data_.getCurrentPlayer().getHand().get(0) | ||
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root) | ||
|
||
expect: | ||
ret != null; | ||
|
||
assertBoardDelta(copiedBoard, ret.data_) { | ||
currentPlayer { | ||
playMinion(CoreRager) | ||
mana(6) | ||
numCardsUsed(1) | ||
updateMinion(CharacterIndex.MINION_1, [deltaHealth: 0, deltaAttack: 0, deltaMaxHealth: 0]) | ||
} | ||
} | ||
|
||
} | ||
|
||
} |