mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 04:09:54 -08:00
* Replaced some wrong card movement handling.
This commit is contained in:
parent
db077d68ca
commit
7cddc3d03a
9 changed files with 67 additions and 77 deletions
|
|
@ -52,8 +52,7 @@ import mage.util.CardUtil;
|
|||
public class Flash extends CardImpl {
|
||||
|
||||
public Flash(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}");
|
||||
|
||||
// You may put a creature card from your hand onto the battlefield. If you do, sacrifice it unless you pay its mana cost reduced by up to {2}.
|
||||
this.getSpellAbility().addEffect(new FlashEffect());
|
||||
|
|
@ -70,7 +69,7 @@ public class Flash extends CardImpl {
|
|||
}
|
||||
|
||||
class FlashEffect extends OneShotEffect {
|
||||
|
||||
|
||||
private static final String choiceText = "Put a creature card from your hand onto the battlefield?";
|
||||
|
||||
public FlashEffect() {
|
||||
|
|
@ -89,35 +88,33 @@ class FlashEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null || !player.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null || !controller.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TargetCardInHand target = new TargetCardInHand(new FilterCreatureCard());
|
||||
if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
|
||||
if (controller.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Zone.HAND, source.getSourceId(), source.getControllerId());
|
||||
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
ManaCosts<ManaCost> reducedCost = ManaCosts.removeVariableManaCost(CardUtil.reduceCost(card.getManaCost(), 2));
|
||||
StringBuilder sb = new StringBuilder("Pay ").append(reducedCost.getText()).append('?');
|
||||
if (player.chooseUse(Outcome.Benefit, sb.toString(), source, game)) {
|
||||
if (controller.chooseUse(Outcome.Benefit, String.valueOf("Pay " + reducedCost.getText()) + Character.toString('?'), source, game)) {
|
||||
reducedCost.clearPaid();
|
||||
if (reducedCost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
|
@ -42,14 +40,14 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
|
@ -59,6 +57,8 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -169,7 +169,7 @@ class TravelingPlagueEffect extends OneShotEffect {
|
|||
Permanent targetPermanent = game.getPermanent(target.getFirstTarget());
|
||||
if (!targetPermanent.cantBeAttachedBy(travelingPlague, game)) {
|
||||
game.getState().setValue("attachTo:" + travelingPlague.getId(), targetPermanent);
|
||||
travelingPlague.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), controllerOfEnchantedCreature.getId());
|
||||
controllerOfEnchantedCreature.moveCards(travelingPlague, Zone.BATTLEFIELD, source, game);
|
||||
return targetPermanent.addAttachment(travelingPlague.getId(), game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,13 +33,12 @@ import mage.abilities.common.PayMoreToCastAsThoughtItHadFlashAbility;
|
|||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
|
|
@ -51,7 +50,7 @@ import mage.players.Player;
|
|||
public class TwilightsCall extends CardImpl {
|
||||
|
||||
public TwilightsCall(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{4}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}{B}");
|
||||
|
||||
Effect effect = new TwilightsCallEffect();
|
||||
// You may cast Twilight's Call as though it had flash if you pay {2} more to cast it.
|
||||
|
|
@ -93,9 +92,7 @@ class TwilightsCallEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) {
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), card.getOwnerId());
|
||||
}
|
||||
player.moveCards(player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game), Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -43,33 +43,34 @@ import mage.players.Player;
|
|||
/**
|
||||
* Gatecrash FAQ 01/2013
|
||||
*
|
||||
* If you reveal a nonland card, you may cast it during the resolution of Unexpected Results.
|
||||
* Ignore timing restrictions based on the card's type. Other timing restrictions, such as
|
||||
* "Cast [this card] only during combat," must be followed.
|
||||
* If you reveal a nonland card, you may cast it during the resolution of
|
||||
* Unexpected Results. Ignore timing restrictions based on the card's type.
|
||||
* Other timing restrictions, such as "Cast [this card] only during combat,"
|
||||
* must be followed.
|
||||
*
|
||||
* If you can't cast the card (perhaps because there are no legal targets), or if you choose
|
||||
* not to, the card will remain on top of the library.
|
||||
* If you can't cast the card (perhaps because there are no legal targets), or
|
||||
* if you choose not to, the card will remain on top of the library.
|
||||
*
|
||||
* If you cast a spell "without paying its mana cost," you can't pay alternative costs such
|
||||
* as overload costs. You can pay additional costs such as kicker costs. If the card has mandatory
|
||||
* additional costs, you must pay those.
|
||||
* If you cast a spell "without paying its mana cost," you can't pay alternative
|
||||
* costs such as overload costs. You can pay additional costs such as kicker
|
||||
* costs. If the card has mandatory additional costs, you must pay those.
|
||||
*
|
||||
* If the card has X Mana in its mana cost, you must choose 0 as its value.
|
||||
*
|
||||
* If you reveal a land card, Unexpected Results will be returned to your hand only if you put
|
||||
* that land card onto the battlefield. If you don't, Unexpected Results will be put into its
|
||||
* owner's graveyard.
|
||||
* If you reveal a land card, Unexpected Results will be returned to your hand
|
||||
* only if you put that land card onto the battlefield. If you don't, Unexpected
|
||||
* Results will be put into its owner's graveyard.
|
||||
*
|
||||
* If you reveal a land card and put that card onto the battlefield, Unexpected Results will
|
||||
* be put into its owner's hand directly from the stack. It won't be put into any graveyard.
|
||||
* If you reveal a land card and put that card onto the battlefield, Unexpected
|
||||
* Results will be put into its owner's hand directly from the stack. It won't
|
||||
* be put into any graveyard.
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class UnexpectedResults extends CardImpl {
|
||||
|
||||
public UnexpectedResults(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{G}{U}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}{U}");
|
||||
|
||||
// Shuffle your library, then reveal the top card. If it's a nonland card, you may cast it without paying its mana cost. If it's a land card, you may put it onto the battlefield and return Unexpected Results to its owner's hand.
|
||||
this.getSpellAbility().addEffect(new UnexpectedResultEffect());
|
||||
|
|
@ -90,7 +91,7 @@ class UnexpectedResultEffect extends OneShotEffect {
|
|||
|
||||
public UnexpectedResultEffect() {
|
||||
super(Outcome.PlayForFree);
|
||||
this.staticText = "Shuffle your library, then reveal the top card. If it's a nonland card, you may cast it without paying its mana cost. If it's a land card, you may put it onto the battlefield and return Unexpected Results to its owner's hand";
|
||||
this.staticText = "Shuffle your library, then reveal the top card. If it's a nonland card, you may cast it without paying its mana cost. If it's a land card, you may put it onto the battlefield and return {this} to its owner's hand";
|
||||
}
|
||||
|
||||
public UnexpectedResultEffect(final UnexpectedResultEffect effect) {
|
||||
|
|
@ -119,8 +120,9 @@ class UnexpectedResultEffect extends OneShotEffect {
|
|||
if (card.isLand()) {
|
||||
String message = "Put " + card.getName() + " onto the battlefield?";
|
||||
if (controller.chooseUse(Outcome.PutLandInPlay, message, source, game)) {
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
|
||||
return sourceCard.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
controller.moveCards(sourceCard, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (controller.chooseUse(outcome, new StringBuilder("Cast ").append(card.getName()).append(" without paying its mana cost?").toString(), source, game)) {
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
|
|
@ -119,12 +119,7 @@ class VeteranExplorerEffect extends OneShotEffect {
|
|||
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, StaticFilters.FILTER_BASIC_LAND_CARD);
|
||||
if (player.searchLibrary(target, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
for (UUID cardId : (List<UUID>) target.getTargets()) {
|
||||
Card card = player.getLibrary().getCard(cardId, game);
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId());
|
||||
}
|
||||
}
|
||||
player.moveCards(new CardsImpl(target.getTargets()), Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ package mage.cards.w;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
|
@ -136,35 +137,38 @@ class WarpWorldEffect extends OneShotEffect {
|
|||
cardsRevealed.put(player.getId(), cards);
|
||||
}
|
||||
}
|
||||
|
||||
game.applyEffects();
|
||||
// put artifacts, creaturs and lands onto the battlefield
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Set<Card> toBattlefield = new HashSet<>();
|
||||
CardsImpl cards = cardsRevealed.get(player.getId());
|
||||
for (Card card : cards.getCards(game)) {
|
||||
if (card != null && (card.isArtifact()
|
||||
|| card.isCreature()
|
||||
|| card.isLand())) {
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId());
|
||||
toBattlefield.add(card);
|
||||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
|
||||
player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
game.applyEffects();
|
||||
// put enchantments onto the battlefield
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Set<Card> toBattlefield = new HashSet<>();
|
||||
CardsImpl cards = cardsRevealed.get(player.getId());
|
||||
for (Card card : cards.getCards(game)) {
|
||||
if (card != null && card.isEnchantment()) {
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), player.getId());
|
||||
toBattlefield.add(card);
|
||||
cards.remove(card);
|
||||
}
|
||||
}
|
||||
|
||||
player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
// put the rest of the cards on buttom of the library
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
|
|
@ -52,7 +52,7 @@ import mage.target.common.TargetCardInYourGraveyard;
|
|||
public class YoreTillerNephilim extends CardImpl {
|
||||
|
||||
public YoreTillerNephilim(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{U}{B}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}{R}");
|
||||
this.subtype.add(SubType.NEPHILIM);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
|
@ -91,8 +91,9 @@ class YoreTillerNephilimEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
if (card != null) {
|
||||
if (card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId(), true)) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
game.getCombat().addAttackingCreature(permanent.getId(), game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class ZirilanOfTheClaw extends CardImpl {
|
||||
|
||||
public ZirilanOfTheClaw(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.VIASHINO, SubType.SHAMAN);
|
||||
this.power = new MageInt(3);
|
||||
|
|
@ -109,7 +109,7 @@ class ZirilanOfTheClawEffect extends OneShotEffect {
|
|||
if (controller.searchLibrary(target, game)) {
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
// gains haste
|
||||
|
|
|
|||
|
|
@ -30,15 +30,14 @@ package mage.cards.z;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -51,7 +50,7 @@ import mage.players.Player;
|
|||
public class ZombieApocalypse extends CardImpl {
|
||||
|
||||
public ZombieApocalypse(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{B}{B}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}{B}{B}");
|
||||
|
||||
// Return all Zombie creature cards from your graveyard to the battlefield tapped, then destroy all Humans.
|
||||
this.getSpellAbility().addEffect(new ZombieApocalypseEffect());
|
||||
|
|
@ -70,11 +69,9 @@ public class ZombieApocalypse extends CardImpl {
|
|||
class ZombieApocalypseEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCreatureCard filterZombie = new FilterCreatureCard();
|
||||
private static final FilterCreaturePermanent filterHuman = new FilterCreaturePermanent();
|
||||
|
||||
static {
|
||||
filterZombie.add(new SubtypePredicate(SubType.ZOMBIE));
|
||||
filterHuman.add(new SubtypePredicate(SubType.HUMAN));
|
||||
}
|
||||
|
||||
public ZombieApocalypseEffect() {
|
||||
|
|
@ -93,19 +90,16 @@ class ZombieApocalypseEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
for (Card card : player.getGraveyard().getCards(filterZombie, game)) {
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
if (permanent != null) {
|
||||
permanent.setTapped(true);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
controller.moveCards(controller.getGraveyard().getCards(filterZombie, game), Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
game.applyEffects();
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
||||
new FilterPermanent(SubType.HUMAN, "Humans"), source.getControllerId(), game)) {
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filterHuman, source.getControllerId(), game)) {
|
||||
permanent.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue