* Fixed a bug with time stamp order and change of basic land type (e.g. Blood Moon and Spreading Seas).

This commit is contained in:
LevelX2 2016-02-25 17:08:17 +01:00
parent 140672b8b3
commit df98b4e0af
4 changed files with 106 additions and 25 deletions

View file

@ -312,14 +312,12 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
url.setFlippedSide(true); url.setFlippedSide(true);
allCardsUrls.add(url); allCardsUrls.add(url);
} }
} else { } else if (card.getCardNumber() < 1) {
if (card.getCardNumber() < 1) { System.err.println("There was a critical error!");
System.err.println("There was a critical error!"); logger.error("Card has no collector ID and won't be sent to client: " + card);
logger.error("Card has no collector ID and won't be sent to client: " + card); } else if (card.getSetCode().isEmpty()) {
} else if (card.getSetCode().isEmpty()) { System.err.println("There was a critical error!");
System.err.println("There was a critical error!"); logger.error("Card has no set name and won't be sent to client:" + card);
logger.error("Card has no set name and won't be sent to client:" + card);
}
} }
} }
allCardsUrls.addAll(getTokenCardUrls()); allCardsUrls.addAll(getTokenCardUrls());

View file

@ -3,7 +3,6 @@
* To change this template file, choose Tools | Templates * To change this template file, choose Tools | Templates
* and open the template in the editor. * and open the template in the editor.
*/ */
package org.mage.test.cards.abilities.enters; package org.mage.test.cards.abilities.enters;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
@ -28,7 +27,6 @@ public class BloodMoonTest extends CardTestPlayerBase {
// or abilities that changed the permanent’s characteristics on the stack (see rule 400.7a), and continuous // or abilities that changed the permanent’s characteristics on the stack (see rule 400.7a), and continuous
// effects from the permanent’s own static abilities, but ignoring continuous effects from any other source // effects from the permanent’s own static abilities, but ignoring continuous effects from any other source
// that would affect it. // that would affect it.
// Grassland has to enter the battlefield tapped, because // Grassland has to enter the battlefield tapped, because
// the Blood Moon does not prevent ETB Replacement Effects // the Blood Moon does not prevent ETB Replacement Effects
@Test @Test
@ -39,10 +37,9 @@ public class BloodMoonTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Blood Moon"); addCard(Zone.BATTLEFIELD, playerA, "Blood Moon");
/** /**
* Grasslands * Grasslands Land Grasslands enters the battlefield tapped. {T},
* Land * Sacrifice Grasslands: Search your library for a Forest or Plains card
* Grasslands enters the battlefield tapped. * and put it onto the battlefield. Then shuffle your library.
* {T}, Sacrifice Grasslands: Search your library for a Forest or Plains card and put it onto the battlefield. Then shuffle your library.
*/ */
addCard(Zone.HAND, playerA, "Grasslands"); addCard(Zone.HAND, playerA, "Grasslands");
@ -67,11 +64,9 @@ public class BloodMoonTest extends CardTestPlayerBase {
addCard(Zone.BATTLEFIELD, playerA, "Blood Moon"); addCard(Zone.BATTLEFIELD, playerA, "Blood Moon");
/** /**
* Kabira Crossroads * Kabira Crossroads Land Kabira Crossroads enters the battlefield
* Land * tapped. When Kabira Crossroads enters the battlefield, you gain 2
* Kabira Crossroads enters the battlefield tapped. * life. {W}: Add to your mana pool.
* When Kabira Crossroads enters the battlefield, you gain 2 life.
* {W}: Add to your mana pool.
* *
*/ */
addCard(Zone.HAND, playerA, "Kabira Crossroads"); addCard(Zone.HAND, playerA, "Kabira Crossroads");
@ -87,6 +82,84 @@ public class BloodMoonTest extends CardTestPlayerBase {
assertLife(playerA, 20); // Trigger may not trigger because of Blood Moon so the 2 life were not added assertLife(playerA, 20); // Trigger may not trigger because of Blood Moon so the 2 life were not added
assertLife(playerB, 20); assertLife(playerB, 20);
}
/**
* There's a bug with Spreading Seas and Blood Moon
*
* Spreading Seas was played turn 3 in a Steam Vents, Blood Moon turn 7 or
* something
*
* The enchanted Steam Vents was producing only U when ir should produce
* only R because of blood moon's time stamp.
*
* http://blogs.magicjudges.org/articles/2013/06/18/blood-moon-in-a-modern-environment/
* Spreading Seas, which has started to see play in Modern, also functions
* similar to Prismatic Omen. If the Seas enters the battlefield before
* Blood Moon, Blood Moon wins since it has a later timestamp and the land
* will just be a Mountain. If the Seas enters the battlefield after Blood
* Moon, then the effect of the Seas wins and the land will be an Island.
*/
@Test
public void testBloodMoonAfterSpreadingSea() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
// Blood Moon 2R
// Enchantment
// Nonbasic lands are Mountains
addCard(Zone.HAND, playerA, "Blood Moon");
// Enchant land
// When Spreading Seas enters the battlefield, draw a card.
// Enchanted land is an Island.
addCard(Zone.HAND, playerA, "Spreading Seas"); // {1}{U}
// {T}: Add {C} to your mana pool.
// {T}: Add {B} or {W} to your mana pool. Caves of Koilos deals 1 damage to you.
addCard(Zone.BATTLEFIELD, playerB, "Steam Vents");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Spreading Seas", "Steam Vents");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Blood Moon");
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Spreading Seas", 1);
assertPermanentCount(playerA, "Blood Moon", 1);
assertHandCount(playerA, 1);
// Check that the Steam Vents produces only {R}
Assert.assertTrue("The mana the land can produce should be [{R}] but it's " + playerB.getManaAvailable(currentGame).toString(), playerB.getManaAvailable(currentGame).toString().equals("[{R}]"));
} }
@Test
public void testBloodMoonBeforeSpreadingSea() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mox Sapphire", 4);
// Blood Moon 2R
// Enchantment
// Nonbasic lands are Mountains
addCard(Zone.HAND, playerA, "Blood Moon");
// Enchant land
// When Spreading Seas enters the battlefield, draw a card.
// Enchanted land is an Island.
addCard(Zone.HAND, playerA, "Spreading Seas"); // {1}{U}
// {T}: Add {C} to your mana pool.
// {T}: Add {B} or {W} to your mana pool. Caves of Koilos deals 1 damage to you.
addCard(Zone.BATTLEFIELD, playerB, "Steam Vents");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Blood Moon");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Spreading Seas", "Steam Vents");
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
execute();
assertPermanentCount(playerA, "Spreading Seas", 1);
assertPermanentCount(playerA, "Blood Moon", 1);
assertHandCount(playerA, 1);
// Check that the Steam Vents produces only {R}
Assert.assertTrue("The mana the land can produce should be [{U}] but it's " + playerB.getManaAvailable(currentGame).toString(), playerB.getManaAvailable(currentGame).toString().equals("[{U}]"));
}
} }

View file

@ -98,19 +98,29 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
for (String landType : landTypes) { for (String landType : landTypes) {
switch (landType) { switch (landType) {
case "Swamp": case "Swamp":
permanent.addAbility(new BlackManaAbility(), source.getSourceId(), game); if (permanent.getSubtype().contains("Swamp")) { // type can be removed by other effect with newer timestamp, so no ability adding
permanent.addAbility(new BlackManaAbility(), source.getSourceId(), game);
}
break; break;
case "Mountain": case "Mountain":
permanent.addAbility(new RedManaAbility(), source.getSourceId(), game); if (permanent.getSubtype().contains("Mountain")) {
permanent.addAbility(new RedManaAbility(), source.getSourceId(), game);
}
break; break;
case "Forest": case "Forest":
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game); if (permanent.getSubtype().contains("Forest")) {
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
}
break; break;
case "Island": case "Island":
permanent.addAbility(new BlueManaAbility(), source.getSourceId(), game); if (permanent.getSubtype().contains("Island")) {
permanent.addAbility(new BlueManaAbility(), source.getSourceId(), game);
}
break; break;
case "Plains": case "Plains":
permanent.addAbility(new WhiteManaAbility(), source.getSourceId(), game); if (permanent.getSubtype().contains("Plains")) {
permanent.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
}
break; break;
} }
} }

View file

@ -180,7 +180,7 @@ public class Library implements Serializable {
} }
public List<UUID> getCardList() { public List<UUID> getCardList() {
return new ArrayList(library); return new ArrayList<>(library);
} }
public List<Card> getCards(Game game) { public List<Card> getCards(Game game) {