diff --git a/Mage.Sets/src/mage/sets/eventide/EndlessHorizons.java b/Mage.Sets/src/mage/sets/eventide/EndlessHorizons.java index 35fe5b54e1f..4251235f46e 100644 --- a/Mage.Sets/src/mage/sets/eventide/EndlessHorizons.java +++ b/Mage.Sets/src/mage/sets/eventide/EndlessHorizons.java @@ -103,17 +103,21 @@ class EndlessHorizonsEffect extends SearchEffect { @Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); - if (you != null && you.searchLibrary(target, game)) { - if (target.getTargets().size() > 0) { - for (UUID cardId : target.getTargets()) { - Card card = you.getLibrary().remove(cardId, game); - if (card != null) { - card.moveToExile(CardUtil.getCardExileZoneId(game, source), "Endless Horizons", source.getSourceId(), game); + if (you != null) { + if (you.searchLibrary(target, game)) { + UUID exileZone = CardUtil.getCardExileZoneId(game, source); + if (target.getTargets().size() > 0) { + for (UUID cardId : target.getTargets()) { + Card card = you.getLibrary().getCard(cardId, game); + if (card != null) { + card.moveToExile(exileZone, "Endless Horizons", source.getSourceId(), game); + } } } - you.shuffleLibrary(game); - return true; } + you.shuffleLibrary(game); + return true; + } return false; } @@ -140,15 +144,13 @@ class EndlessHorizonsEffect extends SearchEffect { ExileZone exZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)); if (exZone != null) { for (Card card : exZone.getCards(game)) { - if (card != null - && card.getOwnerId() == source.getControllerId()) { - if (card.moveToZone(Zone.HAND, source.getId(), game, false)) { - return true; - } + if (card.getOwnerId() == source.getControllerId()) { + card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + break; // only one } } } - return false; + return true; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/eventide/HallowedBurial.java b/Mage.Sets/src/mage/sets/eventide/HallowedBurial.java index cf5a256c63e..f9c9eb7b59e 100644 --- a/Mage.Sets/src/mage/sets/eventide/HallowedBurial.java +++ b/Mage.Sets/src/mage/sets/eventide/HallowedBurial.java @@ -35,6 +35,7 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; @@ -83,10 +84,8 @@ class HallowedBurialEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (Permanent creature : game.getBattlefield().getAllActivePermanents(CardType.CREATURE)) { - if (creature != null) { - creature.moveToZone(Zone.LIBRARY, source.getId(), game, false); - } + for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getSourceId(), game)) { + creature.moveToZone(Zone.LIBRARY, source.getSourceId(), game, false); } return false; } diff --git a/Mage.Sets/src/mage/sets/eventide/IdleThoughts.java b/Mage.Sets/src/mage/sets/eventide/IdleThoughts.java index 36635d64455..8ad19e9750a 100644 --- a/Mage.Sets/src/mage/sets/eventide/IdleThoughts.java +++ b/Mage.Sets/src/mage/sets/eventide/IdleThoughts.java @@ -33,7 +33,9 @@ import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.condition.Condition; import mage.abilities.condition.common.CardsInHandCondition; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardControllerEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; @@ -55,7 +57,9 @@ public class IdleThoughts extends CardImpl { this.color.setBlue(true); // {2}: Draw a card if you have no cards in hand. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new IdleThoughtsEffect(), new ManaCostsImpl("{2}"))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ConditionalOneShotEffect( + new DrawCardControllerEffect(2), new CardsInHandCondition(), + "Draw a card if you have no cards in hand"), new ManaCostsImpl("{{2}}"))); } public IdleThoughts(final IdleThoughts card) { @@ -67,32 +71,3 @@ public class IdleThoughts extends CardImpl { return new IdleThoughts(this); } } - -class IdleThoughtsEffect extends OneShotEffect { - - public IdleThoughtsEffect() { - super(Outcome.Benefit); - this.staticText = "Draw a card if you have no cards in hand"; - } - - public IdleThoughtsEffect(final IdleThoughtsEffect effect) { - super(effect); - } - - @Override - public IdleThoughtsEffect copy() { - return new IdleThoughtsEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Condition condition = new CardsInHandCondition(); - Player you = game.getPlayer(source.getControllerId()); - if (condition.apply(game, source) - && you != null) { - you.drawCards(1, game); - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/eventide/KithkinZealot.java b/Mage.Sets/src/mage/sets/eventide/KithkinZealot.java index a7925db4e43..7c16fb029e4 100644 --- a/Mage.Sets/src/mage/sets/eventide/KithkinZealot.java +++ b/Mage.Sets/src/mage/sets/eventide/KithkinZealot.java @@ -62,9 +62,8 @@ public class KithkinZealot extends CardImpl { // When Kithkin Zealot enters the battlefield, you gain 1 life for each black and/or red permanent target opponent controls. Ability ability = new EntersBattlefieldTriggeredAbility(new KithkinZealotEffect(), false); - ability.addTarget(new TargetOpponent()); + ability.addTarget(new TargetOpponent(true)); this.addAbility(ability); - } public KithkinZealot(final KithkinZealot card) { @@ -79,6 +78,13 @@ public class KithkinZealot extends CardImpl { class KithkinZealotEffect extends OneShotEffect { + private static final FilterPermanent filter = new FilterPermanent(); + static { + filter.add(Predicates.or( + new ColorPredicate(ObjectColor.BLACK), + new ColorPredicate(ObjectColor.RED))); + } + public KithkinZealotEffect() { super(Outcome.Neutral); this.staticText = "you gain 1 life for each black and/or red permanent target opponent controls"; @@ -96,19 +102,13 @@ class KithkinZealotEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); - Player opponent = game.getPlayer(source.getFirstTarget()); - FilterPermanent filter = new FilterPermanent(); - filter.add(Predicates.or( - new ColorPredicate(ObjectColor.BLACK), - new ColorPredicate(ObjectColor.RED))); - if (opponent != null) { + Player opponent = game.getPlayer(targetPointer.getFirst(game, source)); + + if (you!= null && opponent != null) { int amount = game.getBattlefield().countAll(filter, opponent.getId(), game); - if (you != null) { - you.gainLife(amount, game); - return true; - } - + you.gainLife(amount, game); + return true; } return false; } -} \ No newline at end of file +} diff --git a/Mage/src/mage/abilities/decorator/ConditionalOneShotEffect.java b/Mage/src/mage/abilities/decorator/ConditionalOneShotEffect.java index 8b0a1aa31ac..7b308e0067a 100644 --- a/Mage/src/mage/abilities/decorator/ConditionalOneShotEffect.java +++ b/Mage/src/mage/abilities/decorator/ConditionalOneShotEffect.java @@ -59,8 +59,9 @@ public class ConditionalOneShotEffect extends OneShotEffect