diff --git a/Mage.Sets/src/mage/sets/commander2014/AssaultSuit.java b/Mage.Sets/src/mage/sets/commander2014/AssaultSuit.java new file mode 100644 index 0000000000..4bfcf32bbd --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/AssaultSuit.java @@ -0,0 +1,176 @@ +/* + * 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.sets.commander2014; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.combat.CantAttackControllerAttachedEffect; +import mage.abilities.effects.common.continious.BoostEquippedEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.effects.common.continious.GainControlTargetEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LevelX2 + */ +public class AssaultSuit extends CardImpl { + + public AssaultSuit(UUID ownerId) { + super(ownerId, 53, "Assault Suit", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{4}"); + this.expansionSetCode = "C14"; + this.subtype.add("Equipment"); + + // Equipped creature gets +2/+2, has haste, can't attack you or a planeswalker you control, and can't be sacrificed. + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2)); + Effect effect = new GainAbilityAttachedEffect(HasteAbility.getInstance(), AttachmentType.EQUIPMENT); + effect.setText(", has haste"); + ability.addEffect(effect); + effect = new CantAttackControllerAttachedEffect(AttachmentType.EQUIPMENT); + effect.setText(", can't attack you or a planeswalker you control"); + ability.addEffect(effect); + effect = new AssaultSuitCantBeSacrificed(); + effect.setText(", and can't be sacrificed"); + ability.addEffect(effect); + this.addAbility(ability); + + // At the beginning of each opponent's upkeep, you may have that player gain control of equipped creature until end of turn. If you do, untap it. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AssaultSuitGainControlEffect(), TargetController.OPPONENT, false)); + + // Equip {3} + this.addAbility(new EquipAbility(Outcome.Detriment, new GenericManaCost(3))); + } + + public AssaultSuit(final AssaultSuit card) { + super(card); + } + + @Override + public AssaultSuit copy() { + return new AssaultSuit(this); + } +} + + class AssaultSuitCantBeSacrificed extends ContinuousRuleModifiyingEffectImpl { + + public AssaultSuitCantBeSacrificed() { + super(Duration.WhileOnBattlefield, Outcome.Detriment, true, false); + staticText = "and can't be sacrificed"; + } + + public AssaultSuitCantBeSacrificed(final AssaultSuitCantBeSacrificed effect) { + super(effect); + } + + @Override + public AssaultSuitCantBeSacrificed copy() { + return new AssaultSuitCantBeSacrificed(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public String getInfoMessage(Ability source, GameEvent event, Game game) { + return "This creature can't be sacrificed."; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT) { + Permanent equipment = game.getPermanent(source.getSourceId()); + if (equipment != null && equipment.getAttachedTo() != null) { + return equipment.getAttachedTo().equals(event.getTargetId()); + } + } + return false; + } +} + +class AssaultSuitGainControlEffect extends OneShotEffect { + + public AssaultSuitGainControlEffect() { + super(Outcome.Benefit); + this.staticText = "you may have that player gain control of equipped creature until end of turn. If you do, untap it"; + } + + public AssaultSuitGainControlEffect(final AssaultSuitGainControlEffect effect) { + super(effect); + } + + @Override + public AssaultSuitGainControlEffect copy() { + return new AssaultSuitGainControlEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Player activePlayer = game.getPlayer(game.getActivePlayerId()); + Permanent equipment = game.getPermanent(source.getSourceId()); + if (controller != null && activePlayer != null && equipment != null) { + if (equipment.getAttachedTo() != null) { + Permanent equippedCreature = game.getPermanent(equipment.getAttachedTo()); + if (equippedCreature != null && controller.chooseUse(outcome, + "Let have " + activePlayer.getName() + " gain control of " + equippedCreature.getLogName() + "?", game)) { + equippedCreature.untap(game); + ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn, activePlayer.getId()); + effect.setTargetPointer(new FixedTarget(equipment.getAttachedTo())); + game.addEffect(effect, source); + } + } + return true; + } + + + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/commander2014/CrownOfDoom.java b/Mage.Sets/src/mage/sets/commander2014/CrownOfDoom.java new file mode 100644 index 0000000000..eeef0d72f0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2014/CrownOfDoom.java @@ -0,0 +1,123 @@ +/* + * 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.sets.commander2014; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.ActivateIfConditionActivatedAbility; +import mage.abilities.common.AttacksAllTriggeredAbility; +import mage.abilities.condition.common.MyTurnCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.BoostTargetEffect; +import mage.abilities.effects.common.continious.GainControlTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SetTargetPointer; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.filter.FilterPlayer; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.other.OwnerPredicate; +import mage.filter.predicate.other.PlayerPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LevelX2 + */ +public class CrownOfDoom extends CardImpl { + + private static final FilterPlayer filter = new FilterPlayer("player other than Crown of Doom's owner"); + + static { + filter.add(new OwnerPredicate(TargetController.NOT_YOU)); + } + + public CrownOfDoom(UUID ownerId) { + super(ownerId, 55, "Crown of Doom", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}"); + this.expansionSetCode = "C14"; + + // Whenever a creature attacks you or a planeswalker you control, it gets +2/+0 until end of turn. + Effect effect = new BoostTargetEffect(2,0,Duration.EndOfTurn); + effect.setText("it gets +2/+0 until end of turn"); + this.addAbility(new AttacksAllTriggeredAbility(effect, false, new FilterCreaturePermanent(), SetTargetPointer.CREATURE, true)); + + // {2}: Target player other than Crown of Doom's owner gains control of it. Activate this ability only during your turn. + Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new CrownOfDoomEffect(), new ManaCostsImpl("{2}"), MyTurnCondition.getInstance()); + ability.addTarget(new TargetPlayer(1, 1, false, filter)); + this.addAbility(ability); + } + + public CrownOfDoom(final CrownOfDoom card) { + super(card); + } + + @Override + public CrownOfDoom copy() { + return new CrownOfDoom(this); + } +} + +class CrownOfDoomEffect extends OneShotEffect { + + public CrownOfDoomEffect() { + super(Outcome.Detriment); + this.staticText = "Target player other than {this}'s owner gains control of it"; + } + + public CrownOfDoomEffect(final CrownOfDoomEffect effect) { + super(effect); + } + + @Override + public CrownOfDoomEffect copy() { + return new CrownOfDoomEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Player newController = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (controller != null && newController != null) { + ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, newController.getId()); + effect.setTargetPointer(new FixedTarget(source.getSourceId())); + game.addEffect(effect, source); + return true; + } + return false; + } +}