mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -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
|
|
@ -2,6 +2,8 @@ package org.mage.test.cards.cost.adventure;
|
|||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -331,4 +333,25 @@ public class AdventureCardsTest extends CardTestPlayerBase {
|
|||
assertExileCount(playerA, 0);
|
||||
assertGraveyardCount(playerA, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdventurePermanentText() {
|
||||
setStrictChooseMode(true);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
addCard(Zone.HAND, playerA, "Rimrock Knight");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rimrock Knight");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
assertHandCount(playerA, 0);
|
||||
assertPermanentCount(playerA, "Rimrock Knight", 1);
|
||||
assertExileCount(playerA, 0);
|
||||
assertGraveyardCount(playerA, 0);
|
||||
|
||||
Permanent rimrock = getPermanent("Rimrock Knight");
|
||||
Assert.assertEquals(rimrock.getRules(currentGame).get(0), "{this} can't block.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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