* Golem's Heart - Fixed that the triggered ability did not work.

This commit is contained in:
LevelX2 2015-06-28 22:42:18 +02:00
parent df3e6db569
commit 148fd0e6ae
3 changed files with 124 additions and 29 deletions

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.scarsofmirrodin;
import java.util.UUID;
@ -49,6 +48,8 @@ public class GolemsHeart extends CardImpl {
public GolemsHeart(UUID ownerId) {
super(ownerId, 161, "Golem's Heart", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "SOM";
// Whenever a player casts an artifact spell, you may gain 1 life.
this.addAbility(new GolemsHeartAbility());
}
@ -80,7 +81,7 @@ class GolemsHeartAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.CAST_SPELL;
return event.getType() == EventType.SPELL_CAST;
}
@Override

View file

@ -25,11 +25,11 @@
* 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;
import mage.constants.Zone;
import mage.counters.CounterType;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -40,32 +40,27 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
public class ModularTest extends CardTestPlayerBase {
/**
* 702.42. Modular
* 702.42a Modular represents both a static ability and a triggered ability. Modular N means This
* permanent enters the battlefield with N +1/+1 counters on it and When this permanent is put
* into a graveyard from the battlefield, you may put a +1/+1 counter on target artifact creature for
* each +1/+1 counter on this permanent.
* 702.42b If a creature has multiple instances of modular, each one works separately.
* 702.42. Modular 702.42a Modular represents both a static ability and a
* triggered ability. Modular N means This permanent enters the
* battlefield with N +1/+1 counters on it and When this permanent is put
* into a graveyard from the battlefield, you may put a +1/+1 counter on
* target artifact creature for each +1/+1 counter on this permanent.
* 702.42b If a creature has multiple instances of modular, each one works
* separately.
*
*/
/**
* Arcbound Bruiser
* Artifact Creature Golem 0/0, 5 (5)
* Modular 3 (This enters the battlefield with three +1/+1 counters on it.
* When it dies, you may put its +1/+1 counters on target artifact creature.)
* Arcbound Bruiser Artifact Creature Golem 0/0, 5 (5) Modular 3 (This
* enters the battlefield with three +1/+1 counters on it. When it dies, you
* may put its +1/+1 counters on target artifact creature.)
*
*/
/**
* Arcbound Hybrid
* Artifact Creature Beast 0/0, 4 (4)
* Haste
* Modular 2 (This enters the battlefield with two +1/+1 counters on it.
* When it dies, you may put its +1/+1 counters on target artifact creature.)
* Arcbound Hybrid Artifact Creature Beast 0/0, 4 (4) Haste Modular 2
* (This enters the battlefield with two +1/+1 counters on it. When it dies,
* you may put its +1/+1 counters on target artifact creature.)
*
*/
@Test
public void testModularEnters() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
@ -108,4 +103,32 @@ public class ModularTest extends CardTestPlayerBase {
}
/**
* My Inkmoth Nexus was in creature "form". My Arcbound Ravager died. I
* could not transfer his counters on my Inkmoth "creature".
*/
@Test
public void testInkmothNexus() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
addCard(Zone.BATTLEFIELD, playerA, "Inkmoth Nexus");
addCard(Zone.HAND, playerA, "Arcbound Ravager");
addCard(Zone.HAND, playerB, "Lightning Bolt");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Arcbound Ravager");
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}: {this} becomes");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Arcbound Ravager");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertGraveyardCount(playerA, "Arcbound Ravager", 1);
assertGraveyardCount(playerB, "Lightning Bolt", 1);
assertCounterCount("Inkmoth Nexus", CounterType.P1P1, 1);
}
}

View file

@ -0,0 +1,71 @@
/*
* 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.triggers;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class GolemsHeartTest extends CardTestPlayerBase {
/*
My opponent and I were both playing artifact decks.
He had Golem's Heart out.
He wasn't gaining life when I or he was casting spells.
*/
@Test
public void testFirstTriggeredAbility() {
// Whenever a player casts an artifact spell, you may gain 1 life.
addCard(Zone.BATTLEFIELD, playerA, "Golem's Heart", 1);
addCard(Zone.HAND, playerA, "Expedition Map"); // {1}
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
addCard(Zone.HAND, playerB, "Darksteel Axe"); // {1}
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Expedition Map");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Darksteel Axe");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 22);
assertLife(playerB, 20);
assertPermanentCount(playerA, "Expedition Map", 1);
assertPermanentCount(playerB, "Darksteel Axe", 1);
}
}