[MH2] Implemented Harmonic Prodigy

This commit is contained in:
Evan Kranzler 2021-05-31 16:17:15 -04:00
parent 7607d69015
commit bb7b230513
2 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,91 @@
package mage.cards.h;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.ProwessAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.NumberOfTriggersEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class HarmonicProdigy extends CardImpl {
public HarmonicProdigy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// Prowess
this.addAbility(new ProwessAbility());
// If an ability of a Shaman or another Wizard you control triggers, that ability triggers an additional time.
this.addAbility(new SimpleStaticAbility(new HarmonicProdigyEffect()));
}
private HarmonicProdigy(final HarmonicProdigy card) {
super(card);
}
@Override
public HarmonicProdigy copy() {
return new HarmonicProdigy(this);
}
}
class HarmonicProdigyEffect extends ReplacementEffectImpl {
HarmonicProdigyEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "if an ability of a Shaman or another Wizard you control triggers, " +
"that ability triggers an additional time";
}
HarmonicProdigyEffect(final HarmonicProdigyEffect effect) {
super(effect);
}
@Override
public HarmonicProdigyEffect copy() {
return new HarmonicProdigyEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!(event instanceof NumberOfTriggersEvent)) {
return false;
}
Permanent permanent = game.getPermanent(((NumberOfTriggersEvent) event).getSourceId());
return permanent != null
&& permanent.isControlledBy(source.getControllerId())
&& (permanent.hasSubtype(SubType.SHAMAN, game)
|| (permanent.hasSubtype(SubType.WIZARD, game)
&& !permanent.getId().equals(source.getSourceId())));
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(event.getAmount() + 1);
return false;
}
}

View file

@ -87,6 +87,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Gorilla Shaman", 280, Rarity.UNCOMMON, mage.cards.g.GorillaShaman.class));
cards.add(new SetCardInfo("Greed", 274, Rarity.UNCOMMON, mage.cards.g.Greed.class));
cards.add(new SetCardInfo("Grief", 87, Rarity.MYTHIC, mage.cards.g.Grief.class));
cards.add(new SetCardInfo("Harmonic Prodigy", 132, Rarity.RARE, mage.cards.h.HarmonicProdigy.class));
cards.add(new SetCardInfo("Herd Baloth", 165, Rarity.UNCOMMON, mage.cards.h.HerdBaloth.class));
cards.add(new SetCardInfo("Ignoble Hierarch", 166, Rarity.RARE, mage.cards.i.IgnobleHierarch.class));
cards.add(new SetCardInfo("Imperial Recruiter", 281, Rarity.MYTHIC, mage.cards.i.ImperialRecruiter.class));