mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Use ShuffleIntoLibrarySourceEffect instead of custom effect implementation for Blitz Hellion and Lightning Shrieker.
This also fixes a bug where controller's library was shuffled instead of owner's.
This commit is contained in:
parent
ccd92dd241
commit
596bee33c2
2 changed files with 13 additions and 79 deletions
|
@ -29,17 +29,15 @@ package mage.sets.alarareborn;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.*;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.keyword.TrampleAbility;
|
import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.constants.*;
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -64,7 +62,9 @@ public class BlitzHellion extends CardImpl {
|
||||||
this.addAbility(HasteAbility.getInstance());
|
this.addAbility(HasteAbility.getInstance());
|
||||||
|
|
||||||
// At the beginning of the end step, Blitz Hellion's owner shuffles it into his or her library.
|
// At the beginning of the end step, Blitz Hellion's owner shuffles it into his or her library.
|
||||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new ShuffleSourceEffect(), TargetController.ANY, null, false));
|
Effect effect = new ShuffleIntoLibrarySourceEffect();
|
||||||
|
effect.setText("{this}'s owner shuffles it into his or her library.");
|
||||||
|
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.ANY, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlitzHellion(final BlitzHellion card) {
|
public BlitzHellion(final BlitzHellion card) {
|
||||||
|
@ -76,35 +76,3 @@ public class BlitzHellion extends CardImpl {
|
||||||
return new BlitzHellion(this);
|
return new BlitzHellion(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShuffleSourceEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
ShuffleSourceEffect() {
|
|
||||||
super(Outcome.Neutral);
|
|
||||||
staticText = "{this}'s owner shuffles it into his or her library";
|
|
||||||
}
|
|
||||||
|
|
||||||
ShuffleSourceEffect(final ShuffleSourceEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
|
||||||
if (player == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
permanent.moveToZone(Zone.LIBRARY, id, game, false);
|
|
||||||
player.shuffleLibrary(game);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ShuffleSourceEffect copy() {
|
|
||||||
return new ShuffleSourceEffect(this);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -29,21 +29,17 @@ package mage.sets.fatereforged;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.abilities.keyword.TrampleAbility;
|
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
|
import mage.abilities.keyword.TrampleAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.permanent.Permanent;
|
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -65,7 +61,9 @@ public class LightningShrieker extends CardImpl {
|
||||||
// Haste
|
// Haste
|
||||||
this.addAbility(HasteAbility.getInstance());
|
this.addAbility(HasteAbility.getInstance());
|
||||||
// At the beginning of the end step, Lightning Shrieker's owner shuffles it into his or her library.
|
// At the beginning of the end step, Lightning Shrieker's owner shuffles it into his or her library.
|
||||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new ShuffleSourceEffect(), TargetController.ANY, null, false));
|
Effect effect = new ShuffleIntoLibrarySourceEffect();
|
||||||
|
effect.setText("{this}'s owner shuffles it into his or her library.");
|
||||||
|
this.addAbility(new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, effect, TargetController.ANY, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LightningShrieker(final LightningShrieker card) {
|
public LightningShrieker(final LightningShrieker card) {
|
||||||
|
@ -77,35 +75,3 @@ public class LightningShrieker extends CardImpl {
|
||||||
return new LightningShrieker(this);
|
return new LightningShrieker(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ShuffleSourceEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
ShuffleSourceEffect() {
|
|
||||||
super(Outcome.Neutral);
|
|
||||||
staticText = "{this}'s owner shuffles it into his or her library";
|
|
||||||
}
|
|
||||||
|
|
||||||
ShuffleSourceEffect(final ShuffleSourceEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
|
||||||
if (player == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
permanent.moveToZone(Zone.LIBRARY, id, game, false);
|
|
||||||
player.shuffleLibrary(game);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ShuffleSourceEffect copy() {
|
|
||||||
return new ShuffleSourceEffect(this);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue