mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
[BRO] Implement Blanchwood Prowler
This commit is contained in:
parent
661e86915a
commit
3cf0c4a40c
4 changed files with 158 additions and 58 deletions
43
Mage.Sets/src/mage/cards/b/BlanchwoodProwler.java
Normal file
43
Mage.Sets/src/mage/cards/b/BlanchwoodProwler.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.common.MillThenPutInHandEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BlanchwoodProwler extends CardImpl {
|
||||
|
||||
public BlanchwoodProwler(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
|
||||
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// When Blanchwood Prowler enters the battlefield, mill three cards. You may put a land card from among the cards milled this way into your hand. If you don't, put a +1/+1 counter on Blanchwood Prowler.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new MillThenPutInHandEffect(
|
||||
3, StaticFilters.FILTER_CARD_LAND_A,
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance())
|
||||
)));
|
||||
}
|
||||
|
||||
private BlanchwoodProwler(final BlanchwoodProwler card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlanchwoodProwler copy() {
|
||||
return new BlanchwoodProwler(this);
|
||||
}
|
||||
}
|
|
@ -1,21 +1,16 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.MillThenPutInHandEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -24,6 +19,17 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class SzarekhTheSilentKing extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("an artifact creature card or Vehicle card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
Predicates.and(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate()
|
||||
), SubType.VEHICLE.getPredicate()
|
||||
));
|
||||
}
|
||||
|
||||
public SzarekhTheSilentKing(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{B}{B}{B}");
|
||||
|
||||
|
@ -36,7 +42,9 @@ public final class SzarekhTheSilentKing extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// My Will Be Done -- Whenever Szarekh, the Silent King attacks, mill three cards. You may put an artifact creature card or Vehicle card from among the cards milled this way into your hand.
|
||||
this.addAbility(new AttacksTriggeredAbility(new SzarekhTheSilentKingEffect()).withFlavorWord("My Will Be Done"));
|
||||
this.addAbility(new AttacksTriggeredAbility(
|
||||
new MillThenPutInHandEffect(3, filter)
|
||||
).withFlavorWord("My Will Be Done"));
|
||||
}
|
||||
|
||||
private SzarekhTheSilentKing(final SzarekhTheSilentKing card) {
|
||||
|
@ -48,51 +56,3 @@ public final class SzarekhTheSilentKing extends CardImpl {
|
|||
return new SzarekhTheSilentKing(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SzarekhTheSilentKingEffect extends OneShotEffect {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("artifact creature card or Vehicle card");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
Predicates.and(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate()
|
||||
), SubType.VEHICLE.getPredicate()
|
||||
));
|
||||
}
|
||||
|
||||
SzarekhTheSilentKingEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "mill three cards. You may put an artifact creature card " +
|
||||
"or Vehicle card from among the cards milled this way into your hand";
|
||||
}
|
||||
|
||||
private SzarekhTheSilentKingEffect(final SzarekhTheSilentKingEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SzarekhTheSilentKingEffect copy() {
|
||||
return new SzarekhTheSilentKingEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = player.millCards(3, source, game);
|
||||
if (cards.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
TargetCard target = new TargetCardInGraveyard(0, 1, filter);
|
||||
player.choose(outcome, cards, target, game);
|
||||
Card card = cards.get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
player.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ public final class TheBrothersWar extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Bitter Reunion", 127, Rarity.COMMON, mage.cards.b.BitterReunion.class));
|
||||
cards.add(new SetCardInfo("Bladecoil Serpent", 229, Rarity.MYTHIC, mage.cards.b.BladecoilSerpent.class));
|
||||
cards.add(new SetCardInfo("Blanchwood Armor", 171, Rarity.UNCOMMON, mage.cards.b.BlanchwoodArmor.class));
|
||||
cards.add(new SetCardInfo("Blanchwood Prowler", 172, Rarity.COMMON, mage.cards.b.BlanchwoodProwler.class));
|
||||
cards.add(new SetCardInfo("Blast Zone", 258, Rarity.RARE, mage.cards.b.BlastZone.class));
|
||||
cards.add(new SetCardInfo("Blitz Automaton", 158, Rarity.COMMON, mage.cards.b.BlitzAutomaton.class));
|
||||
cards.add(new SetCardInfo("Boulderbranch Golem", 197, Rarity.COMMON, mage.cards.b.BoulderbranchGolem.class));
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class MillThenPutInHandEffect extends OneShotEffect {
|
||||
|
||||
private final int amount;
|
||||
private final FilterCard filter;
|
||||
private final Effect otherwiseEffect;
|
||||
|
||||
public MillThenPutInHandEffect(int amount, FilterCard filter) {
|
||||
this(amount, filter, null);
|
||||
}
|
||||
|
||||
public MillThenPutInHandEffect(int amount, FilterCard filter, Effect otherwiseEffect) {
|
||||
super(Outcome.Benefit);
|
||||
this.amount = amount;
|
||||
this.filter = filter;
|
||||
this.otherwiseEffect = otherwiseEffect;
|
||||
}
|
||||
|
||||
private MillThenPutInHandEffect(final MillThenPutInHandEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount;
|
||||
this.filter = effect.filter;
|
||||
this.otherwiseEffect = effect.otherwiseEffect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MillThenPutInHandEffect copy() {
|
||||
return new MillThenPutInHandEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = player.millCards(amount, source, game);
|
||||
if (cards.isEmpty()) {
|
||||
return applyOtherwiseEffect(game, source);
|
||||
}
|
||||
TargetCard target = new TargetCard(0, 1, Zone.ALL, filter);
|
||||
player.choose(Outcome.DrawCard, cards, target, game);
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card == null) {
|
||||
return applyOtherwiseEffect(game, source);
|
||||
}
|
||||
return player.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
|
||||
private boolean applyOtherwiseEffect(Game game, Ability source) {
|
||||
if (otherwiseEffect instanceof OneShotEffect) {
|
||||
return otherwiseEffect.apply(game, source);
|
||||
} else if (otherwiseEffect instanceof ContinuousEffect) {
|
||||
game.addEffect((ContinuousEffect) otherwiseEffect, source);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText == null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("mill ");
|
||||
sb.append(CardUtil.numberToText(amount));
|
||||
sb.append(" cards. You may put ");
|
||||
sb.append(filter.getMessage());
|
||||
sb.append(" from among the cards milled this way into your hand");
|
||||
if (otherwiseEffect != null) {
|
||||
sb.append(". If you don't, ");
|
||||
sb.append(otherwiseEffect.getText(mode));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue