mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
Remove cast ability when adventure is a permanent.
This prevents the adventure ability text from displaying when the card is on the battlefield.
This commit is contained in:
parent
abcd0512a5
commit
317a81678f
3 changed files with 41 additions and 0 deletions
|
|
@ -35,6 +35,7 @@ public class AdventureCardSpellImpl extends CardImpl implements AdventureCardSpe
|
|||
newSpellAbility.addEffect(ExileAdventureSpellEffect.getInstance());
|
||||
newSpellAbility.setCardName(adventureName);
|
||||
this.replaceSpellAbility(newSpellAbility);
|
||||
spellAbility = newSpellAbility;
|
||||
|
||||
this.setName(adventureName);
|
||||
this.adventureCardParent = adventureCardParent;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,20 @@
|
|||
|
||||
package mage.game.permanent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.cards.AdventureCard;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.LevelerCard;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
||||
|
|
@ -87,6 +92,18 @@ public class PermanentCard extends PermanentImpl {
|
|||
} else {
|
||||
this.abilities = card.getAbilities().copy();
|
||||
}
|
||||
if (card instanceof AdventureCard) {
|
||||
// Adventure card spell abilities should not appear on permanents.
|
||||
List<Ability> toRemove = new ArrayList<Ability>();
|
||||
for (Ability ability : this.abilities) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
if (((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.ADVENTURE_SPELL) {
|
||||
toRemove.add(ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
toRemove.forEach(ability -> this.abilities.remove(ability));
|
||||
}
|
||||
this.abilities.setControllerId(this.controllerId);
|
||||
this.abilities.setSourceId(objectId);
|
||||
this.cardType.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue