1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-08 17:00:07 -09:00

* Cavern of Soul - Fixed a bug that caused that every spell could not be countered that was cast using the first (colorless) mana ability (fixes ).

This commit is contained in:
LevelX2 2014-03-12 15:53:27 +01:00
parent 0356272cae
commit 1e7cfa086b
4 changed files with 34 additions and 4 deletions
Mage.Sets/src/mage/sets/avacynrestored
Mage.Tests/src/test/java/org/mage/test/cards/single/avr
Mage/src/mage/players

View file

@ -130,6 +130,7 @@ class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
@Override
public ConditionalMana build(Object... options) {
this.mana.setFlag(true); // indicates that the mana is from second ability
return new CavernOfSoulsConditionalMana(this.mana);
}
@ -169,7 +170,7 @@ class CavernOfSoulsManaCondition extends CreatureCastManaCondition {
class CavernOfSoulsWatcher extends WatcherImpl<CavernOfSoulsWatcher> {
public List<UUID> spells = new ArrayList<UUID>();
public List<UUID> spells = new ArrayList<>();
public CavernOfSoulsWatcher() {
super("ManaPaidFromCavernOfSoulsWatcher", WatcherScope.GAME);
@ -188,7 +189,7 @@ class CavernOfSoulsWatcher extends WatcherImpl<CavernOfSoulsWatcher> {
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.MANA_PAYED) {
MageObject object = game.getObject(event.getSourceId());
if (object != null && object.getName().equals("Cavern of Souls")) {
if (object != null && object.getName().equals("Cavern of Souls") && event.getFlag()) {
spells.add(event.getTargetId());
}
}

View file

@ -82,7 +82,7 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
}
/**
* Tests card can be countered for cast with Cavern of Souls
* Tests spell can't be countered for cast with Cavern of Souls
*/
@Test
public void testDrakeCantBeCountered() {
@ -90,6 +90,7 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
addCard(Zone.HAND, playerA, "Cavern of Souls");
addCard(Zone.HAND, playerA, "Azure Drake");
// {1}{U} Remove Soul - Counter target creature spell.
addCard(Zone.HAND, playerB, "Remove Soul");
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
@ -107,5 +108,32 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
assertGraveyardCount(playerA, "Azure Drake", 0);
assertPermanentCount(playerA, "Azure Drake", 1);
}
/**
* Tests spell can be countered if cast with colorless mana from Cavern
*/
@Test
public void testDrakeCanBeCountered() {
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
addCard(Zone.HAND, playerA, "Cavern of Souls");
addCard(Zone.HAND, playerA, "Azure Drake");
// {1}{U} Remove Soul - Counter target creature spell.
addCard(Zone.HAND, playerB, "Remove Soul");
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
setChoice(playerA, "Drake");
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cavern of Souls");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Azure Drake");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Remove Soul");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
// check it was countered
assertGraveyardCount(playerB, "Remove Soul", 1);
assertGraveyardCount(playerA, "Azure Drake", 1);
assertPermanentCount(playerA, "Azure Drake", 0);
}
}

View file

@ -327,7 +327,7 @@ public class ManaPool implements Serializable {
for (ConditionalMana mana : getConditionalMana()) {
if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId())) {
mana.set(manaType, mana.get(manaType) - 1);
game.fireEvent(new GameEvent(GameEvent.EventType.MANA_PAYED, ability.getId(), mana.getManaProducerId(), ability.getControllerId()));
game.fireEvent(new GameEvent(GameEvent.EventType.MANA_PAYED, ability.getId(), mana.getManaProducerId(), ability.getControllerId(), 0, mana.getFlag()));
break;
}
}

View file

@ -66,6 +66,7 @@ public class ManaPoolItem implements Serializable {
this.conditionalMana = conditionalMana;
this.sourceId = sourceId;
this.conditionalMana.setManaProducerId(sourceId);
this.flag = conditionalMana.getFlag();
}
public ManaPoolItem(final ManaPoolItem item) {