Some minor changes.

This commit is contained in:
LevelX2 2017-07-28 12:21:52 +02:00
parent 99f206d536
commit ffd0c24c9c
8 changed files with 56 additions and 52 deletions

View file

@ -27,25 +27,22 @@
*/ */
package mage.cards.w; package mage.cards.w;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.players.Player; import mage.players.Player;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.constants.TargetController;
import mage.abilities.dynamicvalue.common.StaticValue;
/** /**
* *
@ -54,8 +51,7 @@ import mage.abilities.dynamicvalue.common.StaticValue;
public class WordsOfWaste extends CardImpl { public class WordsOfWaste extends CardImpl {
public WordsOfWaste(UUID ownerId, CardSetInfo setInfo) { public WordsOfWaste(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
// {1}: The next time you would draw a card this turn, each opponent discards a card instead. // {1}: The next time you would draw a card this turn, each opponent discards a card instead.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WordsOfWasteEffect(), new ManaCostsImpl("{1}"))); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WordsOfWasteEffect(), new ManaCostsImpl("{1}")));
@ -75,7 +71,7 @@ class WordsOfWasteEffect extends ReplacementEffectImpl {
public WordsOfWasteEffect() { public WordsOfWasteEffect() {
super(Duration.EndOfTurn, Outcome.Discard); super(Duration.EndOfTurn, Outcome.Discard);
staticText = "The next time you would draw a card this turn, each opponent discards a card instead."; staticText = "The next time you would draw a card this turn, each opponent discards a card instead";
} }
public WordsOfWasteEffect(final WordsOfWasteEffect effect) { public WordsOfWasteEffect(final WordsOfWasteEffect effect) {
@ -87,15 +83,13 @@ class WordsOfWasteEffect extends ReplacementEffectImpl {
return new WordsOfWasteEffect(this); return new WordsOfWasteEffect(this);
} }
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
new DiscardEachPlayerEffect(new StaticValue(1), false, TargetController.OPPONENT).apply(game, source); new DiscardEachPlayerEffect(TargetController.OPPONENT).apply(game, source);
this.used = true; this.discard();
discard(); return true;
return true;
} }
return false; return false;
} }
@ -107,9 +101,6 @@ class WordsOfWasteEffect extends ReplacementEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used) { return source.getControllerId().equals(event.getPlayerId());
return source.getControllerId().equals(event.getPlayerId());
}
return false;
} }
} }

View file

@ -27,13 +27,12 @@
*/ */
package mage.cards.w; package mage.cards.w;
import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
@ -42,11 +41,8 @@ import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.players.Player;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.game.permanent.token.BearToken; import mage.game.permanent.token.BearToken;
import mage.constants.TargetController; import mage.players.Player;
import mage.abilities.dynamicvalue.common.StaticValue;
/** /**
* *
@ -55,8 +51,7 @@ import mage.abilities.dynamicvalue.common.StaticValue;
public class WordsOfWilding extends CardImpl { public class WordsOfWilding extends CardImpl {
public WordsOfWilding(UUID ownerId, CardSetInfo setInfo) { public WordsOfWilding(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
// {1}: The next time you would draw a card this turn, create a 2/2 green Bear creature token instead. // {1}: The next time you would draw a card this turn, create a 2/2 green Bear creature token instead.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WordsOfWildingEffect(), new ManaCostsImpl("{1}"))); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WordsOfWildingEffect(), new ManaCostsImpl("{1}")));
@ -75,8 +70,8 @@ public class WordsOfWilding extends CardImpl {
class WordsOfWildingEffect extends ReplacementEffectImpl { class WordsOfWildingEffect extends ReplacementEffectImpl {
public WordsOfWildingEffect() { public WordsOfWildingEffect() {
super(Duration.EndOfTurn, Outcome.Discard); super(Duration.EndOfTurn, Outcome.PutCreatureInPlay);
staticText = "The next time you would draw a card this turn, create a 2/2 green Bear creature token instead."; staticText = "The next time you would draw a card this turn, create a 2/2 green Bear creature token instead";
} }
public WordsOfWildingEffect(final WordsOfWildingEffect effect) { public WordsOfWildingEffect(final WordsOfWildingEffect effect) {
@ -88,15 +83,13 @@ class WordsOfWildingEffect extends ReplacementEffectImpl {
return new WordsOfWildingEffect(this); return new WordsOfWildingEffect(this);
} }
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
new CreateTokenEffect(new BearToken()).apply(game, source); new CreateTokenEffect(new BearToken()).apply(game, source);
this.used = true; discard();
discard(); return true;
return true;
} }
return false; return false;
} }
@ -108,9 +101,6 @@ class WordsOfWildingEffect extends ReplacementEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used) { return source.getControllerId().equals(event.getPlayerId());
return source.getControllerId().equals(event.getPlayerId());
}
return false;
} }
} }

View file

@ -381,8 +381,9 @@ public class FlashbackTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Snapcaster Mage", 1); assertPermanentCount(playerA, "Snapcaster Mage", 1);
assertGraveyardCount(playerA, "Whispers of the Muse", 0); assertGraveyardCount(playerA, "Whispers of the Muse", 0);
assertHandCount(playerA, 1);
assertExileCount("Whispers of the Muse", 1); assertExileCount("Whispers of the Muse", 1);
assertHandCount(playerA, 1);
} }
/** /**
@ -418,7 +419,7 @@ public class FlashbackTest extends CardTestPlayerBase {
Sorcery Sorcery
Create X 1/1 red Elemental Cat creature tokens with haste. Exile them at the beginning of the next end step. Create X 1/1 red Elemental Cat creature tokens with haste. Exile them at the beginning of the next end step.
Flashback{R}{R}, Sacrifice X Mountains. Flashback{R}{R}, Sacrifice X Mountains.
*/ */
String fCatBlitz = "Firecat Blitz"; String fCatBlitz = "Firecat Blitz";
String mountain = "Mountain"; String mountain = "Mountain";
@ -506,7 +507,7 @@ public class FlashbackTest extends CardTestPlayerBase {
execute(); execute();
assertGraveyardCount(playerA, eVanguard, 1); assertGraveyardCount(playerA, eVanguard, 1);
assertGraveyardCount(playerA,yOx, 1); assertGraveyardCount(playerA, yOx, 1);
assertGraveyardCount(playerA, memnite, 1); assertGraveyardCount(playerA, memnite, 1);
assertExileCount(playerA, dReturn, 1); assertExileCount(playerA, dReturn, 1);
assertPermanentCount(playerA, bSable, 1); assertPermanentCount(playerA, bSable, 1);

View file

@ -110,4 +110,24 @@ public class DrawEffectsTest extends CardTestPlayerBase {
assertHandCount(playerA, 14); assertHandCount(playerA, 14);
assertHandCount(playerB, 0); assertHandCount(playerB, 0);
} }
@Test
public void WordsOfWilding() {
addCard(Zone.BATTLEFIELD, playerA, "Island", 4);
// {1}: The next time you would draw a card this turn, create a 2/2 green Bear creature token instead.
addCard(Zone.BATTLEFIELD, playerA, "Words of Wilding", 1);
// Draw two cards.
addCard(Zone.HAND, playerA, "Counsel of the Soratami", 1); // Sorcery {2}{U}
activateAbility(1, PhaseStep.UPKEEP, playerA, "{1}");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Counsel of the Soratami");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, "Counsel of the Soratami", 1);
assertPermanentCount(playerA, "Bear", 1);
assertHandCount(playerA, 1);
}
} }

