mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Kestia, the Cultivator - Fixed bestow from the Command Zone doesn't attach her to the creature you target (fixes #6763).
This commit is contained in:
parent
91571df264
commit
299e664191
6 changed files with 48 additions and 9 deletions
|
@ -3,6 +3,8 @@ package org.mage.test.commander.duel;
|
|||
|
||||
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.CardTestCommanderDuelBase;
|
||||
|
||||
|
@ -11,6 +13,7 @@ import org.mage.test.serverside.base.CardTestCommanderDuelBase;
|
|||
* @author LevelX2
|
||||
*/
|
||||
public class CastCommanderTest extends CardTestCommanderDuelBase {
|
||||
|
||||
@Test
|
||||
public void testCastCommander() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
|
@ -25,4 +28,39 @@ public class CastCommanderTest extends CardTestCommanderDuelBase {
|
|||
|
||||
assertPermanentCount(playerA, "Ob Nixilis of the Black Oath", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCastKestiaCommander() {
|
||||
// Bestow {3}{G}{W}{U}
|
||||
// Enchanted creature gets +4/+4.
|
||||
// Whenever an enchanted creature or enchantment creature you control attacks, draw a card.
|
||||
addCard(Zone.COMMAND, playerA, "Kestia, the Cultivator", 1); // Creature {1}{G}{W}{U} 4/4
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Kestia, the Cultivator using bestow", "Silvercoat Lion");
|
||||
|
||||
setStrictChooseMode(true);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertAllCommandsUsed();
|
||||
assertLife(playerA, 40);
|
||||
assertLife(playerB, 40);
|
||||
|
||||
|
||||
assertPermanentCount(playerA, "Kestia, the Cultivator", 1);
|
||||
|
||||
Permanent kestia = getPermanent("Kestia, the Cultivator", playerA);
|
||||
Assert.assertNotEquals("Kestia may not be an creature", true, kestia.isCreature());
|
||||
Assert.assertEquals("Kestia has to be an enchantment", true, kestia.isEnchantment());
|
||||
|
||||
assertPowerToughness(playerA, "Silvercoat Lion", 6, 6);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import mage.constants.Zone;
|
|||
*/
|
||||
public class CastCommanderAbility extends SpellAbility {
|
||||
|
||||
private String ruleText;
|
||||
private final String ruleText;
|
||||
|
||||
public CastCommanderAbility(Card card, SpellAbility spellTemplate) {
|
||||
super(spellTemplate);
|
||||
|
|
|
@ -12,6 +12,7 @@ import mage.cards.Card;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SpellAbilityCastMode;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TimingRule;
|
||||
|
@ -92,6 +93,7 @@ public class BestowAbility extends SpellAbility {
|
|||
public BestowAbility(Card card, String manaString) {
|
||||
super(new ManaCostsImpl(manaString), card.getName() + " using bestow");
|
||||
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||
this.spellAbilityCastMode = SpellAbilityCastMode.BESTOW;
|
||||
this.timing = TimingRule.SORCERY;
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.addTarget(auraTarget);
|
||||
|
|
|
@ -8,7 +8,8 @@ package mage.constants;
|
|||
public enum SpellAbilityCastMode {
|
||||
NORMAL("Normal"),
|
||||
MADNESS("Madness"),
|
||||
FLASHBACK("Flashback");
|
||||
FLASHBACK("Flashback"),
|
||||
BESTOW("Bestow");
|
||||
|
||||
private final String text;
|
||||
|
||||
|
|
|
@ -2059,8 +2059,6 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
if (card != null && card.isCreature()) {
|
||||
UUID wasAttachedTo = perm.getAttachedTo();
|
||||
perm.attachTo(null, this);
|
||||
//moved to mage.game.permanent.PermanentImpl::detachAllAttachments
|
||||
//BestowAbility.becomeCreature(perm, this);
|
||||
fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, wasAttachedTo, perm.getId(), perm.getControllerId()));
|
||||
} else if (movePermanentToGraveyardWithInfo(perm)) {
|
||||
somethingHappened = true;
|
||||
|
|
|
@ -244,7 +244,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
} else if (this.isEnchantment() && this.hasSubtype(SubType.AURA, game)) {
|
||||
if (ability.getTargets().stillLegal(ability, game)) {
|
||||
updateOptionalCosts(0);
|
||||
boolean bestow = ability instanceof BestowAbility;
|
||||
boolean bestow = SpellAbilityCastMode.BESTOW.equals(ability.getSpellAbilityCastMode());
|
||||
if (bestow) {
|
||||
// Must be removed first time, after that will be removed by continous effect
|
||||
// Otherwise effects like evolve trigger from creature comes into play event
|
||||
|
@ -274,7 +274,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
return false;
|
||||
}
|
||||
// Aura has no legal target and its a bestow enchantment -> Add it to battlefield as creature
|
||||
if (this.getSpellAbility() instanceof BestowAbility) {
|
||||
if (SpellAbilityCastMode.BESTOW.equals(this.getSpellAbility().getSpellAbilityCastMode())) {
|
||||
updateOptionalCosts(0);
|
||||
if (controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null)) {
|
||||
Permanent permanent = game.getPermanent(card.getId());
|
||||
|
@ -500,7 +500,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
cardTypes.add(CardType.CREATURE);
|
||||
return cardTypes;
|
||||
}
|
||||
if (this.getSpellAbility() instanceof BestowAbility) {
|
||||
if (SpellAbilityCastMode.BESTOW.equals(this.getSpellAbility().getSpellAbilityCastMode())) {
|
||||
ArrayList<CardType> cardTypes = new ArrayList<>();
|
||||
cardTypes.addAll(card.getCardType());
|
||||
cardTypes.remove(CardType.CREATURE);
|
||||
|
@ -511,7 +511,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
|
||||
@Override
|
||||
public SubTypeList getSubtype(Game game) {
|
||||
if (this.getSpellAbility() instanceof BestowAbility) {
|
||||
if (SpellAbilityCastMode.BESTOW.equals(this.getSpellAbility().getSpellAbilityCastMode())) {
|
||||
SubTypeList subtypes = card.getSubtype(game);
|
||||
if (!subtypes.contains(SubType.AURA)) { // do it only once
|
||||
subtypes.add(SubType.AURA);
|
||||
|
@ -523,7 +523,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
|
||||
@Override
|
||||
public boolean hasSubtype(SubType subtype, Game game) {
|
||||
if (this.getSpellAbility() instanceof BestowAbility) { // workaround for Bestow (don't like it)
|
||||
if (SpellAbilityCastMode.BESTOW.equals(this.getSpellAbility().getSpellAbilityCastMode())) { // workaround for Bestow (don't like it)
|
||||
SubTypeList subtypes = card.getSubtype(game);
|
||||
if (!subtypes.contains(SubType.AURA)) { // do it only once
|
||||
subtypes.add(SubType.AURA);
|
||||
|
|
Loading…
Reference in a new issue