mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Garruk, Caller of Beasts - Fixed that target for second ability was chosen before resolution.
This commit is contained in:
parent
2974907293
commit
daff690af3
2 changed files with 54 additions and 6 deletions
|
@ -107,12 +107,13 @@ class SnapcasterMageEffect extends ContinuousEffectImpl<SnapcasterMageEffect> {
|
|||
public SnapcasterMageEffect copy() {
|
||||
return new SnapcasterMageEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
Card card = game.getCard(targetPointer.getFirst(game, source));
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (card != null && sourceObject != null) {
|
||||
game.informPlayers(new StringBuilder(sourceObject.getName()).append(" gained Flashback to ").append(card.getName()).toString());
|
||||
game.informPlayers(new StringBuilder(sourceObject.getName()).append(" gives Flashback to ").append(card.getName()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,24 +34,27 @@ import mage.abilities.LoyaltyAbility;
|
|||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.GetEmblemEffect;
|
||||
import mage.abilities.effects.common.PutOntoBattlefieldTargetEffect;
|
||||
import mage.abilities.effects.common.RevealLibraryPutIntoHandEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
|
@ -79,9 +82,7 @@ public class GarrukCallerOfBeasts extends CardImpl<GarrukCallerOfBeasts> {
|
|||
this.addAbility(new LoyaltyAbility(new RevealLibraryPutIntoHandEffect(5, new FilterCreatureCard("all creature cards"),true), 1));
|
||||
|
||||
// -3: You may put a green creature card from your hand onto the battlefield.
|
||||
LoyaltyAbility ability2 = new LoyaltyAbility(new PutOntoBattlefieldTargetEffect(false), -3);
|
||||
ability2.addTarget(new TargetCardInHand(filterGreenCreature));
|
||||
this.addAbility(ability2);
|
||||
this.addAbility(new LoyaltyAbility(new GarrukCallerOfBeastsPutOntoBattlefieldEffect(), -3));
|
||||
|
||||
// -7: You get an emblem with "Whenever you cast a creature spell, you may search your library for a creature card, put it onto the battlefield, then shuffle your library.");
|
||||
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new GarrukCallerOfBeastsEmblem()), -7));
|
||||
|
@ -113,3 +114,49 @@ class GarrukCallerOfBeastsEmblem extends Emblem {
|
|||
this.getAbilities().add(ability);
|
||||
}
|
||||
}
|
||||
|
||||
class GarrukCallerOfBeastsPutOntoBattlefieldEffect extends OneShotEffect<GarrukCallerOfBeastsPutOntoBattlefieldEffect> {
|
||||
|
||||
private static final FilterCreatureCard filterGreenCreature = new FilterCreatureCard("a green creature card from your hand");
|
||||
|
||||
static {
|
||||
filterGreenCreature.add(new ColorPredicate(ObjectColor.GREEN));
|
||||
}
|
||||
|
||||
public GarrukCallerOfBeastsPutOntoBattlefieldEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.staticText = "You may put a green creature card from your hand onto the battlefield";
|
||||
}
|
||||
|
||||
public GarrukCallerOfBeastsPutOntoBattlefieldEffect(final GarrukCallerOfBeastsPutOntoBattlefieldEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GarrukCallerOfBeastsPutOntoBattlefieldEffect copy() {
|
||||
return new GarrukCallerOfBeastsPutOntoBattlefieldEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (controller.getHand().count(filterGreenCreature, game) > 0) {
|
||||
|
||||
if (controller.chooseUse(Outcome.PutCreatureInPlay,
|
||||
"Put a green creature card onto the battlefield?", game)) {
|
||||
Target target = new TargetCardInHand(filterGreenCreature);
|
||||
target.setRequired(true);
|
||||
if (controller.chooseTarget(outcome, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
controller.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue