This commit is contained in:
BetaSteward 2012-02-19 23:13:08 -05:00
parent 828662f6f3
commit 1951fd314b
6 changed files with 431 additions and 1 deletions

View file

@ -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.darkascension;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerAttachedTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.continious.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author BetaSteward
*/
public class ElbrusTheBindingBlade extends CardImpl<ElbrusTheBindingBlade> {
public ElbrusTheBindingBlade(UUID ownerId) {
super(ownerId, 147, "Elbrus, the Binding Blade", Rarity.MYTHIC, new CardType[]{CardType.ARTIFACT}, "{7}");
this.expansionSetCode = "DKA";
this.supertype.add("Legendary");
this.subtype.add("Equipment");
this.canTransform = true;
this.secondSideCard = new WithengarUnbound(ownerId);
this.addAbility(new TransformAbility());
// Equipped creature gets +1/+0.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEquippedEffect(1, 0)));
// When equipped creature deals combat damage to a player, unattach Elbrus, the Binding Blade, then transform it.
this.addAbility(new DealsCombatDamageToAPlayerAttachedTriggeredAbility(new ElbrusTheBindingBladeEffect(), "equipped", true));
// Equip {1}
this.addAbility(new EquipAbility(Constants.Outcome.AddAbility, new GenericManaCost(1)));
}
public ElbrusTheBindingBlade(final ElbrusTheBindingBlade card) {
super(card);
}
@Override
public ElbrusTheBindingBlade copy() {
return new ElbrusTheBindingBlade(this);
}
}
class ElbrusTheBindingBladeEffect extends OneShotEffect<ElbrusTheBindingBladeEffect> {
public ElbrusTheBindingBladeEffect() {
super(Constants.Outcome.BecomeCreature);
staticText = "unattach {this}, then transform it";
}
public ElbrusTheBindingBladeEffect(final ElbrusTheBindingBladeEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
Permanent attachedTo = game.getPermanent(equipment.getAttachedTo());
if (attachedTo != null) {
attachedTo.removeAttachment(equipment.getId(), game);
equipment.transform(game);
}
}
return false;
}
@Override
public ElbrusTheBindingBladeEffect copy() {
return new ElbrusTheBindingBladeEffect(this);
}
}

View file

@ -0,0 +1,110 @@
/*
* 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.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.IntimidateAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author BetaSteward
*/
public class WithengarUnbound extends CardImpl<WithengarUnbound> {
public WithengarUnbound(UUID ownerId) {
super(ownerId, 147, "Withengar Unbound", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "");
this.expansionSetCode = "DKA";
this.supertype.add("Legendary");
this.subtype.add("Demon");
// this card is the second face of double-faced card
this.nightCard = true;
this.canTransform = true;
this.power = new MageInt(13);
this.toughness = new MageInt(13);
this.addAbility(FlyingAbility.getInstance());
this.addAbility(IntimidateAbility.getInstance());
this.addAbility(TrampleAbility.getInstance());
// Whenever a player loses the game, put thirteen +1/+1 counters on Withengar Unbound.
this.addAbility(new WithengarUnboundTriggeredAbility());
}
public WithengarUnbound(final WithengarUnbound card) {
super(card);
}
@Override
public WithengarUnbound copy() {
return new WithengarUnbound(this);
}
}
class WithengarUnboundTriggeredAbility extends TriggeredAbilityImpl<WithengarUnboundTriggeredAbility> {
public WithengarUnboundTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance(13)), false);
}
public WithengarUnboundTriggeredAbility(final WithengarUnboundTriggeredAbility ability) {
super(ability);
}
@Override
public WithengarUnboundTriggeredAbility copy() {
return new WithengarUnboundTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.LOST)
return true;
return false;
}
@Override
public String getRule() {
return "Whenever a player loses the game, put thirteen +1/+1 counters on Withengar Unbound.";
}
}

View file

