* Void Winnower - Fixed that the check for even casting costs did not work correctly.

This commit is contained in:
LevelX2 2015-11-14 11:24:26 +01:00
parent d3000da3a3
commit 70bce1c082
3 changed files with 31 additions and 5 deletions

View file

@ -31,7 +31,6 @@ import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.RestrictionEffect;
@ -45,6 +44,7 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
/**
*
@ -115,10 +115,10 @@ class VoidWinnowerCantCastEffect extends ContinuousRuleModifyingEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Ability ability = (Ability) getValue("targetAbility");
if (ability != null && (ability instanceof SpellAbility)) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null) {
// the low bit will always be set on an odd number.
return (((SpellAbility) ability).getConvertedManaCost() & 1) == 0;
return (spell.getConvertedManaCost() & 1) == 0;
}
}
return false;

View file

@ -47,7 +47,7 @@ public class MorphTest extends CardTestPlayerBase {
*
*/
@Test
public void testCastMoprhCreatureWithoutMorph() {
public void testCastMorphCreatureWithoutMorph() {
/*
Pine Walker
Creature - Elemental

View file

@ -110,4 +110,30 @@ public class CantCastTest extends CardTestPlayerBase {
assertLife(playerB, 16);
}
@Test
public void testVoidWinnowerWithMorph() {
// Your opponent can't cast spells with even converted mana costs. (Zero is even.)
// Your opponents can't block with creatures with even converted mana costs.
addCard(Zone.BATTLEFIELD, playerB, "Void Winnower");
/*
Pine Walker
Creature - Elemental
5/5
Morph {4}{G} (You may cast this card face down as a 2/2 creature for . Turn it face up any time for its morph cost.)
Whenever Pine Walker or another creature you control is turned face up, untap that creature.
*/
addCard(Zone.HAND, playerA, "Pine Walker");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "", 0);
assertHandCount(playerA, "Pine Walker", 1);
}
}