[ONE] Implement Urabrask's Forge

This commit is contained in:
theelk801 2023-01-15 14:23:38 -05:00
parent 630617b6d0
commit 6e6a08fe78
3 changed files with 128 additions and 0 deletions

View file

@ -0,0 +1,88 @@
package mage.cards.u;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.token.PhyrexianHorrorToken;
import mage.game.permanent.token.Token;
import mage.target.targetpointer.FixedTarget;
import mage.target.targetpointer.FixedTargets;
/**
* @author TheElk801
*/
public final class UrabrasksForge extends CardImpl {
public UrabrasksForge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{R}");
// At the beginning of combat on your turn, put an oil counter on Urabrask's Forge, then create an X/1 red Phyrexian Horror creature token with trample and haste, where X is the number of oil counters on Urabrask's Forge. Sacrifice that token at the beginning of the next end step.
Ability ability = new BeginningOfCombatTriggeredAbility(
new AddCountersSourceEffect(CounterType.OIL.createInstance()), TargetController.YOU, false
);
ability.addEffect(new UrabrasksForgeEffect());
this.addAbility(ability);
}
private UrabrasksForge(final UrabrasksForge card) {
super(card);
}
@Override
public UrabrasksForge copy() {
return new UrabrasksForge(this);
}
}
class UrabrasksForgeEffect extends OneShotEffect {
UrabrasksForgeEffect() {
super(Outcome.Benefit);
staticText = ", then create an X/1 red Phyrexian Horror creature token with trample and haste, " +
"where X is the number of oil counters on {this}. " +
"Sacrifice that token at the beginning of the next end step";
}
private UrabrasksForgeEffect(final UrabrasksForgeEffect effect) {
super(effect);
}
@Override
public UrabrasksForgeEffect copy() {
return new UrabrasksForgeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = Optional
.ofNullable(source.getSourcePermanentOrLKI(game))
.filter(Objects::nonNull)
.map(permanent -> permanent.getCounters(game))
.map(counters -> counters.getCount(CounterType.OIL))
.orElse(0);
Token token = new PhyrexianHorrorToken(amount);
token.putOntoBattlefield(1, game, source);
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new SacrificeTargetEffect().setText("sacrifice it")
.setTargetPointer(new FixedTargets(token, game))
), source);
return true;
}
}

View file

@ -50,6 +50,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Swamp", 274, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Tablet of Compleation", 245, Rarity.RARE, mage.cards.t.TabletOfCompleation.class));
cards.add(new SetCardInfo("The Monumental Facade", 255, Rarity.RARE, mage.cards.t.TheMonumentalFacade.class));
cards.add(new SetCardInfo("Urabrask's Forge", 153, Rarity.RARE, mage.cards.u.UrabrasksForge.class));
cards.add(new SetCardInfo("Vindictive Flamestoker", 154, Rarity.RARE, mage.cards.v.VindictiveFlamestoker.class));
}

View file

@ -0,0 +1,39 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.Arrays;
/**
* @author TheElk801
*/
public final class PhyrexianHorrorToken extends TokenImpl {
public PhyrexianHorrorToken(int xValue) {
super("Phyrexian Token", "X/1 red Phyrexian Horror creature token with trample and haste");
cardType.add(CardType.CREATURE);
color.setRed(true);
subtype.add(SubType.PHYREXIAN);
subtype.add(SubType.HORROR);
power = new MageInt(xValue);
toughness = new MageInt(1);
addAbility(TrampleAbility.getInstance());
addAbility(HasteAbility.getInstance());
availableImageSetCodes = Arrays.asList("ONE");
}
public PhyrexianHorrorToken(final PhyrexianHorrorToken token) {
super(token);
}
@Override
public PhyrexianHorrorToken copy() {
return new PhyrexianHorrorToken(this);
}
}