diff --git a/Mage.Sets/src/mage/sets/alarareborn/MycoidShepherd.java b/Mage.Sets/src/mage/sets/alarareborn/MycoidShepherd.java new file mode 100644 index 00000000000..b093db9c376 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alarareborn/MycoidShepherd.java @@ -0,0 +1,117 @@ +/* + * 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.alarareborn; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.Constants.Zone; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; + +/** + * + * @author jeffwadsworth + */ +public class MycoidShepherd extends CardImpl { + + public MycoidShepherd(UUID ownerId) { + super(ownerId, 73, "Mycoid Shepherd", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{G}{G}{W}"); + this.expansionSetCode = "ARB"; + this.subtype.add("Fungus"); + + this.color.setGreen(true); + this.color.setWhite(true); + this.power = new MageInt(5); + this.toughness = new MageInt(4); + + // Whenever Mycoid Shepherd or another creature you control with power 5 or greater dies, you may gain 5 life. + this.addAbility(new MycoidShepherdTriggeredAbility()); + + } + + public MycoidShepherd(final MycoidShepherd card) { + super(card); + } + + @Override + public MycoidShepherd copy() { + return new MycoidShepherd(this); + } +} + +class MycoidShepherdTriggeredAbility extends TriggeredAbilityImpl { + + public MycoidShepherdTriggeredAbility() { + super(Constants.Zone.BATTLEFIELD, new GainLifeEffect(5), true); + } + + public MycoidShepherdTriggeredAbility(final MycoidShepherdTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { + MageObject lastKnown = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + if (lastKnown == null) { + return false; + } + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + Permanent permanent = zEvent.getTarget(); + if (permanent == null) { + return false; + } + if (super.getSourceId().equals(event.getTargetId()) + || permanent.getPower().getValue() > 4 + && permanent.getControllerId().equals(controllerId)) { + Zone after = game.getState().getZone(event.getTargetId()); + return after != null && Zone.GRAVEYARD.match(after); + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever Mycoid Shepherd or another creature you control with power 5 or greater dies, you may gain 5 life."; + } + + @Override + public MycoidShepherdTriggeredAbility copy() { + return new MycoidShepherdTriggeredAbility(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/coldsnap/Counterbalance.java b/Mage.Sets/src/mage/sets/coldsnap/Counterbalance.java new file mode 100644 index 00000000000..c5796ead1f4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/coldsnap/Counterbalance.java @@ -0,0 +1,109 @@ +/* + * 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.coldsnap; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.OpponentCastsSpellTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardsImpl; +import mage.game.Game; +import mage.game.stack.StackObject; +import mage.players.Player; + +/** + * + * @author jeffwadsworth + */ +public class Counterbalance extends CardImpl { + + public Counterbalance(UUID ownerId) { + super(ownerId, 31, "Counterbalance", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}"); + this.expansionSetCode = "CSP"; + + this.color.setBlue(true); + + // Whenever an opponent casts a spell, you may reveal the top card of your library. If you do, counter that spell if it has the same converted mana cost as the revealed card. + this.addAbility(new OpponentCastsSpellTriggeredAbility(new CounterbalanceEffect(), true)); + } + + public Counterbalance(final Counterbalance card) { + super(card); + } + + @Override + public Counterbalance copy() { + return new Counterbalance(this); + } +} + +class CounterbalanceEffect extends OneShotEffect { + + public CounterbalanceEffect() { + super(Outcome.Neutral); + this.staticText = "you may reveal the top card of your library. If you do, counter that spell if it has the same converted mana cost as the revealed card"; + } + + public CounterbalanceEffect(final CounterbalanceEffect effect) { + super(effect); + } + + @Override + public CounterbalanceEffect copy() { + return new CounterbalanceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player you = game.getPlayer(source.getControllerId()); + if (you == null) { + return false; + } + Card topcard = you.getLibrary().getFromTop(game); + if (topcard == null) { + return false; + } + CardsImpl cards = new CardsImpl(); + cards.add(topcard); + you.revealCards("Counterbalance", cards, game); + int cmc = topcard.getManaCost().convertedManaCost(); + StackObject spell = game.getStack().getStackObject(targetPointer.getFirst(game, source)); + if (spell == null) { + return false; + } + if (cmc == spell.getManaCost().convertedManaCost()) { + return game.getStack().counter(spell.getSourceId(), source.getSourceId(), game); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/commander/BasandraBattleSeraph.java b/Mage.Sets/src/mage/sets/commander/BasandraBattleSeraph.java new file mode 100644 index 00000000000..6c83e2f1281 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander/BasandraBattleSeraph.java @@ -0,0 +1,126 @@ +/* + * 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.commander; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.Constants.TurnPhase; +import mage.Constants.Zone; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.AttacksIfAbleTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.keyword.AttacksThisTurnMarkerAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class BasandraBattleSeraph extends CardImpl { + + public BasandraBattleSeraph(UUID ownerId) { + super(ownerId, 184, "Basandra, Battle Seraph", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}{W}"); + this.expansionSetCode = "CMD"; + this.supertype.add("Legendary"); + this.subtype.add("Angel"); + + this.color.setRed(true); + this.color.setWhite(true); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Players can't cast spells during combat. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BasandraBattleSeraphEffect())); + + // {R}: Target creature attacks this turn if able. + Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new AttacksIfAbleTargetEffect(Constants.Duration.EndOfTurn), new ManaCostsImpl("{R}")); + ability.addEffect(new GainAbilityTargetEffect(AttacksThisTurnMarkerAbility.getInstance(), Constants.Duration.EndOfTurn, null)); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + } + + public BasandraBattleSeraph(final BasandraBattleSeraph card) { + super(card); + } + + @Override + public BasandraBattleSeraph copy() { + return new BasandraBattleSeraph(this); + } +} + +class BasandraBattleSeraphEffect extends ReplacementEffectImpl { + + public BasandraBattleSeraphEffect() { + super(Constants.Duration.EndOfTurn, Constants.Outcome.Neutral); + staticText = "Players can't cast spells during combat"; + } + + public BasandraBattleSeraphEffect(final BasandraBattleSeraphEffect effect) { + super(effect); + } + + @Override + public BasandraBattleSeraphEffect copy() { + return new BasandraBattleSeraphEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + return true; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getType() == GameEvent.EventType.CAST_SPELL + && game.getPhase().getType() == TurnPhase.COMBAT) { + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/futuresight/DaybreakCoronet.java b/Mage.Sets/src/mage/sets/futuresight/DaybreakCoronet.java new file mode 100644 index 00000000000..065232d745b --- /dev/null +++ b/Mage.Sets/src/mage/sets/futuresight/DaybreakCoronet.java @@ -0,0 +1,117 @@ +/* + * 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.futuresight; + +import java.util.LinkedList; +import java.util.List; +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continious.BoostEnchantedEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class DaybreakCoronet extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with another Aura attached to it."); + + static { + filter.add(new AuraAttachedPredicate()); + } + + public DaybreakCoronet(UUID ownerId) { + super(ownerId, 21, "Daybreak Coronet", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{W}{W}"); + this.expansionSetCode = "FUT"; + this.subtype.add("Aura"); + + this.color.setWhite(true); + + // Enchant creature with another Aura attached to it + TargetPermanent auraTarget = new TargetCreaturePermanent(filter); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +3/+3 and has first strike, vigilance, and lifelink. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3, Constants.Duration.WhileOnBattlefield))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), Constants.AttachmentType.AURA))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), Constants.AttachmentType.AURA))); + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(LifelinkAbility.getInstance(), Constants.AttachmentType.AURA))); + } + + public DaybreakCoronet(final DaybreakCoronet card) { + super(card); + } + + @Override + public DaybreakCoronet copy() { + return new DaybreakCoronet(this); + } +} + +class AuraAttachedPredicate implements Predicate { + + @Override + public boolean apply(Permanent input, Game game) { + List attachments = new LinkedList(); + attachments.addAll(input.getAttachments()); + for (UUID uuid : attachments) { + Permanent attachment = game.getPermanent(uuid); + if (attachment != null + && attachment.getSubtype().contains("Aura")) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return "Aura attached"; + } +}