Implemented River's Rebuke, fixed Hurkyl's Recall

This commit is contained in:
Evan Kranzler 2017-09-01 18:20:11 -04:00
parent 7c64e487ab
commit 9d6fdbb600
3 changed files with 100 additions and 4 deletions

View file

@ -36,7 +36,7 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.filter.predicate.other.OwnerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
@ -48,8 +48,7 @@ import mage.target.TargetPlayer;
public class HurkylsRecall extends CardImpl {
public HurkylsRecall(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
// Return all artifacts target player owns to his or her hand.
this.getSpellAbility().addEffect(new HurkylsRecallReturnToHandEffect());
@ -81,7 +80,7 @@ class HurkylsRecallReturnToHandEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
if (targetPointer.getFirst(game, source) != null) {
FilterArtifactPermanent filter = new FilterArtifactPermanent();
filter.add(new ControllerIdPredicate(targetPointer.getFirst(game, source)));
filter.add(new OwnerIdPredicate(targetPointer.getFirst(game, source)));
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true);
}

View file

@ -0,0 +1,96 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterNonlandPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
/**
*
* @author TheElk801
*/
public class RiversRebuke extends CardImpl {
public RiversRebuke(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{U}");
// Return all nonland permanents target player controls to their owner's hand.
this.getSpellAbility().addEffect(new RiversRebukeReturnToHandEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public RiversRebuke(final RiversRebuke card) {
super(card);
}
@Override
public RiversRebuke copy() {
return new RiversRebuke(this);
}
}
class RiversRebukeReturnToHandEffect extends OneShotEffect {
public RiversRebukeReturnToHandEffect() {
super(Outcome.ReturnToHand);
staticText = "Return all nonland permanents target player controls to their owner's hand";
}
public RiversRebukeReturnToHandEffect(final RiversRebukeReturnToHandEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
if (targetPointer.getFirst(game, source) != null) {
FilterNonlandPermanent filter = new FilterNonlandPermanent();
filter.add(new ControllerIdPredicate(targetPointer.getFirst(game, source)));
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true);
}
return true;
}
return false;
}
@Override
public RiversRebukeReturnToHandEffect copy() {
return new RiversRebukeReturnToHandEffect(this);
}
}

View file

@ -53,6 +53,7 @@ public class Ixalan extends ExpansionSet {
cards.add(new SetCardInfo("Queen's Bay Soldier", 115, Rarity.COMMON, mage.cards.q.QueensBaySoldier.class));
cards.add(new SetCardInfo("Revel in Riches", 117, Rarity.RARE, mage.cards.r.RevelInRiches.class));
cards.add(new SetCardInfo("Ripjaw Raptor", 203, Rarity.RARE, mage.cards.r.RipjawRaptor.class));
cards.add(new SetCardInfo("River's Rebuke", 71, Rarity.RARE, mage.cards.r.RiversRebuke.class));
cards.add(new SetCardInfo("Rootbound Crag", 256, Rarity.RARE, mage.cards.r.RootboundCrag.class));
cards.add(new SetCardInfo("Rowdy Crew", 159, Rarity.MYTHIC, mage.cards.r.RowdyCrew.class));
cards.add(new SetCardInfo("Ruin Raider", 118, Rarity.RARE, mage.cards.r.RuinRaider.class));