mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
- refactored Tergrid, God of Fright to allow the controller to choose the order of the cards entering the battlefield from the graveyard.
This commit is contained in:
parent
0247f101af
commit
fa33561dda
1 changed files with 16 additions and 6 deletions
|
|
@ -11,6 +11,7 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.UntapSourceEffect;
|
import mage.abilities.effects.common.UntapSourceEffect;
|
||||||
import mage.abilities.keyword.MenaceAbility;
|
import mage.abilities.keyword.MenaceAbility;
|
||||||
|
|
@ -23,6 +24,7 @@ import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jeffwadsworth
|
* @author jeffwadsworth
|
||||||
|
|
@ -107,15 +109,20 @@ class TergridGodOfFrightTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
if (permanent != null
|
if (permanent != null
|
||||||
&& !(permanent instanceof PermanentToken)
|
&& !(permanent instanceof PermanentToken)
|
||||||
&& game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
|
&& game.getState().getZone(permanent.getId()) == Zone.GRAVEYARD) {
|
||||||
game.getState().setValue(this.getSourceId() + "TergridGodOfFrightControl", ((Card) permanent));
|
for (Effect effect : this.getEffects()) {
|
||||||
|
effect.setTargetPointer(new FixedTarget(((Card) permanent).getId(), game));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.DISCARDED_CARD) {
|
if (event.getType() == GameEvent.EventType.DISCARDED_CARD) {
|
||||||
Card discardedCard = game.getCard(event.getTargetId());
|
Card discardedCard = game.getCard(event.getTargetId());
|
||||||
if (discardedCard != null
|
if (discardedCard != null
|
||||||
&& !(discardedCard.isInstantOrSorcery())) {
|
&& !(discardedCard.isInstantOrSorcery())) {
|
||||||
game.getState().setValue(this.getSourceId() + "TergridGodOfFrightControl", discardedCard);
|
for (Effect effect : this.getEffects()) {
|
||||||
|
effect.setTargetPointer(new FixedTarget(discardedCard.getId(), game));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -145,11 +152,14 @@ class TergridGodOfFrightEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Card card = (Card) game.getState().getValue(source.getSourceId() + "TergridGodOfFrightControl");
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null
|
if (controller != null) {
|
||||||
&& card != null) {
|
Card card = game.getCard(targetPointer.getFirst(game, source));
|
||||||
return card.putOntoBattlefield(game, Zone.GRAVEYARD, source, controller.getId());
|
if (card != null) {
|
||||||
|
// controller gets to choose the order in which the cards enter the battlefield
|
||||||
|
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue