mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 19:11:59 -08: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 #391).
This commit is contained in:
parent
0356272cae
commit
1e7cfa086b
4 changed files with 34 additions and 4 deletions
|
|
@ -130,6 +130,7 @@ class CavernOfSoulsManaBuilder extends ConditionalManaBuilder {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConditionalMana build(Object... options) {
|
public ConditionalMana build(Object... options) {
|
||||||
|
this.mana.setFlag(true); // indicates that the mana is from second ability
|
||||||
return new CavernOfSoulsConditionalMana(this.mana);
|
return new CavernOfSoulsConditionalMana(this.mana);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,7 +170,7 @@ class CavernOfSoulsManaCondition extends CreatureCastManaCondition {
|
||||||
|
|
||||||
class CavernOfSoulsWatcher extends WatcherImpl<CavernOfSoulsWatcher> {
|
class CavernOfSoulsWatcher extends WatcherImpl<CavernOfSoulsWatcher> {
|
||||||
|
|
||||||
public List<UUID> spells = new ArrayList<UUID>();
|
public List<UUID> spells = new ArrayList<>();
|
||||||
|
|
||||||
public CavernOfSoulsWatcher() {
|
public CavernOfSoulsWatcher() {
|
||||||
super("ManaPaidFromCavernOfSoulsWatcher", WatcherScope.GAME);
|
super("ManaPaidFromCavernOfSoulsWatcher", WatcherScope.GAME);
|
||||||
|
|
@ -188,7 +189,7 @@ class CavernOfSoulsWatcher extends WatcherImpl<CavernOfSoulsWatcher> {
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.MANA_PAYED) {
|
if (event.getType() == GameEvent.EventType.MANA_PAYED) {
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
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());
|
spells.add(event.getTargetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
@Test
|
||||||
public void testDrakeCantBeCountered() {
|
public void testDrakeCantBeCountered() {
|
||||||
|
|
@ -90,6 +90,7 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
||||||
addCard(Zone.HAND, playerA, "Cavern of Souls");
|
addCard(Zone.HAND, playerA, "Cavern of Souls");
|
||||||
addCard(Zone.HAND, playerA, "Azure Drake");
|
addCard(Zone.HAND, playerA, "Azure Drake");
|
||||||
|
|
||||||
|
// {1}{U} Remove Soul - Counter target creature spell.
|
||||||
addCard(Zone.HAND, playerB, "Remove Soul");
|
addCard(Zone.HAND, playerB, "Remove Soul");
|
||||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||||
|
|
||||||
|
|
@ -107,5 +108,32 @@ public class CavernOfSoulsTest extends CardTestPlayerBase {
|
||||||
assertGraveyardCount(playerA, "Azure Drake", 0);
|
assertGraveyardCount(playerA, "Azure Drake", 0);
|
||||||
assertPermanentCount(playerA, "Azure Drake", 1);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ public class ManaPool implements Serializable {
|
||||||
for (ConditionalMana mana : getConditionalMana()) {
|
for (ConditionalMana mana : getConditionalMana()) {
|
||||||
if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId())) {
|
if (mana.get(manaType) > 0 && mana.apply(ability, game, mana.getManaProducerId())) {
|
||||||
mana.set(manaType, mana.get(manaType) - 1);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ public class ManaPoolItem implements Serializable {
|
||||||
this.conditionalMana = conditionalMana;
|
this.conditionalMana = conditionalMana;
|
||||||
this.sourceId = sourceId;
|
this.sourceId = sourceId;
|
||||||
this.conditionalMana.setManaProducerId(sourceId);
|
this.conditionalMana.setManaProducerId(sourceId);
|
||||||
|
this.flag = conditionalMana.getFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManaPoolItem(final ManaPoolItem item) {
|
public ManaPoolItem(final ManaPoolItem item) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue