mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Deep-Sea Kraken - Fixed that the triggered ability to remove time counters did not work.
This commit is contained in:
parent
8d31a38d1d
commit
c896ae2442
4 changed files with 56 additions and 8 deletions
|
@ -40,6 +40,7 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
|
@ -69,7 +70,7 @@ public class DeepSeaKraken extends CardImpl {
|
|||
this.addAbility(new SuspendAbility(9, new ManaCostsImpl("{2}{U}"), this));
|
||||
// Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it.
|
||||
this.addAbility(new ConditionalTriggeredAbility(
|
||||
new SpellCastAllTriggeredAbility(new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), filter, false), SuspendedCondition.getInstance(),
|
||||
new SpellCastAllTriggeredAbility(Zone.EXILED, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), filter, false, false), SuspendedCondition.getInstance(),
|
||||
"Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it.", false));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ package org.mage.test.cards.abilities.keywords;
|
|||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
@ -114,4 +115,28 @@ public class SuspendTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
}
|
||||
@Test
|
||||
public void testDeepSeaKraken() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
|
||||
// Suspend 9-{2}{U}
|
||||
// Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it.
|
||||
addCard(Zone.HAND, playerA, "Deep-Sea Kraken",1);
|
||||
|
||||
// Instant {1}{U}
|
||||
// Counter target spell. If the spell is countered this way, exile it with three time counters on it instead of putting it into its owner's graveyard. If it doesn't have suspend, it gains suspend. (At the beginning of its owner's upkeep, remove a counter from that card. When the last is removed, the player plays it without paying its mana cost. If it's a creature, it has haste.)
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt",1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Suspend");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertExileCount("Deep-Sea Kraken", 1);
|
||||
|
||||
assertCounterOnExiledCardCount("Deep-Sea Kraken", CounterType.TIME, 8); // -1 from spell of player B
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -490,12 +490,32 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Assert.assertNotNull("There is no such permanent on the battlefield, cardName=" + cardName, found);
|
||||
|
||||
Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters().getCount(type));
|
||||
}
|
||||
/**
|
||||
* Assert counter count on a card in exile
|
||||
*
|
||||
* @param cardName Name of the cards that should be counted.
|
||||
* @param type Type of the counter that should be counted.
|
||||
* @param count Expected count.
|
||||
*/
|
||||
public void assertCounterOnExiledCardCount(String cardName, CounterType type, int count) throws AssertionError {
|
||||
Card found = null;
|
||||
|
||||
if (found == null) {
|
||||
for (Card card : currentGame.getExile().getAllCards(currentGame)) {
|
||||
if (card.getName().equals(cardName)) {
|
||||
found = card;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Assert.assertNotNull("There is no such card in the exile, cardName=" + cardName, found);
|
||||
Assert.assertEquals("(Exile) Counter counts are not equal (" + cardName + ":" + type + ")", count, found.getCounters(currentGame).getCount(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert counter count on a player
|
||||
*
|
||||
|
|
|
@ -60,18 +60,20 @@ public class RemoveCounterSourceEffect extends OneShotEffect {
|
|||
Permanent p = game.getPermanent(source.getSourceId());
|
||||
if (p != null && p.getCounters().getCount(counter.getName()) >= counter.getCount()) {
|
||||
p.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName())
|
||||
.append(" counter from ").append(p.getName()).toString());
|
||||
.append(" counter from ").append(p.getName()).toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Card c = game.getCard(source.getSourceId());
|
||||
if (c != null && c.getCounters(game).getCount(counter.getName()) >= counter.getCount()) {
|
||||
c.removeCounters(counter.getName(), counter.getCount(), game);
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName())
|
||||
.append(" counter from ").append(c.getName())
|
||||
.append(" (").append(c.getCounters(game).getCount(counter.getName())).append(" left)").toString());
|
||||
.append(" counter from ").append(c.getName())
|
||||
.append(" (").append(c.getCounters(game).getCount(counter.getName())).append(" left)").toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue