Added Myr Servitor, Salvaging Station, Porphyry Nodes, and Gaea's Blessing.

This commit is contained in:
LevelX2 2014-04-01 17:33:58 +02:00
parent c9f72bfc0c
commit a558c052ef
13 changed files with 673 additions and 25 deletions

View file

@ -32,7 +32,6 @@ import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.ControlsPermanentCondition;
import mage.abilities.condition.common.SourceOnBattelfieldCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.DeathtouchAbility;

View file

@ -68,6 +68,7 @@ public class BeckonApparition extends CardImpl<BeckonApparition> {
class BeckonApparitionToken extends Token {
BeckonApparitionToken() {
super("Spirit", "1/1 white and black Spirit creature token with flying");
this.setOriginalExpansionSetCode("GTC");
cardType.add(CardType.CREATURE);
color.setWhite(true);
color.setBlack(true);

View file

@ -0,0 +1,119 @@
/*
* 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.fifthdawn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.SourceOnBattelfieldCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.NamePredicate;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class MyrServitor extends CardImpl<MyrServitor> {
public MyrServitor(UUID ownerId) {
super(ownerId, 139, "Myr Servitor", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}");
this.expansionSetCode = "5DN";
this.subtype.add("Myr");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// At the beginning of your upkeep, if Myr Servitor is on the battlefield, each player returns all cards named Myr Servitor from his or her graveyard to the battlefield.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new MyrServitorReturnEffect(), TargetController.YOU, false),
SourceOnBattelfieldCondition.getInstance(),
"At the beginning of your upkeep, if {this} is on the battlefield, each player returns all cards named Myr Servitor from his or her graveyard to the battlefield"
));
}
public MyrServitor(final MyrServitor card) {
super(card);
}
@Override
public MyrServitor copy() {
return new MyrServitor(this);
}
}
class MyrServitorReturnEffect extends OneShotEffect<MyrServitorReturnEffect> {
private static final FilterCard filter = new FilterCard("cards named Myr Servitor");
static {
filter.add(new NamePredicate("Myr Servitor"));
}
public MyrServitorReturnEffect() {
super(Outcome.PutCardInPlay);
this.staticText = "if {this} is on the battlefield, each player returns all cards named Myr Servitor from his or her graveyard to the battlefield";
}
public MyrServitorReturnEffect(final MyrServitorReturnEffect effect) {
super(effect);
}
@Override
public MyrServitorReturnEffect copy() {
return new MyrServitorReturnEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId: controller.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (Card card: player.getGraveyard().getCards(filter, game)) {
player.putOntoBattlefieldWithInfo(card, game, Zone.GRAVEYARD, source.getSourceId());
}
}
}
}
return false;
}
}

View file

@ -0,0 +1,82 @@
/*
* 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.fifthdawn;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author LevelX2
*/
public class SalvagingStation extends CardImpl<SalvagingStation> {
private static final FilterCard filter = new FilterCard("noncreature artifact card with converted mana cost 1 or less");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, 2));
}
public SalvagingStation(UUID ownerId) {
super(ownerId, 148, "Salvaging Station", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{6}");
this.expansionSetCode = "5DN";
// {tap}: Return target noncreature artifact card with converted mana cost 1 or less from your graveyard to the battlefield.
Ability secondAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new TapSourceCost());
secondAbility.addTarget(new TargetCardInYourGraveyard(filter));
this.addAbility(secondAbility);
// Whenever a creature dies, you may untap Salvaging Station.
this.addAbility(new DiesCreatureTriggeredAbility(new UntapSourceEffect(), true));
}
public SalvagingStation(final SalvagingStation card) {
super(card);
}
@Override
public SalvagingStation copy() {
return new SalvagingStation(this);
}
}

View file

