Implemented Boot Nipper

This commit is contained in:
Evan Kranzler 2020-04-10 21:52:23 -04:00
parent f0d1cff7b9
commit b139e5b0e1
5 changed files with 109 additions and 88 deletions

View file

@ -0,0 +1,40 @@
package mage.cards.b;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.common.counter.AddCounterChoiceSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.CounterType;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BootNipper extends CardImpl {
public BootNipper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.subtype.add(SubType.BEAST);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Boot Nipper enters the battlefield with your choice of a deathtouch counter or a lifelink counter on it.
this.addAbility(new EntersBattlefieldAbility(
new AddCounterChoiceSourceEffect(CounterType.DEATHTOUCH, CounterType.LIFELINK)
));
}
private BootNipper(final BootNipper card) {
super(card);
}
@Override
public BootNipper copy() {
return new BootNipper(this);
}
}

View file

@ -1,19 +1,13 @@
package mage.cards.h; package mage.cards.h;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.counter.AddCounterChoiceSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.counters.Counter;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID; import java.util.UUID;
@ -31,7 +25,9 @@ public final class HelicaGlider extends CardImpl {
this.toughness = new MageInt(2); this.toughness = new MageInt(2);
// Helica Glider enters the battlfield with your choice of a flying counter or a first strike counter on it. // Helica Glider enters the battlfield with your choice of a flying counter or a first strike counter on it.
this.addAbility(new EntersBattlefieldAbility(new HelicaGliderEffect())); this.addAbility(new EntersBattlefieldAbility(
new AddCounterChoiceSourceEffect(CounterType.FLYING, CounterType.FIRST_STRIKE)
));
} }
private HelicaGlider(final HelicaGlider card) { private HelicaGlider(final HelicaGlider card) {
@ -43,39 +39,3 @@ public final class HelicaGlider extends CardImpl {
return new HelicaGlider(this); return new HelicaGlider(this);
} }
} }
class HelicaGliderEffect extends OneShotEffect {
HelicaGliderEffect() {
super(Outcome.Benefit);
staticText = "with your choice of a flying counter or a first strike counter on it";
}
private HelicaGliderEffect(final HelicaGliderEffect effect) {
super(effect);
}
@Override
public HelicaGliderEffect copy() {
return new HelicaGliderEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (player == null || permanent == null) {
return false;
}
Counter counter;
if (player.chooseUse(
Outcome.Neutral, "Choose flying or first strike", null,
"Flying", "First strike", source, game
)) {
counter = CounterType.FLYING.createInstance();
} else {
counter = CounterType.FIRST_STRIKE.createInstance();
}
return permanent.addCounters(counter, source, game);
}
}

View file

@ -1,19 +1,13 @@
package mage.cards.w; package mage.cards.w;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility; import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.counter.AddCounterChoiceSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.counters.Counter;
import mage.counters.CounterType; import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID; import java.util.UUID;
@ -30,7 +24,9 @@ public final class WingfoldPteron extends CardImpl {
this.toughness = new MageInt(6); this.toughness = new MageInt(6);
// Wingfold Pteron enters the battlefield with your choice of a flying counter or a hexproof counter on it. // Wingfold Pteron enters the battlefield with your choice of a flying counter or a hexproof counter on it.
this.addAbility(new EntersBattlefieldAbility(new WingfoldPteronEffect())); this.addAbility(new EntersBattlefieldAbility(
new AddCounterChoiceSourceEffect(CounterType.FLYING, CounterType.HEXPROOF)
));
} }
private WingfoldPteron(final WingfoldPteron card) { private WingfoldPteron(final WingfoldPteron card) {
@ -42,39 +38,3 @@ public final class WingfoldPteron extends CardImpl {
return new WingfoldPteron(this); return new WingfoldPteron(this);
} }
} }
class WingfoldPteronEffect extends OneShotEffect {
WingfoldPteronEffect() {
super(Outcome.Benefit);
staticText = "with your choice of a flying counter or a hexproof counter on it";
}
private WingfoldPteronEffect(final WingfoldPteronEffect effect) {
super(effect);
}
@Override
public WingfoldPteronEffect copy() {
return new WingfoldPteronEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (player == null || permanent == null) {
return false;
}
Counter counter;
if (player.chooseUse(
Outcome.Neutral, "Choose flying or hexproof", null,
"Flying", "Hexproof", source, game
)) {
counter = CounterType.FLYING.createInstance();
} else {
counter = CounterType.HEXPROOF.createInstance();
}
return permanent.addCounters(counter, source, game);
}
}

