diff --git a/Mage.Sets/src/mage/cards/a/Aetherplasm.java b/Mage.Sets/src/mage/cards/a/Aetherplasm.java index 6864f3c98fd..29862c661da 100644 --- a/Mage.Sets/src/mage/cards/a/Aetherplasm.java +++ b/Mage.Sets/src/mage/cards/a/Aetherplasm.java @@ -2,21 +2,17 @@ package mage.cards.a; import java.util.UUID; import mage.MageInt; -import mage.MageObjectReference; import mage.abilities.Ability; import mage.abilities.common.BlocksTriggeredAbility; import mage.abilities.costs.common.ReturnToHandFromBattlefieldSourceCost; -import mage.abilities.effects.Effect; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DoIfCostPaid; -import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect; -import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.cards.Card; -import mage.constants.Outcome; -import mage.constants.SubType; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.Zone; import mage.filter.StaticFilters; import mage.game.Game; @@ -33,14 +29,13 @@ public final class Aetherplasm extends CardImpl { public Aetherplasm(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); - + this.subtype.add(SubType.ILLUSION); this.power = new MageInt(1); this.toughness = new MageInt(1); // Whenever Aetherplasm blocks a creature, you may return Aetherplasm to its owner's hand. If you do, you may put a creature card from your hand onto the battlefield blocking that creature. - this.addAbility(new BlocksTriggeredAbility - (new DoIfCostPaid(new AetherplasmEffect(), new ReturnToHandFromBattlefieldSourceCost()), false, true)); + this.addAbility(new BlocksTriggeredAbility(new DoIfCostPaid(new AetherplasmEffect(), new ReturnToHandFromBattlefieldSourceCost()), false, true)); } public Aetherplasm(final Aetherplasm card) { @@ -67,7 +62,6 @@ class AetherplasmEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - Permanent blockedCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (player == null) { return false; } @@ -76,23 +70,24 @@ class AetherplasmEffect extends OneShotEffect { if (player.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) { Card card = game.getCard(target.getFirstTarget()); if (card != null) { - if(player.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, false, null) - && game.getCombat() != null && blockedCreature != null){ + Permanent blockedCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (player.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, false, null) + && game.getCombat() != null && blockedCreature != null) { CombatGroup attacker = game.getCombat().findGroup(blockedCreature.getId()); Permanent putIntoPlay = game.getPermanent(target.getFirstTarget()); - if (putIntoPlay != null && putIntoPlay.isCreature() &&attacker != null) { + if (putIntoPlay != null && putIntoPlay.isCreature() && attacker != null) { game.getCombat().findGroup(blockedCreature.getId()).addBlocker(putIntoPlay.getId(), source.getControllerId(), game); - return true; + } } } } } - return false; + return true; } @Override public AetherplasmEffect copy() { return new AetherplasmEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java index 35199654d97..eed329f9580 100644 --- a/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java +++ b/Mage.Tests/src/test/java/org/mage/test/player/TestPlayer.java @@ -4,7 +4,6 @@ import java.io.Serializable; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; - import mage.MageObject; import mage.MageObjectReference; import mage.ObjectColor; @@ -127,7 +126,7 @@ public class TestPlayer implements Player { /** * @param maxCallsWithoutAction max number of priority passes a player may - * have for this test (default = 100) + * have for this test (default = 100) */ public void setMaxCallsWithoutAction(int maxCallsWithoutAction) { this.maxCallsWithoutAction = maxCallsWithoutAction; @@ -686,7 +685,6 @@ public class TestPlayer implements Player { } } - private void assertManaPoolInner(PlayerAction action, Player player, ManaType manaType, Integer amount) { Integer current = player.getManaPool().get(manaType); Assert.assertEquals(action.getActionName() + " - mana pool must contain [" + amount.toString() + " " + manaType.toString() + "], but found [" + current.toString() + "]", amount, current); @@ -696,7 +694,6 @@ public class TestPlayer implements Player { Assert.assertNotEquals(action.getActionName() + " - must setup color", "", colors); // Can't use ObjectColor -- it's doesn't contain colorless -- need to use custom parse - for (int i = 0; i < colors.length(); i++) { switch (colors.charAt(i)) { case 'W': @@ -774,7 +771,7 @@ public class TestPlayer implements Player { // Loop through players and validate can attack/block this turn UUID defenderId = null; //List - for (Iterator it = actions.iterator(); it.hasNext(); ) { + for (Iterator it = actions.iterator(); it.hasNext();) { PlayerAction action = it.next(); if (action.getTurnNum() == game.getTurnNum() && action.getAction().startsWith("attack:")) { String command = action.getAction(); @@ -826,6 +823,11 @@ public class TestPlayer implements Player { } } + @Override + public List getTurnControllers() { + return computerPlayer.getTurnControllers(); + } + @Override public void selectBlockers(Game game, UUID defendingPlayerId) { @@ -1488,6 +1490,11 @@ public class TestPlayer implements Player { computerPlayer.setGameUnderYourControl(value); } + @Override + public void setGameUnderYourControl(boolean value, boolean fullRestore) { + computerPlayer.setGameUnderYourControl(value, fullRestore); + } + @Override public void endOfTurn(Game game) { computerPlayer.endOfTurn(game); @@ -2197,6 +2204,11 @@ public class TestPlayer implements Player { return computerPlayer.canPlayCardsFromGraveyard(); } + @Override + public void setPayManaMode(boolean payManaMode) { + computerPlayer.setPayManaMode(payManaMode); + } + @Override public void setPlayCardsFromGraveyard(boolean playCardsFromGraveyard) { computerPlayer.setPlayCardsFromGraveyard(playCardsFromGraveyard); @@ -2442,7 +2454,7 @@ public class TestPlayer implements Player { @Override public boolean choose(Outcome outcome, Target target, - UUID sourceId, Game game + UUID sourceId, Game game ) { // needed to call here the TestPlayer because it's overwitten return choose(outcome, target, sourceId, game, null); @@ -2450,7 +2462,7 @@ public class TestPlayer implements Player { @Override public boolean choose(Outcome outcome, Cards cards, - TargetCard target, Game game + TargetCard target, Game game ) { if (!choices.isEmpty()) { for (String choose2 : choices) { @@ -2482,7 +2494,7 @@ public class TestPlayer implements Player { @Override public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, - Ability source, Game game + Ability source, Game game ) { return computerPlayer.chooseTargetAmount(outcome, target, source, game); } @@ -2495,15 +2507,15 @@ public class TestPlayer implements Player { @Override public boolean choosePile(Outcome outcome, String message, - List pile1, List pile2, - Game game + List pile1, List pile2, + Game game ) { return computerPlayer.choosePile(outcome, message, pile1, pile2, game); } @Override public boolean playMana(Ability ability, ManaCost unpaid, - String promptText, Game game + String promptText, Game game ) { groupsForTargetHandling = null; return computerPlayer.playMana(ability, unpaid, promptText, game); @@ -2517,15 +2529,15 @@ public class TestPlayer implements Player { @Override public UUID chooseBlockerOrder(List blockers, CombatGroup combatGroup, - List blockerOrder, Game game + List blockerOrder, Game game ) { return computerPlayer.chooseBlockerOrder(blockers, combatGroup, blockerOrder, game); } @Override public void assignDamage(int damage, List targets, - String singleTargetName, UUID sourceId, - Game game + String singleTargetName, UUID sourceId, + Game game ) { computerPlayer.assignDamage(damage, targets, singleTargetName, sourceId, game); } @@ -2544,14 +2556,14 @@ public class TestPlayer implements Player { @Override public void pickCard(List cards, Deck deck, - Draft draft + Draft draft ) { computerPlayer.pickCard(cards, deck, draft); } @Override public boolean scry(int value, Ability source, - Game game + Game game ) { // Don't scry at the start of the game. if (game.getTurnNum() == 1 && game.getStep() == null) { @@ -2562,37 +2574,37 @@ public class TestPlayer implements Player { @Override public boolean moveCards(Card card, Zone toZone, - Ability source, Game game + Ability source, Game game ) { return computerPlayer.moveCards(card, toZone, source, game); } @Override public boolean moveCards(Card card, Zone toZone, - Ability source, Game game, - boolean tapped, boolean faceDown, boolean byOwner, List appliedEffects + Ability source, Game game, + boolean tapped, boolean faceDown, boolean byOwner, List appliedEffects ) { return computerPlayer.moveCards(card, toZone, source, game, tapped, faceDown, byOwner, appliedEffects); } @Override public boolean moveCards(Cards cards, Zone toZone, - Ability source, Game game + Ability source, Game game ) { return computerPlayer.moveCards(cards, toZone, source, game); } @Override public boolean moveCards(Set cards, Zone toZone, - Ability source, Game game + Ability source, Game game ) { return computerPlayer.moveCards(cards, toZone, source, game); } @Override public boolean moveCards(Set cards, Zone toZone, - Ability source, Game game, - boolean tapped, boolean faceDown, boolean byOwner, List appliedEffects + Ability source, Game game, + boolean tapped, boolean faceDown, boolean byOwner, List appliedEffects ) { return computerPlayer.moveCards(cards, toZone, source, game, tapped, faceDown, byOwner, appliedEffects); } diff --git a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java index 43a16020dcf..bc84033378e 100644 --- a/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java +++ b/Mage.Tests/src/test/java/org/mage/test/stub/PlayerStub.java @@ -1307,6 +1307,21 @@ public class PlayerStub implements Player { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } + @Override + public List getTurnControllers() { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public void setGameUnderYourControl(boolean value, boolean fullRestore) { + + } + + @Override + public void setPayManaMode(boolean payManaMode) { + + } + @Override public boolean equals(Object o) { if (this == o) { @@ -1325,4 +1340,11 @@ public class PlayerStub implements Player { return this.getId().equals(obj.getId()); } + @Override + public int hashCode() { + int hash = 5; + hash = 41 * hash + Objects.hashCode(this.id); + return hash; + } + }