Fixed a bug that Bestow creatures came back assigned to enchanted creature instead as creature if exiled and returned with Flickerform.

This commit is contained in:
LevelX2 2013-11-17 09:48:40 +01:00
parent 15b3b18940
commit bfe3958aa8
3 changed files with 26 additions and 33 deletions

View file

@ -112,19 +112,6 @@ public class BestowAbility extends SpellAbility {
card.addAbility(ability); card.addAbility(ability);
} }
@Override
public boolean activate(Game game, boolean noMana) {
boolean result;
result = super.activate(game, noMana);
if (result) {
Spell spell = game.getStack().getSpell(this.getOriginalId());
if (spell != null) {
spell.getSubtype().add("Aura");
}
}
return result;
}
public BestowAbility(final BestowAbility ability) { public BestowAbility(final BestowAbility ability) {
super(ability); super(ability);
} }

View file

@ -60,7 +60,7 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
init(card); init(card);
} }
protected void init(Card card) { private void init(Card card) {
copyFromCard(card); copyFromCard(card);
/*if (card.getCardType().contains(CardType.PLANESWALKER)) { /*if (card.getCardType().contains(CardType.PLANESWALKER)) {
this.loyalty = new MageInt(card.getLoyalty().getValue()); this.loyalty = new MageInt(card.getLoyalty().getValue());

View file

@ -28,9 +28,9 @@
package mage.game.stack; package mage.game.stack;
import mage.constants.CardType; import java.util.ArrayList;
import mage.constants.Rarity; import java.util.List;
import mage.constants.Zone; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.Mana; import mage.Mana;
@ -43,8 +43,13 @@ import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts; import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.PostResolveEffect; import mage.abilities.effects.PostResolveEffect;
import mage.abilities.keyword.BestowAbility;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.SpellAbilityType; import mage.constants.SpellAbilityType;
import mage.constants.Zone;
import mage.counters.Counter; import mage.counters.Counter;
import mage.counters.Counters; import mage.counters.Counters;
import mage.game.Game; import mage.game.Game;
@ -53,28 +58,23 @@ import mage.players.Player;
import mage.target.Target; import mage.target.Target;
import mage.watchers.Watcher; import mage.watchers.Watcher;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.keyword.BestowAbility;
import mage.cards.SplitCard;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
* @param <T>
*/ */
public class Spell<T extends Spell<T>> implements StackObject, Card { public class Spell<T extends Spell<T>> implements StackObject, Card {
private List<Card> spellCards = new ArrayList<Card>(); private final List<Card> spellCards = new ArrayList<Card>();
private List<SpellAbility> spellAbilities = new ArrayList<SpellAbility>(); private final List<SpellAbility> spellAbilities = new ArrayList<SpellAbility>();
private final Card card;
private final SpellAbility ability;
private final Zone fromZone;
private final UUID id;
private Card card;
private SpellAbility ability;
private UUID controllerId; private UUID controllerId;
private boolean copiedSpell; private boolean copiedSpell;
private Zone fromZone;
private UUID id;
public Spell(Card card, SpellAbility ability, UUID controllerId, Zone fromZone) { public Spell(Card card, SpellAbility ability, UUID controllerId, Zone fromZone) {
this.card = card; this.card = card;
@ -146,7 +146,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
@Override @Override
public boolean resolve(Game game) { public boolean resolve(Game game) {
boolean result; boolean result;
if (card.getCardType().contains(CardType.INSTANT) || card.getCardType().contains(CardType.SORCERY)) { if (this.getCardType().contains(CardType.INSTANT) || this.getCardType().contains(CardType.SORCERY)) {
int index = 0; int index = 0;
result = false; result = false;
boolean legalParts = false; boolean legalParts = false;
@ -181,7 +181,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
game.informPlayers(getName() + " has been fizzled."); game.informPlayers(getName() + " has been fizzled.");
counter(null, game); counter(null, game);
return false; return false;
} else if (card.getCardType().contains(CardType.ENCHANTMENT) && card.getSubtype().contains("Aura")) { } else if (this.getCardType().contains(CardType.ENCHANTMENT) && this.getSubtype().contains("Aura")) {
if (ability.getTargets().stillLegal(ability, game)) { if (ability.getTargets().stillLegal(ability, game)) {
updateOptionalCosts(0); updateOptionalCosts(0);
if (card.putOntoBattlefield(game, Zone.HAND, ability.getId(), controllerId)) { if (card.putOntoBattlefield(game, Zone.HAND, ability.getId(), controllerId)) {
@ -189,7 +189,7 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
} }
return false; return false;
} }
if (card.getCardType().contains(CardType.CREATURE)) { // e.g. Creature with Bestow (rule confirmation yet missing) if (this.getCardType().contains(CardType.CREATURE)) { // e.g. Creature with Bestow (rule confirmation yet missing)
updateOptionalCosts(0); updateOptionalCosts(0);
result = card.putOntoBattlefield(game, Zone.HAND, ability.getId(), controllerId); result = card.putOntoBattlefield(game, Zone.HAND, ability.getId(), controllerId);
return result; return result;
@ -351,6 +351,12 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
@Override @Override
public List<String> getSubtype() { public List<String> getSubtype() {
if (this.getSpellAbility() instanceof BestowAbility) {
List<String> subtypes = new ArrayList<String>();
subtypes.addAll(card.getSubtype());
subtypes.add("Aura");
return subtypes;
}
return card.getSubtype(); return card.getSubtype();
} }