mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge pull request #1749 from drmDev/master
CreepingDread implementation. Updated cards-data to fix typo.
This commit is contained in:
commit
13329bcd59
3 changed files with 166 additions and 2 deletions
164
Mage.Sets/src/mage/sets/shadowsoverinnistrad/CreepingDread.java
Normal file
164
Mage.Sets/src/mage/sets/shadowsoverinnistrad/CreepingDread.java
Normal file
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* 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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||
*/
|
||||
public class CreepingDread extends CardImpl {
|
||||
|
||||
public CreepingDread(UUID ownerId) {
|
||||
super(ownerId, 104, "Creeping Dread", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}");
|
||||
this.expansionSetCode = "SOI";
|
||||
|
||||
// At the beginning of your upkeep, each player discards a card. Each opponent who discarded a card that shares a card type with the card you discarded loses 3 life.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CreepingDreadEffect(), TargetController.YOU, false));
|
||||
}
|
||||
|
||||
public CreepingDread(final CreepingDread card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreepingDread copy() {
|
||||
return new CreepingDread(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CreepingDreadEffect extends OneShotEffect {
|
||||
|
||||
public CreepingDreadEffect() {
|
||||
super(Outcome.Detriment);
|
||||
this.staticText = "each player discards a card. Each opponent who discarded a card that shares a card type with the card you discarded loses 3 life.";
|
||||
}
|
||||
|
||||
public CreepingDreadEffect(final CreepingDreadEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreepingDreadEffect copy() {
|
||||
return new CreepingDreadEffect(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* When a spell or ability instructs each player to discard a card,
|
||||
starting with the player whose turn it is and proceeding in turn order,
|
||||
each player selects a card from his or her hand without revealing it,
|
||||
sets it aside, and then all of those cards are revealed and discarded at once.
|
||||
|
||||
http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=409851
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
||||
// controller discards a card - store info on card type
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
|
||||
List<CardType> typesChosen = new ArrayList<>();
|
||||
Map<Player,Card> cardsChosen = new HashMap<>();
|
||||
if(!controller.getHand().isEmpty()) {
|
||||
|
||||
TargetCard controllerTarget = new TargetCard(Zone.HAND, new FilterCard());
|
||||
if(controller.choose(Outcome.Discard, controller.getHand(), controllerTarget, game)) {
|
||||
Card card = controller.getHand().get(controllerTarget.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
typesChosen = card.getCardType();
|
||||
cardsChosen.put(controller, card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<Player> opponentsAffected = new ArrayList<>();
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
// opponent discards a card - if it is same card type as controller, add to opponentsAffected
|
||||
if(!opponent.getHand().isEmpty()) {
|
||||
TargetCard target = new TargetCard(Zone.HAND, new FilterCard());
|
||||
if(opponent.choose(Outcome.Discard, opponent.getHand(), target, game)) {
|
||||
Card card = opponent.getHand().get(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
for (CardType cType : typesChosen) {
|
||||
for (CardType oType : card.getCardType()) {
|
||||
if (cType == oType) {
|
||||
opponentsAffected.add(opponent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cardsChosen.put(opponent, card);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// each opponent who discarded a card of the same type loses 3 life
|
||||
if (!opponentsAffected.isEmpty()) {
|
||||
for(Player opponent : opponentsAffected) {
|
||||
opponent.loseLife(3, game);
|
||||
}
|
||||
}
|
||||
|
||||
// everyone discards the card at the same time
|
||||
for (Map.Entry<Player, Card> entry : cardsChosen.entrySet()) {
|
||||
Player player = entry.getKey();
|
||||
Card cardChosen = entry.getValue();
|
||||
if (player != null && cardChosen != null) {
|
||||
player.discard(cardChosen, source, game);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@ public class DiscardTargetCost extends CostImpl {
|
|||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
|
||||
this.cards.clear();
|
||||
this.targets.clearChosen();;
|
||||
this.targets.clearChosen();
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player == null) {
|
||||
return false;
|
||||
|
|
|
@ -57051,7 +57051,7 @@ Behind the Scenes|Shadows over Innistrad|100|U|{2}{B}|Enchantment|||Creature you
|
|||
Behold the Beyond|Shadows over Innistrad|101|M|{5}{B}{B}|Sorcery|||Discard your hand. Search your library for three cards and put those cards into your hand. Then shuffle your library.|
|
||||
Biting Rain|Shadows over Innistrad|102|U|{2}{B}{B}|Sorcery|||All creatures get -2/-2 until end of turn.$Madness {2}{B} <i>(If you discard this card, discard it into exile. WHen you do, cast it for its madness cost or put it into your graveyard.)</i>|
|
||||
Call the Bloodline|Shadows over Innistrad|103|U|{1}{B}|Enchantment|||{1}, Discard a card: Put a 1/1 black Vampire Knight token with lifelink onto the battlefield. Activate this ability only once each turn.|
|
||||
Creeping Death|Shadows over Innistrad|104|U|{3}{B}|Enchantment|||At the beginning of your upkeep, each player discards a card. Each opponent who discarded a card that shares a card type with the card you discarded loses 3 life.|
|
||||
Creeping Dread|Shadows over Innistrad|104|U|{3}{B}|Enchantment|||At the beginning of your upkeep, each player discards a card. Each opponent who discarded a card that shares a card type with the card you discarded loses 3 life.|
|
||||
Crow of Dark Tidings|Shadows over Innistrad|105|C|{2}{B}|Creature - Zombie Bird|2|2|Flying$When Crow of Dark Tidings enters the battlefield or dies, put the top two cards of your library into your graveyard.|
|
||||
Dead Weight|Shadows over Innistrad|106|C|{B}|Enchantment - Aura|||Enchant creature$Enchanted creature gets -2/-2.|
|
||||
Diregraf Colossus|Shadows over Innistrad|107|R|{2}{B}|Creature - Zombie Giant|2|2|Diregraf Colossus enters the battlefield with a +1/+1 counter on it for each Zombie card in your graveyard.$Whenever you cast a Zombie spell, put a 2/2 black Zombie creature token onto the battlefield tapped.|
|
||||
|
|
Loading…
Reference in a new issue