Merge pull request #5369 from Zzooouhh/planeshift

Implemented remaining Planeshift cards
This commit is contained in:
L_J 2018-10-15 20:56:44 +02:00 committed by GitHub
commit 685175acd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 420 additions and 0 deletions

View file

@ -0,0 +1,48 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
/**
*
* @author L_J
*/
public final class AmphibiousKavu extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blue and/or black creatures");
static {
filter.add(Predicates.or(new ColorPredicate(ObjectColor.BLUE), new ColorPredicate(ObjectColor.BLACK)));
}
public AmphibiousKavu(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
this.subtype.add(SubType.KAVU);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Amphibious Kavu blocks or becomes blocked by one or more blue and/or black creatures, Amphibious Kavu gets +3/+3 until end of turn.
this.addAbility(new BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility(new BoostSourceEffect(3, 3, Duration.EndOfTurn), filter, false));
}
public AmphibiousKavu(final AmphibiousKavu card) {
super(card);
}
@Override
public AmphibiousKavu copy() {
return new AmphibiousKavu(this);
}
}

View file

@ -0,0 +1,63 @@
package mage.cards.d;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author L_J
*/
public final class DominariasJudgment extends CardImpl {
private static final FilterLandPermanent filterPlains = new FilterLandPermanent("Plains");
private static final FilterLandPermanent filterIsland = new FilterLandPermanent("Island");
private static final FilterLandPermanent filterSwamp = new FilterLandPermanent("Swamp");
private static final FilterLandPermanent filterMountain = new FilterLandPermanent("Mountain");
private static final FilterLandPermanent filterForest = new FilterLandPermanent("Forest");
static {
filterPlains.add(new SubtypePredicate(SubType.PLAINS));
filterIsland.add(new SubtypePredicate(SubType.ISLAND));
filterSwamp.add(new SubtypePredicate(SubType.SWAMP));
filterMountain.add(new SubtypePredicate(SubType.MOUNTAIN));
filterForest.add(new SubtypePredicate(SubType.FOREST));
}
public DominariasJudgment(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}");
// Until end of turn, creatures you control gain protection from white if you control a Plains, from blue if you control an Island, from black if you control a Swamp, from red if you control a Mountain, and from green if you control a Forest.
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.WHITE), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterPlains),"Until end of turn, creatures you control gain protection from white if you control a Plains,"));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.BLUE), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterIsland)," from blue if you control an Island,"));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.BLACK), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterSwamp)," from black if you control a Swamp,"));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.RED), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterMountain)," from red if you control a Mountain,"));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(ProtectionAbility.from(ObjectColor.GREEN), Duration.EndOfTurn,
StaticFilters.FILTER_PERMANENT_CREATURE, false), new PermanentsOnTheBattlefieldCondition(filterForest)," and from green if you control a Forest"));
}
public DominariasJudgment(final DominariasJudgment card) {
super(card);
}
@Override
public DominariasJudgment copy() {
return new DominariasJudgment(this);
}
}

View file

@ -0,0 +1,100 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.PreventionEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author L_J
*/
public final class GuardDogs extends CardImpl {
public GuardDogs(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}");
this.subtype.add(SubType.HOUND);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// {2}{W}, {T}: Choose a permanent you control. Prevent all combat damage target creature would deal this turn if it shares a color with that permanent.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GuardDogsEffect(), new ManaCostsImpl("{2}{W}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public GuardDogs(final GuardDogs card) {
super(card);
}
@Override
public GuardDogs copy() {
return new GuardDogs(this);
}
}
class GuardDogsEffect extends PreventionEffectImpl {
private TargetControlledPermanent controlledTarget;
public GuardDogsEffect() {
super(Duration.EndOfTurn, Integer.MAX_VALUE, true);
this.staticText = "Choose a permanent you control. Prevent all combat damage target creature would deal this turn if it shares a color with that permanent";
}
public GuardDogsEffect(final GuardDogsEffect effect) {
super(effect);
}
@Override
public void init(Ability source, Game game) {
this.controlledTarget = new TargetControlledPermanent();
this.controlledTarget.setNotTarget(true);
this.controlledTarget.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
super.init(source, game);
}
@Override
public GuardDogsEffect copy() {
return new GuardDogsEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!this.used && super.applies(event, source, game)) {
MageObject mageObject = game.getObject(event.getSourceId());
if (mageObject != null
&& controlledTarget.getFirstTarget() != null) {
Permanent permanent = game.getPermanentOrLKIBattlefield(controlledTarget.getFirstTarget());
Permanent targetPermanent = game.getPermanentOrLKIBattlefield(this.getTargetPointer().getFirst(game, source));
if (permanent != null
&& targetPermanent != null
&& this.getTargetPointer().getTargets(game, source).contains(event.getSourceId())
&& permanent.getColor(game).shares(targetPermanent.getColor(game))) {
return true;
}
}
}
return false;
}
}

