Implement 6 cmc pws (except Teferi) and rin (#6611)

[M21] Implement 6 cmc pws (except Teferi) and rin
This commit is contained in:
htrajan 2020-06-06 19:13:20 -07:00 committed by GitHub
parent d1da9ad843
commit a897df7c79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 681 additions and 134 deletions

View file

@ -0,0 +1,115 @@
package mage.abilities.effects;
import mage.abilities.Ability;
import mage.cards.Card;
import mage.constants.AsThoughEffectType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
public class CastCardFromGraveyardThenExileItEffect extends OneShotEffect {
public CastCardFromGraveyardThenExileItEffect() {
super(Outcome.Benefit);
}
CastCardFromGraveyardThenExileItEffect(final CastCardFromGraveyardThenExileItEffect effect) {
super(effect);
}
@Override
public CastCardFromGraveyardThenExileItEffect copy() {
return new CastCardFromGraveyardThenExileItEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
if (card != null) {
ContinuousEffect effect = new CastCardFromGraveyardEffect();
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
game.addEffect(effect, source);
effect = new ExileReplacementEffect(card.getId());
game.addEffect(effect, source);
return true;
}
return false;
}
}
class CastCardFromGraveyardEffect extends AsThoughEffectImpl {
CastCardFromGraveyardEffect() {
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
this.staticText = "You may cast target card from your graveyard";
}
CastCardFromGraveyardEffect(final CastCardFromGraveyardEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public CastCardFromGraveyardEffect copy() {
return new CastCardFromGraveyardEffect(this);
}
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
return objectId.equals(this.getTargetPointer().getFirst(game, source)) && affectedControllerId.equals(source.getControllerId());
}
}
class ExileReplacementEffect extends ReplacementEffectImpl {
private final UUID cardId;
ExileReplacementEffect(UUID cardId) {
super(Duration.EndOfTurn, Outcome.Exile);
this.cardId = cardId;
this.staticText = "If that card would be put into your graveyard this turn, exile it instead";
}
ExileReplacementEffect(final ExileReplacementEffect effect) {
super(effect);
this.cardId = effect.cardId;
}
@Override
public ExileReplacementEffect copy() {
return new ExileReplacementEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
Card card = game.getCard(this.cardId);
if (controller != null && card != null) {
return controller.moveCards(card, Zone.EXILED, source, game);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
return zEvent.getToZone() == Zone.GRAVEYARD
&& zEvent.getTargetId().equals(this.cardId);
}
}

View file

@ -28,10 +28,14 @@ public class CastFromHandWithoutPayingManaCostEffect extends ContinuousEffectImp
}
public CastFromHandWithoutPayingManaCostEffect(FilterCard filter, boolean fromHand) {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this(filter, fromHand, Duration.WhileOnBattlefield);
}
public CastFromHandWithoutPayingManaCostEffect(FilterCard filter, boolean fromHand, Duration duration) {
super(duration, Outcome.Detriment);
this.filter = filter;
this.fromHand = fromHand;
staticText = "You may cast " + filter.getMessage()
this.staticText = "You may cast " + filter.getMessage()
+ (fromHand ? " from your hand" : "")
+ " without paying their mana costs";
}

View file

@ -391,6 +391,7 @@ public enum SubType {
ARLINN("Arlinn", SubTypeSet.PlaneswalkerType),
ASHIOK("Ashiok", SubTypeSet.PlaneswalkerType),
AURRA("Aurra", SubTypeSet.PlaneswalkerType, true), // Star Wars
BASRI("Basri", SubTypeSet.PlaneswalkerType),
BOLAS("Bolas", SubTypeSet.PlaneswalkerType),
CALIX("Calix", SubTypeSet.PlaneswalkerType),
CHANDRA("Chandra", SubTypeSet.PlaneswalkerType),

View file

@ -9,9 +9,9 @@ import mage.constants.SubType;
*
* @author spjspj
*/
public final class WaitingInTheWeedsCatToken extends TokenImpl {
public final class GreenCatToken extends TokenImpl {
public WaitingInTheWeedsCatToken() {
public GreenCatToken() {
super("Cat", "1/1 green Cat creature token");
cardType.add(CardType.CREATURE);
color.setGreen(true);
@ -20,11 +20,11 @@ public final class WaitingInTheWeedsCatToken extends TokenImpl {
toughness = new MageInt(1);
}
public WaitingInTheWeedsCatToken(final WaitingInTheWeedsCatToken token) {
public GreenCatToken(final GreenCatToken token) {
super(token);
}
public WaitingInTheWeedsCatToken copy() {
return new WaitingInTheWeedsCatToken(this);
public GreenCatToken copy() {
return new GreenCatToken(this);
}
}

View file

@ -7,9 +7,9 @@ import mage.constants.SubType;
/**
* @author spjspj
*/
public final class DogToken extends TokenImpl {
public final class GreenDogToken extends TokenImpl {
public DogToken() {
public GreenDogToken() {
super("Dog", "1/1 green Dog creature token");
cardType.add(CardType.CREATURE);
subtype.add(SubType.DOG);
@ -19,11 +19,11 @@ public final class DogToken extends TokenImpl {
toughness = new MageInt(1);
}
private DogToken(final DogToken token) {
private GreenDogToken(final GreenDogToken token) {
super(token);
}
public DogToken copy() {
return new DogToken(this);
public GreenDogToken copy() {
return new GreenDogToken(this);
}
}

View file

@ -0,0 +1,31 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
/**
*
* @author htrajan
*/
public final class WhiteDogToken extends TokenImpl {
public WhiteDogToken() {
super("Dog", "1/1 white Dog creature token");
cardType.add(CardType.CREATURE);
subtype.add(SubType.DOG);
color.setWhite(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
private WhiteDogToken(final WhiteDogToken token) {
super(token);
}
public WhiteDogToken copy() {
return new WhiteDogToken(this);
}
}