* Some minor chnages.

This commit is contained in:
LevelX2 2018-02-14 22:57:57 +01:00
parent 00dd941260
commit d10d6361ac
5 changed files with 58 additions and 18 deletions

View file

@ -55,7 +55,7 @@ public class ContestedWarZone extends CardImpl {
private static final FilterAttackingCreature filter = new FilterAttackingCreature("Attacking creatures"); private static final FilterAttackingCreature filter = new FilterAttackingCreature("Attacking creatures");
public ContestedWarZone(UUID ownerId, CardSetInfo setInfo) { public ContestedWarZone(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},null); super(ownerId, setInfo, new CardType[]{CardType.LAND}, null);
// Whenever a creature deals combat damage to you, that creature's controller gains control of Contested War Zone. // Whenever a creature deals combat damage to you, that creature's controller gains control of Contested War Zone.
this.addAbility(new ContestedWarZoneAbility()); this.addAbility(new ContestedWarZoneAbility());
@ -102,7 +102,7 @@ class ContestedWarZoneAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event; DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
if (damageEvent.isCombatDamage()) { if (damageEvent.isCombatDamage()) {
Permanent permanent = game.getPermanent(event.getSourceId()); Permanent permanent = game.getPermanent(event.getSourceId());
if (damageEvent.getPlayerId().equals(getControllerId()) && permanent != null && permanent.isCreature()) { if (damageEvent.getPlayerId().equals(getControllerId()) && permanent != null && permanent.isCreature()) {
@ -137,7 +137,7 @@ class ContestedWarZoneEffect extends ContinuousEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); Permanent permanent = game.getPermanent(source.getSourceId());
UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString()); UUID controllerId = (UUID) game.getState().getValue(source.getSourceId().toString());
if (permanent != null && controllerId != null) { if (permanent != null && controllerId != null) {
return permanent.changeControllerId(controllerId, game); return permanent.changeControllerId(controllerId, game);

View file

@ -29,6 +29,7 @@ package org.mage.test.cards.abilities.keywords;
import mage.constants.PhaseStep; import mage.constants.PhaseStep;
import mage.constants.Zone; import mage.constants.Zone;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase; import org.mage.test.serverside.base.CardTestPlayerBase;
@ -512,4 +513,45 @@ public class FlashbackTest extends CardTestPlayerBase {
assertExileCount(playerA, dReturn, 1); assertExileCount(playerA, dReturn, 1);
assertPermanentCount(playerA, bSable, 1); assertPermanentCount(playerA, bSable, 1);
} }
/**
* I can play Force of Will with flashback paying his alternative mana cost.
* The ruling say no to it, because we only can choose one alternative cost
* to a spell, and the flashback cost is already an alternative cost.
*/
@Test
@Ignore
public void testSnapcasterMageSpellWithAlternateCost() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
// When Snapcaster Mage enters the battlefield, target instant or sorcery card in your graveyard gains flashback until end of turn.
// The flashback cost is equal to its mana cost.
addCard(Zone.HAND, playerA, "Snapcaster Mage", 2); // Creature{1}{U}
// You may pay 1 life and exile a blue card from your hand rather than pay Force of Will's mana cost.
// Counter target spell.
addCard(Zone.GRAVEYARD, playerA, "Force of Will");
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Snapcaster Mage");
setChoice(playerA, "Force of Will");
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Snapcaster Mage");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Flashback", null, "Lightning Bolt");
addTarget(playerA, "Lightning Bolt");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Snapcaster Mage", 0);
assertGraveyardCount(playerA, "Snapcaster Mage", 1);
assertGraveyardCount(playerA, "Force of Will", 1);
assertGraveyardCount(playerB, "Lightning Bolt", 1);
assertLife(playerA, 20);
}
} }

View file

@ -72,6 +72,9 @@ public class AddManaOfAnyColorEffect extends BasicManaEffect {
String mes = String.format("Select color of %d mana to add it to your mana pool", this.amount); String mes = String.format("Select color of %d mana to add it to your mana pool", this.amount);
ChoiceColor choice = new ChoiceColor(true, mes, game.getObject(source.getSourceId())); ChoiceColor choice = new ChoiceColor(true, mes, game.getObject(source.getSourceId()));
if (controller.choose(outcome, choice, game)) { if (controller.choose(outcome, choice, game)) {
if (choice.getColor() == null) {
return false;
}
Mana createdMana = choice.getMana(amount); Mana createdMana = choice.getMana(amount);
if (createdMana != null) { if (createdMana != null) {
checkToFirePossibleEvents(createdMana, game, source); checkToFirePossibleEvents(createdMana, game, source);

View file

@ -11,8 +11,6 @@ import mage.constants.SubLayer;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import java.util.UUID;
public class PlayLandsFromGraveyardEffect extends ContinuousEffectImpl { public class PlayLandsFromGraveyardEffect extends ContinuousEffectImpl {
public PlayLandsFromGraveyardEffect() { public PlayLandsFromGraveyardEffect() {
@ -33,11 +31,10 @@ public class PlayLandsFromGraveyardEffect extends ContinuousEffectImpl {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null) { if (player != null) {
for (UUID cardId: player.getGraveyard()) { for (Card card : player.getGraveyard().getCards(game)) {
Card card = game.getCard(cardId); if (card != null && card.isLand()) {
if(card != null && card.isLand()){
PlayLandFromGraveyardAbility ability = new PlayLandFromGraveyardAbility(card.getName()); PlayLandFromGraveyardAbility ability = new PlayLandFromGraveyardAbility(card.getName());
ability.setSourceId(cardId); ability.setSourceId(card.getId());
ability.setControllerId(card.getOwnerId()); ability.setControllerId(card.getOwnerId());
game.getState().addOtherAbility(card, ability); game.getState().addOtherAbility(card, ability);
} }

View file

@ -30,9 +30,7 @@ package mage.game.draft;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.repository.CardCriteria;
import mage.cards.repository.CardInfo; import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository; import mage.cards.repository.CardRepository;
import mage.util.RandomUtil; import mage.util.RandomUtil;