Implemented The Wanderer

This commit is contained in:
Evan Kranzler 2019-04-01 16:32:57 -04:00
parent a54bb5024a
commit 9b43285df4
3 changed files with 80 additions and 8 deletions

View file

@ -0,0 +1,66 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.PreventAllNonCombatDamageToAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TheWanderer extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledPermanent("other permanents you control");
private static final FilterPermanent filter2
= new FilterCreaturePermanent("creature with power 4 or greater");
static {
filter.add(AnotherPredicate.instance);
filter2.add(new PowerPredicate(ComparisonType.MORE_THAN, 3));
}
public TheWanderer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5));
// Prevent all noncombat damage that would be dealt to you and other permanents you control.
this.addAbility(new SimpleStaticAbility(
new PreventAllNonCombatDamageToAllEffect(
Duration.WhileOnBattlefield, filter, true
)
));
// -2: Exile target creature with power 4 or greater.
Ability ability = new LoyaltyAbility(new ExileTargetEffect(), -2);
ability.addTarget(new TargetPermanent(filter2));
this.addAbility(ability);
}
private TheWanderer(final TheWanderer card) {
super(card);
}
@Override
public TheWanderer copy() {
return new TheWanderer(this);
}
}

View file

@ -74,6 +74,7 @@ public final class WarOfTheSpark extends ExpansionSet {
cards.add(new SetCardInfo("Swamp", 257, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swamp", 257, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Swamp", 258, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swamp", 258, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Tezzeret, Master of the Bridge", 275, Rarity.MYTHIC, mage.cards.t.TezzeretMasterOfTheBridge.class)); cards.add(new SetCardInfo("Tezzeret, Master of the Bridge", 275, Rarity.MYTHIC, mage.cards.t.TezzeretMasterOfTheBridge.class));
cards.add(new SetCardInfo("The Wanderer", 37, Rarity.UNCOMMON, mage.cards.t.TheWanderer.class));
cards.add(new SetCardInfo("Tibalt's Rager", 147, Rarity.UNCOMMON, mage.cards.t.TibaltsRager.class)); cards.add(new SetCardInfo("Tibalt's Rager", 147, Rarity.UNCOMMON, mage.cards.t.TibaltsRager.class));
cards.add(new SetCardInfo("Tibalt, Rakish Instigator", 146, Rarity.UNCOMMON, mage.cards.t.TibaltRakishInstigator.class)); cards.add(new SetCardInfo("Tibalt, Rakish Instigator", 146, Rarity.UNCOMMON, mage.cards.t.TibaltRakishInstigator.class));
cards.add(new SetCardInfo("Time Wipe", 223, Rarity.RARE, mage.cards.t.TimeWipe.class)); cards.add(new SetCardInfo("Time Wipe", 223, Rarity.RARE, mage.cards.t.TimeWipe.class));

View file

@ -2,34 +2,38 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import mage.constants.Duration;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.PreventionEffectImpl; import mage.abilities.effects.PreventionEffectImpl;
import mage.filter.FilterInPlay; import mage.constants.Duration;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DamageEvent; import mage.game.events.DamageEvent;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl { public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl {
protected final FilterPermanent filter; protected final FilterPermanent filter;
private final boolean andToYou;
public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterPermanent filter) { public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterPermanent filter) {
super(duration, Integer.MAX_VALUE, false); this(duration, filter, false);
this.filter = filter;
staticText = "Prevent all non combat damage that would be dealt to " + filter.getMessage() + ' ' + duration.toString();
} }
public PreventAllNonCombatDamageToAllEffect(final PreventAllNonCombatDamageToAllEffect effect) { public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterPermanent filter, boolean andToYou) {
super(duration, Integer.MAX_VALUE, false);
this.filter = filter;
this.andToYou = andToYou;
staticText = "Prevent all non combat damage that would be dealt to " + (andToYou ? "you and " : "") + filter.getMessage() + ' ' + duration.toString();
}
private PreventAllNonCombatDamageToAllEffect(final PreventAllNonCombatDamageToAllEffect effect) {
super(effect); super(effect);
this.filter = effect.filter.copy(); this.filter = effect.filter.copy();
this.andToYou = effect.andToYou;
} }
@Override @Override
@ -45,6 +49,7 @@ public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl {
if (permanent != null) { if (permanent != null) {
return filter.match(permanent, source.getSourceId(), source.getControllerId(), game); return filter.match(permanent, source.getSourceId(), source.getControllerId(), game);
} }
return andToYou && source.getControllerId().equals(event.getTargetId());
} }
return false; return false;
} }