[BRO] Implemented Fortified Beachhead

This commit is contained in:
Daniel Bomar 2022-11-09 16:09:48 -06:00
parent ce9ac8665c
commit 3b8ae39e4c
No known key found for this signature in database
GPG key ID: C86C8658F4023918
2 changed files with 122 additions and 0 deletions

View file

@ -0,0 +1,121 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.mana.BlueManaAbility;
import mage.abilities.mana.WhiteManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
* @author weirddan455
*/
public final class FortifiedBeachhead extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.SOLDIER, "Soldiers");
public FortifiedBeachhead(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// As Fortified Beachhead enters the battlefield, you may reveal a Soldier card from your hand. Fortified Beachhead enters the battlefield tapped unless you revealed a Soldier card this way or you control a Soldier.
this.addAbility(new AsEntersBattlefieldAbility(new FortifiedBeachheadEffect()));
// {T}: Add {W} or {U}.
this.addAbility(new WhiteManaAbility());
this.addAbility(new BlueManaAbility());
// {5}, {T}: Soldiers you control get +1/+1 until end of turn.
Ability ability = new SimpleActivatedAbility(
new BoostControlledEffect(1, 1, Duration.EndOfTurn, filter),
new GenericManaCost(5)
);
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
private FortifiedBeachhead(final FortifiedBeachhead card) {
super(card);
}
@Override
public FortifiedBeachhead copy() {
return new FortifiedBeachhead(this);
}
}
class FortifiedBeachheadEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard("Soldier card from your hand");
static {
filter.add(SubType.SOLDIER.getPredicate());
}
public FortifiedBeachheadEffect() {
super(Outcome.Tap);
this.staticText = "you may reveal a Soldier card from your hand. {this} enters the battlefield tapped unless you revealed a Soldier card this way or you control a Soldier.";
}
private FortifiedBeachheadEffect(final FortifiedBeachheadEffect effect) {
super(effect);
}
@Override
public FortifiedBeachheadEffect copy() {
return new FortifiedBeachheadEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent land = game.getPermanentEntering(source.getSourceId());
if (land == null) {
return false;
}
if (revealSoldier(game, source)) {
return true;
}
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (permanent.hasSubtype(SubType.SOLDIER, game)) {
return true;
}
}
land.setTapped(true);
return true;
}
private boolean revealSoldier(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
TargetCardInHand target = new TargetCardInHand(0, 1, filter);
target.withChooseHint("to reveal");
controller.chooseTarget(Outcome.Benefit, target, source, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;
}
controller.revealCards(source, new CardsImpl(card), game);
return true;
}
}

View file

@ -113,6 +113,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Fog of War", 180, Rarity.COMMON, mage.cards.f.FogOfWar.class));
cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Forging the Anchor", 50, Rarity.UNCOMMON, mage.cards.f.ForgingTheAnchor.class));
cards.add(new SetCardInfo("Fortified Beachhead", 262, Rarity.RARE, mage.cards.f.FortifiedBeachhead.class));
cards.add(new SetCardInfo("Gaea's Courser", 181, Rarity.UNCOMMON, mage.cards.g.GaeasCourser.class));
cards.add(new SetCardInfo("Gaea's Gift", 182, Rarity.COMMON, mage.cards.g.GaeasGift.class));
cards.add(new SetCardInfo("Geology Enthusiast", 289, Rarity.RARE, mage.cards.g.GeologyEnthusiast.class));