Fixed some put into graveyard effects that were implemented wrongly as triggered effects to replacment effects (LegacyWeapon, Progenitus, Darksteel Colossus, Blightsteel Colossus).

This commit is contained in:
LevelX2 2014-08-21 15:13:29 +02:00
parent cc676b2258
commit b094df2a52
11 changed files with 424 additions and 186 deletions

View file

@ -29,21 +29,14 @@ package mage.sets.apocalypse;
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.common.PutIntoGraveFromAnywhereTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromAnywhereAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.cards.Card;
import mage.abilities.effects.common.RevealAndShuffleIntoLibrarySourceEffect;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPermanent;
/**
@ -64,7 +57,7 @@ public class LegacyWeapon extends CardImpl {
ability.addTarget(new TargetPermanent());
this.addAbility(ability);
// If Legacy Weapon would be put into a graveyard from anywhere, reveal Legacy Weapon and shuffle it into its owner's library instead.
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new LegacyWeaponEffect()));
this.addAbility(new PutIntoGraveFromAnywhereAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
}
public LegacyWeapon(final LegacyWeapon card) {
@ -76,37 +69,3 @@ public class LegacyWeapon extends CardImpl {
return new LegacyWeapon(this);
}
}
class LegacyWeaponEffect extends OneShotEffect {
public LegacyWeaponEffect() {
super(Outcome.Benefit);
this.staticText = "reveal {this} and shuffle it into its owner's library instead";
}
public LegacyWeaponEffect(final LegacyWeaponEffect effect) {
super(effect);
}
@Override
public LegacyWeaponEffect copy() {
return new LegacyWeaponEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
Player player = game.getPlayer(card.getOwnerId());
if (player != null) {
Cards cards = new CardsImpl();
cards.add(card);
player.revealCards("Legacy Weapon", cards, game);
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
player.shuffleLibrary(game);
return true;
}
}
return false;
}
}

View file

@ -30,21 +30,14 @@ package mage.sets.conflux;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.common.PutIntoGraveFromAnywhereAbility;
import mage.abilities.effects.common.RevealAndShuffleIntoLibrarySourceEffect;
import mage.abilities.keyword.ProtectionAbility;
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.game.Game;
import mage.players.Player;
/**
*
@ -72,10 +65,11 @@ public class Progenitus extends CardImpl {
// spells or abilities, and all damage that would be dealt to Progenitus is prevented.
// 2/1/2009: Progenitus can still be affected by effects that don't target it or deal damage
// to it (such as Day of Judgment).
// Protection from everything
this.addAbility(new ProgenitusProtectionAbility());
// If Progenitus would be put into a graveyard from anywhere, reveal Progenitus and shuffle it into its owner's library instead.
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new ProgenitusEffect()));
this.addAbility(new PutIntoGraveFromAnywhereAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
}
public Progenitus(final Progenitus card) {
@ -113,37 +107,3 @@ class ProgenitusProtectionAbility extends ProtectionAbility {
return false;
}
}
class ProgenitusEffect extends OneShotEffect {
public ProgenitusEffect() {
super(Outcome.Benefit);
this.staticText = "reveal {this} and shuffle it into its owner's library instead";
}
public ProgenitusEffect(final ProgenitusEffect effect) {
super(effect);
}
@Override
public ProgenitusEffect copy() {
return new ProgenitusEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
Player player = game.getPlayer(card.getOwnerId());
if (player != null) {
Cards cards = new CardsImpl();
cards.add(card);
player.revealCards("Progenitus", cards, game);
card.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
player.shuffleLibrary(game);
return true;
}
}
return false;
}
}

View file

@ -33,19 +33,11 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.common.PutIntoGraveFromAnywhereAbility;
import mage.abilities.effects.common.RevealAndShuffleIntoLibrarySourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
* @author Loki
@ -58,9 +50,15 @@ public class DarksteelColossus extends CardImpl {
this.subtype.add("Golem");
this.power = new MageInt(11);
this.toughness = new MageInt(11);
// Trample
this.addAbility(TrampleAbility.getInstance());
// Darksteel Colossus is indestructible.
this.addAbility(IndestructibleAbility.getInstance());
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new DarksteelColossusEffect(), false));
// If Darksteel Colossus would be put into a graveyard from anywhere, reveal Darksteel Colossus and shuffle it into its owner's library instead.
this.addAbility(new PutIntoGraveFromAnywhereAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
}
public DarksteelColossus(final DarksteelColossus card) {
@ -73,37 +71,3 @@ public class DarksteelColossus extends CardImpl {
}
}
class DarksteelColossusEffect extends OneShotEffect {
DarksteelColossusEffect() {
super(Outcome.Benefit);
staticText = "reveal {this} and shuffle it into its owner's library instead";
}
DarksteelColossusEffect(final DarksteelColossusEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Card c = game.getCard(source.getSourceId());
if (c != null) {
Player player = game.getPlayer(c.getOwnerId());
if (player != null) {
Cards cards = new CardsImpl();
cards.add(c);
player.revealCards("Blightsteel Colossus", cards, game);
c.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
player.shuffleLibrary(game);
return true;
}
}
return false;
}
@Override
public DarksteelColossusEffect copy() {
return new DarksteelColossusEffect(this);
}
}

View file

@ -68,10 +68,12 @@ public class LilianaOfTheVeil extends CardImpl {
// +1: Each player discards a card.
this.addAbility(new LoyaltyAbility(new DiscardEachPlayerEffect(), 1));
// -2: Target player sacrifices a creature.
LoyaltyAbility ability = new LoyaltyAbility(new SacrificeEffect(new FilterCreaturePermanent(), 1, "Target player"), -2);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
// -6: Separate all permanents target player controls into two piles. That player sacrifices all permanents in the pile of his or her choice.
ability = new LoyaltyAbility(new LilianaOfTheVeilEffect(), -6);
ability.addTarget(new TargetPlayer());

View file

@ -33,20 +33,12 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.common.PutIntoGraveFromAnywhereAbility;
import mage.abilities.effects.common.RevealAndShuffleIntoLibrarySourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.InfectAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
* @author Loki
@ -59,10 +51,16 @@ public class BlightsteelColossus extends CardImpl {
this.subtype.add("Golem");
this.power = new MageInt(11);
this.toughness = new MageInt(11);
// Trample, infect
this.addAbility(TrampleAbility.getInstance());
this.addAbility(InfectAbility.getInstance());
// Blightsteel Colossus is indestructible.
this.addAbility(IndestructibleAbility.getInstance());
this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new BlightsteelColossusEffect(), false));
// If Blightsteel Colossus would be put into a graveyard from anywhere, reveal Blightsteel Colossus and shuffle it into its owner's library instead.
this.addAbility(new PutIntoGraveFromAnywhereAbility(new RevealAndShuffleIntoLibrarySourceEffect()));
}
public BlightsteelColossus(final BlightsteelColossus card) {
@ -75,37 +73,3 @@ public class BlightsteelColossus extends CardImpl {
}
}
class BlightsteelColossusEffect extends OneShotEffect {
BlightsteelColossusEffect() {
super(Outcome.Benefit);
staticText = "reveal {this} and shuffle it into its owner's library";
}
BlightsteelColossusEffect(final BlightsteelColossusEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Card c = game.getCard(source.getSourceId());
if (c != null) {
Player player = game.getPlayer(c.getOwnerId());
if (player != null) {
Cards cards = new CardsImpl();
cards.add(c);
player.revealCards("Blightsteel Colossus", cards, game);
c.moveToZone(Zone.LIBRARY, source.getSourceId(), game, true);
player.shuffleLibrary(game);
return true;
}
}
return false;
}
@Override
public BlightsteelColossusEffect copy() {
return new BlightsteelColossusEffect(this);
}
}

View file

@ -104,7 +104,7 @@ class DryadMilitantReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD) {
Card card = (Card) game.getCard(event.getTargetId());
Card card = game.getCard(event.getTargetId());
if (card != null && (card.getCardType().contains(CardType.SORCERY) || card.getCardType().contains(CardType.INSTANT))) {
return true;
}

View file

@ -165,10 +165,7 @@ class RestInPeaceReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD) {
return true;
}
return false;
return event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).getToZone() == Zone.GRAVEYARD;
}
}