mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
* Some more minor changes. Added test.
This commit is contained in:
parent
093b22081a
commit
d7255f971c
5 changed files with 56 additions and 62 deletions
|
@ -1,36 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Config.xsd">
|
||||
<server serverAddress="0.0.0.0" serverName="mage-server" port="17171" maxGameThreads="10" maxSecondsIdle="600"/>
|
||||
<playerTypes>
|
||||
<playerType name="Human" jar="mage-player-human.jar" className="mage.player.human.HumanPlayer"/>
|
||||
<playerType name="Computer - minimax" jar="mage-player-aiminimax.jar" className="mage.player.ai.ComputerPlayer3"/>
|
||||
<playerType name="Computer - mad" jar="mage-player-ai-ma.jar" className="mage.player.ai.ComputerPlayer6"/>
|
||||
<playerType name="Computer - monte carlo" jar="mage-player-aimcts.jar" className="mage.player.ai.ComputerPlayerMCTS"/>
|
||||
</playerTypes>
|
||||
<gameTypes>
|
||||
<gameType name="Two Player Duel" jar="mage-game-twoplayerduel.jar" className="mage.game.TwoPlayerMatch" typeName="mage.game.TwoPlayerDuelType"/>
|
||||
<gameType name="Free For All" jar="mage-game-freeforall.jar" className="mage.game.FreeForAllMatch" typeName="mage.game.FreeForAllType"/>
|
||||
</gameTypes>
|
||||
<tournamentTypes>
|
||||
<tournamentType name="Elimination Booster Draft" jar="mage-tournament-booster-draft.jar" className="mage.tournament.BoosterDraftEliminationTournament" typeName="mage.tournament.BoosterDraftEliminationTournamentType"/>
|
||||
<tournamentType name="Sealed Elimination" jar="mage-tournament-sealed.jar" className="mage.tournament.SealedEliminationTournament" typeName="mage.tournament.SealedEliminationTournamentType"/>
|
||||
</tournamentTypes>
|
||||
<deckTypes>
|
||||
<deckType name="Constructed - Standard" jar="mage-deck-constructed.jar" className="mage.deck.Standard"/>
|
||||
<deckType name="Constructed - Extended" jar="mage-deck-constructed.jar" className="mage.deck.Extended"/>
|
||||
<deckType name="Constructed - Modern" jar="mage-deck-constructed.jar" className="mage.deck.Modern"/>
|
||||
<deckType name="Constructed - Vintage" jar="mage-deck-constructed.jar" className="mage.deck.Vintage"/>
|
||||
<deckType name="Constructed - Legacy" jar="mage-deck-constructed.jar" className="mage.deck.Legacy"/>
|
||||
<deckType name="Block Constructed - Innistrad" jar="mage-deck-constructed.jar" className="mage.deck.InnistradBlock"/>
|
||||
<deckType name="Block Constructed - Kamigawa" jar="mage-deck-constructed.jar" className="mage.deck.KamigawaBlock"/>
|
||||
<deckType name="Block Constructed - Khans of Tarkir" jar="mage-deck-constructed.jar" className="mage.deck.KhansOfTarkirBlock"/>
|
||||
<deckType name="Block Constructed - Return to Ravnica" jar="mage-deck-constructed.jar" className="mage.deck.ReturnToRavnicaBlock"/>
|
||||
<deckType name="Block Constructed - Scars of Mirrodin" jar="mage-deck-constructed.jar" className="mage.deck.ScarsOfMirrodinBlock"/>
|
||||
<deckType name="Block Constructed - Shadowmoore" jar="mage-deck-constructed.jar" className="mage.deck.ShadowmooreBlock"/>
|
||||
<deckType name="Block Constructed - Shards of Alara" jar="mage-deck-constructed.jar" className="mage.deck.ShardsOfAlaraBlock"/>
|
||||
<deckType name="Block Constructed - Zendikar" jar="mage-deck-constructed.jar" className="mage.deck.ZendikarBlock"/>
|
||||
<deckType name="Variant Magic - Commander" jar="mage-deck-constructed.jar" className="mage.deck.Commander"/>
|
||||
<deckType name="Limited" jar="mage-deck-limited.jar" className="mage.deck.Limited"/>
|
||||
</deckTypes>
|
||||
</config>
|
|
@ -35,13 +35,13 @@ import mage.constants.Zone;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
|
||||
/**
|
||||
|
@ -88,19 +88,17 @@ class GrafdiggersCageEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return EventType.ZONE_CHANGE.equals(event.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event instanceof ZoneChangeEvent) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() == Zone.BATTLEFIELD && (zEvent.getFromZone() == Zone.GRAVEYARD || zEvent.getFromZone() == Zone.LIBRARY)) {
|
||||
Card card = game.getCard(zEvent.getTargetId());
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
}
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.getToZone() == Zone.BATTLEFIELD && (zEvent.getFromZone() == Zone.GRAVEYARD || zEvent.getFromZone() == Zone.LIBRARY)) {
|
||||
Card card = game.getCard(zEvent.getTargetId());
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -124,20 +122,19 @@ class GrafdiggersCageEffect2 extends ContinuousRuleModifyingEffectImpl {
|
|||
return new GrafdiggersCageEffect2(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null) {
|
||||
Zone zone = game.getState().getZone(card.getId());
|
||||
if (zone != null && (zone == Zone.GRAVEYARD || zone == Zone.LIBRARY)) {
|
||||
return true;
|
||||
}
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null) {
|
||||
Zone zone = game.getState().getZone(card.getId());
|
||||
if (zone != null && (zone == Zone.GRAVEYARD || zone == Zone.LIBRARY)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -114,8 +114,8 @@ class TargetTwoNonLandCardsWithSameNameInHand extends TargetCardInHand {
|
|||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {
|
||||
Set<UUID> newPossibleTargets = new HashSet<UUID>();
|
||||
Set<UUID> possibleTargets = new HashSet<UUID>();
|
||||
Set<UUID> newPossibleTargets = new HashSet<>();
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
Player player = game.getPlayer(sourceControllerId);
|
||||
for (Card card : player.getHand().getCards(filter, game)) {
|
||||
possibleTargets.add(card.getId());
|
||||
|
|
|
@ -12,9 +12,14 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
public class GrafdiggersCageTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testCard() {
|
||||
public void testCard1() {
|
||||
// Creature cards can't enter the battlefield from graveyards or libraries.
|
||||
// Players can't cast cards in graveyards or libraries.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Grafdigger's Cage");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
|
||||
// Put two 1/1 white Spirit creature tokens with flying onto the battlefield.
|
||||
// Flashback {1}{B}
|
||||
addCard(Zone.GRAVEYARD, playerA, "Lingering Souls");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback {1}{B}");
|
||||
|
@ -28,7 +33,7 @@ public class GrafdiggersCageTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCard1() {
|
||||
public void testCard2() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Grafdigger's Cage");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
addCard(Zone.HAND, playerA, "Rise from the Grave", 1);
|
||||
|
@ -44,5 +49,34 @@ public class GrafdiggersCageTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerA, "Craw Wurm", 1);
|
||||
assertGraveyardCount(playerA, "Rise from the Grave", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* With a Grafdigger's Cage in play you can still announce Cabal Therapy and pay it's flashback cost - resulting
|
||||
* in a sacrificed creature (and any triggers along with that) and a Cabal Therapy still in the graveyard.
|
||||
*
|
||||
* Don't get me wrong, I love sacrificing 2-3 Veteran Explorer to the same Cabal Therapy, but it's just not all that fair.
|
||||
*
|
||||
* Same thing goes for cards like Ethersworn Canonist, assuming that the flashback isn't the first non-artifact spell for the turn.
|
||||
*/
|
||||
@Test
|
||||
public void testCard3() {
|
||||
// Creature cards can't enter the battlefield from graveyards or libraries.
|
||||
// Players can't cast cards in graveyards or libraries.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Grafdigger's Cage");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 2);
|
||||
|
||||
// Name a nonland card. Target player reveals his or her hand and discards all cards with that name.
|
||||
// Flashback-Sacrifice a creature. (You may cast this card from your graveyard for its flashback cost. Then exile it.)
|
||||
addCard(Zone.GRAVEYARD, playerA, "Cabal Therapy");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Flashback");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 2);
|
||||
assertGraveyardCount(playerA, "Cabal Therapy", 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ package mage.abilities.effects.common;
|
|||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
|
Loading…
Reference in a new issue