diff --git a/Mage.Sets/src/mage/sets/darkascension/DiregrafCaptain.java b/Mage.Sets/src/mage/sets/darkascension/DiregrafCaptain.java index eb3045f2a5..095214cc07 100644 --- a/Mage.Sets/src/mage/sets/darkascension/DiregrafCaptain.java +++ b/Mage.Sets/src/mage/sets/darkascension/DiregrafCaptain.java @@ -92,6 +92,14 @@ public class DiregrafCaptain extends CardImpl { } class DiregrafCaptainTriggeredAbility extends TriggeredAbilityImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Zombie"); + + static { + filter.getSubtype().add("Zombie"); + filter.setScopeSubtype(Filter.ComparisonScope.Any); + } + public DiregrafCaptainTriggeredAbility() { super(Constants.Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), false); this.addTarget(new TargetOpponent()); @@ -107,7 +115,7 @@ class DiregrafCaptainTriggeredAbility extends TriggeredAbilityImpl { + + public FavorOfTheWoods(UUID ownerId) { + super(ownerId, 113, "Favor of the Woods", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); + this.expansionSetCode = "DKA"; + 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.Neutral)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + // Whenever enchanted creature blocks, you gain 3 life. + this.addAbility(new BlocksAttachedTriggeredAbility(new GainLifeEffect(3), "equipped", false)); + } + + public FavorOfTheWoods(final FavorOfTheWoods card) { + super(card); + } + + @Override + public FavorOfTheWoods copy() { + return new FavorOfTheWoods(this); + } +} diff --git a/Mage.Sets/src/mage/sets/darkascension/PyreheartWolf.java b/Mage.Sets/src/mage/sets/darkascension/PyreheartWolf.java new file mode 100644 index 0000000000..fc9066f0c5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/darkascension/PyreheartWolf.java @@ -0,0 +1,104 @@ +/* + * 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.darkascension; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Duration; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.CantBeBlockedByOneEffect; +import mage.abilities.keyword.UndyingAbility; +import mage.cards.CardImpl; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author intimidatingant + */ +public class PyreheartWolf extends CardImpl { + + public PyreheartWolf(UUID ownerId) { + super(ownerId, 101, "Pyreheart Wolf", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R}"); + this.expansionSetCode = "DKA"; + this.subtype.add("Wolf"); + + this.color.setRed(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever Pyreheart Wolf attacks, each creature you control can't be blocked this turn except by two or more creatures. + this.addAbility(new UndyingAbility()); + this.addAbility(new AttacksTriggeredAbility(new PyreheartWolfEffect(), false)); + } + + public PyreheartWolf(final PyreheartWolf card) { + super(card); + } + + @Override + public PyreheartWolf copy() { + return new PyreheartWolf(this); + } +} + +class PyreheartWolfEffect extends OneShotEffect { + + public PyreheartWolfEffect() { + super(Constants.Outcome.Benefit); + this.staticText = "creatures you control can't be blocked except by two or more creatures until end of turn"; + } + + public PyreheartWolfEffect(final PyreheartWolfEffect effect) { + super(effect); + } + + @Override + public PyreheartWolfEffect copy() { + return new PyreheartWolfEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + for (Permanent perm: game.getBattlefield().getAllActivePermanents(filter, source.getControllerId())) { + CantBeBlockedByOneEffect effect = new CantBeBlockedByOneEffect(2, Duration.EndOfTurn); + SimpleStaticAbility ability = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, effect); + perm.addAbility(ability, game); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/darkascension/RequiemAngel.java b/Mage.Sets/src/mage/sets/darkascension/RequiemAngel.java new file mode 100644 index 0000000000..d0304a16ba --- /dev/null +++ b/Mage.Sets/src/mage/sets/darkascension/RequiemAngel.java @@ -0,0 +1,77 @@ +/* + * 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.darkascension; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.common.DiesAnotherCreatureYouControlTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.filter.Filter; +import mage.game.permanent.token.SpiritWhiteToken; +import mage.filter.common.FilterCreaturePermanent; + +/** + * + * @author intimidatingant + */ +public class RequiemAngel extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Human creatures"); + + static { + filter.getSubtype().add("Spirit"); + filter.setNotSubtype(true); + } + + public RequiemAngel(UUID ownerId) { + super(ownerId, 18, "Requiem Angel", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{W}"); + this.expansionSetCode = "DKA"; + this.subtype.add("Angel"); + + this.color.setWhite(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + this.addAbility(FlyingAbility.getInstance()); + + // Whenever another non-Spirit creature you control dies, put a 1/1 white Spirit creature token with flying onto the battlefield. + this.addAbility(new DiesAnotherCreatureYouControlTriggeredAbility(new CreateTokenEffect(new SpiritWhiteToken(), 1), false, filter)); + } + + public RequiemAngel(final RequiemAngel card) { + super(card); + } + + @Override + public RequiemAngel copy() { + return new RequiemAngel(this); + } +} diff --git a/Mage/src/mage/abilities/common/BlocksAttachedTriggeredAbility.java b/Mage/src/mage/abilities/common/BlocksAttachedTriggeredAbility.java new file mode 100644 index 0000000000..c00f39c7b8 --- /dev/null +++ b/Mage/src/mage/abilities/common/BlocksAttachedTriggeredAbility.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.common; + +import mage.Constants; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author garnold + */ +public class BlocksAttachedTriggeredAbility extends TriggeredAbilityImpl{ + private boolean setFixedTargetPointer; + private String attachedDescription; + + public BlocksAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional) { + this(effect, attachedDescription, optional, false); + } + + public BlocksAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional, boolean setFixedTargetPointer) { + super(Constants.Zone.BATTLEFIELD, effect, optional); + this.setFixedTargetPointer = setFixedTargetPointer; + this.attachedDescription = attachedDescription; + } + + public BlocksAttachedTriggeredAbility(final BlocksAttachedTriggeredAbility ability) { + super(ability); + this.setFixedTargetPointer = ability.setFixedTargetPointer; + this.attachedDescription = ability.attachedDescription; + } + + @Override + public BlocksAttachedTriggeredAbility copy() { + return new BlocksAttachedTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) { + Permanent p = game.getPermanent(event.getSourceId()); + if (p != null && p.getAttachments().contains(this.getSourceId())) { + if (setFixedTargetPointer) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + } + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever " + attachedDescription + " creature blocks, " + super.getRule(); + } +} diff --git a/Mage/src/mage/abilities/common/DiesAnotherCreatureYouControlTriggeredAbility.java b/Mage/src/mage/abilities/common/DiesAnotherCreatureYouControlTriggeredAbility.java index 25fd1f2498..296e0ea337 100644 --- a/Mage/src/mage/abilities/common/DiesAnotherCreatureYouControlTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/DiesAnotherCreatureYouControlTriggeredAbility.java @@ -1,19 +1,25 @@ package mage.abilities.common; +import java.util.UUID; import mage.Constants; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; +import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; -import java.util.UUID; - public class DiesAnotherCreatureYouControlTriggeredAbility extends TriggeredAbilityImpl { + protected FilterCreaturePermanent filter; public DiesAnotherCreatureYouControlTriggeredAbility(Effect effect, boolean optional) { + this(effect, optional, new FilterCreaturePermanent()); + } + + public DiesAnotherCreatureYouControlTriggeredAbility(Effect effect, boolean optional, FilterCreaturePermanent filter) { super(Constants.Zone.BATTLEFIELD, effect, optional); + this.filter = filter; } public DiesAnotherCreatureYouControlTriggeredAbility(DiesAnotherCreatureYouControlTriggeredAbility ability) { @@ -41,7 +47,8 @@ public class DiesAnotherCreatureYouControlTriggeredAbility extends TriggeredAbil if (permanent != null && permanent.getCardType().contains(Constants.CardType.CREATURE) && zEvent.isDiesEvent() && - permanent.getControllerId().equals(this.getControllerId())) { + permanent.getControllerId().equals(this.getControllerId()) && filter != null && + filter.match(permanent)) { return true; } } diff --git a/Mage/src/mage/abilities/effects/common/continious/CantBeBlockedByOneEffect.java b/Mage/src/mage/abilities/effects/common/continious/CantBeBlockedByOneEffect.java index 1654a3a75f..db2e1ef76b 100644 --- a/Mage/src/mage/abilities/effects/common/continious/CantBeBlockedByOneEffect.java +++ b/Mage/src/mage/abilities/effects/common/continious/CantBeBlockedByOneEffect.java @@ -45,7 +45,11 @@ public class CantBeBlockedByOneEffect extends ContinuousEffectImpl