1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-03-13 01:09:53 -09:00

* Split Second - Fixed a bug that if more than one split second card was in the game, the zone of the owning card ould not be retrieved correctly.

This commit is contained in:
LevelX2 2014-04-02 20:54:09 +02:00
parent fd51fc8216
commit d22153362f
14 changed files with 35 additions and 40 deletions

View file

@ -65,7 +65,7 @@ public class CelestialCrusader extends CardImpl<CelestialCrusader> {
this.toughness = new MageInt(2);
this.addAbility(FlashAbility.getInstance());
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
this.addAbility(FlyingAbility.getInstance());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
}

View file

@ -28,11 +28,11 @@
package mage.sets.elspethvstezzeret;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.AffinityForArtifactsAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
@ -49,7 +49,7 @@ public class Thoughtcast extends CardImpl<Thoughtcast> {
// Affinity for artifacts
this.addAbility(new AffinityForArtifactsAbility());
// Draw two cards.
this.getSpellAbility().addEffect(new DrawCardControllerEffect(2));
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));
}
public Thoughtcast(final Thoughtcast card) {

View file

@ -86,7 +86,7 @@ public class MoltenDisaster extends CardImpl<MoltenDisaster> {
class MoltenDisasterTriggeredAbility extends TriggeredAbilityImpl<MoltenDisasterTriggeredAbility> {
public MoltenDisasterTriggeredAbility() {
super(Zone.HAND, new GainAbilitySourceEffect(SplitSecondAbility.getInstance(), Duration.WhileOnStack), false);
super(Zone.HAND, new GainAbilitySourceEffect(new SplitSecondAbility(), Duration.WhileOnStack), false);
}
public MoltenDisasterTriggeredAbility(final MoltenDisasterTriggeredAbility ability) {

View file

@ -56,7 +56,7 @@ public class TakePossession extends CardImpl<TakePossession> {
this.color.setBlue(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
// Enchant permanent
TargetPermanent auraTarget = new TargetPermanent();
this.getSpellAbility().addTarget(auraTarget);

View file

@ -29,10 +29,6 @@ package mage.sets.planarchaos;
import java.util.List;
import java.util.UUID;
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.abilities.keyword.SplitSecondAbility;
@ -40,6 +36,10 @@ 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.predicate.Predicates;
import mage.filter.predicate.mageobject.NamePredicate;
@ -69,7 +69,7 @@ public class Extirpate extends CardImpl<Extirpate> {
this.color.setBlack(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
// Choose target card in a graveyard other than a basic land card. Search its owner's graveyard, hand, and library for all cards with the same name as that card and exile them. Then that player shuffles his or her library.
this.getSpellAbility().addEffect(new ExtirpateEffect());
this.getSpellAbility().addTarget(new TargetCardInGraveyard(filter));
@ -125,8 +125,7 @@ class ExtirpateEffect extends OneShotEffect<ExtirpateEffect> {
for (UUID targetId : targets) {
Card targetCard = targetPlayer.getGraveyard().get(targetId, game);
if (targetCard != null) {
targetPlayer.getGraveyard().remove(targetCard);
targetCard.moveToZone(Zone.EXILED, source.getId(), game, false);
player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.GRAVEYARD);
}
}
}
@ -142,8 +141,7 @@ class ExtirpateEffect extends OneShotEffect<ExtirpateEffect> {
for (UUID targetId : targets) {
Card targetCard = targetPlayer.getHand().get(targetId, game);
if (targetCard != null) {
targetPlayer.getHand().remove(targetCard);
targetCard.moveToZone(Zone.EXILED, source.getId(), game, false);
player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.HAND);
}
}
}
@ -161,19 +159,17 @@ class ExtirpateEffect extends OneShotEffect<ExtirpateEffect> {
for (UUID targetId : targets) {
Card targetCard = targetPlayer.getLibrary().remove(targetId, game);
if (targetCard != null) {
targetCard.moveToZone(Zone.EXILED, source.getId(), game, false);
player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY);
}
}
}
} else {
player.lookAtCards(targetPlayer.getName() + " library", cardsInLibrary, game);
}
}
targetPlayer.shuffleLibrary(game);
return true;
}
}
return false;
}

