From 022587e6f97a362869bc10dec06c03ffb8937e16 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 4 Feb 2014 22:18:06 +0100 Subject: [PATCH] * Felhide Spiritbinder - Fixed a bug that the copied token did not have a supertype l(e.g. Legendary). --- .../sets/bornofthegods/FelhideSpiritbinder.java | 14 +++++++++----- .../abilities/effects/common/DoIfCostPaid.java | 14 +++++++++++++- Mage/src/mage/game/permanent/PermanentToken.java | 11 ++++++----- Mage/src/mage/game/permanent/token/Token.java | 7 ++++++- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/Mage.Sets/src/mage/sets/bornofthegods/FelhideSpiritbinder.java b/Mage.Sets/src/mage/sets/bornofthegods/FelhideSpiritbinder.java index d85b1b253c9..07f55979c61 100644 --- a/Mage.Sets/src/mage/sets/bornofthegods/FelhideSpiritbinder.java +++ b/Mage.Sets/src/mage/sets/bornofthegods/FelhideSpiritbinder.java @@ -38,14 +38,15 @@ import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.InspiredAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; +import mage.game.permanent.Permanent; import mage.sets.tokens.EmptyToken; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; @@ -74,7 +75,7 @@ public class FelhideSpiritbinder extends CardImpl { this.toughness = new MageInt(4); // Inspired - Whenever Felhide Spiritbinder becomes untapped, you may pay {1}{R}. If you do, put a token onto the battlefield that's a copy of another target creature except it's an enchantment in addition to its other types. It gains haste. Exile it at the beginning of the next end step. - Ability ability = new InspiredAbility(new DoIfCostPaid(new FelhideSpiritbinderEffect(), new ManaCostsImpl("{1}{R}"))); + Ability ability = new InspiredAbility(new DoIfCostPaid(new FelhideSpiritbinderEffect(), new ManaCostsImpl("{1}{R}"),"Use effect of {source}?")); ability.addTarget(new TargetCreaturePermanent(filter, true)); this.addAbility(ability); } @@ -107,10 +108,13 @@ class FelhideSpiritbinderEffect extends OneShotEffect @Override public boolean apply(Game game, Ability source) { - Card card = game.getCard(source.getFirstTarget()); - if (card != null) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD); + } + if (permanent != null) { EmptyToken token = new EmptyToken(); - CardUtil.copyTo(token).from(card); + CardUtil.copyTo(token).from(permanent); if (!token.getCardType().contains(CardType.ENCHANTMENT)) { token.getCardType().add(CardType.ENCHANTMENT); diff --git a/Mage/src/mage/abilities/effects/common/DoIfCostPaid.java b/Mage/src/mage/abilities/effects/common/DoIfCostPaid.java index f09b06c42b8..cc6348c453d 100644 --- a/Mage/src/mage/abilities/effects/common/DoIfCostPaid.java +++ b/Mage/src/mage/abilities/effects/common/DoIfCostPaid.java @@ -13,17 +13,24 @@ import mage.util.CardUtil; public class DoIfCostPaid extends OneShotEffect { private final OneShotEffect executingEffect; private final Cost cost; + private String chooseUseText; public DoIfCostPaid(OneShotEffect effect, Cost cost) { + this(effect, cost, null); + } + + public DoIfCostPaid(OneShotEffect effect, Cost cost, String chooseUseText) { super(Outcome.Benefit); this.executingEffect = effect; this.cost = cost; + this.chooseUseText = chooseUseText; } public DoIfCostPaid(final DoIfCostPaid effect) { super(effect); this.executingEffect = (OneShotEffect) effect.executingEffect.copy(); this.cost = effect.cost.copy(); + this.chooseUseText = effect.chooseUseText; } @Override @@ -31,7 +38,12 @@ public class DoIfCostPaid extends OneShotEffect { Player player = game.getPlayer(source.getControllerId()); MageObject mageObject = game.getObject(source.getSourceId()); if (player != null && mageObject != null) { - String message = new StringBuilder(getCostText()).append(" and ").append(executingEffect.getText(source.getModes().getMode())).append("?").toString(); + String message; + if (chooseUseText == null) { + message = new StringBuilder(getCostText()).append(" and ").append(executingEffect.getText(source.getModes().getMode())).append("?").toString(); + } else { + message = chooseUseText; + } message = CardUtil.replaceSourceName(message, mageObject.getName()); if (player.chooseUse(executingEffect.getOutcome(), message, game)) { cost.clearPaid(); diff --git a/Mage/src/mage/game/permanent/PermanentToken.java b/Mage/src/mage/game/permanent/PermanentToken.java index 8416d15611b..9c7eb0ebad4 100644 --- a/Mage/src/mage/game/permanent/PermanentToken.java +++ b/Mage/src/mage/game/permanent/PermanentToken.java @@ -75,11 +75,12 @@ public class PermanentToken extends PermanentImpl { for (ManaCost cost: token.getManaCost()) { this.getManaCost().add(cost.copy()); } - this.cardType = token.getCardType(); - this.color = token.getColor(); - this.power = token.getPower(); - this.toughness = token.getToughness(); - this.subtype = token.getSubtype(); + this.cardType.addAll(token.getCardType()); + this.color = token.getColor().copy(); + this.power.initValue(token.getPower().getValue()); + this.toughness.initValue(token.getToughness().getValue()); + this.supertype.addAll(token.getSupertype()); + this.subtype.addAll(token.getSubtype()); } @Override diff --git a/Mage/src/mage/game/permanent/token/Token.java b/Mage/src/mage/game/permanent/token/Token.java index 63ba63057e5..cea868bed0d 100644 --- a/Mage/src/mage/game/permanent/token/Token.java +++ b/Mage/src/mage/game/permanent/token/Token.java @@ -117,7 +117,12 @@ public class Token extends MageObjectImpl { public boolean putOntoBattlefield(int amount, Game game, UUID sourceId, UUID controllerId, boolean tapped, boolean attacking) { Card source = game.getCard(sourceId); - String setCode = source != null ? source.getExpansionSetCode() : null; + String setCode; + if (this.getOriginalExpansionSetCode() != null && !this.getOriginalExpansionSetCode().isEmpty()) { + setCode = this.getOriginalExpansionSetCode(); + } else { + setCode = source != null ? source.getExpansionSetCode() : null; + } GameEvent event = GameEvent.getEvent(EventType.CREATE_TOKEN, null, sourceId, controllerId, amount); if (!game.replaceEvent(event)) { amount = event.getAmount();