mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Bestow - Fixed that creature with bestow went to graveyard if enchanted target got protection from a color of the bestow permanent.
This commit is contained in:
parent
cb4b2cbc05
commit
74e3fa63a8
7 changed files with 158 additions and 7 deletions
|
@ -411,7 +411,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
r = new Rectangle(21, 21);
|
||||
resized = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB), r);
|
||||
commandZone = new HoverButton(null, resized, resized, resized, r);
|
||||
commandZone.setToolTipText("Command Zone (Emblems)");
|
||||
commandZone.setToolTipText("Command Zone (Commander and Emblems)");
|
||||
commandZone.setOpaque(false);
|
||||
commandZone.setObserver(new Command() {
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.abilities.keyword.HexproofAbility;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class BestowTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests that if from bestow permanent targeted creature
|
||||
* gets protection from the color of the bestow permanent,
|
||||
* the bestow permanent becomes a creature on the battlefield.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Silent Artisan
|
||||
* Creature - Giant 3/5
|
||||
*
|
||||
*
|
||||
* Hopeful Eidolon {W}
|
||||
* Enchantment Creature - Spirit 1/1
|
||||
* Bestow {3}{W} (If you cast this card for its bestow cost, it's an Aura spell with enchant creature.
|
||||
* It becomes a creature again if it's not attached to a creature.)
|
||||
* Lifelink (Damage dealt by this creature also causes you to gain that much life.)
|
||||
* Enchanted creature gets +1/+1 and has lifelink.
|
||||
*
|
||||
* Gods Willing {W}
|
||||
* Instant
|
||||
* Target creature you control gains protection from the color of your choice until end of turn.
|
||||
* Scry 1. (Look at the top card of your library. You may put that card on the bottom of your library.)
|
||||
*
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void bestowEnchantmentToCreature() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 5);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silent Artisan");
|
||||
addCard(Zone.HAND, playerA, "Hopeful Eidolon");
|
||||
addCard(Zone.HAND, playerA, "Gods Willing");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hopeful Eidolon using bestow", "Silent Artisan");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Gods Willing", "Silent Artisan");
|
||||
setChoice(playerA, "White");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
// because of protection the Hopeful Eidolon should be a creature on the battlefield
|
||||
assertPermanentCount(playerA, "Silent Artisan", 1);
|
||||
assertPowerToughness(playerA, "Silent Artisan", 3, 5);
|
||||
assertPermanentCount(playerA, "Hopeful Eidolon", 1);
|
||||
assertPowerToughness(playerA, "Hopeful Eidolon", 1, 1);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,31 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
|
|
|
@ -1,7 +1,29 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
|
|
@ -255,8 +255,9 @@ public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
|||
|
||||
protected Permanent findPermanent(FilterPermanent filter, UUID controllerId, Game game) {
|
||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId, game);
|
||||
if (permanents.size() > 0)
|
||||
if (permanents.size() > 0) {
|
||||
return permanents.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,9 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
* it an Aura spell ends. It continues resolving as a creature spell and will be put onto the battlefield
|
||||
* under the control of the spell’s controller. This is an exception to rule 608.3a.
|
||||
*
|
||||
* 702.102e If an Aura with bestow is attached to an illegal object or player, it becomes unattached.
|
||||
* This is an exception to rule 704.5n.
|
||||
*
|
||||
* You don’t choose whether the spell is going to be an Aura spell or not until the spell is already on
|
||||
* the stack. Abilities that affect when you can cast a spell, such as flash, will apply to the creature
|
||||
* card in whatever zone you’re casting it from. For example, an effect that said you can cast creature
|
||||
|
|
|
@ -1296,8 +1296,16 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
}
|
||||
} else {
|
||||
if (!auraFilter.match(attachedTo, this) || attachedTo.hasProtectionFrom(perm, this)) {
|
||||
if (perm.moveToZone(Zone.GRAVEYARD, null, this, false)) {
|
||||
somethingHappened = true;
|
||||
// handle bestow unattachment
|
||||
Card card = this.getCard(perm.getId());
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
|
||||
UUID wasAttachedTo = perm.getAttachedTo();
|
||||
perm.attachTo(null, this);
|
||||
fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, wasAttachedTo, perm.getId(), perm.getControllerId()));
|
||||
} else {
|
||||
if (perm.moveToZone(Zone.GRAVEYARD, null, this, false)) {
|
||||
somethingHappened = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue