Implemented Zndrsplt's Judgment

This commit is contained in:
Evan Kranzler 2018-05-26 18:51:49 -04:00
parent 9fb0ee42ba
commit 21e834a5a1
3 changed files with 124 additions and 13 deletions

View file

@ -0,0 +1,122 @@
/*
* 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.z;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.ChooseFriendsAndFoes;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public class ZndrspltsJudgment extends CardImpl {
public ZndrspltsJudgment(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}");
// For each player, choose friend or foe. Each friend creates a token that's a copy of a creature they control. Each foe returns a creature they control to its owner's hand.
this.getSpellAbility().addEffect(new ZndrspltsJudgmentEffect());
}
public ZndrspltsJudgment(final ZndrspltsJudgment card) {
super(card);
}
@Override
public ZndrspltsJudgment copy() {
return new ZndrspltsJudgment(this);
}
}
class ZndrspltsJudgmentEffect extends OneShotEffect {
ZndrspltsJudgmentEffect() {
super(Outcome.Benefit);
this.staticText = "For each player, choose friend or foe. Each friend creates a token that's a copy of a creature they control. Each foe returns a creature they control to its owner's hand";
}
ZndrspltsJudgmentEffect(final ZndrspltsJudgmentEffect effect) {
super(effect);
}
@Override
public ZndrspltsJudgmentEffect copy() {
return new ZndrspltsJudgmentEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
ChooseFriendsAndFoes choice = new ChooseFriendsAndFoes();
choice.chooseFriendOrFoe(controller, source, game);
for (Player player : choice.getFriends()) {
if (player == null) {
continue;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
filter.add(new ControllerIdPredicate(player.getId()));
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
if (!player.choose(Outcome.Copy, target, source.getSourceId(), game)) {
continue;
}
Effect effect = new CreateTokenCopyTargetEffect(player.getId());
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
effect.apply(game, source);
}
for (Player player : choice.getFoes()) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature you control");
filter.add(new ControllerIdPredicate(player.getId()));
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
if (!player.choose(Outcome.ReturnToHand, target, source.getSourceId(), game)) {
continue;
}
Effect effect = new ReturnToHandTargetEffect();
effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game));
effect.apply(game, source);
}
return true;
}
}

View file

@ -293,6 +293,7 @@ public class Battlebond extends ExpansionSet {
cards.add(new SetCardInfo("Will Kenrith", 1, Rarity.MYTHIC, mage.cards.w.WillKenrith.class)); cards.add(new SetCardInfo("Will Kenrith", 1, Rarity.MYTHIC, mage.cards.w.WillKenrith.class));
cards.add(new SetCardInfo("Wrap in Flames", 188, Rarity.COMMON, mage.cards.w.WrapInFlames.class)); cards.add(new SetCardInfo("Wrap in Flames", 188, Rarity.COMMON, mage.cards.w.WrapInFlames.class));
cards.add(new SetCardInfo("Yotian Soldier", 249, Rarity.COMMON, mage.cards.y.YotianSoldier.class)); cards.add(new SetCardInfo("Yotian Soldier", 249, Rarity.COMMON, mage.cards.y.YotianSoldier.class));
cards.add(new SetCardInfo("Zndrsplt's Judgment", 43, Rarity.RARE, mage.cards.z.ZndrspltsJudgment.class));
cards.add(new SetCardInfo("Zndrsplt, Eye of Wisdom", 5, Rarity.RARE, mage.cards.z.ZndrspltEyeOfWisdom.class)); cards.add(new SetCardInfo("Zndrsplt, Eye of Wisdom", 5, Rarity.RARE, mage.cards.z.ZndrspltEyeOfWisdom.class));
} }
} }

View file

@ -81,19 +81,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
} }
public CreateTokenCopyTargetEffect() { public CreateTokenCopyTargetEffect() {
super(Outcome.PutCreatureInPlay); this((UUID) null);
this.playerId = null;
this.additionalCardType = null;
this.addedTokenPermanents = new ArrayList<>();
this.number = 1;
this.additionalSubType = null;
this.onlySubType = null;
this.attackedPlayer = null;
this.tokenPower = Integer.MIN_VALUE;
this.tokenToughness = Integer.MIN_VALUE;
this.gainsFlying = false;
this.becomesArtifact = false;
this.color = null;
} }
public CreateTokenCopyTargetEffect(UUID playerId) { public CreateTokenCopyTargetEffect(UUID playerId) {