diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/TajuruPreserver.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/TajuruPreserver.java new file mode 100644 index 0000000000..dce1ff8489 --- /dev/null +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/TajuruPreserver.java @@ -0,0 +1,119 @@ +/* + * 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 mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.permanent.PermanentCard; +import mage.game.stack.Spell; + +import java.util.UUID; + +/** + * @author noxx + */ +public class TajuruPreserver extends CardImpl { + + public TajuruPreserver(UUID ownerId) { + super(ownerId, 211, "Tajuru Preserver", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{G}"); + this.expansionSetCode = "ROE"; + this.subtype.add("Elf"); + this.subtype.add("Shaman"); + + this.color.setGreen(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Spells and abilities your opponents control can't cause you to sacrifice permanents. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new TajuruPreserverEffect())); + } + + public TajuruPreserver(final TajuruPreserver card) { + super(card); + } + + @Override + public TajuruPreserver copy() { + return new TajuruPreserver(this); + } +} + +class TajuruPreserverEffect extends ReplacementEffectImpl { + + public TajuruPreserverEffect() { + super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Benefit); + staticText = "Spells and abilities your opponents control can't cause you to sacrifice permanents"; + } + + public TajuruPreserverEffect(final TajuruPreserverEffect effect) { + super(effect); + } + + @Override + public TajuruPreserverEffect copy() { + return new TajuruPreserverEffect(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.SACRIFICE_PERMANENT) { + MageObject object = game.getObject(event.getSourceId()); + if (object instanceof PermanentCard) { + if (game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId())) { + return true; + } + } + if (object instanceof Spell) { + if (game.getOpponents(source.getControllerId()).contains(((Spell)object).getControllerId())) { + return true; + } + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/worldwake/CanopyCover.java b/Mage.Sets/src/mage/sets/worldwake/CanopyCover.java new file mode 100644 index 0000000000..a63180e594 --- /dev/null +++ b/Mage.Sets/src/mage/sets/worldwake/CanopyCover.java @@ -0,0 +1,143 @@ +/* + * 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.worldwake; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.EvasionAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.HexproofAbility; +import mage.abilities.keyword.ReachAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class CanopyCover extends CardImpl { + + public CanopyCover(UUID ownerId) { + super(ownerId, 98, "Canopy Cover", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); + this.expansionSetCode = "WWK"; + this.subtype.add("Aura"); + + this.color.setGreen(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Constants.Outcome.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature can't be blocked except by creatures with flying or reach. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(OrchardSpiritAbility.getInstance(), Constants.AttachmentType.AURA))); + + // Enchanted creature can't be the target of spells or abilities your opponents control. + this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(HexproofAbility.getInstance(), Constants.AttachmentType.AURA))); + } + + public CanopyCover(final CanopyCover card) { + super(card); + } + + @Override + public CanopyCover copy() { + return new CanopyCover(this); + } +} + +class OrchardSpiritAbility extends EvasionAbility { + + private static OrchardSpiritAbility instance; + + public static OrchardSpiritAbility getInstance() { + if (instance == null) { + instance = new OrchardSpiritAbility(); + } + return instance; + } + + private OrchardSpiritAbility() { + this.addEffect(new OrchardSpiritEffect()); + } + + @Override + public String getRule() { + return "\"{this} can't be blocked except by creatures with flying or reach\""; + } + + @Override + public OrchardSpiritAbility copy() { + return getInstance(); + } +} + +class OrchardSpiritEffect extends RestrictionEffect { + + public OrchardSpiritEffect() { + super(Constants.Duration.WhileOnBattlefield); + } + + public OrchardSpiritEffect(final OrchardSpiritEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getAbilities().containsKey(OrchardSpiritAbility.getInstance().getId())) { + return true; + } + return false; + } + + @Override + public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { + if (blocker.getAbilities().contains(FlyingAbility.getInstance()) || blocker.getAbilities().contains(ReachAbility.getInstance())) { + return true; + } + return false; + } + + @Override + public OrchardSpiritEffect copy() { + return new OrchardSpiritEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/worldwake/StrengthOfTheTajuru.java b/Mage.Sets/src/mage/sets/worldwake/StrengthOfTheTajuru.java new file mode 100644 index 0000000000..bc5f023420 --- /dev/null +++ b/Mage.Sets/src/mage/sets/worldwake/StrengthOfTheTajuru.java @@ -0,0 +1,119 @@ +/* + * 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.worldwake; + +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.counters.Counter; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author noxx + */ +public class StrengthOfTheTajuru extends CardImpl { + + public StrengthOfTheTajuru(UUID ownerId) { + super(ownerId, 113, "Strength of the Tajuru", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{X}{G}{G}"); + this.expansionSetCode = "WWK"; + + this.color.setGreen(true); + + // Multikicker {1} + //MultikickerAbility ability = new MultikickerAbility(new EmptyEffect(""), false); + //ability.addManaCost(new GenericManaCost(1)); + //this.addAbility(ability); + + this.addAbility(new SimpleStaticAbility(Constants.Zone.ALL, new EmptyEffect("Multikicker {1}"))); + + // Choose target creature, then choose another target creature for each time Strength of the Tajuru was kicked. Put X +1/+1 counters on each of them. + this.getSpellAbility().addEffect(new StrengthOfTheTajuruAddCountersTargetEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, Integer.MAX_VALUE)); + } + + @Override + public void adjustCosts(Ability ability, Game game) { + int numTargets = ability.getTargets().get(0).getTargets().size(); + if (numTargets > 1) { + ability.getManaCostsToPay().add(new GenericManaCost(numTargets - 1)); + } + } + + public StrengthOfTheTajuru(final StrengthOfTheTajuru card) { + super(card); + } + + @Override + public StrengthOfTheTajuru copy() { + return new StrengthOfTheTajuru(this); + } +} + +class StrengthOfTheTajuruAddCountersTargetEffect extends OneShotEffect { + + public StrengthOfTheTajuruAddCountersTargetEffect() { + super(Constants.Outcome.BoostCreature); + staticText = "Choose target creature, then choose another target creature for each time Strength of the Tajuru was kicked. Put X +1/+1 counters on each of them."; + } + + public StrengthOfTheTajuruAddCountersTargetEffect(final StrengthOfTheTajuruAddCountersTargetEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + int affectedTargets = 0; + int amount = source.getManaCostsToPay().getX() + 1; + Counter counter = CounterType.P1P1.createInstance(amount); + for (UUID uuid : targetPointer.getTargets(source)) { + Permanent permanent = game.getPermanent(uuid); + if (permanent != null) { + permanent.addCounters(counter.copy(), game); + affectedTargets ++; + } + } + return affectedTargets > 0; + } + + @Override + public StrengthOfTheTajuruAddCountersTargetEffect copy() { + return new StrengthOfTheTajuruAddCountersTargetEffect(this); + } + + +}