diff --git a/res/cards.txt b/res/cards.txt index 8c874d09bcb..388bc305b9f 100644 --- a/res/cards.txt +++ b/res/cards.txt @@ -1,3 +1,30 @@ +No Mercy +2 B B +Enchantment +Whenever a creature deals damage to you, destroy it. +SVar:Rarity:Rare + +Farsight Mask +5 +Artifact +Whenever a source an opponent controls deals damage to you, if Farsight Mask is untapped, you may draw a card. +SVar:Rarity:Uncommon + +Dread +3 B B B +Creature Elemental Incarnation +Whenever a creature deals damage to you, destroy it. +6/6 +Fear +When CARDNAME is put into a graveyard from anywhere, shuffle it into its owner's library. +SVar:Rarity:Rare + +Dissipation Field +2 U U +Enchantment +Whenever a permanent deals damage to you, return it to its owner's hand. +SVar:Rarity:Rare + Long-Term Plans 2 U Instant diff --git a/src/forge/DefaultPlayerZone.java b/src/forge/DefaultPlayerZone.java index a5cab3bad9e..b794358a590 100644 --- a/src/forge/DefaultPlayerZone.java +++ b/src/forge/DefaultPlayerZone.java @@ -33,6 +33,20 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl AllZone.GameAction.shuffle(c.getOwner()); return; } + //slight difference from above I guess, the card gets put into the grave first, then shuffled into library. + //key is that this would trigger abilities that trigger on cards hitting the graveyard + else if (is("Graveyard") && c.getKeyword().contains("When CARDNAME is put into a graveyard from anywhere, shuffle it into its owner's library.")) + { + PlayerZone lib = AllZone.getZone(Constant.Zone.Library, c.getOwner()); + PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, c.getOwner()); + + grave.add(c); + grave.remove(c); + lib.add(c); + AllZone.GameAction.shuffle(c.getOwner()); + return; + } + if (is("Graveyard") && c.getKeyword().contains("When CARDNAME is put into a graveyard from anywhere, reveal CARDNAME and its owner shuffles his or her graveyard into his or her library.")) @@ -47,6 +61,8 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl return; } + + if (c.isUnearthed() && (is("Graveyard") || is("Hand"))) { PlayerZone removed = AllZone.getZone(Constant.Zone.Removed_From_Play, c.getOwner()); diff --git a/src/forge/GameAction.java b/src/forge/GameAction.java index a7b51989707..0957a018590 100644 --- a/src/forge/GameAction.java +++ b/src/forge/GameAction.java @@ -3706,7 +3706,7 @@ public class GameAction { else getPlayerLife(player).subtractLife(damage,source); - GameActionUtil.executePlayerDamageEffects(source, damage, true); + GameActionUtil.executePlayerDamageEffects(player, source, damage, true); GameActionUtil.executePlayerCombatDamageEffects(source); CombatUtil.executeCombatDamageEffects(source); } @@ -3729,7 +3729,7 @@ public class GameAction { GameActionUtil.executeGuiltyConscienceEffects(source, c, damage); } - GameActionUtil.executePlayerDamageEffects(source, damage, false); + GameActionUtil.executePlayerDamageEffects(player, source, damage, false); } public void searchLibraryLand(String type, String player, String Zone1, boolean tapLand) { diff --git a/src/forge/GameActionUtil.java b/src/forge/GameActionUtil.java index 65fd67a5c99..1cc6a22c992 100644 --- a/src/forge/GameActionUtil.java +++ b/src/forge/GameActionUtil.java @@ -5043,10 +5043,44 @@ public class GameActionUtil { } //not restricted to just combat damage: - public static void executePlayerDamageEffects(Card c, int damage, boolean isCombatDamage) + public static void executePlayerDamageEffects(String player, Card c, int damage, boolean isCombatDamage) { if (damage > 0) { + CardList playerPerms = AllZoneUtil.getPlayerCardsInPlay(player); + if (playerPerms.getName("Dissipation Field").size() > 0) { + CardList disFields = playerPerms.getName("Dissipation Field"); + for (int i=0;i 0 || playerPerms.getName("No Mercy").size() > 0)) + { + CardList l = playerPerms.filter(new CardListFilter() + { + public boolean addCard(Card crd) + { + return crd.getName().equals("Dread") || crd.getName().equals("No Mercy"); + } + }); + for (Card crd:l) + playerDamage_No_Mercy(c, crd); + } + if (playerPerms.getName("Farsight Mask").size() > 0) + { + final Card c1 = c; + CardList l = playerPerms.filter(new CardListFilter() + { + public boolean addCard(Card crd) + { + return crd.getName().equals("Farsight Mask") && crd.isUntapped() && !c1.getController().equals(crd.getController()); + } + }); + for (Card crd:l) + playerDamage_Farsight_Mask(player, c, crd); + } + if(c.getKeyword().contains("Whenever this creature deals damage to a player, that player gets a poison counter.")) playerCombatDamage_PoisonCounter(c, 1); @@ -5221,7 +5255,6 @@ public class GameActionUtil { Ability ability2 = new Ability(c, "0") { @Override public void resolve() { - AllZone.GameAction.drawCard(player); if(opponent.equals(Constant.Player.Human)) AllZone.InputControl.setInput(CardFactoryUtil.input_discard(this)); else AllZone.GameAction.discardRandom(Constant.Player.Computer, this); @@ -5234,6 +5267,63 @@ public class GameActionUtil { } } + + private static void playerDamage_Dissipation_Field(final Card c, final Card crd) + { + final String owner = c.getOwner(); + + Ability ability = new Ability(crd,"0") + { + public void resolve() { + if (AllZone.GameAction.isCardInPlay(c)) { + PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, owner); + AllZone.GameAction.moveTo(hand, c); + } + } + }; + ability.setStackDescription("Dissipation Field - returns " +c + " back to owner's hand."); + AllZone.Stack.add(ability); + } + + private static void playerDamage_No_Mercy(final Card c, final Card crd) + { + Ability ability = new Ability(crd,"0") + { + public void resolve() { + if (AllZone.GameAction.isCardInPlay(c)) + { + AllZone.GameAction.destroy(c); + } + } + }; + ability.setStackDescription(crd + " - destroys " +c + "."); + AllZone.Stack.add(ability); + } + + private static void playerDamage_Farsight_Mask(final String player, final Card c, final Card crd) + { + + Ability ability = new Ability(crd,"0") + { + public void resolve() + { + if (crd.isUntapped()) + { + if (player.equals(Constant.Player.Human)) + { + String[] choices = {"Yes", "No"}; + Object choice = AllZone.Display.getChoice("Draw a card?", choices); + if(choice.equals("Yes")) + AllZone.GameAction.drawCard(player); + } + else + AllZone.GameAction.drawCard(player); + } + } + }; + ability.setStackDescription("Farsight Mask - You may draw a card."); + AllZone.Stack.add(ability); + } private static void playerCombatDamage_Ghastlord_of_Fugue(Card c) { final String player = c.getController();