From b6285accde43f3cdde923904f8d55f47bfa79fda Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 2 Sep 2013 17:11:07 +0200 Subject: [PATCH] [THS] Added 3 Theros cards. --- .../mage/sets/magic2014/ColossalWhale.java | 2 +- .../src/mage/sets/theros/CavalryPegasus.java | 82 ++++++++++ .../mage/sets/theros/ChainedToTheRocks.java | 150 ++++++++++++++++++ .../mage/sets/theros/ElspethSunsChampion.java | 103 ++++++++++++ .../continious/GainAbilityAllEffect.java | 6 +- 5 files changed, 341 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/theros/CavalryPegasus.java create mode 100644 Mage.Sets/src/mage/sets/theros/ChainedToTheRocks.java create mode 100644 Mage.Sets/src/mage/sets/theros/ElspethSunsChampion.java diff --git a/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java b/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java index e940547e0f7..db2f0ab05dc 100644 --- a/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java +++ b/Mage.Sets/src/mage/sets/magic2014/ColossalWhale.java @@ -124,7 +124,7 @@ class ColossalWhaleAbility extends TriggeredAbilityImpl { class ColossalWhaleWatcher extends WatcherImpl { - UUID exileId; + private UUID exileId; ColossalWhaleWatcher (UUID exileId) { super("BattlefieldLeft", WatcherScope.CARD); diff --git a/Mage.Sets/src/mage/sets/theros/CavalryPegasus.java b/Mage.Sets/src/mage/sets/theros/CavalryPegasus.java new file mode 100644 index 00000000000..0b2a95535ee --- /dev/null +++ b/Mage.Sets/src/mage/sets/theros/CavalryPegasus.java @@ -0,0 +1,82 @@ +/* + * 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.theros; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.continious.GainAbilityAllEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AttackingPredicate; + +/** + * + * @author LevelX2 + */ +public class CavalryPegasus extends CardImpl { + + private static final FilterPermanent filter = new FilterCreaturePermanent("each attacking Human"); + static { + filter.add(new SubtypePredicate("Human")); + filter.add(new AttackingPredicate()); + } + + public CavalryPegasus(UUID ownerId) { + super(ownerId, 2, "Cavalry Pegasus", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}"); + this.expansionSetCode = "THS"; + this.subtype.add("Pegasus"); + this.color.setWhite(true); + + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever Cavalry Pegasus attacks, each attacking Human gains flying until end of turn. + this.addAbility(new AttacksTriggeredAbility(new GainAbilityAllEffect(FlyingAbility.getInstance(), Duration.EndOfTurn, filter), false)); + + + } + + public CavalryPegasus(final CavalryPegasus card) { + super(card); + } + + @Override + public CavalryPegasus copy() { + return new CavalryPegasus(this); + } +} diff --git a/Mage.Sets/src/mage/sets/theros/ChainedToTheRocks.java b/Mage.Sets/src/mage/sets/theros/ChainedToTheRocks.java new file mode 100644 index 00000000000..36a6c621035 --- /dev/null +++ b/Mage.Sets/src/mage/sets/theros/ChainedToTheRocks.java @@ -0,0 +1,150 @@ +/* + * 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.theros; + +import java.util.LinkedList; +import java.util.UUID; + +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.constants.WatcherScope; +import mage.constants.Zone; +import mage.filter.common.FilterControlledLandPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.ExileZone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; +import mage.watchers.WatcherImpl; + +/** + * + * @author LevelX2 + */ +public class ChainedToTheRocks extends CardImpl { + + private static final FilterControlledLandPermanent filter = new FilterControlledLandPermanent("Mountain you control"); + private static final FilterCreaturePermanent filterTarget = new FilterCreaturePermanent("creature an opponent controls"); + static { + filter.add(new SubtypePredicate("Mountain")); + filterTarget.add(new ControllerPredicate(TargetController.OPPONENT)); + } + private UUID exileId = UUID.randomUUID(); + + public ChainedToTheRocks(UUID ownerId) { + super(ownerId, 4, "Chained to the Rocks", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{W}"); + this.expansionSetCode = "THS"; + this.subtype.add("Aura"); + + this.color.setWhite(true); + + // Enchant Mountain you control + TargetPermanent auraTarget = new TargetPermanent(filter); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Exile)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + + // When Chained to the Rocks enters the battlefield, exile target creature an opponent controls until Chained to the Rocks leaves the battlefield. (That creature returns under its owner's control.) + Effect effect = new ExileTargetEffect(exileId, this.getName()); + effect.setText("exile target creature an opponent controls until {this} leaves the battlefield. (That creature returns under its owner's control.)"); + ability = new EntersBattlefieldTriggeredAbility(effect); + ability.addTarget(new TargetCreaturePermanent(filterTarget)); + this.addAbility(ability); + this.addWatcher(new ChainedToTheRocksWatcher(exileId)); + + } + + public ChainedToTheRocks(final ChainedToTheRocks card) { + super(card); + } + + @Override + public ChainedToTheRocks copy() { + return new ChainedToTheRocks(this); + } +} + + +class ChainedToTheRocksWatcher extends WatcherImpl { + + private UUID exileId; + + ChainedToTheRocksWatcher (UUID exileId) { + super("BattlefieldLeft", WatcherScope.CARD); + this.exileId = exileId; + } + + ChainedToTheRocksWatcher(final ChainedToTheRocksWatcher watcher) { + super(watcher); + this.exileId = watcher.exileId; + } + + @Override + public void watch(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE && event.getTargetId().equals(sourceId)) { + ZoneChangeEvent zEvent = (ZoneChangeEvent)event; + if (zEvent.getFromZone() == Zone.BATTLEFIELD) { + ExileZone exile = game.getExile().getExileZone(exileId); + if (exile != null) { + LinkedList cards = new LinkedList(exile); + for (UUID cardId: cards) { + Card card = game.getCard(cardId); + card.moveToZone(Zone.BATTLEFIELD, this.getSourceId(), game, false); + } + exile.clear(); + } + } + } + } + + @Override + public void reset() { + //don't reset condition each turn - only when this leaves the battlefield + } + + @Override + public ChainedToTheRocksWatcher copy() { + return new ChainedToTheRocksWatcher(this); + } +} diff --git a/Mage.Sets/src/mage/sets/theros/ElspethSunsChampion.java b/Mage.Sets/src/mage/sets/theros/ElspethSunsChampion.java new file mode 100644 index 00000000000..4fe61b14c6e --- /dev/null +++ b/Mage.Sets/src/mage/sets/theros/ElspethSunsChampion.java @@ -0,0 +1,103 @@ +/* + * 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.theros; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.abilities.effects.common.GetEmblemEffect; +import mage.abilities.effects.common.continious.BoostControlledEffect; +import mage.abilities.effects.common.continious.GainAbilityControlledEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.Filter; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.PowerPredicate; +import mage.game.command.Emblem; +import mage.game.permanent.token.SoldierToken; + +/** + * + * @author LevelX2 + */ +public class ElspethSunsChampion extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with power 4 or greater"); + static { + filter.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 3)); + } + + public ElspethSunsChampion(UUID ownerId) { + super(ownerId, 9, "Elspeth, Sun's Champion", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{4}{W}{W}"); + this.expansionSetCode = "THS"; + this.subtype.add("Elsepth"); + + this.color.setWhite(true); + + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance(4)), false)); + + // +1: Put three 1/1 white Soldier creature tokens onto the battlefield. + this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new SoldierToken(), 3), 1)); + // -3: Destroy all creatures with power 4 or greater. + this.addAbility(new LoyaltyAbility(new DestroyAllEffect(filter), -3)); + // -7: You get an emblem with "Creatures you control get +2/+2 and have flying." + this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new ElspethSunsChampionEmblem()), -7)); + } + + public ElspethSunsChampion(final ElspethSunsChampion card) { + super(card); + } + + @Override + public ElspethSunsChampion copy() { + return new ElspethSunsChampion(this); + } +} + +// -7: You get an emblem with "Creatures you control get +2/+2 and have flying." +class ElspethSunsChampionEmblem extends Emblem { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures"); + + public ElspethSunsChampionEmblem() { + Ability ability = new SimpleStaticAbility(Zone.COMMAND, new BoostControlledEffect(2,2, Duration.WhileOnBattlefield, filter, false)); + ability.addEffect(new GainAbilityControlledEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield, filter)); + this.getAbilities().add(ability); + + } +} diff --git a/Mage/src/mage/abilities/effects/common/continious/GainAbilityAllEffect.java b/Mage/src/mage/abilities/effects/common/continious/GainAbilityAllEffect.java index a724bc6ab56..30e2c08f073 100644 --- a/Mage/src/mage/abilities/effects/common/continious/GainAbilityAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/GainAbilityAllEffect.java @@ -118,7 +118,11 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl 0) {