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

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

View file

@ -27,25 +27,22 @@
*/
package mage.cards.w;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.discard.DiscardEachPlayerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
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 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.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WordsOfWasteEffect(), new ManaCostsImpl("{1}")));
@ -75,7 +71,7 @@ class WordsOfWasteEffect extends ReplacementEffectImpl {
public WordsOfWasteEffect() {
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) {
@ -87,29 +83,24 @@ class WordsOfWasteEffect extends ReplacementEffectImpl {
return new WordsOfWasteEffect(this);
}
@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());
if (controller != null) {
new DiscardEachPlayerEffect(new StaticValue(1), false, TargetController.OPPONENT).apply(game, source);
this.used = true;
discard();
return true;
new DiscardEachPlayerEffect(TargetController.OPPONENT).apply(game, source);
this.discard();
return true;
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DRAW_CARD;
}
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used) {
return source.getControllerId().equals(event.getPlayerId());
}
return false;
return source.getControllerId().equals(event.getPlayerId());
}
}

View file

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

View file

@ -381,8 +381,9 @@ public class FlashbackTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Snapcaster Mage", 1);
assertGraveyardCount(playerA, "Whispers of the Muse", 0);
assertHandCount(playerA, 1);
assertExileCount("Whispers of the Muse", 1);
assertHandCount(playerA, 1);
}
/**
@ -418,7 +419,7 @@ public class FlashbackTest extends CardTestPlayerBase {
Sorcery
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.
*/
*/
String fCatBlitz = "Firecat Blitz";
String mountain = "Mountain";
@ -434,7 +435,7 @@ public class FlashbackTest extends CardTestPlayerBase {
execute();
assertExileCount(playerA, fCatBlitz, 1);
assertPermanentCount(playerA, "Elemental Cat", 1);
assertPermanentCount(playerA, "Elemental Cat", 1);
assertGraveyardCount(playerA, mountain, 1);
}
@ -506,7 +507,7 @@ public class FlashbackTest extends CardTestPlayerBase {
execute();
assertGraveyardCount(playerA, eVanguard, 1);
assertGraveyardCount(playerA,yOx, 1);
assertGraveyardCount(playerA, yOx, 1);
assertGraveyardCount(playerA, memnite, 1);
assertExileCount(playerA, dReturn, 1);
assertPermanentCount(playerA, bSable, 1);

View file

@ -110,4 +110,24 @@ public class DrawEffectsTest extends CardTestPlayerBase {
assertHandCount(playerA, 14);
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
* 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.
* The game won't allow you to attach it him, even though it should, since
* the enchantment is put onto the battlefield and not cast, hence, no
* The game won't allow you to attach it to him, even though it should,
* 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:
*
* Shroud shouldn't stop Empyrial Armor from attaching to Zur, only
@ -55,7 +55,8 @@ public class ZurTheEnchanterTest extends CardTestPlayerBase {
@Test
public void testAuraToBattlefieldDoesNotTarget() {
// 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, "Island", 2);

View file

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

View file

@ -355,7 +355,7 @@ public class ContinuousEffects implements Serializable {
for (Ability ability : abilities) {
// 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 (effect.getDuration() != Duration.OneUse || !effect.isUsed()) {
if (!effect.isUsed()) {
if (!game.getScopeRelevant()
|| effect.hasSelfScope()
|| !event.getTargetId().equals(ability.getSourceId())) {

View file

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