* Steel Golem - Fixed not correct working "dont cast" effect.

This commit is contained in:
LevelX2 2017-01-20 15:46:17 +01:00
parent 2bac7637b9
commit 509139bb4a
2 changed files with 36 additions and 10 deletions

View file

@ -28,18 +28,16 @@
package mage.cards.s;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.common.FilterCreatureSpell;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
/**
*
@ -70,8 +68,6 @@ public class SteelGolem extends CardImpl {
class SteelGolemEffect extends ContinuousRuleModifyingEffectImpl {
private static final FilterCreatureSpell filter = new FilterCreatureSpell();
public SteelGolemEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "You can't cast creature spells";
@ -94,10 +90,8 @@ class SteelGolemEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getPlayerId().equals(source.getControllerId())) {
Spell spell = game.getStack().getSpell(event.getSourceId());
if (spell != null && filter.match(spell, game)) {
return true;
}
Card card = game.getCard(event.getSourceId());
return card != null && card.getCardType().contains(CardType.CREATURE);
}
return false;
}

View file

@ -105,4 +105,36 @@ public class GainControlTargetEffectTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Mutavault", 1);
}
/**
* Steel Golem, once Donate'd to another player does not disable their ability to play creature cards.
*/
@Test
public void testDonateSteelGolem() {
// You can't cast creature spells.
addCard(Zone.HAND, playerA, "Steel Golem", 1); // Creature 3/4 {3}
// Target player gains control of target permanent you control.
addCard(Zone.HAND, playerA, "Donate", 1); // Sorcery {2}{U}
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
addCard(Zone.BATTLEFIELD, playerB, "Plains", 2);
addCard(Zone.HAND, playerB, "Silvercoat Lion", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Steel Golem");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Donate", playerB);
addTarget(playerA, "Steel Golem");
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Silvercoat Lion");
setStopAt(2, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Donate", 1);
assertPermanentCount(playerA, "Steel Golem", 0);
assertPermanentCount(playerB, "Steel Golem", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 0);
assertHandCount(playerB, "Silvercoat Lion", 1);
}
}