View file

@ -65,7 +65,7 @@ public class SulfurElemental extends CardImpl<SulfurElemental> {
// Flash
this.addAbility(FlashAbility.getInstance());
// Split second
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
// White creatures get +1/-1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,-1, Duration.WhileOnBattlefield, filter, false)));
}

View file

@ -54,7 +54,7 @@ public class AngelsGrace extends CardImpl<AngelsGrace> {
this.color.setWhite(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
// You can't lose the game this turn and your opponents can't win the game this turn. Until end of turn, damage that would reduce your life total to less than 1 reduces it to 1 instead.
this.getSpellAbility().addEffect(new AngelsGraceEffect());

View file

@ -59,7 +59,7 @@ public class KrosanGrip extends CardImpl<KrosanGrip> {
this.color.setGreen(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
// Destroy target artifact or enchantment.
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addEffect(new DestroyTargetEffect());

View file

@ -48,7 +48,7 @@ public class SuddenShock extends CardImpl<SuddenShock> {
this.color.setRed(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
// Sudden Shock deals 2 damage to target creature or player.
this.getSpellAbility().addEffect(new DamageTargetEffect(2, true));
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer(true));

View file

@ -58,7 +58,7 @@ public class SuddenSpoiling extends CardImpl<SuddenSpoiling> {
this.color.setBlack(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
// Creatures target player controls become 0/2 and lose all abilities until end of turn.
this.getSpellAbility().addEffect(new SuddenSpoilingEffect(Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetPlayer());

View file

@ -56,7 +56,7 @@ public class Trickbind extends CardImpl<Trickbind> {
this.color.setBlue(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
// Counter target activated or triggered ability. If a permanent's ability is countered this way, activated abilities of that permanent can't be activated this turn.
this.getSpellAbility().addEffect(new TrickbindCounterEffect());

View file

@ -28,11 +28,11 @@
package mage.sets.timespiral;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.SplitSecondAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.TargetPermanent;
/**
@ -48,7 +48,7 @@ public class WipeAway extends CardImpl<WipeAway> {
this.color.setBlue(true);
// Split second
this.addAbility(SplitSecondAbility.getInstance());
this.addAbility(new SplitSecondAbility());
// Return target permanent to its owner's hand.
this.getSpellAbility().addTarget(new TargetPermanent());
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());

View file

@ -78,9 +78,9 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect<PutLibraryInt
// putting cards to grave shouldn't end the game, so getting minimun available
int cardsCount = Math.min(amount.calculate(game, source), player.getLibrary().size());
for (int i = 0; i < cardsCount; i++) {
Card card = player.getLibrary().removeFromTop(game);
Card card = player.getLibrary().getFromTop(game);
if (card != null) {
card.moveToZone(Zone.GRAVEYARD, source.getId(), game, false);
player.moveCardToGraveyardWithInfo(card, source.getId(), game, Zone.LIBRARY);
}
else {
break;

View file

@ -17,14 +17,9 @@ import mage.game.events.GameEvent;
* As long as this spell is on the stack, players can't cast other spells or activate abilities that aren't mana abilities.
*/
public class SplitSecondAbility extends SimpleStaticAbility implements MageSingleton {
private static final SplitSecondAbility ability = new SplitSecondAbility();
public class SplitSecondAbility extends SimpleStaticAbility {
public static SplitSecondAbility getInstance() {
return ability;
}
private SplitSecondAbility() {
public SplitSecondAbility() {
super(Zone.STACK, new SplitSecondEffect());
this.setRuleAtTheTop(true);
}
@ -34,9 +29,13 @@ public class SplitSecondAbility extends SimpleStaticAbility implements MageSingl
return "Split second <i>(As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)</i>";
}
public SplitSecondAbility(SplitSecondAbility ability) {
super(ability);
}
@Override
public SimpleStaticAbility copy() {
return ability;
return new SplitSecondAbility(this);
}
}