* Fixed that some mana effects did not send all neded events (prevented that Contamination chnaged conditonal mana from Cavern of Souls to black mana).

This commit is contained in:
LevelX2 2015-05-11 15:33:22 +02:00 committed by Luna Skyrise
parent ef1ee0adbf
commit 70f152feb1
6 changed files with 33 additions and 4 deletions

View file

@ -223,4 +223,31 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Silvercoat Lion", 0);
}
/**
* Cavern of Souls can produce any colour of mana with its second ability when Contamination is in play.
*/
@Test
public void testUseWithConversionInPlay() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
addCard(Zone.HAND, playerA, "Cavern of Souls");
// Creature - Drake {3}{R}
addCard(Zone.HAND, playerA, "Desert Drake");
addCard(Zone.BATTLEFIELD, playerB, "Contamination", 1);
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cavern of Souls");
setChoice(playerA, "Drake");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Desert Drake");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Cavern of Souls", 1);
assertPermanentCount(playerA, "Desert Drake", 0);
}
}

View file

@ -106,6 +106,7 @@ public class AddConditionalManaOfAnyColorEffect extends ManaEffect {
}
if (mana != null) {
checkToFirePossibleEvents(mana, game, source);
controller.getManaPool().addMana(mana, game, source);
result = true;
}

View file

@ -59,7 +59,7 @@ public class AddContinuousEffectToGame extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
ContinuousEffect effectToAdd = (ContinuousEffect) effect.copy();
ContinuousEffect effectToAdd = effect.copy();
game.addEffect(effectToAdd, source);
return true;
}

View file

@ -88,8 +88,8 @@ public class AddManaOfAnyColorEffect extends BasicManaEffect {
createdMana = Mana.WhiteMana(amount);
}
if (createdMana != null) {
controller.getManaPool().addMana(createdMana, game, source);
checkToFirePossibleEvents(createdMana, game, source);
controller.getManaPool().addMana(createdMana, game, source);
}
return true;
}

View file

@ -111,8 +111,9 @@ public class AddManaOfAnyTypeProducedEffect extends ManaEffect {
newMana.setColorless(1);
break;
}
targetController.getManaPool().addMana(newMana, game, source);
checkToFirePossibleEvents(newMana, game, source);
targetController.getManaPool().addMana(newMana, game, source);
}
return true;
}

View file

@ -56,7 +56,7 @@ public abstract class ManaEffect extends OneShotEffect {
public abstract Mana getMana(Game game, Ability source);
/**
* Only used for mana effects that decide which mana is produced during resolution of the effect.
* Only used for mana effects that decide which kind of mana is produced during resolution of the effect.
*
* @param mana
* @param game