Implemented Tomik, Distinguished Advokist

This commit is contained in:
Evan Kranzler 2019-04-14 14:22:44 -04:00
parent 9ec8b1816d
commit 82a32613f9
2 changed files with 139 additions and 0 deletions

View file

@ -0,0 +1,138 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.CantBeTargetedAllEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterObject;
import mage.filter.FilterStackObject;
import mage.filter.StaticFilters;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.StackObject;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TomikDistinguishedAdvokist extends CardImpl {
private static final FilterObject filter
= new FilterStackObject();
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public TomikDistinguishedAdvokist(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ADVISOR);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Lands on the battlefield and land cards in graveyards can't be the targets of spells or abilities your opponents control.
Ability ability = new SimpleStaticAbility(new CantBeTargetedAllEffect(
StaticFilters.FILTER_LANDS, filter, Duration.WhileOnBattlefield
).setText("lands on the battlefield"));
ability.addEffect(new TomikDistinguishedAdvokistTargetEffect());
this.addAbility(ability);
// Your opponents can't play land cards from graveyards.
this.addAbility(new SimpleStaticAbility(new TomikDistinguishedAdvokistRestrictionEffect()));
}
private TomikDistinguishedAdvokist(final TomikDistinguishedAdvokist card) {
super(card);
}
@Override
public TomikDistinguishedAdvokist copy() {
return new TomikDistinguishedAdvokist(this);
}
}
class TomikDistinguishedAdvokistTargetEffect extends ContinuousRuleModifyingEffectImpl {
TomikDistinguishedAdvokistTargetEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "and land cards in graveyards can't be the targets of spells or abilities your opponents control";
}
private TomikDistinguishedAdvokistTargetEffect(final TomikDistinguishedAdvokistTargetEffect effect) {
super(effect);
}
@Override
public TomikDistinguishedAdvokistTargetEffect copy() {
return new TomikDistinguishedAdvokistTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TARGET;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Card targetCard = game.getCard(event.getTargetId());
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
Player player = game.getPlayer(source.getControllerId());
return targetCard != null && stackObject != null && player != null
&& player.hasOpponent(stackObject.getControllerId(), game)
&& game.getState().getZone(targetCard.getId()) == Zone.GRAVEYARD;
}
}
class TomikDistinguishedAdvokistRestrictionEffect extends ContinuousRuleModifyingEffectImpl {
TomikDistinguishedAdvokistRestrictionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
this.staticText = "Your opponents can't play land cards from graveyards";
}
private TomikDistinguishedAdvokistRestrictionEffect(final TomikDistinguishedAdvokistRestrictionEffect effect) {
super(effect);
}
@Override
public TomikDistinguishedAdvokistRestrictionEffect copy() {
return new TomikDistinguishedAdvokistRestrictionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.PLAY_LAND;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(source.getControllerId());
return player != null && player.hasOpponent(event.getPlayerId(), game)
&& game.getState().getZone(event.getSourceId()) == Zone.GRAVEYARD;
}
}

View file

@ -205,6 +205,7 @@ public final class WarOfTheSpark extends ExpansionSet {
cards.add(new SetCardInfo("Time Wipe", 223, Rarity.RARE, mage.cards.t.TimeWipe.class));
cards.add(new SetCardInfo("Toll of the Invasion", 108, Rarity.COMMON, mage.cards.t.TollOfTheInvasion.class));
cards.add(new SetCardInfo("Tolsimir, Friend to Wolves", 224, Rarity.RARE, mage.cards.t.TolsimirFriendToWolves.class));
cards.add(new SetCardInfo("Tomik, Distinguished Advokist", 34, Rarity.RARE, mage.cards.t.TomikDistinguishedAdvokist.class));
cards.add(new SetCardInfo("Topple the Statue", 35, Rarity.COMMON, mage.cards.t.ToppleTheStatue.class));
cards.add(new SetCardInfo("Totally Lost", 74, Rarity.COMMON, mage.cards.t.TotallyLost.class));
cards.add(new SetCardInfo("Turret Ogre", 148, Rarity.COMMON, mage.cards.t.TurretOgre.class));