From cf0ef7b398da1d276205b06a449c567dab8fd93c Mon Sep 17 00:00:00 2001 From: Loki Date: Sat, 9 Jul 2011 22:41:02 +0300 Subject: [PATCH] cards --- .../HikariTwilightGuardian.java | 146 ++++++++++++++++++ .../mage/sets/eventide/CinderPyromancer.java | 82 ++++++++++ .../mirrodinbesieged/BlightsteelColossus.java | 18 +-- .../KozilekButcherofTruth.java | 145 +++++++++++++++++ ...IntoGraveFromAnywhereTriggeredAbility.java | 26 ++++ 5 files changed, 401 insertions(+), 16 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/championsofkamigawa/HikariTwilightGuardian.java create mode 100644 Mage.Sets/src/mage/sets/eventide/CinderPyromancer.java create mode 100644 Mage.Sets/src/mage/sets/riseoftheeldrazi/KozilekButcherofTruth.java create mode 100644 Mage/src/mage/abilities/common/PutIntoGraveFromAnywhereTriggeredAbility.java diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/HikariTwilightGuardian.java b/Mage.Sets/src/mage/sets/championsofkamigawa/HikariTwilightGuardian.java new file mode 100644 index 0000000000..cbde29ec18 --- /dev/null +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/HikariTwilightGuardian.java @@ -0,0 +1,146 @@ +/* + * 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.championsofkamigawa; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SpellCastTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnFromExileEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.filter.Filter; +import mage.filter.FilterCard; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +/** + * + * @author Loki + */ +public class HikariTwilightGuardian extends CardImpl { + private final static FilterCard filter = new FilterCard("a Spirit or Arcane spell"); + + static { + filter.getSubtype().add("Spirit"); + filter.getSubtype().add("Arcane"); + filter.setScopeSubtype(Filter.ComparisonScope.Any); + } + + public HikariTwilightGuardian (UUID ownerId) { + super(ownerId, 12, "Hikari, Twilight Guardian", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}{W}"); + this.expansionSetCode = "CHK"; + this.supertype.add("Legendary"); + this.subtype.add("Spirit"); + this.color.setWhite(true); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + this.addAbility(FlyingAbility.getInstance()); + this.addAbility(new SpellCastTriggeredAbility(new HikariTwilightGuardianEffect(), filter, true)); + } + + public HikariTwilightGuardian (final HikariTwilightGuardian card) { + super(card); + } + + @Override + public HikariTwilightGuardian copy() { + return new HikariTwilightGuardian(this); + } + +} + +class HikariTwilightGuardianEffect extends OneShotEffect { + + private static final String effectText = "Exile Hikari, Twilight Guardian. Return it to the battlefield under your control at the beginning of the next end step"; + + HikariTwilightGuardianEffect ( ) { + super(Constants.Outcome.Benefit); + } + + HikariTwilightGuardianEffect(HikariTwilightGuardianEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + if (permanent.moveToExile(source.getSourceId(), "Hikari, Twilight Guardian Exile", source.getId(), game)) { + //create delayed triggered ability + HikariTwilightGuardianDelayedTriggeredAbility delayedAbility = new HikariTwilightGuardianDelayedTriggeredAbility(source.getSourceId()); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(delayedAbility); + return true; + } + } + return false; + } + + @Override + public HikariTwilightGuardianEffect copy() { + return new HikariTwilightGuardianEffect(this); + } + + @Override + public String getText(Ability source) { + return effectText; + } +} + +class HikariTwilightGuardianDelayedTriggeredAbility extends DelayedTriggeredAbility { + + HikariTwilightGuardianDelayedTriggeredAbility ( UUID exileId ) { + super(new ReturnFromExileEffect(exileId, Constants.Zone.BATTLEFIELD)); + } + + HikariTwilightGuardianDelayedTriggeredAbility(HikariTwilightGuardianDelayedTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.END_TURN_STEP_PRE) { + return true; + } + return false; + } + @Override + public HikariTwilightGuardianDelayedTriggeredAbility copy() { + return new HikariTwilightGuardianDelayedTriggeredAbility(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/eventide/CinderPyromancer.java b/Mage.Sets/src/mage/sets/eventide/CinderPyromancer.java new file mode 100644 index 0000000000..6f9e6a5f6b --- /dev/null +++ b/Mage.Sets/src/mage/sets/eventide/CinderPyromancer.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.eventide; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SpellCastTriggeredAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.UntapSourceEffect; +import mage.cards.CardImpl; +import mage.filter.FilterCard; +import mage.target.TargetPlayer; + +/** + * + * @author Loki + */ +public class CinderPyromancer extends CardImpl { + private static final FilterCard filter = new FilterCard("a red spell"); + + static { + filter.getColor().setRed(true); + filter.setUseColor(true); + } + + public CinderPyromancer (UUID ownerId) { + super(ownerId, 50, "Cinder Pyromancer", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{R}"); + this.expansionSetCode = "EVE"; + this.subtype.add("Elemental"); + this.subtype.add("Shaman"); + this.color.setRed(true); + this.power = new MageInt(0); + this.toughness = new MageInt(1); + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost()); + ability.addTarget(new TargetPlayer()); + this.addAbility(ability); + this.addAbility(new SpellCastTriggeredAbility(new UntapSourceEffect(), filter, true)); + } + + public CinderPyromancer (final CinderPyromancer card) { + super(card); + } + + @Override + public CinderPyromancer copy() { + return new CinderPyromancer(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/BlightsteelColossus.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/BlightsteelColossus.java index 5899813582..ece377b5c8 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/BlightsteelColossus.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/BlightsteelColossus.java @@ -36,6 +36,7 @@ import mage.Constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility; import mage.abilities.common.ZoneChangeTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.IndestructibleAbility; @@ -64,7 +65,7 @@ public class BlightsteelColossus extends CardImpl { this.addAbility(TrampleAbility.getInstance()); this.addAbility(InfectAbility.getInstance()); this.addAbility(IndestructibleAbility.getInstance()); - this.addAbility(new BlightsteelColossusTriggeredAbility()); + this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new BlightsteelColossusEffect(), false)); } public BlightsteelColossus(final BlightsteelColossus card) { @@ -78,21 +79,6 @@ public class BlightsteelColossus extends CardImpl { } -class BlightsteelColossusTriggeredAbility extends ZoneChangeTriggeredAbility { - BlightsteelColossusTriggeredAbility() { - super(Constants.Zone.GRAVEYARD, new BlightsteelColossusEffect(), "If Blightsteel Colossus would be put into a graveyard from anywhere, ", false); - } - - BlightsteelColossusTriggeredAbility(final BlightsteelColossusTriggeredAbility ability) { - super(ability); - } - - @Override - public BlightsteelColossusTriggeredAbility copy() { - return new BlightsteelColossusTriggeredAbility(this); - } -} - class BlightsteelColossusEffect extends OneShotEffect { BlightsteelColossusEffect() { super(Constants.Outcome.Benefit); diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/KozilekButcherofTruth.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KozilekButcherofTruth.java new file mode 100644 index 0000000000..d11d1eef52 --- /dev/null +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/KozilekButcherofTruth.java @@ -0,0 +1,145 @@ +/* + * 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.riseoftheeldrazi; + +import java.util.UUID; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.PutIntoGraveFromAnywhereTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.abilities.effects.common.TakesAnExtraTurnControlledEffect; +import mage.abilities.keyword.AnnihilatorAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.stack.Spell; +import mage.players.Player; + +/** + * + * @author Loki + */ +public class KozilekButcherofTruth extends CardImpl { + + public KozilekButcherofTruth (UUID ownerId) { + super(ownerId, 6, "Kozilek, Butcher of Truth", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{10}"); + this.expansionSetCode = "ROE"; + this.subtype.add("Legendary"); + this.subtype.add("Eldrazi"); + this.power = new MageInt(12); + this.toughness = new MageInt(12); + this.addAbility(new KozilekButcherofTruthOnCastAbility()); + this.addAbility(new AnnihilatorAbility(4)); + this.addAbility(new PutIntoGraveFromAnywhereTriggeredAbility(new KozilekButcherofTruthEffect(), false)); + } + + public KozilekButcherofTruth (final KozilekButcherofTruth card) { + super(card); + } + + @Override + public KozilekButcherofTruth copy() { + return new KozilekButcherofTruth(this); + } + +} + +class KozilekButcherofTruthOnCastAbility extends TriggeredAbilityImpl { + + private static final String abilityText = "When you cast Kozilek, Butcher of Truth, draw four cards"; + + KozilekButcherofTruthOnCastAbility() { + super(Constants.Zone.STACK, new DrawCardControllerEffect(4)); + } + + KozilekButcherofTruthOnCastAbility(final KozilekButcherofTruthOnCastAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.SPELL_CAST) { + Spell spell = (Spell) game.getObject(event.getTargetId()); + if (this.getSourceId().equals(spell.getSourceId())) { + return true; + } + } + return false; + } + + @Override + public KozilekButcherofTruthOnCastAbility copy() { + return new KozilekButcherofTruthOnCastAbility(this); + } + + @Override + public String getRule() { + return abilityText; + } +} + +class KozilekButcherofTruthEffect extends OneShotEffect { + KozilekButcherofTruthEffect() { + super(Constants.Outcome.Benefit); + } + + KozilekButcherofTruthEffect(final KozilekButcherofTruthEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + /*Card permanent = (Card)game.getObject(source.getSourceId());*/ + if (player != null /* && permanent != null */) { + /*permanent.moveToZone(Zone.LIBRARY, source.getId(), game, true);*/ + player.getLibrary().addAll(player.getGraveyard().getCards(game), game); + player.getGraveyard().clear(); + player.getLibrary().shuffle(); + return true; + } + return false; + } + + @Override + public KozilekButcherofTruthEffect copy() { + return new KozilekButcherofTruthEffect(this); + } + + @Override + public String getText(Ability source) { + return "its owner shuffles his or her graveyard into his or her library"; + } +} diff --git a/Mage/src/mage/abilities/common/PutIntoGraveFromAnywhereTriggeredAbility.java b/Mage/src/mage/abilities/common/PutIntoGraveFromAnywhereTriggeredAbility.java new file mode 100644 index 0000000000..80be7481b2 --- /dev/null +++ b/Mage/src/mage/abilities/common/PutIntoGraveFromAnywhereTriggeredAbility.java @@ -0,0 +1,26 @@ +package mage.abilities.common; + +import mage.Constants; +import mage.abilities.effects.Effect; + +/** + * @author Loki + */ +public class PutIntoGraveFromAnywhereTriggeredAbility extends ZoneChangeTriggeredAbility { + public PutIntoGraveFromAnywhereTriggeredAbility(Effect effect, boolean optional) { + super(Constants.Zone.GRAVEYARD, effect, "When {this} is put into a graveyard from anywhere, ", optional); + } + + public PutIntoGraveFromAnywhereTriggeredAbility(Effect effect) { + this(effect, false); + } + + public PutIntoGraveFromAnywhereTriggeredAbility(final PutIntoGraveFromAnywhereTriggeredAbility ability) { + super(ability); + } + + @Override + public PutIntoGraveFromAnywhereTriggeredAbility copy() { + return new PutIntoGraveFromAnywhereTriggeredAbility(this); + } +}