[BRO] Implemented Tawnos, the Toymaker

This commit is contained in:
Evan Kranzler 2022-10-31 20:22:49 -04:00
parent b245dd036f
commit 44d836129b
3 changed files with 114 additions and 12 deletions

View file

@ -20,7 +20,6 @@ import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.util.functions.StackObjectCopyApplier;
import java.util.UUID;
@ -52,7 +51,7 @@ public class DonalHeraldOfWings extends CardImpl {
// except the copy is a 1/1 Spirit in addition to its other types.
// Do this only once each turn. (The copy becomes a token.)
this.addAbility(new SpellCastControllerTriggeredAbility(
new DonalHeraldOfWingsEffect(), filterSpell, true, true
new DonalHeraldOfWingsEffect(), filterSpell, true
).setDoOnlyOnce(true));
}
@ -80,19 +79,15 @@ class DonalHeraldOfWingsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
Spell spell = (Spell) getValue("spellCast");
if (controller == null || spell == null) {
return false;
}
// Get the card that was cast
if (this.getTargetPointer() == null) {
return false;
}
Spell originalSpell = game.getStack().getSpell(((FixedTarget) this.getTargetPointer()).getTarget());
// Create a token copy
originalSpell.createCopyOnStack(game, source, controller.getId(), false, 1, DonalHeraldOfWingsApplier.instance);
spell.createCopyOnStack(
game, source, controller.getId(), false,
1, DonalHeraldOfWingsApplier.instance
);
return true;
}

View file

@ -0,0 +1,106 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterSpell;
import mage.filter.common.FilterCreatureSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.MageObjectReferencePredicate;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.util.functions.StackObjectCopyApplier;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TawnosTheToymaker extends CardImpl {
private static final FilterSpell filter = new FilterCreatureSpell("a Beast or Bird creature spell");
static {
filter.add(Predicates.or(
SubType.BEAST.getPredicate(),
SubType.BIRD.getPredicate()
));
}
public TawnosTheToymaker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ARTIFICER);
this.power = new MageInt(3);
this.toughness = new MageInt(5);
// Whenever you cast a Beast or Bird creature spell, you may copy it, except it's an artifact in addition to its other types.
this.addAbility(new SpellCastControllerTriggeredAbility(new TawnosTheToymakerEffect(), filter, false));
}
private TawnosTheToymaker(final TawnosTheToymaker card) {
super(card);
}
@Override
public TawnosTheToymaker copy() {
return new TawnosTheToymaker(this);
}
}
class TawnosTheToymakerEffect extends OneShotEffect {
TawnosTheToymakerEffect() {
super(Outcome.Benefit);
staticText = "copy it, except the copy is an artifact in addition to its other types";
}
private TawnosTheToymakerEffect(final TawnosTheToymakerEffect effect) {
super(effect);
}
@Override
public TawnosTheToymakerEffect copy() {
return new TawnosTheToymakerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Spell spell = (Spell) getValue("spellCast");
if (controller == null || spell == null) {
return false;
}
// Create a token copy
spell.createCopyOnStack(
game, source, controller.getId(), false,
1, TawnosTheToymakerApplier.instance
);
return true;
}
}
enum TawnosTheToymakerApplier implements StackObjectCopyApplier {
instance;
@Override
public void modifySpell(StackObject copiedSpell, Game game) {
copiedSpell.addCardType(CardType.ARTIFACT);
}
@Override
public MageObjectReferencePredicate getNextNewTargetType() {
return null;
}
}

View file

@ -72,6 +72,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Stern Lesson", 64, Rarity.COMMON, mage.cards.s.SternLesson.class));
cards.add(new SetCardInfo("Surge Engine", 81, Rarity.MYTHIC, mage.cards.s.SurgeEngine.class));
cards.add(new SetCardInfo("Swamp", 282, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Tawnos, the Toymaker", 222, Rarity.RARE, mage.cards.t.TawnosTheToymaker.class));
cards.add(new SetCardInfo("Teferi, Temporal Pilgrim", 66, Rarity.MYTHIC, mage.cards.t.TeferiTemporalPilgrim.class));
cards.add(new SetCardInfo("The Mightstone and Weakstone", "238a", Rarity.RARE, mage.cards.t.TheMightstoneAndWeakstone.class));
cards.add(new SetCardInfo("Third Path Savant", 67, Rarity.COMMON, mage.cards.t.ThirdPathSavant.class));