View file

@ -0,0 +1,95 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.RedirectionEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetAnyTarget;
/**
*
* @author LevelX2 & L_J
*/
public final class MirrorwoodTreefolk extends CardImpl {
public MirrorwoodTreefolk(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.TREEFOLK);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// {2}{R}{W}: The next time damage would be dealt to Mirrorwood Treefolk this turn, that damage is dealt to any target instead.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MirrorwoodTreefolkEffect(), new ManaCostsImpl("{2}{R}{W}"));
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
}
public MirrorwoodTreefolk(final MirrorwoodTreefolk card) {
super(card);
}
@Override
public MirrorwoodTreefolk copy() {
return new MirrorwoodTreefolk(this);
}
}
class MirrorwoodTreefolkEffect extends RedirectionEffect {
protected MageObjectReference redirectToObject;
public MirrorwoodTreefolkEffect() {
super(Duration.EndOfTurn, Integer.MAX_VALUE, UsageType.ONE_USAGE_ABSOLUTE);
staticText = "The next time damage would be dealt to {this} this turn, that damage is dealt to any target instead";
}
public MirrorwoodTreefolkEffect(final MirrorwoodTreefolkEffect effect) {
super(effect);
this.redirectToObject = effect.redirectToObject;
}
@Override
public MirrorwoodTreefolkEffect copy() {
return new MirrorwoodTreefolkEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
redirectToObject = new MageObjectReference(source.getTargets().get(0).getFirstTarget(), game);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getSourceId())) {
if (redirectToObject.equals(new MageObjectReference(source.getTargets().get(0).getFirstTarget(), game))) {
redirectTarget = source.getTargets().get(0);
return true;
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
}

View file

@ -0,0 +1,109 @@
package mage.cards.n;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterCard;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
* @author L_J
*/
public final class NoxiousVapors extends CardImpl {
public NoxiousVapors(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
// Each player reveals their hand, chooses one card of each color from it, then discards all other nonland cards.
this.getSpellAbility().addEffect(new NoxiousVaporsEffect());
}
public NoxiousVapors(final NoxiousVapors card) {
super(card);
}
@Override
public NoxiousVapors copy() {
return new NoxiousVapors(this);
}
}
class NoxiousVaporsEffect extends OneShotEffect {
private static final FilterNonlandCard filter = new FilterNonlandCard();
public NoxiousVaporsEffect() {
super(Outcome.Benefit);
this.staticText = "Each player reveals their hand, chooses one card of each color from it, then discards all other nonland cards";
}
public NoxiousVaporsEffect(final NoxiousVaporsEffect effect) {
super(effect);
}
@Override
public NoxiousVaporsEffect copy() {
return new NoxiousVaporsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.revealCards(player.getName() + "'s hand", player.getHand(), game);
}
}
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Set<Card> chosenCards = new HashSet<>();
chooseCardForColor(ObjectColor.WHITE, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.BLUE, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.BLACK, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.RED, chosenCards, player, game, source);
chooseCardForColor(ObjectColor.GREEN, chosenCards, player, game, source);
Set<Card> cards = player.getHand().getCards(game);
for (Card card : cards) {
if (card != null && !chosenCards.contains(card) && filter.match(card, game)) {
player.discard(card, source, game);
}
}
}
}
return true;
}
return false;
}
private void chooseCardForColor(ObjectColor color, Set<Card> chosenCards, Player player, Game game, Ability source) {
FilterCard filter = new FilterCard();
filter.add(new ColorPredicate(color));
TargetCardInHand target = new TargetCardInHand(filter);
if (player.choose(Outcome.Benefit, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
chosenCards.add(card);
}
}
}
}

View file

