Added Blatant Thievery, Drafna's Restoration and Naked Singularity.

This commit is contained in:
emerald000 2015-10-04 17:48:51 -04:00
parent b3cadac4ea
commit 6c2e2cad5f
4 changed files with 470 additions and 0 deletions

View file

@ -0,0 +1,166 @@
/*
* 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.sets.antiquities;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterArtifactCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
import mage.target.common.TargetCardInGraveyard;
/**
*
* @author emerald000
*/
public class DrafnasRestoration extends CardImpl {
public DrafnasRestoration(UUID ownerId) {
super(ownerId, 52, "Drafna's Restoration", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{U}");
this.expansionSetCode = "ATQ";
// Return any number of target artifact cards from target player's graveyard to the top of his or her library in any order.
this.getSpellAbility().addEffect(new DrafnasRestorationEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new DrafnasRestorationTarget());
}
public DrafnasRestoration(final DrafnasRestoration card) {
super(card);
}
@Override
public DrafnasRestoration copy() {
return new DrafnasRestoration(this);
}
}
class DrafnasRestorationTarget extends TargetCardInGraveyard {
DrafnasRestorationTarget() {
super(0, Integer.MAX_VALUE, new FilterArtifactCard("any number of artifact cards from that player's graveyard"));
}
DrafnasRestorationTarget(final DrafnasRestorationTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
return targetPlayer != null && targetPlayer.getGraveyard().contains(id) && super.canTarget(id, source, game);
}
@Override
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
Set<UUID> possibleTargets = new HashSet<>();
MageObject object = game.getObject(sourceId);
if (object != null && object instanceof StackObject) {
Player targetPlayer = game.getPlayer(((StackObject) object).getStackAbility().getFirstTarget());
if (targetPlayer != null) {
for (Card card : targetPlayer.getGraveyard().getCards(filter, sourceId, sourceControllerId, game)) {
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.TARGET, card.getId(), sourceId, sourceControllerId))) {
possibleTargets.add(card.getId());
}
}
}
}
return possibleTargets;
}
@Override
public DrafnasRestorationTarget copy() {
return new DrafnasRestorationTarget(this);
}
}
class DrafnasRestorationEffect extends OneShotEffect {
DrafnasRestorationEffect() {
super(Outcome.Benefit);
this.staticText = "Return any number of target artifact cards from target player's graveyard to the top of his or her library in any order";
}
DrafnasRestorationEffect(final DrafnasRestorationEffect effect) {
super(effect);
}
@Override
public DrafnasRestorationEffect copy() {
return new DrafnasRestorationEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (controller != null && targetPlayer != null) {
Cards cards = new CardsImpl(source.getTargets().get(1).getTargets()); // prevent possible ConcurrentModificationException
cards.addAll(source.getTargets().get(1).getTargets());
if (!cards.isEmpty()) {
TargetCard target = new TargetCard(Zone.PICK, new FilterCard("card to put on the top of the library (last one chosen will be topmost)"));
target.setRequired(true);
while (controller.isInGame() && cards.size() > 1) {
controller.choose(Outcome.Neutral, cards, target, game);
UUID targetId = target.getFirstTarget();
cards.remove(targetId);
target.clearChosen();
Card card = targetPlayer.getGraveyard().get(targetId, game);
if (card != null) {
controller.moveCards(card, Zone.GRAVEYARD, Zone.LIBRARY, source, game);
}
}
if (cards.size() == 1) {
Card card = targetPlayer.getGraveyard().get(cards.iterator().next(), game);
if (card != null) {
controller.moveCards(card, Zone.GRAVEYARD, Zone.LIBRARY, source, game);
}
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,168 @@
/*
* 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.sets.iceage;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.CumulativeUpkeepAbility;
import mage.cards.CardImpl;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ManaEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author emerald000
*/
public class NakedSingularity extends CardImpl {
public NakedSingularity(UUID ownerId) {
super(ownerId, 305, "Naked Singularity", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "ICE";
// Cumulative upkeep {3}
this.addAbility(new CumulativeUpkeepAbility(new GenericManaCost(3)));
// If tapped for mana, Plains produce {R}, Islands produce {G}, Swamps produce {W}, Mountains produce {U}, and Forests produce {B} instead of any other type.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new NakedSingularityEffect()));
}
public NakedSingularity(final NakedSingularity card) {
super(card);
}
@Override
public NakedSingularity copy() {
return new NakedSingularity(this);
}
}
class NakedSingularityEffect extends ReplacementEffectImpl {
NakedSingularityEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "If tapped for mana, Plains produce {R}, Islands produce {G}, Swamps produce {W}, Mountains produce {U}, and Forests produce {B} instead of any other type";
}
NakedSingularityEffect(final NakedSingularityEffect effect) {
super(effect);
}
@Override
public NakedSingularityEffect copy() {
return new NakedSingularityEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent permanent = game.getPermanent(event.getSourceId());
Choice choice = new ChoiceImpl(true);
choice.setMessage("Pick a color to produce");
if (permanent.hasSubtype("Plains")) {
choice.getChoices().add("Red");
}
if (permanent.hasSubtype("Island")) {
choice.getChoices().add("Green");
}
if (permanent.hasSubtype("Swamp")) {
choice.getChoices().add("White");
}
if (permanent.hasSubtype("Mountain")) {
choice.getChoices().add("Blue");
}
if (permanent.hasSubtype("Forest")) {
choice.getChoices().add("Black");
}
String chosenColor;
if (choice.getChoices().size() == 1) {
chosenColor = choice.getChoices().iterator().next();
}
else {
controller.choose(Outcome.PutManaInPool, choice, game);
chosenColor = choice.getChoice();
}
ManaEvent manaEvent = (ManaEvent) event;
Mana mana = manaEvent.getMana();
int amount = mana.count();
switch (chosenColor) {
case "White":
mana.setToMana(Mana.WhiteMana(amount));
break;
case "Blue":
mana.setToMana(Mana.BlueMana(amount));
break;
case "Black":
mana.setToMana(Mana.BlackMana(amount));
break;
case "Red":
mana.setToMana(Mana.RedMana(amount));
break;
case "Green":
mana.setToMana(Mana.GreenMana(amount));
break;
}
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TAPPED_FOR_MANA;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getSourceId());
return permanent != null
&& (permanent.hasSubtype("Plains")
|| permanent.hasSubtype("Island")
|| permanent.hasSubtype("Swamp")
|| permanent.hasSubtype("Mountain")
|| permanent.hasSubtype("Forest"));
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.sets.masterseditioniv;
import java.util.UUID;
/**
*
* @author emerald000
*/
public class NakedSingularity extends mage.sets.iceage.NakedSingularity {
public NakedSingularity(UUID ownerId) {
super(ownerId);
this.cardNumber = 216;
this.expansionSetCode = "ME4";
}
public NakedSingularity(final NakedSingularity card) {
super(card);
}
@Override
public NakedSingularity copy() {
return new NakedSingularity(this);
}
}

View file

@ -0,0 +1,84 @@
/*
* 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.sets.onslaught;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPermanent;
/**
*
* @author emerald000
*/
public class BlatantThievery extends CardImpl {
public BlatantThievery(UUID ownerId) {
super(ownerId, 71, "Blatant Thievery", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{U}{U}{U}");
this.expansionSetCode = "ONS";
// For each opponent, gain control of target permanent that player controls.
Effect effect = new GainControlTargetEffect(Duration.EndOfGame);
effect.setText("For each opponent, gain control of target permanent that player controls");
this.getSpellAbility().addEffect(effect);
}
public BlatantThievery(final BlatantThievery card) {
super(card);
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability instanceof SpellAbility) {
ability.getTargets().clear();
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent != null) {
FilterPermanent filter = new FilterPermanent("permanent controlled by " + opponent.getName());
filter.add(new ControllerIdPredicate(opponentId));
ability.addTarget(new TargetPermanent(filter));
}
}
}
}
@Override
public BlatantThievery copy() {
return new BlatantThievery(this);
}
}