mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
[SOI] Added Falkenrath Gorger.
This commit is contained in:
parent
b0240d02ff
commit
c6f17e6569
5 changed files with 186 additions and 42 deletions
|
@ -97,7 +97,7 @@ class TemptWithDiscoveryEffect extends OneShotEffect {
|
|||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, null, Zone.BATTLEFIELD, source, game);
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ class TemptWithDiscoveryEffect extends OneShotEffect {
|
|||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
opponent.moveCards(card, null, Zone.BATTLEFIELD, source, game);
|
||||
opponent.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ class TemptWithDiscoveryEffect extends OneShotEffect {
|
|||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
controller.moveCards(card, null, Zone.BATTLEFIELD, source, game);
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ public class TemptWithImmortality extends CardImpl {
|
|||
super(ownerId, 95, "Tempt with Immortality", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}");
|
||||
this.expansionSetCode = "C13";
|
||||
|
||||
|
||||
// Tempting offer - Return a creature card from your graveyard to the battlefield. Each opponent may return a creature card from his or her graveyard to the battlefield. For each player who does, return a creature card from your graveyard to the battlefield.
|
||||
this.getSpellAbility().addEffect(new TemptWithImmortalityEffect());
|
||||
}
|
||||
|
@ -99,15 +98,15 @@ class TemptWithImmortalityEffect extends OneShotEffect {
|
|||
if (opponent != null) {
|
||||
FilterCard filter = new FilterCreatureCard("creature card from your graveyard");
|
||||
filter.add(new OwnerIdPredicate(opponent.getId()));
|
||||
Target targetOpponent = new TargetCardInGraveyard(filter);
|
||||
Target targetCardOpponent = new TargetCardInGraveyard(filter);
|
||||
|
||||
if (targetOpponent.canChoose(source.getSourceId(), opponent.getId(), game)) {
|
||||
if (opponent.chooseUse(outcome, new StringBuilder("Return a creature card from your graveyard to the battlefield?").toString(), source, game)) {
|
||||
if (opponent.chooseTarget(outcome, targetOpponent, source, game)) {
|
||||
Card card = game.getCard(targetOpponent.getFirstTarget());
|
||||
if (targetCardOpponent.canChoose(source.getSourceId(), opponent.getId(), game)) {
|
||||
if (opponent.chooseUse(outcome, "Return a creature card from your graveyard to the battlefield?", source, game)) {
|
||||
if (opponent.chooseTarget(outcome, targetCardOpponent, source, game)) {
|
||||
Card card = game.getCard(targetCardOpponent.getFirstTarget());
|
||||
if (card != null) {
|
||||
opponentsReturnedCreatures++;
|
||||
card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
|
||||
opponent.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +131,7 @@ class TemptWithImmortalityEffect extends OneShotEffect {
|
|||
if (player.chooseTarget(outcome, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
return card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
|
||||
return player.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.shadowsoverinnistrad;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.keyword.MadnessAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class FalkenrathGorger extends CardImpl {
|
||||
|
||||
public FalkenrathGorger(UUID ownerId) {
|
||||
super(ownerId, 155, "Falkenrath Gorger", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{R}");
|
||||
this.expansionSetCode = "SOI";
|
||||
this.subtype.add("Vampire");
|
||||
this.subtype.add("Warrior");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Each Vampire creature card you own that isn't on the battlefield has madness. Its madness cost is equal to its mana cost.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new FalkenrathGorgerEffect()));
|
||||
}
|
||||
|
||||
public FalkenrathGorger(final FalkenrathGorger card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FalkenrathGorger copy() {
|
||||
return new FalkenrathGorger(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FalkenrathGorgerEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterCreatureCard filter = new FilterCreatureCard("Vampire creature card you own");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Vampire"));
|
||||
|
||||
}
|
||||
|
||||
public FalkenrathGorgerEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
this.staticText = "Each Vampire creature card you own that isn't on the battlefield has madness. Its madness cost is equal to its mana cost";
|
||||
}
|
||||
|
||||
public FalkenrathGorgerEffect(final FalkenrathGorgerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FalkenrathGorgerEffect copy() {
|
||||
return new FalkenrathGorgerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
// hand
|
||||
for (Card card : controller.getHand().getCards(filter, game)) {
|
||||
game.getState().addOtherAbility(card, new MadnessAbility(card, card.getSpellAbility().getManaCosts()));
|
||||
}
|
||||
// graveyard
|
||||
for (Card card : controller.getGraveyard().getCards(filter, game)) {
|
||||
game.getState().addOtherAbility(card, new MadnessAbility(card, card.getSpellAbility().getManaCosts()));
|
||||
}
|
||||
// Exile
|
||||
for (Card card : game.getExile().getAllCards(game)) {
|
||||
if (filter.match(card, source.getSourceId(), controller.getId(), game)) {
|
||||
if (card.getOwnerId().equals(controller.getId())) {
|
||||
game.getState().addOtherAbility(card, new MadnessAbility(card, card.getSpellAbility().getManaCosts()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
|
@ -40,39 +39,31 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
public class MadnessTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* 702.34. Madness
|
||||
* 702.34a Madness is a keyword that represents two abilities. The first is a static ability that functions
|
||||
* while the card with madness is in a player’s hand. The second is a triggered ability that
|
||||
* functions when the first ability is applied. “Madness [cost]” means “If a player would discard
|
||||
* this card, that player discards it, but may exile it instead of putting it into his or her graveyard”
|
||||
* and “When this card is exiled this way, its owner may cast it by paying [cost] rather than paying
|
||||
* its mana cost. If that player doesn’t, he or she puts this card into his or her graveyard.”
|
||||
* 702.34b Casting a spell using its madness ability follows the rules for paying alternative costs in
|
||||
* rules 601.2b and 601.2e–g.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Arrogant Wurm
|
||||
* 3GG
|
||||
* Creature -- Wurm
|
||||
* 4/4
|
||||
* Trample
|
||||
* Madness {2}{G} (If you discard this card, you may cast it for its
|
||||
* madness cost instead of putting it into your graveyard.)
|
||||
* 702.34. Madness 702.34a Madness is a keyword that represents two
|
||||
* abilities. The first is a static ability that functions while the card
|
||||
* with madness is in a player’s hand. The second is a triggered ability
|
||||
* that functions when the first ability is applied. “Madness [cost]” means
|
||||
* “If a player would discard this card, that player discards it, but may
|
||||
* exile it instead of putting it into his or her graveyard” and “When this
|
||||
* card is exiled this way, its owner may cast it by paying [cost] rather
|
||||
* than paying its mana cost. If that player doesn’t, he or she puts this
|
||||
* card into his or her graveyard.” 702.34b Casting a spell using its
|
||||
* madness ability follows the rules for paying alternative costs in rules
|
||||
* 601.2b and 601.2e–g.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Raven's Crime
|
||||
* B
|
||||
* Sorcery
|
||||
* Target player discards a card.
|
||||
* Retrace (You may cast this card from your graveyard by discarding a land
|
||||
* card in addition to paying its other costs.)
|
||||
*
|
||||
* Arrogant Wurm 3GG Creature -- Wurm 4/4 Trample Madness {2}{G} (If you
|
||||
* discard this card, you may cast it for its madness cost instead of
|
||||
* putting it into your graveyard.)
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Raven's Crime B Sorcery Target player discards a card. Retrace (You may
|
||||
* cast this card from your graveyard by discarding a land card in addition
|
||||
* to paying its other costs.)
|
||||
*
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testMadness() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||
|
@ -91,7 +82,7 @@ public class MadnessTest extends CardTestPlayerBase {
|
|||
assertHandCount(playerA, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNoMadness() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||
|
@ -112,4 +103,30 @@ public class MadnessTest extends CardTestPlayerBase {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFalkenrathGorger() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
|
||||
// Each Vampire creature card you own that isn't on the battlefield has madness. Its madness cost is equal to its mana cost.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Falkenrath Gorger", 1);
|
||||
|
||||
// Sacrifice a creature: Vampire Aristocrat gets +2/+2 until end of turn.
|
||||
addCard(Zone.HAND, playerA, "Vampire Aristocrat");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 6);
|
||||
// Target player discards two cards. If you cast this spell during your main phase, that player discards four cards instead.
|
||||
addCard(Zone.HAND, playerB, "Haunting Hymn");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Haunting Hymn", playerA);
|
||||
setChoice(playerA, "Yes");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Haunting Hymn", 1);
|
||||
assertGraveyardCount(playerB, "Haunting Hymn", 1);
|
||||
assertPermanentCount(playerA, "Vampire Aristocrat", 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ public class MadnessAbility extends StaticAbility {
|
|||
|
||||
public MadnessAbility(final MadnessAbility ability) {
|
||||
super(ability);
|
||||
this.rule = ability.rule;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,6 +104,7 @@ class MadnessReplacementEffect extends ReplacementEffectImpl {
|
|||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null) {
|
||||
if (controller.moveCardToExileWithInfo(card, source.getSourceId(), "Madness", source.getSourceId(), game, ((ZoneChangeEvent) event).getFromZone(), true)) {
|
||||
game.applyEffects(); // needed to add Madness ability to cards (e.g. by Falkenrath Gorger)
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.MADNESS_CARD_EXILED, card.getId(), card.getId(), controller.getId()));
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue