Menu

Submission for Rust Elemental

234

Config

name=Rust Elemental
image=http://mtgimage.com/card/rust%20elemental.jpg
value=2.500
rarity=U
type=Artifact,Creature
subtype=Elemental
cost={4}
pt=4/4
ability=Flying
timing=main
requires_groovy_code
oracle=Flying. At the beginning of your upkeep, sacrifice an artifact other than Rust Elemental. If you can't, tap Rust Elemental and you lose 4 life.

Script

[
    new MagicAtUpkeepTrigger() {
        @Override
        public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer upkeepPlayer) {
            return permanent.isController(upkeepPlayer) ?
                new MagicEvent(
                    permanent,
                    this,
                    "Sacrifice an artifact other than SN. If you can't, tap SN and lose 4 life."
                ) :
                MagicEvent.NONE;
        }

        @Override
        public void executeEvent(final MagicGame game, final MagicEvent event) {
            final MagicPermanent permanent = event.getPermanent();
            final MagicPlayer player = event.getPlayer();
            final MagicTargetChoice targetChoice = new MagicTargetChoice(
                new MagicOtherPermanentTargetFilter(
                    MagicTargetFilterFactory.ARTIFACT_YOU_CONTROL,
                    permanent
                ),
                MagicTargetHint.None,
                "an artifact other than " + permanent + " to sacrifice"
            );
		if (player.getNrOfPermanents(MagicType.Artifact) >=2) {
            game.addEvent(new MagicSacrificePermanentEvent(permanent,player,targetChoice));
		} else {
			game.doAction(new MagicTapAction(event.getPermanent(),true));
                game.doAction(new MagicChangeLifeAction(event.getPlayer(),-4));		
		}
        }
    }
]
Pushed