View file

@ -45,8 +45,8 @@ public class ZurTheEnchanterTest extends CardTestPlayerBase {
* shroud (Lightning Greaves, Diplomatic Immunity, Greater Auramancy + an * shroud (Lightning Greaves, Diplomatic Immunity, Greater Auramancy + an
* aura on him, etc.) and when his ability triggers searching for an aura * aura on him, etc.) and when his ability triggers searching for an aura
* (in this case, Empyrial Armor) and trying to attach it to Zur himself. * (in this case, Empyrial Armor) and trying to attach it to Zur himself.
* The game won't allow you to attach it him, even though it should, since * The game won't allow you to attach it to him, even though it should,
* the enchantment is put onto the battlefield and not cast, hence, no * since the enchantment is put onto the battlefield and not cast, hence, no
* targeting is done. The rulings page for Zur itself say it so on Gatherer: * targeting is done. The rulings page for Zur itself say it so on Gatherer:
* *
* Shroud shouldn't stop Empyrial Armor from attaching to Zur, only * Shroud shouldn't stop Empyrial Armor from attaching to Zur, only
@ -55,7 +55,8 @@ public class ZurTheEnchanterTest extends CardTestPlayerBase {
@Test @Test
public void testAuraToBattlefieldDoesNotTarget() { public void testAuraToBattlefieldDoesNotTarget() {
// Flying // Flying
// Whenever Zur the Enchanter attacks, you may search your library for an enchantment card with converted mana cost 3 or less and put it onto the battlefield. If you do, shuffle your library. // Whenever Zur the Enchanter attacks, you may search your library for an enchantment card
// with converted mana cost 3 or less and put it onto the battlefield. If you do, shuffle your library.
addCard(Zone.BATTLEFIELD, playerB, "Zur the Enchanter"); // 1/4 addCard(Zone.BATTLEFIELD, playerB, "Zur the Enchanter"); // 1/4
addCard(Zone.BATTLEFIELD, playerB, "Island", 2); addCard(Zone.BATTLEFIELD, playerB, "Island", 2);

View file

@ -34,7 +34,6 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.MageSingleton; import mage.abilities.MageSingleton;
@ -165,6 +164,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
*/ */
@Override @Override
public void discard() { public void discard() {
this.used = true; // to prevent further usage before effect is removed
this.discarded = true; this.discarded = true;
} }

View file

@ -355,7 +355,7 @@ public class ContinuousEffects implements Serializable {
for (Ability ability : abilities) { for (Ability ability : abilities) {
// for replacment effects of static abilities do not use LKI to check if to apply // for replacment effects of static abilities do not use LKI to check if to apply
if (ability.getAbilityType() != AbilityType.STATIC || ability.isInUseableZone(game, null, event)) { if (ability.getAbilityType() != AbilityType.STATIC || ability.isInUseableZone(game, null, event)) {
if (effect.getDuration() != Duration.OneUse || !effect.isUsed()) { if (!effect.isUsed()) {
if (!game.getScopeRelevant() if (!game.getScopeRelevant()
|| effect.hasSelfScope() || effect.hasSelfScope()
|| !event.getTargetId().equals(ability.getSourceId())) { || !event.getTargetId().equals(ability.getSourceId())) {

View file

@ -267,6 +267,7 @@ class FlashbackReplacementEffect extends ReplacementEffectImpl {
if (controller != null) { if (controller != null) {
Card card = game.getCard(event.getTargetId()); Card card = game.getCard(event.getTargetId());
if (card != null) { if (card != null) {
discard();
return controller.moveCards( return controller.moveCards(
card, Zone.EXILED, source, game, false, false, false, event.getAppliedEffects()); card, Zone.EXILED, source, game, false, false, false, event.getAppliedEffects());
} }
@ -284,7 +285,7 @@ class FlashbackReplacementEffect extends ReplacementEffectImpl {
if (event.getTargetId().equals(source.getSourceId()) if (event.getTargetId().equals(source.getSourceId())
&& ((ZoneChangeEvent) event).getFromZone() == Zone.STACK && ((ZoneChangeEvent) event).getFromZone() == Zone.STACK
&& ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) { && ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) {
discard();
int zcc = game.getState().getZoneChangeCounter(source.getSourceId()); int zcc = game.getState().getZoneChangeCounter(source.getSourceId());
if (((FixedTarget) getTargetPointer()).getZoneChangeCounter() == zcc) { if (((FixedTarget) getTargetPointer()).getZoneChangeCounter() == zcc) {
return true; return true;