@ -60,7 +60,7 @@ public class MemorysJourney extends CardImpl<MemorysJourney> {
// Target player shuffles up to three target cards from his or her graveyard into his or her library.
this.getSpellAbility().addEffect(new MemorysJourneyEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new TargetPlayer(true));
this.getSpellAbility().addTarget(new MemorysJourneyTarget());
// Flashback {G}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{G}"), TimingRule.INSTANT));

View file

@ -115,34 +115,42 @@ class ThievingSpriteEffect extends OneShotEffect<ThievingSpriteEffect> {
filter.add(new SubtypePredicate("Faerie"));
int numberOfFaeries = game.getBattlefield().countAll(filter, controller.getId(), game);
Cards cardsInHand = new CardsImpl(Zone.PICK);
cardsInHand.addAll(targetPlayer.getHand());
int count = Math.min(cardsInHand.size(), numberOfFaeries);
TargetCard target = new TargetCard(count, Zone.PICK, new FilterCard());
target.setRequired(true);
Cards revealedCards = new CardsImpl();
if (numberOfFaeries > 0 && targetPlayer.getHand().size() > numberOfFaeries) {
Cards cardsInHand = new CardsImpl(Zone.PICK);
cardsInHand.addAll(targetPlayer.getHand());
if (targetPlayer.choose(Outcome.Discard, cardsInHand, target, game)) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
revealedCards.add(card);
TargetCard target = new TargetCard(numberOfFaeries, Zone.PICK, new FilterCard());
target.setRequired(true);
if (targetPlayer.choose(Outcome.Discard, cardsInHand, target, game)) {
List<UUID> targets = target.getTargets();
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
revealedCards.add(card);
}
}
}
}
} else {
revealedCards.addAll(targetPlayer.getHand());
}
TargetCard targetInHand = new TargetCard(Zone.PICK, new FilterCard("card to discard"));
targetInHand.setRequired(true);
if (!revealedCards.isEmpty()) {
targetPlayer.revealCards("Thieving Sprite", revealedCards, game);
controller.choose(Outcome.Discard, revealedCards, targetInHand, game);
Card card = revealedCards.get(targetInHand.getFirstTarget(), game);
Card card = null;
if(revealedCards.size() > 1) {
controller.choose(Outcome.Discard, revealedCards, targetInHand, game);
card = revealedCards.get(targetInHand.getFirstTarget(), game);
} else {
card = revealedCards.getRandom(game);
}
if (card != null) {
targetPlayer.discard(card, source, game);
game.informPlayers(new StringBuilder("Thieving Sprite: ").append(targetPlayer.getName()).append(" discarded ").append(card.getName()).toString());
}
}
return true;

View file

