-
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 #1 from oyachai/master
sync test
- Loading branch information
Showing
19 changed files
with
597 additions
and
4 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/com/hearthsim/card/blackrockmountain/minion/common/FireguardDestroyer.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,34 @@ | ||
package com.hearthsim.card.blackrockmountain.minion.common; | ||
|
||
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.PlayerSide; | ||
import com.hearthsim.util.HearthAction; | ||
import com.hearthsim.util.tree.HearthTreeNode; | ||
import com.hearthsim.util.tree.RandomEffectNode; | ||
|
||
public class FireguardDestroyer extends Minion implements MinionBattlecryInterface { | ||
|
||
public FireguardDestroyer() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public EffectCharacter<Minion> getBattlecryEffect() { | ||
return (PlayerSide targetSide, CharacterIndex minionPlacementIndex, HearthTreeNode boardState) -> { | ||
CharacterIndex thisMinionIndex = minionPlacementIndex.indexToRight(); | ||
HearthTreeNode toRet = new RandomEffectNode(boardState, | ||
new HearthAction(HearthAction.Verb.UNTARGETABLE_BATTLECRY, PlayerSide.CURRENT_PLAYER, | ||
thisMinionIndex.getInt(), | ||
PlayerSide.CURRENT_PLAYER, minionPlacementIndex)); | ||
for (int indx = 1; indx <= 4; ++indx) { | ||
HearthTreeNode child = new HearthTreeNode(boardState.data_.deepCopy()); | ||
child.data_.getCharacter(PlayerSide.CURRENT_PLAYER, thisMinionIndex).addAttack((byte)indx); | ||
toRet.addChild(child); | ||
} | ||
return toRet; | ||
}; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/hearthsim/card/blackrockmountain/minion/legendary/EmperorThaurissan.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,34 @@ | ||
package com.hearthsim.card.blackrockmountain.minion.legendary; | ||
|
||
import com.hearthsim.card.Card; | ||
import com.hearthsim.card.minion.Minion; | ||
import com.hearthsim.event.effect.EffectHandManaCost; | ||
import com.hearthsim.event.effect.SimpleEffectHand; | ||
import com.hearthsim.exception.HSException; | ||
import com.hearthsim.model.PlayerModel; | ||
import com.hearthsim.model.PlayerSide; | ||
import com.hearthsim.util.tree.HearthTreeNode; | ||
|
||
public class EmperorThaurissan extends Minion { | ||
|
||
private static final SimpleEffectHand effect = new EffectHandManaCost(-1); | ||
|
||
public EmperorThaurissan() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public HearthTreeNode endTurn(PlayerSide thisMinionPlayerIndex, HearthTreeNode boardModel) throws HSException { | ||
HearthTreeNode tmpState = super.endTurn(thisMinionPlayerIndex, boardModel); | ||
if (isWaitingPlayer(thisMinionPlayerIndex)) | ||
return tmpState; | ||
|
||
PlayerModel currentPlayer = boardModel.data_.modelForSide(PlayerSide.CURRENT_PLAYER); | ||
for (Card card : currentPlayer.getHand()) { | ||
effect.applyEffect(PlayerSide.CURRENT_PLAYER, this, PlayerSide.CURRENT_PLAYER, card, boardModel.data_); | ||
} | ||
|
||
return boardModel; | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/com/hearthsim/card/blackrockmountain/spell/rare/Demonwrath.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,29 @@ | ||
package com.hearthsim.card.blackrockmountain.spell.rare; | ||
|
||
import com.hearthsim.card.spellcard.SpellCard; | ||
import com.hearthsim.event.effect.EffectCharacter; | ||
import com.hearthsim.event.effect.EffectCharacterDamageSpell; | ||
import com.hearthsim.event.effect.EffectOnResolveAoe; | ||
import com.hearthsim.event.filter.FilterCharacter; | ||
|
||
/** | ||
* Created by oyachai on 8/23/15. | ||
*/ | ||
public class Demonwrath extends SpellCard implements EffectOnResolveAoe { | ||
|
||
private static final EffectCharacter effect = new EffectCharacterDamageSpell<>(2); | ||
|
||
public Demonwrath() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public EffectCharacter getAoeEffect() { | ||
return Demonwrath.effect; | ||
} | ||
|
||
@Override | ||
public FilterCharacter getAoeFilter() { | ||
return FilterCharacter.ALL_NON_DEMONS; | ||
} | ||
} |
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
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/hearthsim/card/thegrandtournament/minion/common/TournamentAttendee.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,11 @@ | ||
package com.hearthsim.card.thegrandtournament.minion.common; | ||
|
||
import com.hearthsim.card.minion.Minion; | ||
|
||
public class TournamentAttendee extends Minion { | ||
|
||
public TournamentAttendee() { | ||
super(); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/hearthsim/card/thegrandtournament/minion/rare/InjuredKvaldir.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,28 @@ | ||
package com.hearthsim.card.thegrandtournament.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.PlayerSide; | ||
import com.hearthsim.util.tree.HearthTreeNode; | ||
|
||
public class InjuredKvaldir extends Minion implements MinionBattlecryInterface { | ||
|
||
public InjuredKvaldir() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public EffectCharacter getBattlecryEffect() { | ||
return new EffectCharacter<Minion>() { | ||
|
||
@Override | ||
public HearthTreeNode applyEffect(PlayerSide targetSide, CharacterIndex targetCharacterIndex, HearthTreeNode boardState) { | ||
HearthTreeNode toRet; | ||
toRet = InjuredKvaldir.this.takeDamageAndNotify((byte) 3, PlayerSide.CURRENT_PLAYER, PlayerSide.CURRENT_PLAYER, boardState, false, true); | ||
return toRet; | ||
} | ||
}; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/hearthsim/card/thegrandtournament/spell/epic/Confuse.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,26 @@ | ||
package com.hearthsim.card.thegrandtournament.spell.epic; | ||
|
||
import com.hearthsim.card.spellcard.SpellCard; | ||
import com.hearthsim.event.effect.EffectCharacter; | ||
import com.hearthsim.event.effect.EffectOnResolveAoe; | ||
import com.hearthsim.event.filter.FilterCharacter; | ||
|
||
/** | ||
* Created by oyachai on 8/23/15. | ||
*/ | ||
public class Confuse extends SpellCard implements EffectOnResolveAoe { | ||
|
||
public Confuse() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public EffectCharacter getAoeEffect() { | ||
return EffectCharacter.SWAP_ATTACK_HEALTH; | ||
} | ||
|
||
@Override | ||
public FilterCharacter getAoeFilter() { | ||
return FilterCharacter.ALL_MINIONS; | ||
} | ||
} |
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
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
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
71 changes: 71 additions & 0 deletions
71
...oovy/com/hearthsim/test/groovy/card/blackrockmountain/minion/EmperorThaurissanSpec.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,71 @@ | ||
package com.hearthsim.test.groovy.card.blackrockmountain.minion | ||
|
||
import com.hearthsim.Game | ||
import com.hearthsim.card.CharacterIndex | ||
import com.hearthsim.card.basic.minion.BloodfenRaptor | ||
import com.hearthsim.card.blackrockmountain.minion.legendary.EmperorThaurissan | ||
import com.hearthsim.card.classic.minion.common.Wisp | ||
import com.hearthsim.card.goblinsvsgnomes.minion.common.SpiderTank | ||
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 | ||
import static org.junit.Assert.assertFalse | ||
|
||
class EmperorThaurissanSpec extends CardSpec{ | ||
|
||
HearthTreeNode root | ||
BoardModel startingBoard | ||
|
||
def setup() { | ||
|
||
startingBoard = new BoardModelBuilder().make { | ||
currentPlayer { | ||
hand([EmperorThaurissan, SpiderTank, BloodfenRaptor]) | ||
mana(10) | ||
} | ||
waitingPlayer { | ||
hand([EmperorThaurissan, SpiderTank, BloodfenRaptor]) | ||
mana(10) | ||
} | ||
} | ||
|
||
root = new HearthTreeNode(startingBoard) | ||
} | ||
|
||
def "at the end of currentPlayer turn, reduce the Cost of currentPlayer cards by 1"() { | ||
def copiedBoard = startingBoard.deepCopy() | ||
def theCard = root.data_.getCurrentPlayer().getHand().get(0) | ||
def ret = theCard.useOn(CURRENT_PLAYER, CharacterIndex.HERO, root) | ||
|
||
expect: | ||
assertFalse(ret == null); | ||
|
||
assertBoardDelta(copiedBoard, ret.data_) { | ||
currentPlayer { | ||
playMinion(EmperorThaurissan) | ||
mana(4) | ||
numCardsUsed(1) | ||
} | ||
} | ||
|
||
def retAfterEndTurn = new HearthTreeNode(Game.endTurn(ret.data_)) | ||
assertBoardDelta(copiedBoard, retAfterEndTurn.data_) { | ||
currentPlayer { | ||
playMinion(EmperorThaurissan) | ||
mana(4) | ||
numCardsUsed(1) | ||
updateCardInHand(0, [manaDelta: -1]) | ||
updateCardInHand(1, [manaDelta: -1]) | ||
} | ||
waitingPlayer { | ||
updateCardInHand(0, [manaDelta: 0]) | ||
updateCardInHand(1, [manaDelta: 0]) | ||
updateCardInHand(2, [manaDelta: 0]) | ||
} | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.