Implemented Mathas, Fiend Seeker

This commit is contained in:
Evan Kranzler 2017-08-17 18:18:44 -04:00
parent f7e9c222af
commit 53a666a580
3 changed files with 156 additions and 1 deletions

View file

@ -0,0 +1,154 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class MathasFiendSeeker extends CardImpl {
private static final String rule = "For as long as that creature has a bounty counter on it, it has \"When this creature dies, each opponent draws a card and gains 2 life.\"";
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public MathasFiendSeeker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{W}{B}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add("Vampire");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Menace
this.addAbility(new MenaceAbility());
// At the beginning of your end step, put a bounty counter on target creature an opponent controls. For as long as that creature has a bounty counter on it, it has "When this creature dies, each opponent draws a card and gains 2 life."
Ability ability = new BeginningOfYourEndStepTriggeredAbility(new AddCountersTargetEffect(CounterType.BOUNTY.createInstance()), false);
ability.addTarget(new TargetCreaturePermanent(filter));
Ability ability2 = new DiesTriggeredAbility(new DrawCardAllEffect(2, TargetController.OPPONENT));
ability2.addEffect(new OpponentsGainLifeEffect());
Effect effect = new MathasFiendSeekerGainAbilityEffect(
ability2,
Duration.Custom, rule);
ability.addEffect(effect);
this.addAbility(ability);
}
public MathasFiendSeeker(final MathasFiendSeeker card) {
super(card);
}
@Override
public MathasFiendSeeker copy() {
return new MathasFiendSeeker(this);
}
}
class MathasFiendSeekerGainAbilityEffect extends GainAbilityTargetEffect {
public MathasFiendSeekerGainAbilityEffect(Ability ability, Duration duration, String rule) {
super(ability, duration, rule);
}
public MathasFiendSeekerGainAbilityEffect(final MathasFiendSeekerGainAbilityEffect effect) {
super(effect);
}
@Override
public boolean isInactive(Ability source, Game game) {
Permanent land = game.getPermanent(this.targetPointer.getFirst(game, source));
if (land != null && land.getCounters(game).getCount(CounterType.BOUNTY) < 1) {
return true;
}
return false;
}
@Override
public MathasFiendSeekerGainAbilityEffect copy() {
return new MathasFiendSeekerGainAbilityEffect(this);
}
}
class OpponentsGainLifeEffect extends OneShotEffect {
public OpponentsGainLifeEffect() {
super(Outcome.GainLife);
staticText = "Each opponent gains 2 life.";
}
public OpponentsGainLifeEffect(final OpponentsGainLifeEffect effect) {
super(effect);
}
@Override
public OpponentsGainLifeEffect copy() {
return new OpponentsGainLifeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null && game.isOpponent(player, source.getControllerId())) {
player.gainLife(2, game);
}
}
return true;
}
}

View file

@ -75,6 +75,7 @@ public class Commander2017 extends ExpansionSet {
cards.add(new SetCardInfo("Kindred Summons", 32, Rarity.RARE, mage.cards.k.KindredSummons.class));
cards.add(new SetCardInfo("Licia, Sanguine Tribune", 40, Rarity.MYTHIC, mage.cards.l.LiciaSanguineTribune.class));
cards.add(new SetCardInfo("Magus of the Mind", 12, Rarity.RARE, mage.cards.m.MagusOfTheMind.class));
cards.add(new SetCardInfo("Mathas, Fiend Seeker", 42, Rarity.MYTHIC, mage.cards.m.MathasFiendSeeker.class));
cards.add(new SetCardInfo("Mirri, Weatherlight Duelist", 43, Rarity.MYTHIC, mage.cards.m.MirriWeatherlightDuelist.class));
cards.add(new SetCardInfo("Mirror of the Forebears", 54, Rarity.UNCOMMON, mage.cards.m.MirrorOfTheForebears.class));
cards.add(new SetCardInfo("Nazahn, Revered Bladesmith", 44, Rarity.MYTHIC, mage.cards.n.NazahnReveredBladesmith.class));

View file

@ -102,7 +102,7 @@ public class DrawCardAllEffect extends OneShotEffect {
}
private String setText() {
StringBuilder sb = new StringBuilder("Each ");
StringBuilder sb = new StringBuilder("each ");
switch (targetController) {
case ANY:
sb.append("player");