@ -112,7 +112,7 @@ class KarnLiberatedEffect extends OneShotEffect<KarnLiberatedEffect> {
@Override
public boolean apply(Game game, Ability source) {
List<Card> cards = new ArrayList<Card>();
List<Card> cards = new ArrayList<>();
for (ExileZone zone: game.getExile().getExileZones()) {
if (zone.getId().equals(exileId)) {
for (Card card: zone.getCards(game)) {
@ -186,7 +186,7 @@ class KarnLiberatedDelayedTriggeredAbility extends DelayedTriggeredAbility<KarnL
class KarnLiberatedDelayedEffect extends OneShotEffect<KarnLiberatedDelayedEffect> {
private UUID exileId;
private final UUID exileId;
public KarnLiberatedDelayedEffect(UUID exileId) {
super(Outcome.PlayForFree);

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.planarchaos;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPermanent;
/**
*
* @author LevelX2
*/
public class PorphyryNodes extends CardImpl<PorphyryNodes> {
public static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
public PorphyryNodes(UUID ownerId) {
super(ownerId, 28, "Porphyry Nodes", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{W}");
this.expansionSetCode = "PLC";
this.color.setWhite(true);
// At the beginning of your upkeep, destroy the creature with the least power. It can't be regenerated. If two or more creatures are tied for least power, you choose one of them.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new PorphyryNodesEffect(), TargetController.YOU, false));
// When there are no creatures on the battlefield, sacrifice Porphyry Nodes.
this.addAbility(new PorphyryNodesStateTriggeredAbility());
}
public PorphyryNodes(final PorphyryNodes card) {
super(card);
}
@Override
public PorphyryNodes copy() {
return new PorphyryNodes(this);
}
}
class PorphyryNodesEffect extends OneShotEffect<PorphyryNodesEffect> {
public PorphyryNodesEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "destroy the creature with the least power. It can't be regenerated. If two or more creatures are tied for least power, you choose one of them";
}
public PorphyryNodesEffect(final PorphyryNodesEffect effect) {
super(effect);
}
@Override
public PorphyryNodesEffect copy() {
return new PorphyryNodesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
int leastPower = Integer.MAX_VALUE;
boolean multipleExist = false;
Permanent permanentToDestroy = null;
for (Permanent permanent : game.getBattlefield().getActivePermanents(PorphyryNodes.filter, source.getControllerId(), game)) {
if (permanent.getPower().getValue() < leastPower) {
permanentToDestroy = permanent;
leastPower = permanent.getPower().getValue();
multipleExist = false;
} else {
if (permanent.getPower().getValue() == leastPower) {
multipleExist = true;
}
}
}
if (multipleExist) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("one of the creatures with the least power");
filter.add(new PowerPredicate(Filter.ComparisonType.Equal, leastPower));
Target target = new TargetPermanent(filter, true);
target.setNotTarget(true);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
if (controller.choose(outcome, target, source.getSourceId(), game)) {
permanentToDestroy = game.getPermanent(target.getFirstTarget());
}
}
}
if (permanentToDestroy != null) {
game.informPlayers(new StringBuilder(sourcePermanent.getName()).append(" chosen creature: ").append(permanentToDestroy.getName()).toString());
return permanentToDestroy.destroy(source.getSourceId(), game, true);
}
return true;
}
return false;
}
}
class PorphyryNodesStateTriggeredAbility extends StateTriggeredAbility<PorphyryNodesStateTriggeredAbility> {
public PorphyryNodesStateTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public PorphyryNodesStateTriggeredAbility(final PorphyryNodesStateTriggeredAbility ability) {
super(ability);
}
@Override
public PorphyryNodesStateTriggeredAbility copy() {
return new PorphyryNodesStateTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return game.getBattlefield().count(PorphyryNodes.filter, this.getSourceId(), this.getControllerId(), game) == 0;
}
@Override
public String getRule() {
return new StringBuilder("When there are no creatures on the battlefield, ").append(super.getRule()).toString() ;
}
}

View file

@ -0,0 +1,202 @@
/*
* 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.timeshifted;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.ZoneChangeTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
/**
*
* @author LevelX2
*/
public class GaeasBlessing extends CardImpl<GaeasBlessing> {
public GaeasBlessing(UUID ownerId) {
super(ownerId, 77, "Gaea's Blessing", Rarity.SPECIAL, new CardType[]{CardType.SORCERY}, "{1}{G}");
this.expansionSetCode = "TSB";
this.color.setGreen(true);
// Target player shuffles up to three target cards from his or her graveyard into his or her library.
this.getSpellAbility().addEffect(new GaeasBlessingEffect());
this.getSpellAbility().addTarget(new TargetPlayer(true));
this.getSpellAbility().addTarget(new GaeasBlessingTarget());
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
// When Gaea's Blessing is put into your graveyard from your library, shuffle your graveyard into your library.
this.addAbility(new GaeasBlessingTriggeredAbility());
}
public GaeasBlessing(final GaeasBlessing card) {
super(card);
}
@Override
public GaeasBlessing copy() {
return new GaeasBlessing(this);
}
}
class GaeasBlessingEffect extends OneShotEffect<GaeasBlessingEffect> {
public GaeasBlessingEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to three target cards from his or her graveyard into his or her library";
}
public GaeasBlessingEffect(final GaeasBlessingEffect effect) {
super(effect);
}
@Override
public GaeasBlessingEffect copy() {
return new GaeasBlessingEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
List<UUID> targets = source.getTargets().get(1).getTargets();
boolean shuffle = false;
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
if (player.getGraveyard().contains(card.getId())) {
player.getGraveyard().remove(card);
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
shuffle = true;
}
}
}
if (shuffle) {
player.shuffleLibrary(game);
}
return true;
}
return false;
}
}
class GaeasBlessingTarget extends TargetCard<GaeasBlessingTarget> {
public GaeasBlessingTarget() {
super(0, 3, Zone.GRAVEYARD, new FilterCard());
}
public GaeasBlessingTarget(final GaeasBlessingTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card, game);
}
}
return false;
}
@Override
public GaeasBlessingTarget copy() {
return new GaeasBlessingTarget(this);
}
}
class GaeasBlessingTriggeredAbility extends ZoneChangeTriggeredAbility<GaeasBlessingTriggeredAbility> {
public GaeasBlessingTriggeredAbility() {
super(Zone.LIBRARY, Zone.GRAVEYARD, new GaeasBlessingGraveToLibraryEffect(), "", false);
this.zone = Zone.ALL;
}
public GaeasBlessingTriggeredAbility(final GaeasBlessingTriggeredAbility ability) {
super(ability);
}
@Override
public GaeasBlessingTriggeredAbility copy() {
return new GaeasBlessingTriggeredAbility(this);
}
@Override
public String getRule() {
return "When {this} is put into your graveyard from your library, shuffle your graveyard into your library.";
}
}
class GaeasBlessingGraveToLibraryEffect extends OneShotEffect<GaeasBlessingGraveToLibraryEffect> {
public GaeasBlessingGraveToLibraryEffect() {
super(Outcome.GainLife);
staticText = "shuffle your graveyard into your library";
}
public GaeasBlessingGraveToLibraryEffect(final GaeasBlessingGraveToLibraryEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
game.informPlayers(new StringBuilder(controller.getName()).append(" shuffle his or her graveyard into his or her library").toString());
controller.getLibrary().addAll(controller.getGraveyard().getCards(game), game);
controller.getGraveyard().clear();
controller.shuffleLibrary(game);
return true;
}
return false;
}
@Override
public GaeasBlessingGraveToLibraryEffect copy() {
return new GaeasBlessingGraveToLibraryEffect(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* 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.weatherlight;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class GaeasBlessing extends mage.sets.timeshifted.GaeasBlessing {
public GaeasBlessing(UUID ownerId) {
super(ownerId);
this.cardNumber = 71;
this.expansionSetCode = "WTH";
this.rarity = Rarity.UNCOMMON;
}
public GaeasBlessing(final GaeasBlessing card) {
super(card);
}
@Override
public GaeasBlessing copy() {
return new GaeasBlessing(this);
}
}

View file

@ -40,9 +40,21 @@ import mage.game.Game;
*/
public class SourceOnBattelfieldCondition implements Condition {
private static final SourceOnBattelfieldCondition fInstance = new SourceOnBattelfieldCondition();
public static SourceOnBattelfieldCondition getInstance() {
return fInstance;
}
@Override
public boolean apply(Game game, Ability source) {
return (game.getPermanent(source.getSourceId()) != null);
}
@Override
public String toString() {
return "if {this} is on the battlefield";
}
}

View file

@ -206,7 +206,12 @@ public interface Player extends MageItem, Copyable<Player> {
void init(Game game);
void init(Game game, boolean testMode);
void useDeck(Deck deck, Game game);
/**
* Called before each applyEffects, to rest all what can be applyed by continuous effects
*/
void reset();
void shuffleLibrary(Game game);
int drawCards(int num, Game game);
int drawCards(int num, Game game, ArrayList<UUID> appliedEffects);

View file

@ -158,7 +158,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
// conceded or connection lost game
protected boolean left;
// quit match
// set if the player quits the complete match
protected boolean quit;
protected RangeOfInfluence range;
@ -337,7 +337,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
this.wins = false;
this.loses = false;
this.left = false;
this.quit = false;
this.quit = false; // reset is neccessary because in tournament player will be used for each round
this.passed = false;
this.passedTurn = false;
this.passedAllTurns = false;
@ -346,9 +346,9 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
this.topCardRevealed = false;
this.setLife(game.getLife(), game);
this.setReachedNextTurnAfterLeaving(false);
game.getState().getWatchers().add(new BloodthirstWatcher(playerId));
game.getState().getWatchers().add(new BloodthirstWatcher(playerId));
}
@Override
public void reset() {
this.abilities.clear();