@ -30,6 +30,7 @@ public final class Planeshift extends ExpansionSet {
cards.add(new SetCardInfo("Allied Strategies", 20, Rarity.UNCOMMON, mage.cards.a.AlliedStrategies.class));
cards.add(new SetCardInfo("Alpha Kavu", 77, Rarity.UNCOMMON, mage.cards.a.AlphaKavu.class));
cards.add(new SetCardInfo("Amphibious Kavu", 78, Rarity.COMMON, mage.cards.a.AmphibiousKavu.class));
cards.add(new SetCardInfo("Ancient Spider", 96, Rarity.RARE, mage.cards.a.AncientSpider.class));
cards.add(new SetCardInfo("Arctic Merfolk", 21, Rarity.COMMON, mage.cards.a.ArcticMerfolk.class));
cards.add(new SetCardInfo("Aura Blast", 1, Rarity.COMMON, mage.cards.a.AuraBlast.class));
@ -50,6 +51,7 @@ public final class Planeshift extends ExpansionSet {
cards.add(new SetCardInfo("Destructive Flow", 102, Rarity.RARE, mage.cards.d.DestructiveFlow.class));
cards.add(new SetCardInfo("Diabolic Intent", 42, Rarity.RARE, mage.cards.d.DiabolicIntent.class));
cards.add(new SetCardInfo("Disciple of Kangee", 3, Rarity.COMMON, mage.cards.d.DiscipleOfKangee.class));
cards.add(new SetCardInfo("Dominaria's Judgment", 4, Rarity.RARE, mage.cards.d.DominariasJudgment.class));
cards.add(new SetCardInfo("Doomsday Specter", 103, Rarity.RARE, mage.cards.d.DoomsdaySpecter.class));
cards.add(new SetCardInfo("Draco", 131, Rarity.RARE, mage.cards.d.Draco.class));
cards.add(new SetCardInfo("Dralnu's Crusade", 104, Rarity.RARE, mage.cards.d.DralnusCrusade.class));
@ -71,6 +73,7 @@ public final class Planeshift extends ExpansionSet {
cards.add(new SetCardInfo("Gainsay", 26, Rarity.UNCOMMON, mage.cards.g.Gainsay.class));
cards.add(new SetCardInfo("Gerrard's Command", 109, Rarity.COMMON, mage.cards.g.GerrardsCommand.class));
cards.add(new SetCardInfo("Goblin Game", 61, Rarity.RARE, mage.cards.g.GoblinGame.class));
cards.add(new SetCardInfo("Guard Dogs", 5, Rarity.UNCOMMON, mage.cards.g.GuardDogs.class));
cards.add(new SetCardInfo("Heroic Defiance", 6, Rarity.COMMON, mage.cards.h.HeroicDefiance.class));
cards.add(new SetCardInfo("Hobble", 7, Rarity.COMMON, mage.cards.h.Hobble.class));
cards.add(new SetCardInfo("Honorable Scout", 8, Rarity.COMMON, mage.cards.h.HonorableScout.class));
@ -95,6 +98,7 @@ public final class Planeshift extends ExpansionSet {
cards.add(new SetCardInfo("Meddling Mage", 116, Rarity.RARE, mage.cards.m.MeddlingMage.class));
cards.add(new SetCardInfo("Meteor Crater", 140, Rarity.RARE, mage.cards.m.MeteorCrater.class));
cards.add(new SetCardInfo("Mire Kavu", 67, Rarity.COMMON, mage.cards.m.MireKavu.class));
cards.add(new SetCardInfo("Mirrorwood Treefolk", 83, Rarity.UNCOMMON, mage.cards.m.MirrorwoodTreefolk.class));
cards.add(new SetCardInfo("Mogg Jailer", 68, Rarity.UNCOMMON, mage.cards.m.MoggJailer.class));
cards.add(new SetCardInfo("Mogg Sentry", 69, Rarity.RARE, mage.cards.m.MoggSentry.class));
cards.add(new SetCardInfo("Morgue Toad", 46, Rarity.COMMON, mage.cards.m.MorgueToad.class));
@ -103,6 +107,7 @@ public final class Planeshift extends ExpansionSet {
cards.add(new SetCardInfo("Nemata, Grove Guardian", 85, Rarity.RARE, mage.cards.n.NemataGroveGuardian.class));
cards.add(new SetCardInfo("Nightscape Battlemage", 47, Rarity.UNCOMMON, mage.cards.n.NightscapeBattlemage.class));
cards.add(new SetCardInfo("Nightscape Familiar", 48, Rarity.COMMON, mage.cards.n.NightscapeFamiliar.class));
cards.add(new SetCardInfo("Noxious Vapors", 49, Rarity.UNCOMMON, mage.cards.n.NoxiousVapors.class));
cards.add(new SetCardInfo("Orim's Chant", 11, Rarity.RARE, mage.cards.o.OrimsChant.class));
cards.add(new SetCardInfo("Phyrexian Bloodstock", 50, Rarity.COMMON, mage.cards.p.PhyrexianBloodstock.class));
cards.add(new SetCardInfo("Phyrexian Scuta", 51, Rarity.RARE, mage.cards.p.PhyrexianScuta.class));