[MH2] Implemented Shattered Ego

This commit is contained in:
Evan Kranzler 2021-05-31 09:50:24 -04:00
parent 7b61da989b
commit cd0c123172
2 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,86 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ShatteredEgo extends CardImpl {
public ShatteredEgo(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature gets -3/-0.
this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(-3, 0)));
// {3}{U}{U}: Put enchanted creature into its owner's library third from the top.
this.addAbility(new SimpleActivatedAbility(new ShatteredEgoEffect(), new ManaCostsImpl<>("{3}{U}{U}")));
}
private ShatteredEgo(final ShatteredEgo card) {
super(card);
}
@Override
public ShatteredEgo copy() {
return new ShatteredEgo(this);
}
}
class ShatteredEgoEffect extends OneShotEffect {
ShatteredEgoEffect() {
super(Outcome.Benefit);
staticText = "put enchanted creature into its owner's library third from the top";
}
private ShatteredEgoEffect(final ShatteredEgoEffect effect) {
super(effect);
}
@Override
public ShatteredEgoEffect copy() {
return new ShatteredEgoEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent aura = source.getSourcePermanentOrLKI(game);
if (player == null || aura == null) {
return false;
}
Permanent permanent = game.getPermanent(aura.getAttachedTo());
return permanent != null && player.putCardOnTopXOfLibrary(
permanent, game, source, 3, true
);
}
}

View file

@ -138,6 +138,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Seal of Cleansing", 264, Rarity.UNCOMMON, mage.cards.s.SealOfCleansing.class)); cards.add(new SetCardInfo("Seal of Cleansing", 264, Rarity.UNCOMMON, mage.cards.s.SealOfCleansing.class));
cards.add(new SetCardInfo("Seal of Removal", 269, Rarity.UNCOMMON, mage.cards.s.SealOfRemoval.class)); cards.add(new SetCardInfo("Seal of Removal", 269, Rarity.UNCOMMON, mage.cards.s.SealOfRemoval.class));
cards.add(new SetCardInfo("Shardless Agent", 321, Rarity.RARE, mage.cards.s.ShardlessAgent.class)); cards.add(new SetCardInfo("Shardless Agent", 321, Rarity.RARE, mage.cards.s.ShardlessAgent.class));
cards.add(new SetCardInfo("Shattered Ego", 62, Rarity.COMMON, mage.cards.s.ShatteredEgo.class));
cards.add(new SetCardInfo("Silverbluff Bridge", 255, Rarity.COMMON, mage.cards.s.SilverbluffBridge.class)); cards.add(new SetCardInfo("Silverbluff Bridge", 255, Rarity.COMMON, mage.cards.s.SilverbluffBridge.class));
cards.add(new SetCardInfo("Skirge Familiar", 276, Rarity.UNCOMMON, mage.cards.s.SkirgeFamiliar.class)); cards.add(new SetCardInfo("Skirge Familiar", 276, Rarity.UNCOMMON, mage.cards.s.SkirgeFamiliar.class));
cards.add(new SetCardInfo("Skophos Reaver", 140, Rarity.COMMON, mage.cards.s.SkophosReaver.class)); cards.add(new SetCardInfo("Skophos Reaver", 140, Rarity.COMMON, mage.cards.s.SkophosReaver.class));