[STX] Implemented Prismari Apprentice

This commit is contained in:
Evan Kranzler 2021-03-27 08:06:26 -04:00
parent cc9e52e316
commit 730ac37930
3 changed files with 71 additions and 1 deletions

View file

@ -0,0 +1,61 @@
package mage.cards.p;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.MagecraftAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.stack.Spell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PrismariApprentice extends CardImpl {
public PrismariApprentice(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{R}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Magecraft Whenever you cast or copy an instant or sorcery spell, Prismari Apprentice can't be blocked this turn. If that spell has mana value 5 or greater, put a +1/+1 counter on Prismari Apprentice.
Ability ability = new MagecraftAbility(new CantBeBlockedSourceEffect(Duration.EndOfTurn));
ability.addEffect(new ConditionalOneShotEffect(new AddCountersSourceEffect(
CounterType.P1P1.createInstance()), PrismariApprenticeCondition.instance,
"If that spell has mana value 5 or greater, put a +1/+1 counter on {this}"
));
this.addAbility(ability);
}
private PrismariApprentice(final PrismariApprentice card) {
super(card);
}
@Override
public PrismariApprentice copy() {
return new PrismariApprentice(this);
}
}
enum PrismariApprenticeCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Spell spell = (Spell) source.getEffects().get(0).getValue(MagecraftAbility.SPELL_KEY);
return spell != null && spell.getConvertedManaCost() >= 5;
}
}

View file

@ -50,6 +50,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Plains", 366, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Plains", 367, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Pop Quiz", 49, Rarity.COMMON, mage.cards.p.PopQuiz.class));
cards.add(new SetCardInfo("Prismari Apprentice", 213, Rarity.UNCOMMON, mage.cards.p.PrismariApprentice.class));
cards.add(new SetCardInfo("Prismari Command", 214, Rarity.RARE, mage.cards.p.PrismariCommand.class));
cards.add(new SetCardInfo("Professor Onyx", 83, Rarity.MYTHIC, mage.cards.p.ProfessorOnyx.class));
cards.add(new SetCardInfo("Professor of Symbology", 24, Rarity.UNCOMMON, mage.cards.p.ProfessorOfSymbology.class));

View file

@ -12,6 +12,8 @@ import mage.game.stack.Spell;
*/
public class MagecraftAbility extends TriggeredAbilityImpl {
public static final String SPELL_KEY = "castCopiedSpell";
public MagecraftAbility(Effect effect) {
this(effect, false);
}
@ -33,7 +35,13 @@ public class MagecraftAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Spell spell = game.getSpell(event.getTargetId());
return spell != null && spell.isControlledBy(getControllerId()) && spell.isInstantOrSorcery();
if (spell == null
|| !spell.isControlledBy(getControllerId())
|| !spell.isInstantOrSorcery()) {
return false;
}
getEffects().setValue(SPELL_KEY, spell);
return true;
}
@Override