Skip to content

Commit

Permalink
Merge pull request #122 from Hofls/master
Browse files Browse the repository at this point in the history
Implemented Core Rager
  • Loading branch information
oyachai committed Aug 17, 2015
2 parents 73c8e1e + fe1a959 commit db17d57
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
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;
}
};
}

}
5 changes: 5 additions & 0 deletions src/main/resources/implemented_cards.json
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@
"id": "CS2_201",
"name": "Core Hound"
},
{
"class": "com.hearthsim.card.blackrockmountain.minion.rare.CoreRager",
"id": "BRM_014",
"name": "Core Rager"
},
{
"class": "com.hearthsim.card.basic.spell.Corruption",
"id": "CS2_063",
Expand Down
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])
}
}

}

}

0 comments on commit db17d57

Please sign in to comment.