View file

@ -83,6 +83,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
cards.add(new SetCardInfo("Bonder's Enclave", 245, Rarity.RARE, mage.cards.b.BondersEnclave.class)); cards.add(new SetCardInfo("Bonder's Enclave", 245, Rarity.RARE, mage.cards.b.BondersEnclave.class));
cards.add(new SetCardInfo("Boneyard Lurker", 178, Rarity.UNCOMMON, mage.cards.b.BoneyardLurker.class)); cards.add(new SetCardInfo("Boneyard Lurker", 178, Rarity.UNCOMMON, mage.cards.b.BoneyardLurker.class));
cards.add(new SetCardInfo("Boon of the Wish-Giver", 43, Rarity.UNCOMMON, mage.cards.b.BoonOfTheWishGiver.class)); cards.add(new SetCardInfo("Boon of the Wish-Giver", 43, Rarity.UNCOMMON, mage.cards.b.BoonOfTheWishGiver.class));
cards.add(new SetCardInfo("Boot Nipper", 76, Rarity.COMMON, mage.cards.b.BootNipper.class));
cards.add(new SetCardInfo("Bristling Boar", 146, Rarity.COMMON, mage.cards.b.BristlingBoar.class)); cards.add(new SetCardInfo("Bristling Boar", 146, Rarity.COMMON, mage.cards.b.BristlingBoar.class));
cards.add(new SetCardInfo("Bushmeat Poacher", 77, Rarity.COMMON, mage.cards.b.BushmeatPoacher.class)); cards.add(new SetCardInfo("Bushmeat Poacher", 77, Rarity.COMMON, mage.cards.b.BushmeatPoacher.class));
cards.add(new SetCardInfo("Call of the Death-Dweller", 78, Rarity.UNCOMMON, mage.cards.c.CallOfTheDeathDweller.class)); cards.add(new SetCardInfo("Call of the Death-Dweller", 78, Rarity.UNCOMMON, mage.cards.c.CallOfTheDeathDweller.class));

View file

@ -0,0 +1,60 @@
package mage.abilities.effects.common.counter;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
* @author TheElk801
*/
public class AddCounterChoiceSourceEffect extends OneShotEffect {
private final CounterType counterType1;
private final CounterType counterType2;
public AddCounterChoiceSourceEffect(CounterType counterType1, CounterType counterType2) {
super(Outcome.Benefit);
this.counterType1 = counterType1;
this.counterType2 = counterType2;
staticText = "with your choice of a " + counterType1 + " counter or a " + counterType2 + " counter on it";
}
private AddCounterChoiceSourceEffect(final AddCounterChoiceSourceEffect effect) {
super(effect);
this.counterType1 = effect.counterType1;
this.counterType2 = effect.counterType2;
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanentEntering(source.getSourceId());
if (player == null || permanent == null) {
return false;
}
Counter counter;
if (player.chooseUse(
Outcome.Neutral, "Choose " + counterType1 + " or " + counterType2, null,
cap(counterType1.getName()), cap(counterType2.getName()), source, game
)) {
counter = counterType1.createInstance();
} else {
counter = counterType2.createInstance();
}
return permanent.addCounters(counter, source, game);
}
private static final String cap(String string) {
return string != null ? string.substring(0, 1).toUpperCase() + string.substring(1) : null;
}
@Override
public AddCounterChoiceSourceEffect copy() {
return new AddCounterChoiceSourceEffect(this);
}
}