@ -0,0 +1,120 @@
/*
* 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.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author BetaSteward
*/
public class ZombieApocalypse extends CardImpl<ZombieApocalypse> {
public ZombieApocalypse(UUID ownerId) {
super(ownerId, 80, "Zombie Apocalypse", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{B}{B}{B}");
this.expansionSetCode = "DKA";
this.color.setBlack(true);
// Return all Zombie creature cards from your graveyard to the battlefield tapped, then destroy all Humans.
this.getSpellAbility().addEffect(new ZombieApocalypseEffect());
}
public ZombieApocalypse(final ZombieApocalypse card) {
super(card);
}
@Override
public ZombieApocalypse copy() {
return new ZombieApocalypse(this);
}
}
class ZombieApocalypseEffect extends OneShotEffect<ZombieApocalypseEffect> {
private static final FilterCreatureCard filterZombie = new FilterCreatureCard();
private static final FilterCreaturePermanent filterHuman = new FilterCreaturePermanent();
static {
filterZombie.getSubtype().add("Zombie");
filterZombie.setScopeSubtype(Filter.ComparisonScope.Any);
filterHuman.getSubtype().add("Human");
filterHuman.setScopeSubtype(Filter.ComparisonScope.Any);
}
public ZombieApocalypseEffect() {
super(Constants.Outcome.PutCreatureInPlay);
this.staticText = "Return all Zombie creature cards from your graveyard to the battlefield tapped, then destroy all Humans.";
}
public ZombieApocalypseEffect(final ZombieApocalypseEffect effect) {
super(effect);
}
@Override
public ZombieApocalypseEffect copy() {
return new ZombieApocalypseEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
for (Card card : player.getGraveyard().getCards(filterZombie, game)) {
player.getGraveyard().remove(card);
card.putOntoBattlefield(game, Constants.Zone.GRAVEYARD, source.getId(), source.getControllerId());
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.setTapped(true);
}
}
for (Permanent permanent: game.getBattlefield().getActivePermanents(filterHuman, source.getControllerId(), game)) {
permanent.destroy(source.getSourceId(), game, false);
}
return true;
}
}

View file

@ -0,0 +1,35 @@
package org.mage.test.cards;
import mage.Constants;
import mage.counters.CounterType;
import mage.players.Player;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TestElbrusTheBindingBlade extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Air Elemental");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elbrus, the Binding Blade");
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {1}", "Air Elemental");
attack(1, playerA, "Air Elemental");
setStopAt(1, Constants.PhaseStep.END_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 15);
assertPermanentCount(playerA, "Air Elemental", 1);
assertPermanentCount(playerA, "Elbrus, the Binding Blade", 0);
assertPermanentCount(playerA, "Withengar Unbound", 1);
}
}

View file

@ -0,0 +1,38 @@
package org.mage.test.cards;
import junit.framework.Assert;
import mage.Constants;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class TestZombieApocalypse extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 6);
addCard(Constants.Zone.HAND, playerA, "Zombie Apocalypse");
addCard(Constants.Zone.GRAVEYARD, playerA, "Bog Raiders", 2);
addCard(Constants.Zone.GRAVEYARD, playerA, "Toxic Nim", 1);
addCard(Constants.Zone.BATTLEFIELD, playerA, "White Knight");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Black Knight", 2);
castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Zombie Apocalypse");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertGraveyardCount(playerA, 2);
assertGraveyardCount(playerB, 2);
assertPermanentCount(playerA, "Bog Raiders", 2);
assertPermanentCount(playerA, "Toxic Nim", 1);
assertPermanentCount(playerA, "White Knight", 0);
assertPermanentCount(playerA, "Black Knight", 0);
}
}

View file

@ -15,6 +15,7 @@ import org.mage.test.serverside.base.MageTestPlayerBase;
import java.util.List;
import java.util.UUID;
import mage.Constants.PhaseStep;
import mage.counters.CounterType;
import org.mage.test.player.TestPlayer;
/**
@ -351,7 +352,24 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
}
Assert.assertEquals("(Battlefield) Card counts are not equal (" + cardName + ")", count, actualCount);
}
/**
* Assert counter count on a permanent
*
* @param cardName Name of the cards that should be counted.
* @param type Type of the counter that should be counted.
* @param count Expected count.
*/
public void assertCounterCount(String cardName, CounterType type, int count) throws AssertionError {
int actualCount = 0;
for (Permanent permanent : currentGame.getBattlefield().getAllPermanents()) {
if (permanent.getName().equals(cardName)) {
actualCount += permanent.getCounters().getCount(type);
}
}
Assert.assertEquals("(Battlefield) Counter counts are not equal (" + cardName + ":" + type + ")", count, actualCount);
}
/**
* Assert card count in player's hand.
*