From 66ec60a1cdf12e82ee514b073a16bd91917c516c Mon Sep 17 00:00:00 2001 From: Zzooouhh Date: Tue, 26 Sep 2017 14:14:12 +0200 Subject: [PATCH] Implemented Leviathan --- Mage.Sets/src/mage/cards/l/Leviathan.java | 138 ++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/Leviathan.java diff --git a/Mage.Sets/src/mage/cards/l/Leviathan.java b/Mage.Sets/src/mage/cards/l/Leviathan.java new file mode 100644 index 0000000000..cf79670e67 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/Leviathan.java @@ -0,0 +1,138 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.cards.l; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTappedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.PayCostToAttackBlockEffectImpl; +import mage.abilities.effects.common.DoIfCostPaid; +import mage.abilities.effects.common.DontUntapInControllersUntapStepSourceEffect; +import mage.abilities.effects.common.UntapSourceEffect; +import mage.abilities.effects.common.combat.CantAttackUnlessPaysAttachedEffect; +import mage.abilities.keyword.TrampleAbility; +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.constants.TargetController; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.common.TargetControlledPermanent; + + +//import mage.abilities.decorator.ConditionalTriggeredAbility; + +/** + * + * @author L_J + */ +public class Leviathan extends CardImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent("two Islands"); + static { + filter.add(new SubtypePredicate(SubType.ISLAND)); + } + + public Leviathan(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{U}{U}{U}{U}"); + this.subtype.add(SubType.LEVIATHAN); + + this.power = new MageInt(10); + this.toughness = new MageInt(10); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Leviathan enters the battlefield tapped and doesn't untap during your untap step. + Ability abilityTapped = new EntersBattlefieldTappedAbility( + "{this} enters the battlefield tapped and doesn't untap during your untap step."); + abilityTapped.addEffect(new DontUntapInControllersUntapStepSourceEffect()); + this.addAbility(abilityTapped); + + // At the beginning of your upkeep, you may sacrifice two Islands. If you do, untap Leviathan. + this.addAbility(new BeginningOfUpkeepTriggeredAbility( + Zone.BATTLEFIELD, + new DoIfCostPaid(new UntapSourceEffect(), + new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, false))), + TargetController.YOU, + false)); + + // Leviathan can't attack unless you sacrifice two Islands. (This cost is paid as attackers are declared.) + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LeviathanCostToAttackBlockEffect())); + + } + + public Leviathan(final Leviathan card) { + super(card); + } + + @Override + public Leviathan copy() { + return new Leviathan(this); + } +} + + +class LeviathanCostToAttackBlockEffect extends PayCostToAttackBlockEffectImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent("two Islands"); + static { + filter.add(new SubtypePredicate(SubType.ISLAND)); + } + + LeviathanCostToAttackBlockEffect() { + super(Duration.WhileOnBattlefield, Outcome.Detriment, RestrictType.ATTACK, + new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, false))); + staticText = "{this} can't attack unless you sacrifice two Islands (This cost is paid as attackers are declared.)"; + } + + LeviathanCostToAttackBlockEffect(LeviathanCostToAttackBlockEffect effect) { + super(effect); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return source.getSourceId().equals(event.getSourceId()); + } + + @Override + public LeviathanCostToAttackBlockEffect copy() { + return new LeviathanCostToAttackBlockEffect(this); + } + +}