[STX] Implemented Start Pupil

This commit is contained in:
Evan Kranzler 2021-03-27 11:48:05 -04:00
parent a55ed17beb
commit 9c0bfc0250
2 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,86 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
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.SubType;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class StarPupil extends CardImpl {
public StarPupil(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Star Pupil enters the battlefield with a +1/+1 counter on it.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
"with a +1/+1 counter on it"
));
// When Star Pupil dies, put its counters on target creature you control.
Ability ability = new DiesSourceTriggeredAbility(new StarPupilEffect());
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
}
private StarPupil(final StarPupil card) {
super(card);
}
@Override
public StarPupil copy() {
return new StarPupil(this);
}
}
class StarPupilEffect extends OneShotEffect {
StarPupilEffect() {
super(Outcome.Benefit);
staticText = "put its counters on target creature you control";
}
private StarPupilEffect(final StarPupilEffect effect) {
super(effect);
}
@Override
public StarPupilEffect copy() {
return new StarPupilEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = source.getSourcePermanentOrLKI(game);
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent == null || permanent == null) {
return false;
}
sourcePermanent
.getCounters(game)
.values()
.stream()
.forEach(counter -> permanent.addCounters(counter, source.getControllerId(), source, game));
return true;
}
}

View file

@ -61,6 +61,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Shineshadow Snarl", 272, Rarity.RARE, mage.cards.s.ShineshadowSnarl.class));
cards.add(new SetCardInfo("Silverquill Apprentice", 231, Rarity.UNCOMMON, mage.cards.s.SilverquillApprentice.class));
cards.add(new SetCardInfo("Silverquill Command", 232, Rarity.RARE, mage.cards.s.SilverquillCommand.class));
cards.add(new SetCardInfo("Star Pupil", 30, Rarity.COMMON, mage.cards.s.StarPupil.class));
cards.add(new SetCardInfo("Storm-Kiln Artist", 115, Rarity.UNCOMMON, mage.cards.s.StormKilnArtist.class));
cards.add(new SetCardInfo("Study Break", 34, Rarity.COMMON, mage.cards.s.StudyBreak.class));
cards.add(new SetCardInfo("Swamp", 370, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));