1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-12 09:11:05 -09:00

* 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
Mage.Sets/src/mage/cards/c
Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords
Mage/src/main/java/mage

View file

@ -1,16 +1,16 @@
/*
* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
@ -55,14 +55,14 @@ public class ContestedWarZone extends CardImpl {
private static final FilterAttackingCreature filter = new FilterAttackingCreature("Attacking creatures");
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.
this.addAbility(new ContestedWarZoneAbility());
// {T}: Add {C} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {1}, {T}: Attacking creatures get +1/+0 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 0, Duration.EndOfTurn, filter, false), new ManaCostsImpl("{1}"));
ability.addCost(new TapSourceCost());
@ -84,7 +84,7 @@ class ContestedWarZoneAbility extends TriggeredAbilityImpl {
public ContestedWarZoneAbility() {
super(Zone.BATTLEFIELD, new ContestedWarZoneEffect());
}
}
public ContestedWarZoneAbility(final ContestedWarZoneAbility ability) {
super(ability);
@ -102,7 +102,7 @@ class ContestedWarZoneAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
if (damageEvent.isCombatDamage()) {
Permanent permanent = game.getPermanent(event.getSourceId());
if (damageEvent.getPlayerId().equals(getControllerId()) && permanent != null && permanent.isCreature()) {
@ -137,7 +137,7 @@ class ContestedWarZoneEffect extends ContinuousEffectImpl {
@Override
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());
if (permanent != null && controllerId != null) {
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.Zone;
import org.junit.Ignore;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -512,4 +513,45 @@ public class FlashbackTest extends CardTestPlayerBase {
assertExileCount(playerA, dReturn, 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);
ChoiceColor choice = new ChoiceColor(true, mes, game.getObject(source.getSourceId()));
if (controller.choose(outcome, choice, game)) {
if (choice.getColor() == null) {
return false;
}
Mana createdMana = choice.getMana(amount);
if (createdMana != null) {
checkToFirePossibleEvents(createdMana, game, source);

View file

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

View file

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