mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
- Fixed #5624
This commit is contained in:
parent
0f4c6c0260
commit
8cb87269d8
1 changed files with 11 additions and 41 deletions
|
@ -6,14 +6,12 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.DelayedTriggeredAbility;
|
import mage.abilities.DelayedTriggeredAbility;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||||
import mage.abilities.effects.AsThoughEffectImpl;
|
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
|
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.AsThoughEffectType;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
@ -57,7 +55,10 @@ class ElkinLairUpkeepEffect extends OneShotEffect {
|
||||||
|
|
||||||
public ElkinLairUpkeepEffect() {
|
public ElkinLairUpkeepEffect() {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
this.staticText = "that player exiles a card at random from their hand. The player may play that card this turn. At the beginning of the next end step, if the player hasn't played the card, he or she puts it into their graveyard";
|
this.staticText = "that player exiles a card at random from their hand. "
|
||||||
|
+ "The player may play that card this turn. "
|
||||||
|
+ "At the beginning of the next end step, if the "
|
||||||
|
+ "player hasn't played the card, he or she puts it into their graveyard";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElkinLairUpkeepEffect(final ElkinLairUpkeepEffect effect) {
|
public ElkinLairUpkeepEffect(final ElkinLairUpkeepEffect effect) {
|
||||||
|
@ -72,8 +73,9 @@ class ElkinLairUpkeepEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(game.getActivePlayerId());
|
Player player = game.getPlayer(game.getActivePlayerId());
|
||||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||||
if (player != null && sourcePermanent != null) {
|
if (player != null
|
||||||
|
&& sourcePermanent != null) {
|
||||||
Card[] cards = player.getHand().getCards(new FilterCard(), game).toArray(new Card[0]);
|
Card[] cards = player.getHand().getCards(new FilterCard(), game).toArray(new Card[0]);
|
||||||
if (cards.length > 0) {
|
if (cards.length > 0) {
|
||||||
Card card = cards[RandomUtil.nextInt(cards.length)];
|
Card card = cards[RandomUtil.nextInt(cards.length)];
|
||||||
|
@ -84,51 +86,19 @@ class ElkinLairUpkeepEffect extends OneShotEffect {
|
||||||
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);
|
ContinuousEffect effect = new PlayFromNotOwnHandZoneTargetEffect(Zone.EXILED, Duration.EndOfTurn);
|
||||||
effect.setTargetPointer(new FixedTarget(card, game));
|
effect.setTargetPointer(new FixedTarget(card, game));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
|
DelayedTriggeredAbility delayed
|
||||||
DelayedTriggeredAbility delayed = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ElkinLairPutIntoGraveyardEffect());
|
= new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||||
|
new ElkinLairPutIntoGraveyardEffect());
|
||||||
game.addDelayedTriggeredAbility(delayed, source);
|
game.addDelayedTriggeredAbility(delayed, source);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ElkinLairPlayExiledEffect extends AsThoughEffectImpl {
|
|
||||||
|
|
||||||
public ElkinLairPlayExiledEffect(Duration duration) {
|
|
||||||
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, duration, Outcome.Benefit);
|
|
||||||
staticText = "The player may play that card this turn";
|
|
||||||
}
|
|
||||||
|
|
||||||
public ElkinLairPlayExiledEffect(final ElkinLairPlayExiledEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ElkinLairPlayExiledEffect copy() {
|
|
||||||
return new ElkinLairPlayExiledEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
|
||||||
Card card = game.getCard(objectId);
|
|
||||||
if (card != null
|
|
||||||
&& affectedControllerId.equals(card.getOwnerId())
|
|
||||||
&& game.getState().getZone(card.getId()) == Zone.EXILED) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ElkinLairPutIntoGraveyardEffect extends OneShotEffect {
|
class ElkinLairPutIntoGraveyardEffect extends OneShotEffect {
|
||||||
|
|
||||||
public ElkinLairPutIntoGraveyardEffect() {
|
public ElkinLairPutIntoGraveyardEffect() {
|
||||||
|
|
Loading…
Reference in a new issue