Add 3 DKA cards. Fix bug with Diregraf Captain.

This commit is contained in:
intimidatingant 2012-03-14 20:52:31 -07:00
parent be35e59b8c
commit eb418cf1fe
7 changed files with 344 additions and 5 deletions

View file

@ -92,6 +92,14 @@ public class DiregrafCaptain extends CardImpl<DiregrafCaptain> {
}
class DiregrafCaptainTriggeredAbility extends TriggeredAbilityImpl<DiregrafCaptainTriggeredAbility> {
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<DiregrafCapta
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getFromZone() == Constants.Zone.BATTLEFIELD && zEvent.getToZone() == Constants.Zone.GRAVEYARD) {
Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
if (p != null && p.getControllerId().equals(this.controllerId)) {
if (p != null && p.getControllerId().equals(this.controllerId) && filter.match(p)) {
return true;
}
}

View file

@ -0,0 +1,74 @@
/*
* 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.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.BlocksAttachedTriggeredAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author intimidatingant
*/
public class FavorOfTheWoods extends CardImpl<FavorOfTheWoods> {
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);
}
}

View file

@ -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<PyreheartWolf> {
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<PyreheartWolfEffect> {
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;
}
}

View file

@ -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<RequiemAngel> {
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);
}
}

View file

@ -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<BlocksAttachedTriggeredAbility>{
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();
}
}

View file

@ -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<DiesAnotherCreatureYouControlTriggeredAbility> {
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;
}
}

View file

@ -45,7 +45,11 @@ public class CantBeBlockedByOneEffect extends ContinuousEffectImpl<CantBeBlocked
protected int amount;
public CantBeBlockedByOneEffect(int amount) {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
this(amount, Duration.WhileOnBattlefield);
}
public CantBeBlockedByOneEffect(int amount, Duration duration) {
super(duration, Outcome.Benefit);
this.amount = amount;
staticText = "{this} can't be blocked except by " + amount + " or more creatures";
}