diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheDross.java b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheDross.java new file mode 100644 index 0000000000..6eb8ffd706 --- /dev/null +++ b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheDross.java @@ -0,0 +1,129 @@ +/* + * 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.newphyrexia; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.ChancellorAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author BetaSteward + */ +public class ChancellorOfTheDross extends CardImpl { + + private static String abilityText = "at the beginning of the first upkeep, each opponent loses 3 life, then you gain life equal to the life lost this way"; + + public ChancellorOfTheDross(UUID ownerId) { + super(ownerId, 54, "Chancellor of the Dross", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{B}{B}{B}"); + this.expansionSetCode = "NPH"; + this.subtype.add("Vampire"); + + this.color.setBlack(true); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // You may reveal this card from your opening hand. If you do, at the beginning of the first upkeep, each opponent loses 3 life, then you gain life equal to the life lost this way. + this.addAbility(new ChancellorAbility(new ChancellorOfTheDrossDelayedTriggeredAbility(), abilityText)); + + this.addAbility(FlyingAbility.getInstance()); + this.addAbility(LifelinkAbility.getInstance()); + } + + public ChancellorOfTheDross(final ChancellorOfTheDross card) { + super(card); + } + + @Override + public ChancellorOfTheDross copy() { + return new ChancellorOfTheDross(this); + } +} + +class ChancellorOfTheDrossDelayedTriggeredAbility extends DelayedTriggeredAbility { + + ChancellorOfTheDrossDelayedTriggeredAbility () { + super(new ChancellorOfTheDrossEffect()); + } + + ChancellorOfTheDrossDelayedTriggeredAbility(ChancellorOfTheDrossDelayedTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { + return true; + } + return false; + } + @Override + public ChancellorOfTheDrossDelayedTriggeredAbility copy() { + return new ChancellorOfTheDrossDelayedTriggeredAbility(this); + } +} + +class ChancellorOfTheDrossEffect extends OneShotEffect { + + ChancellorOfTheDrossEffect () { + super(Outcome.Benefit); + staticText = "each opponent loses 3 life, then you gain life equal to the life lost this way"; + } + + ChancellorOfTheDrossEffect(ChancellorOfTheDrossEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + int loseLife = 0; + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + loseLife += game.getPlayer(opponentId).loseLife(3, game); + } + if (loseLife > 0) + game.getPlayer(source.getControllerId()).gainLife(loseLife, game); + return true; + } + + @Override + public ChancellorOfTheDrossEffect copy() { + return new ChancellorOfTheDrossEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheForge.java b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheForge.java new file mode 100644 index 0000000000..c8ac3a7c9c --- /dev/null +++ b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheForge.java @@ -0,0 +1,121 @@ +/* + * 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.newphyrexia; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.Constants.TargetController; +import mage.MageInt; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.ChancellorAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.token.Token; + +/** + * + * @author BetaSteward + */ +public class ChancellorOfTheForge extends CardImpl { + + private static String abilityText = "at the beginning of the first upkeep, put a 1/1 red Goblin creature token with haste onto the battlefield"; + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control"); + + static { + filter.setTargetController(TargetController.YOU); + } + + public ChancellorOfTheForge(UUID ownerId) { + super(ownerId, 81, "Chancellor of the Forge", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{R}{R}{R}"); + this.expansionSetCode = "NPH"; + this.subtype.add("Giant"); + + this.color.setRed(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // You may reveal this card from your opening hand. If you do, at the beginning of the first upkeep, put a 1/1 red Goblin creature token with haste onto the battlefield. + this.addAbility(new ChancellorAbility(new ChancellorOfTheForgeDelayedTriggeredAbility(), abilityText)); + + // When Chancellor of the Forge enters the battlefield, put X 1/1 red Goblin creature tokens with haste onto the battlefield, where X is the number of creatures you control. + DynamicValue value = new PermanentsOnBattlefieldCount(filter); + this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new GoblinToken(), value), false)); + } + + public ChancellorOfTheForge(final ChancellorOfTheForge card) { + super(card); + } + + @Override + public ChancellorOfTheForge copy() { + return new ChancellorOfTheForge(this); + } +} + +class ChancellorOfTheForgeDelayedTriggeredAbility extends DelayedTriggeredAbility { + + ChancellorOfTheForgeDelayedTriggeredAbility () { + super(new CreateTokenEffect(new GoblinToken())); + } + + ChancellorOfTheForgeDelayedTriggeredAbility(ChancellorOfTheForgeDelayedTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) { + return true; + } + return false; + } + @Override + public ChancellorOfTheForgeDelayedTriggeredAbility copy() { + return new ChancellorOfTheForgeDelayedTriggeredAbility(this); + } +} + +class GoblinToken extends Token { + public GoblinToken() { + super("Goblin", "1/1 red Goblin creature token with haste"); + cardType.add(CardType.CREATURE); + color.setRed(true); + subtype.add("Goblin"); + power = new MageInt(1); + toughness = new MageInt(1); + addAbility(HasteAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheTangle.java b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheTangle.java new file mode 100644 index 0000000000..1e8de0cb81 --- /dev/null +++ b/Mage.Sets/src/mage/sets/newphyrexia/ChancellorOfTheTangle.java @@ -0,0 +1,99 @@ +/* + * 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.newphyrexia; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.Mana; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.ChancellorAbility; +import mage.abilities.effects.common.BasicManaEffect; +import mage.abilities.keyword.VigilanceAbility; +import mage.abilities.keyword.ReachAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author BetaSteward + */ +public class ChancellorOfTheTangle extends CardImpl { + + private static String abilityText = "at the beginning of your first main phase, add {G} to your mana pool"; + + public ChancellorOfTheTangle(UUID ownerId) { + super(ownerId, 106, "Chancellor of the Tangle", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{4}{G}{G}{G}"); + this.expansionSetCode = "NPH"; + this.subtype.add("Beast"); + + this.color.setGreen(true); + this.power = new MageInt(6); + this.toughness = new MageInt(7); + + // You may reveal this card from your opening hand. If you do, at the beginning of your first main phase, add {G} to your mana pool. + this.addAbility(new ChancellorAbility(new ChancellorOfTheTangleDelayedTriggeredAbility(), abilityText)); + + this.addAbility(VigilanceAbility.getInstance()); + this.addAbility(ReachAbility.getInstance()); + } + + public ChancellorOfTheTangle(final ChancellorOfTheTangle card) { + super(card); + } + + @Override + public ChancellorOfTheTangle copy() { + return new ChancellorOfTheTangle(this); + } +} + +class ChancellorOfTheTangleDelayedTriggeredAbility extends DelayedTriggeredAbility { + + ChancellorOfTheTangleDelayedTriggeredAbility () { + super(new BasicManaEffect(Mana.GreenMana)); + } + + ChancellorOfTheTangleDelayedTriggeredAbility(ChancellorOfTheTangleDelayedTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.PRECOMBAT_MAIN_PHASE_PRE && game.getActivePlayerId().equals(controllerId)) { + return true; + } + return false; + } + @Override + public ChancellorOfTheTangleDelayedTriggeredAbility copy() { + return new ChancellorOfTheTangleDelayedTriggeredAbility(this); + } +} diff --git a/Mage/src/mage/abilities/common/ChancellorAbility.java b/Mage/src/mage/abilities/common/ChancellorAbility.java new file mode 100644 index 0000000000..1f8b02248a --- /dev/null +++ b/Mage/src/mage/abilities/common/ChancellorAbility.java @@ -0,0 +1,92 @@ +/* + * Copyright 2011 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.abilities.common; + +import mage.Constants.Outcome; +import mage.Constants.Zone; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.StaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.game.Game; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class ChancellorAbility extends StaticAbility { + + public ChancellorAbility(DelayedTriggeredAbility ability, String text) { + super(Zone.HAND, new ChancellorEffect(ability, text)); + } + + public ChancellorAbility(final ChancellorAbility ability) { + super(ability); + } + + @Override + public ChancellorAbility copy() { + return new ChancellorAbility(this); + } + + @Override + public String getRule() { + return "You may reveal this card from your opening hand. If you do, " + super.getRule(); + } + +} + +class ChancellorEffect extends OneShotEffect { + + private DelayedTriggeredAbility ability; + + ChancellorEffect (DelayedTriggeredAbility ability, String text) { + super(Outcome.Benefit); + this.ability = ability; + staticText = text; + } + + ChancellorEffect(ChancellorEffect effect) { + super(effect); + this.ability = effect.ability; + } + + @Override + public boolean apply(Game game, Ability source) { + ability.setSourceId(source.getSourceId()); + ability.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(ability); + return true; + } + + @Override + public ChancellorEffect copy() { + return new ChancellorEffect(this); + } + +} diff --git a/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java b/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java index b76826b99a..fa5c47c87c 100644 --- a/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java +++ b/Mage/src/mage/abilities/effects/common/CreateTokenEffect.java @@ -73,7 +73,8 @@ public class CreateTokenEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - for (int i = 0; i < amount.calculate(game, source); i++) { + int value = amount.calculate(game, source); + for (int i = 0; i < value; i++) { token.putOntoBattlefield(game, source.getSourceId(), source.getControllerId()); } return true; diff --git a/Mage/src/mage/game/GameImpl.java b/Mage/src/mage/game/GameImpl.java index fe3495be14..74a8fa7f66 100644 --- a/Mage/src/mage/game/GameImpl.java +++ b/Mage/src/mage/game/GameImpl.java @@ -60,8 +60,10 @@ import mage.watchers.Watcher; import java.io.IOException; import java.io.Serializable; import java.util.*; +import mage.abilities.common.ChancellorAbility; import mage.abilities.mana.TriggeredManaAbility; +import mage.cards.CardsImpl; import mage.watchers.common.MorbidWatcher; import org.apache.log4j.Logger; @@ -442,6 +444,16 @@ public abstract class GameImpl> implements Game, Serializa card.putOntoBattlefield(this, Zone.HAND, null, player.getId()); } } + for (Ability ability: card.getAbilities()) { + if (ability instanceof ChancellorAbility) { + if (player.chooseUse(Outcome.PutCardInPlay, "Do you wish to reveal " + card.getName() + "?", this)) { + Cards cards = new CardsImpl(); + cards.add(card); + player.revealCards("Revealed", cards, this); + ability.resolve(this); + } + } + } } } }