mirror of
https://github.com/correl/mage.git
synced 2025-04-11 17:00:08 -09:00
[RTR] Desecration Demon, Epic Experiment, Guild Feud, Psychic Spiral, Search the City
This commit is contained in:
parent
8efda49196
commit
b95b2c7258
5 changed files with 796 additions and 0 deletions
Mage.Sets/src/mage/sets/returntoravnica
162
Mage.Sets/src/mage/sets/returntoravnica/DesecrationDemon.java
Normal file
162
Mage.Sets/src/mage/sets/returntoravnica/DesecrationDemon.java
Normal file
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* 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.returntoravnica;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class DesecrationDemon extends CardImpl<DesecrationDemon> {
|
||||
|
||||
public DesecrationDemon(UUID ownerId) {
|
||||
super(ownerId, 63, "Desecration Demon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
|
||||
this.expansionSetCode = "RTR";
|
||||
this.subtype.add("Demon");
|
||||
this.color.setBlack(true);
|
||||
|
||||
this.power = new MageInt(6);
|
||||
this.toughness = new MageInt(6);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// At the beginning of each combat, any opponent may sacrifice a creature. If a player does, tap Desecration Demon and put a +1/+1 counter on it.
|
||||
this.addAbility(new DesecrationDemonTriggeredAbility());
|
||||
|
||||
}
|
||||
|
||||
public DesecrationDemon(final DesecrationDemon card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesecrationDemon copy() {
|
||||
return new DesecrationDemon(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DesecrationDemonTriggeredAbility extends TriggeredAbilityImpl<DesecrationDemonTriggeredAbility> {
|
||||
|
||||
public DesecrationDemonTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DesecrationDemonEffect());
|
||||
}
|
||||
|
||||
public DesecrationDemonTriggeredAbility(final DesecrationDemonTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesecrationDemonTriggeredAbility copy() {
|
||||
return new DesecrationDemonTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.COMBAT_PHASE_PRE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "At the beginning of each combat, any opponent may sacrifice a creature. If a player does, tap Desecration Demon and put a +1/+1 counter on it";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DesecrationDemonEffect extends OneShotEffect<DesecrationDemonEffect> {
|
||||
DesecrationDemonEffect() {
|
||||
super(Constants.Outcome.BoostCreature);
|
||||
}
|
||||
|
||||
DesecrationDemonEffect(final DesecrationDemonEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent descrationDemon = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && descrationDemon != null) {
|
||||
for (UUID opponentId: game.getOpponents(controller.getId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent != null) {
|
||||
FilterControlledPermanent filter = new FilterControlledPermanent("creature to sacrifice");
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
filter.add(new ControllerPredicate(Constants.TargetController.YOU));
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
|
||||
if (target.canChoose(opponent.getId(), game)) {
|
||||
if (opponent.chooseUse(Outcome.Detriment, "Sacrifice a creature to tap Desecration Demon and put a +1/+1 counter on it?", game))
|
||||
{
|
||||
opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source.getId(), game);
|
||||
game.informPlayers(opponent.getName() + " sacrifices " + permanent.getName() + " to tap Desecration Demon and put a +1/+1 counter on it");
|
||||
if (descrationDemon != null) {
|
||||
descrationDemon.tap(game);
|
||||
descrationDemon.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesecrationDemonEffect copy() {
|
||||
return new DesecrationDemonEffect(this);
|
||||
}
|
||||
}
|
149
Mage.Sets/src/mage/sets/returntoravnica/EpicExperiment.java
Normal file
149
Mage.Sets/src/mage/sets/returntoravnica/EpicExperiment.java
Normal file
|
@ -0,0 +1,149 @@
|
|||
/*
|
||||
* 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.returntoravnica;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
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.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInExile;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class EpicExperiment extends CardImpl<EpicExperiment> {
|
||||
|
||||
public EpicExperiment(UUID ownerId) {
|
||||
super(ownerId, 159, "Epic Experiment", Rarity.MYTHIC, new CardType[]{CardType.SORCERY}, "{X}{U}{R}");
|
||||
this.expansionSetCode = "RTR";
|
||||
|
||||
this.color.setBlue(true);
|
||||
this.color.setRed(true);
|
||||
|
||||
// Exile the top X cards of your library. For each instant and sorcery card with
|
||||
// converted mana cost X or less among them, you may cast that card without paying
|
||||
// its mana cost. Then put all cards exiled this way that weren't cast into your graveyard.
|
||||
this.getSpellAbility().addEffect(new EpicExperimentEffect());
|
||||
}
|
||||
|
||||
public EpicExperiment(final EpicExperiment card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EpicExperiment copy() {
|
||||
return new EpicExperiment(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EpicExperimentEffect extends OneShotEffect<EpicExperimentEffect> {
|
||||
|
||||
private final static FilterCard filter = new FilterCard();
|
||||
static {
|
||||
filter.add(Predicates.or(new CardTypePredicate(CardType.INSTANT),
|
||||
new CardTypePredicate(CardType.SORCERY)));
|
||||
}
|
||||
|
||||
public EpicExperimentEffect() {
|
||||
super(Constants.Outcome.PlayForFree);
|
||||
staticText = "Exile the top X cards of your library. For each instant and sorcery card with converted mana cost X or less among them, you may cast that card without paying its mana cost. Then put all cards exiled this way that weren't cast into your graveyard";
|
||||
}
|
||||
|
||||
public EpicExperimentEffect(final EpicExperimentEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
// move cards from library to exile
|
||||
for (int i = 0; i < source.getManaCostsToPay().getX(); i++) {
|
||||
if (player != null && player.getLibrary().size() > 0) {
|
||||
Card topCard = player.getLibrary().getFromTop(game);
|
||||
topCard.moveToExile(source.getSourceId(), "Cards exiled by Epic Experiment", source.getId(), game);
|
||||
}
|
||||
}
|
||||
// cast the possible cards without paying the mana
|
||||
ExileZone epicExperimentExileZone = game.getExile().getExileZone(source.getSourceId());
|
||||
filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, source.getManaCostsToPay().getX() + 1));
|
||||
filter.setMessage("instant and sorcery cards with converted mana cost "+ source.getManaCostsToPay().getX() +" or less");
|
||||
while (player != null && epicExperimentExileZone != null && epicExperimentExileZone.count(filter, game) > 0
|
||||
&& player.chooseUse(Outcome.PlayForFree, "Cast cards exiled with Epic Experiment without paying its mana cost?", game)) {
|
||||
TargetCardInExile target = new TargetCardInExile(filter, source.getSourceId());
|
||||
while (epicExperimentExileZone.count(filter, game) > 0 && player.choose(Outcome.PlayForFree, epicExperimentExileZone, target, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
|
||||
if (player.cast(card.getSpellAbility(), game, true))
|
||||
{
|
||||
game.getExile().removeCard(card, game);
|
||||
}
|
||||
}
|
||||
target.clearChosen();
|
||||
}
|
||||
}
|
||||
// move not casted cards to graveyard
|
||||
UUID exileId = source.getSourceId();
|
||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
||||
if (exile != null) {
|
||||
exile = exile.copy();
|
||||
for (UUID cardId : exile) {
|
||||
Card card = game.getCard(cardId);
|
||||
card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true);
|
||||
}
|
||||
game.getExile().getExileZone(exileId).clear();
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EpicExperimentEffect copy() {
|
||||
return new EpicExperimentEffect(this);
|
||||
}
|
||||
}
|
161
Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java
Normal file
161
Mage.Sets/src/mage/sets/returntoravnica/GuildFeud.java
Normal file
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* 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.returntoravnica;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class GuildFeud extends CardImpl<GuildFeud> {
|
||||
|
||||
public GuildFeud(UUID ownerId) {
|
||||
super(ownerId, 97, "Guild Feud", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{5}{R}");
|
||||
this.expansionSetCode = "RTR";
|
||||
|
||||
this.color.setRed(true);
|
||||
|
||||
// At the beginning of your upkeep, target opponent reveals the top three cards
|
||||
// of his or her library, may put a creature card from among them onto the battlefield,
|
||||
// then puts the rest into his or her graveyard. You do the same with the top three
|
||||
// cards of your library. If two creatures are put onto the battlefield this way,
|
||||
// those creatures fight each other.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new GuildFeudEffect(), Constants.TargetController.YOU, true);
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public GuildFeud(final GuildFeud card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuildFeud copy() {
|
||||
return new GuildFeud(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class GuildFeudEffect extends OneShotEffect<GuildFeudEffect> {
|
||||
|
||||
public GuildFeudEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
staticText = "target opponent reveals the top three cards of his or her library, may put a creature card from among them onto the battlefield, then puts the rest into his or her graveyard. You do the same with the top three cards of your library. If two creatures are put onto the battlefield this way, those creatures fight each other";
|
||||
}
|
||||
|
||||
public GuildFeudEffect(final GuildFeudEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent opponentCreature = null;
|
||||
Permanent controllerCreature = null;
|
||||
if (opponent != null && controller != null) {
|
||||
for (int activePlayer = 0; activePlayer < 2; activePlayer++) {
|
||||
Player player = (activePlayer == 0? opponent : controller);
|
||||
Cards topThreeCards = new CardsImpl(Zone.PICK);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (player.getLibrary().size() > 0) {
|
||||
Card topCard = player.getLibrary().removeFromTop(game);
|
||||
if (topCard != null) {
|
||||
topThreeCards.add(topCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.revealCards(player.getName() + " top three library cards", topThreeCards, game);
|
||||
Card creatureToBattlefield;
|
||||
if (!topThreeCards.isEmpty()) {
|
||||
if (player.chooseUse(Outcome.PutCreatureInPlay, "Put a creature card among them to the battlefield?", game)) {
|
||||
TargetCard target = new TargetCard(Zone.PICK,
|
||||
new FilterCreatureCard(
|
||||
"creature card to put on the battlefield"));
|
||||
if (player.choose(Outcome.PutCreatureInPlay, topThreeCards, target, game)) {
|
||||
creatureToBattlefield = topThreeCards.get(target.getFirstTarget(), game);
|
||||
if (creatureToBattlefield != null) {
|
||||
topThreeCards.remove(creatureToBattlefield);
|
||||
if (creatureToBattlefield.putOntoBattlefield(game, Zone.PICK,
|
||||
source.getSourceId(), player.getId())) {
|
||||
game.informPlayers("Guild Feud: " + player.getName() + " put " + creatureToBattlefield.getName() + " to the battlefield");
|
||||
if (activePlayer == 0) {
|
||||
opponentCreature = game.getPermanent(creatureToBattlefield.getId());
|
||||
} else {
|
||||
controllerCreature = game.getPermanent(creatureToBattlefield.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (topThreeCards.size() > 0) {
|
||||
|
||||
while (topThreeCards.size() > 0) {
|
||||
Card card = topThreeCards.get(topThreeCards.iterator().next(), game);
|
||||
topThreeCards.remove(card);
|
||||
card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// If two creatures are put onto the battlefield this way, those creatures fight each other
|
||||
if (opponentCreature != null && controllerCreature != null) {
|
||||
int power = opponentCreature.getPower().getValue();
|
||||
opponentCreature.damage(controllerCreature.getPower().getValue(), source.getSourceId(), game, true, false);
|
||||
controllerCreature.damage(power, source.getSourceId(), game, true, false);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuildFeudEffect copy() {
|
||||
return new GuildFeudEffect(this);
|
||||
}
|
||||
}
|
112
Mage.Sets/src/mage/sets/returntoravnica/PsychicSpiral.java
Normal file
112
Mage.Sets/src/mage/sets/returntoravnica/PsychicSpiral.java
Normal file
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* 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.returntoravnica;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class PsychicSpiral extends CardImpl<PsychicSpiral> {
|
||||
|
||||
public PsychicSpiral(UUID ownerId) {
|
||||
super(ownerId, 47, "Psychic Spiral", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{4}{U}");
|
||||
this.expansionSetCode = "RTR";
|
||||
|
||||
this.color.setBlue(true);
|
||||
|
||||
// Shuffle all cards from your graveyard into your library. Target player puts that many cards from the top of his or her library into his or her graveyard.
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
this.getSpellAbility().addEffect(new PsychicSpiralEffect());
|
||||
}
|
||||
|
||||
public PsychicSpiral(final PsychicSpiral card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsychicSpiral copy() {
|
||||
return new PsychicSpiral(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PsychicSpiralEffect extends OneShotEffect<PsychicSpiralEffect> {
|
||||
|
||||
public PsychicSpiralEffect() {
|
||||
super(Constants.Outcome.GainLife);
|
||||
staticText = "Shuffle all cards from your graveyard into your library. Target player puts that many cards from the top of his or her library into his or her graveyard";
|
||||
}
|
||||
|
||||
public PsychicSpiralEffect(final PsychicSpiralEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
int cardsInGraveyard = player.getGraveyard().size();
|
||||
player.getLibrary().addAll(player.getGraveyard().getCards(game), game);
|
||||
player.getGraveyard().clear();
|
||||
player.shuffleLibrary(game);
|
||||
|
||||
if (cardsInGraveyard > 0) {
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (targetPlayer != null) {
|
||||
for (int i = 0; i<cardsInGraveyard ; i++) {
|
||||
if (!targetPlayer.getLibrary().getCardList().isEmpty()) {
|
||||
Card card = targetPlayer.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
card.moveToZone(Constants.Zone.GRAVEYARD, source.getId(), game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsychicSpiralEffect copy() {
|
||||
return new PsychicSpiralEffect(this);
|
||||
}
|
||||
}
|
212
Mage.Sets/src/mage/sets/returntoravnica/SearchTheCity.java
Normal file
212
Mage.Sets/src/mage/sets/returntoravnica/SearchTheCity.java
Normal file
|
@ -0,0 +1,212 @@
|
|||
/*
|
||||
* 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.returntoravnica;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.turn.TurnMod;
|
||||
import mage.players.Player;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SearchTheCity extends CardImpl<SearchTheCity> {
|
||||
|
||||
public SearchTheCity(UUID ownerId) {
|
||||
super(ownerId, 49, "Search the City", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{U}");
|
||||
this.expansionSetCode = "RTR";
|
||||
|
||||
this.color.setBlue(true);
|
||||
|
||||
// When Search the City enters the battlefield, exile the top five cards of your library.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchTheCityExileEffect()));
|
||||
|
||||
// Whenever you play a card with the same name as one of the exiled cards, you may put one of those cards with that name into its owner's hand. Then if there are no cards exiled with Search the City, sacrifice it. If you do, take an extra turn after this one.
|
||||
this.addAbility(new SearchTheCityTriggeredAbility());
|
||||
|
||||
}
|
||||
|
||||
public SearchTheCity(final SearchTheCity card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchTheCity copy() {
|
||||
return new SearchTheCity(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SearchTheCityExileEffect extends OneShotEffect<SearchTheCityExileEffect> {
|
||||
|
||||
public SearchTheCityExileEffect() {
|
||||
super(Constants.Outcome.DrawCard);
|
||||
staticText = "exile the top five cards of your library";
|
||||
}
|
||||
|
||||
public SearchTheCityExileEffect(final SearchTheCityExileEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
// move cards from library to exile
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (player != null && player.getLibrary().size() > 0) {
|
||||
Card topCard = player.getLibrary().getFromTop(game);
|
||||
topCard.moveToExile(source.getSourceId(), "Cards exiled by Search the City", source.getId(), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchTheCityExileEffect copy() {
|
||||
return new SearchTheCityExileEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SearchTheCityTriggeredAbility extends TriggeredAbilityImpl<SearchTheCityTriggeredAbility> {
|
||||
|
||||
public SearchTheCityTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new SearchTheCityExiledCardToHandEffect(), true);
|
||||
|
||||
}
|
||||
|
||||
public SearchTheCityTriggeredAbility(final SearchTheCityTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if ((event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.LAND_PLAYED)
|
||||
&& event.getPlayerId().equals(this.getControllerId())) {
|
||||
String cardName = "";
|
||||
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null) {
|
||||
cardName = spell.getName();
|
||||
}
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.LAND_PLAYED) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null) {
|
||||
cardName = card.getName();
|
||||
}
|
||||
}
|
||||
if (!cardName.isEmpty()) {
|
||||
ExileZone searchTheCityExileZone = game.getExile().getExileZone(this.getSourceId());
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new NamePredicate(cardName));
|
||||
|
||||
if (searchTheCityExileZone.count(filter, game) > 0) {
|
||||
this.getEffects().get(0).setValue("cardName",cardName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever you play a card with the same name as one of the exiled cards, " + super.getRule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchTheCityTriggeredAbility copy() {
|
||||
return new SearchTheCityTriggeredAbility(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SearchTheCityExiledCardToHandEffect extends OneShotEffect<SearchTheCityExiledCardToHandEffect> {
|
||||
|
||||
public SearchTheCityExiledCardToHandEffect() {
|
||||
super(Constants.Outcome.DrawCard);
|
||||
staticText = "you may put one of those cards with that name into its owner's hand. Then if there are no cards exiled with Search the City, sacrifice it. If you do, take an extra turn after this one";
|
||||
}
|
||||
|
||||
public SearchTheCityExiledCardToHandEffect(final SearchTheCityExiledCardToHandEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
String cardName = (String) this.getValue("cardName");
|
||||
ExileZone searchTheCityExileZone = game.getExile().getExileZone(source.getSourceId());
|
||||
if (cardName != null && searchTheCityExileZone != null) {
|
||||
for (Card card :searchTheCityExileZone.getCards(game)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
if (card.moveToZone(Zone.HAND, source.getSourceId(), game, true)) {
|
||||
game.informPlayers("Search the City: put " + card.getName() + " into owner's hand");
|
||||
}
|
||||
searchTheCityExileZone.remove(card);
|
||||
if (searchTheCityExileZone.isEmpty()) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
// extra turn
|
||||
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), false));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchTheCityExiledCardToHandEffect copy() {
|
||||
return new SearchTheCityExiledCardToHandEffect(this);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue