Ficed a problem with Bestow, adding multiple times "AURA" subtype.

This commit is contained in:
LevelX2 2017-11-24 12:30:15 +01:00
parent a6c5871a69
commit 53448e6dc4
2 changed files with 20 additions and 11 deletions

View file

@ -190,8 +190,10 @@ class BestowEntersBattlefieldEffect extends ReplacementEffectImpl {
if (bestowPermanent != null) {
if (bestowPermanent.hasSubtype(SubType.AURA, game)) {
MageObject basicObject = bestowPermanent.getBasicMageObject(game);
basicObject.getSubtype(null).add(SubType.AURA);
basicObject.getCardType().remove(CardType.CREATURE);
if (basicObject != null && !basicObject.getSubtype(null).contains(SubType.AURA)) {
basicObject.getSubtype(null).add(SubType.AURA);
basicObject.getCardType().remove(CardType.CREATURE);
}
}
}
return false;

View file

@ -27,6 +27,10 @@
*/
package mage.game.stack;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.Mana;
@ -60,11 +64,6 @@ import mage.players.Player;
import mage.util.GameLog;
import mage.util.SubTypeList;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
@ -254,7 +253,9 @@ public class Spell extends StackObjImpl implements Card {
// Must be removed first time, after that will be removed by continous effect
// Otherwise effects like evolve trigger from creature comes into play event
card.getCardType().remove(CardType.CREATURE);
card.getSubtype(game).add(SubType.AURA);
if (!card.getSubtype(game).contains(SubType.AURA)) {
card.getSubtype(game).add(SubType.AURA);
}
}
if (controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null)) {
if (bestow) {
@ -263,7 +264,9 @@ public class Spell extends StackObjImpl implements Card {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null && permanent instanceof PermanentCard) {
permanent.setSpellAbility(ability); // otherwise spell ability without bestow will be set
card.addCardType(CardType.CREATURE);
if (!card.getCardType().contains(CardType.CREATURE)) {
card.addCardType(CardType.CREATURE);
}
card.getSubtype(game).remove(SubType.AURA);
}
}
@ -483,7 +486,9 @@ public class Spell extends StackObjImpl implements Card {
public SubTypeList getSubtype(Game game) {
if (this.getSpellAbility() instanceof BestowAbility) {
SubTypeList subtypes = card.getSubtype(game);
subtypes.add(SubType.AURA);
if (!subtypes.contains(SubType.AURA)) { // do it only once
subtypes.add(SubType.AURA);
}
return subtypes;
}
return card.getSubtype(game);
@ -493,7 +498,9 @@ public class Spell extends StackObjImpl implements Card {
public boolean hasSubtype(SubType subtype, Game game) {
if (this.getSpellAbility() instanceof BestowAbility) { // workaround for Bestow (don't like it)
SubTypeList subtypes = card.getSubtype(game);
subtypes.add(SubType.AURA);
if (!subtypes.contains(SubType.AURA)) { // do it only once
subtypes.add(SubType.AURA);
}
if (subtypes.contains(subtype)) {
return true;
}