diff --git a/Mage.Sets/src/mage/cards/m/MythUnbound.java b/Mage.Sets/src/mage/cards/m/MythUnbound.java index 2f47e93bf4..421ff850c8 100644 --- a/Mage.Sets/src/mage/cards/m/MythUnbound.java +++ b/Mage.Sets/src/mage/cards/m/MythUnbound.java @@ -80,7 +80,7 @@ class MythUnboundCostReductionEffect extends CostModificationEffectImpl { public boolean apply(Game game, Ability source, Ability abilityToModify) { Ability spellAbility = abilityToModify; if (spellAbility != null) { - Integer amount = (Integer) game.getState().getValue(abilityToModify.getControllerId() + "_castCount"); + Integer amount = (Integer) game.getState().getValue(abilityToModify.getSourceId() + "_castCount"); if (amount != null && amount > 0) { CardUtil.reduceCost(spellAbility, amount); return true; @@ -99,7 +99,7 @@ class MythUnboundCostReductionEffect extends CostModificationEffectImpl { if (abilityToModify.isControlledBy(source.getControllerId())) { Spell spell = (Spell) game.getStack().getStackObject(abilityToModify.getId()); if (spell != null) { - return player.getCommandersIds().contains(spell.getId()); + return player.getCommandersIds().contains(spell.getSourceId()); } } } diff --git a/Mage.Tests/CommanderOviya.dck b/Mage.Tests/CommanderOviya.dck new file mode 100644 index 0000000000..ffbcf0dbfd --- /dev/null +++ b/Mage.Tests/CommanderOviya.dck @@ -0,0 +1,77 @@ +NAME:Oviya Test Deck +1 [C14:56] Loreseeker's Stone +1 [C14:54] Commander's Sphere +1 [C14:53] Assault Suit +1 [C14:52] Wolfcaller's Howl +1 [C14:51] Wave of Vitriol +1 [C14:50] Titania, Protector of Argoth +1 [C14:305] Oran-Rief, the Vastwood +1 [C14:227] Wren's Run Packmaster +1 [C14:226] Wood Elves +1 [C14:225] Wolfbriar Elemental +1 [C14:302] Jungle Basin +1 [C14:268] Skullclamp +1 [C14:224] Whirlwind +1 [C14:301] Havenwood Battleground +1 [C14:223] Wellwisher +1 [C14:267] Seer's Sundial +1 [C14:300] Haunted Fengraf +1 [C14:189] Drove of Elves +1 [C14:222] Tornado Elemental +1 [C14:221] Titania's Chosen +1 [C14:188] Desert Twister +1 [C14:220] Timberwatch Elf +1 [C14:187] Collective Unconscious +1 [C14:263] Predator, Flagship +1 [C14:186] Beastmaster Ascension +1 [C14:61] Myriad Landscape +1 [C14:316] Tranquil Thicket +1 [C14:315] Terramorphic Expanse +1 [C14:237] Emerald Medallion +1 [C14:311] Slippery Karst +1 [C14:199] Harrow +1 [C14:275] Swiftfoot Boots +1 [C14:198] Grim Flowering +1 [C14:197] Fresh Meat +1 [C14:196] Farhaven Elf +1 [C14:195] Ezuri, Renegade Leader +1 [C14:194] Essence Warden +1 [C14:193] Elvish Visionary +1 [C14:270] Sol Ring +1 [C14:192] Elvish Skysweeper +1 [C14:191] Elvish Mystic +1 [C14:190] Elvish Archdruid +1 [C14:209] Praetor's Counsel +1 [C14:208] Overwhelming Stampede +1 [C14:207] Overrun +1 [C14:206] Masked Admirers +1 [C14:205] Lys Alana Huntmaster +1 [C14:204] Llanowar Elves +1 [C14:203] Joraga Warcaller +1 [C14:202] Imperious Perfect +1 [C14:201] Immaculate Magistrate +1 [C14:289] Crystal Vein +1 [C14:200] Hunting Triad +1 [C14:45] Lifeblood Hydra +1 [C14:44] Grave Sifter +1 [C14:42] Creeperhulk +1 [C14:219] Thornweald Archer +1 [C14:49] Thunderfoot Baloth +1 [C14:218] Terastodon +1 [C14:217] Sylvan Safekeeper +1 [C14:48] Sylvan Offering +1 [C14:216] Sylvan Ranger +1 [C14:47] Song of the Dryads +1 [C14:215] Soul of the Harvest +1 [C14:46] Siege Behemoth +1 [C14:214] Silklash Spider +1 [C14:213] Reclamation Sage +25 [C14:334] Forest +1 [C14:212] Rampaging Baloths +1 [C14:211] Primordial Sage +1 [C14:210] Priest of Titania +1 [C14:298] Ghost Quarter +1 [C14:297] Gargoyle Castle +1 [C14:252] Moss Diamond +1 [C14:295] Evolving Wilds +SB: 1 [KLD:165] Oviya Pashiri, Sage Lifecrafter diff --git a/Mage.Tests/src/test/java/org/mage/test/commander/CommanderColorIdentityTest.java b/Mage.Tests/src/test/java/org/mage/test/commander/CommanderColorIdentityTest.java index 293bde40aa..7dcfa0c827 100644 --- a/Mage.Tests/src/test/java/org/mage/test/commander/CommanderColorIdentityTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/commander/CommanderColorIdentityTest.java @@ -1,11 +1,9 @@ - package org.mage.test.commander; import mage.cards.Card; import mage.cards.repository.CardInfo; import mage.cards.repository.CardRepository; import mage.filter.FilterMana; -import mage.util.CardUtil; import org.junit.Assert; import org.junit.Test; import org.mage.test.serverside.base.CardTestCommander3PlayersFFA; diff --git a/Mage.Tests/src/test/java/org/mage/test/commander/duel/MythUnboundTest.java b/Mage.Tests/src/test/java/org/mage/test/commander/duel/MythUnboundTest.java new file mode 100644 index 0000000000..0388fbde92 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/commander/duel/MythUnboundTest.java @@ -0,0 +1,51 @@ +package org.mage.test.commander.duel; + +import java.io.FileNotFoundException; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.GameException; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestCommanderDuelBase; + +/** + * + * @author LevelX2 + */ +public class MythUnboundTest extends CardTestCommanderDuelBase { + + @Override + protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException { + // Karador, Ghost Chieftain costs {1} less to cast for each creature card in your graveyard. + // During each of your turns, you may cast one creature card from your graveyard. + setDecknamePlayerA("CommanderOviya.dck"); // Commander = Oviya Pashiri, Sage Lifecrafter {G} + setDecknamePlayerB("CMDNorinTheWary.dck"); + + return super.createNewGameAndPlayers(); + } + + @Test + public void castCommanderTwice() { + addCard(Zone.BATTLEFIELD, playerA, "Forest", 4); + // Your commander costs {1} less to cast for each time it's been cast from the command zone this game. + // Whenever your commander is put into the command zone from anywhere, draw a card. + addCard(Zone.BATTLEFIELD, playerA, "Myth Unbound", 1); // Enchantment {2}{G} + + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2); + addCard(Zone.HAND, playerB, "Lightning Bolt", 1); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Oviya Pashiri, Sage Lifecrafter"); + + castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, "Lightning Bolt", "Oviya Pashiri, Sage Lifecrafter"); + + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Oviya Pashiri, Sage Lifecrafter"); + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertPermanentCount(playerA, "Myth Unbound", 1); + assertGraveyardCount(playerB, "Lightning Bolt", 1); + assertPermanentCount(playerA, "Oviya Pashiri, Sage Lifecrafter", 1); + assertHandCount(playerA, 1); + assertTappedCount("Forest", false, 1); + } +} diff --git a/Mage/src/main/java/mage/abilities/common/ZoneChangeAllTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/ZoneChangeAllTriggeredAbility.java index 77872721e3..9d97496682 100644 --- a/Mage/src/main/java/mage/abilities/common/ZoneChangeAllTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ZoneChangeAllTriggeredAbility.java @@ -1,5 +1,3 @@ - - package mage.abilities.common; import mage.abilities.TriggeredAbilityImpl; @@ -50,8 +48,9 @@ public class ZoneChangeAllTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - ZoneChangeEvent zEvent = (ZoneChangeEvent)event; - if ((fromZone == null || zEvent.getFromZone() == fromZone) && (toZone == null || zEvent.getToZone() == toZone)) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if ((fromZone == null || fromZone.match(zEvent.getFromZone())) + && (toZone == null || toZone.match(zEvent.getToZone()))) { Permanent perm; if (zEvent.getTarget() != null) { perm = zEvent.getTarget();