mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
- Added Cemetery Puca, Dream Salvage, and Dire Undercurrents.
This commit is contained in:
parent
221463ff4f
commit
e7a311f04d
3 changed files with 357 additions and 0 deletions
112
Mage.Sets/src/mage/sets/shadowmoor/CemeteryPuca.java
Normal file
112
Mage.Sets/src/mage/sets/shadowmoor/CemeteryPuca.java
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* 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.shadowmoor;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||||
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.DoIfCostPaid;
|
||||||
|
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
import mage.util.functions.EmptyApplyToPermanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public class CemeteryPuca extends CardImpl {
|
||||||
|
|
||||||
|
public CemeteryPuca(UUID ownerId) {
|
||||||
|
super(ownerId, 158, "Cemetery Puca", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U/B}{U/B}");
|
||||||
|
this.expansionSetCode = "SHM";
|
||||||
|
this.subtype.add("Shapeshifter");
|
||||||
|
|
||||||
|
this.color.setBlue(true);
|
||||||
|
this.color.setBlack(true);
|
||||||
|
this.power = new MageInt(1);
|
||||||
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
// Whenever a creature dies, you may pay {1}. If you do, Cemetery Puca becomes a copy of that creature and gains this ability.
|
||||||
|
this.addAbility(new DiesCreatureTriggeredAbility(new DoIfCostPaid(new CemeteryPucaEffect(), new ManaCostsImpl("{1}")), false, new FilterCreaturePermanent("a creature"), true));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public CemeteryPuca(final CemeteryPuca card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CemeteryPuca copy() {
|
||||||
|
return new CemeteryPuca(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CemeteryPucaEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public CemeteryPucaEffect() {
|
||||||
|
super(Outcome.Copy);
|
||||||
|
staticText = " {this} becomes a copy of that creature and gains this ability";
|
||||||
|
}
|
||||||
|
|
||||||
|
public CemeteryPucaEffect(final CemeteryPucaEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CemeteryPucaEffect copy() {
|
||||||
|
return new CemeteryPucaEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent copyToCreature = game.getPermanent(source.getSourceId());
|
||||||
|
if (copyToCreature != null) {
|
||||||
|
Permanent copyFromCreature = (Permanent) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.BATTLEFIELD);
|
||||||
|
if (copyFromCreature != null) {
|
||||||
|
game.copyPermanent(Duration.WhileOnBattlefield, copyFromCreature, copyToCreature, source, new EmptyApplyToPermanent());
|
||||||
|
ContinuousEffect effect = new GainAbilityTargetEffect(new DiesCreatureTriggeredAbility(new DoIfCostPaid(new CemeteryPucaEffect(), new ManaCostsImpl("{1}")), false, new FilterCreaturePermanent("a creature"), true), Duration.WhileOnBattlefield);
|
||||||
|
effect.setTargetPointer(new FixedTarget(copyToCreature.getId()));
|
||||||
|
game.addEffect(effect, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
89
Mage.Sets/src/mage/sets/shadowmoor/DireUndercurrents.java
Normal file
89
Mage.Sets/src/mage/sets/shadowmoor/DireUndercurrents.java
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
* 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.shadowmoor;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.ObjectColor;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||||
|
import mage.abilities.effects.common.discard.DiscardTargetEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
|
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||||
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public class DireUndercurrents extends CardImpl {
|
||||||
|
|
||||||
|
private final static String rule1 = "Whenever a blue creature enters the battlefield under your control, you may have target player draw a card.";
|
||||||
|
private final static String rule2 = "Whenever a black creature enters the battlefield under your control, you may have target player discard a card.";
|
||||||
|
|
||||||
|
private final static FilterControlledPermanent filterBlue = new FilterControlledCreaturePermanent();
|
||||||
|
private final static FilterControlledPermanent filterBlack = new FilterControlledCreaturePermanent();
|
||||||
|
|
||||||
|
static {
|
||||||
|
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
|
||||||
|
filterBlack.add(new ColorPredicate(ObjectColor.BLACK));
|
||||||
|
}
|
||||||
|
|
||||||
|
public DireUndercurrents(UUID ownerId) {
|
||||||
|
super(ownerId, 159, "Dire Undercurrents", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{U/B}{U/B}");
|
||||||
|
this.expansionSetCode = "SHM";
|
||||||
|
|
||||||
|
this.color.setBlue(true);
|
||||||
|
this.color.setBlack(true);
|
||||||
|
|
||||||
|
// Whenever a blue creature enters the battlefield under your control, you may have target player draw a card.
|
||||||
|
Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new DrawCardTargetEffect(1), filterBlue, true, rule1);
|
||||||
|
ability.addTarget(new TargetPlayer());
|
||||||
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
// Whenever a black creature enters the battlefield under your control, you may have target player discard a card.
|
||||||
|
Ability ability2 = new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), filterBlack, true, rule2);
|
||||||
|
ability2.addTarget(new TargetPlayer());
|
||||||
|
this.addAbility(ability2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DireUndercurrents(final DireUndercurrents card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DireUndercurrents copy() {
|
||||||
|
return new DireUndercurrents(this);
|
||||||
|
}
|
||||||
|
}
|
156
Mage.Sets/src/mage/sets/shadowmoor/DreamSalvage.java
Normal file
156
Mage.Sets/src/mage/sets/shadowmoor/DreamSalvage.java
Normal file
|
@ -0,0 +1,156 @@
|
||||||
|
/*
|
||||||
|
* 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.shadowmoor;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.WatcherScope;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.common.TargetOpponent;
|
||||||
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public class DreamSalvage extends CardImpl {
|
||||||
|
|
||||||
|
public DreamSalvage(UUID ownerId) {
|
||||||
|
super(ownerId, 160, "Dream Salvage", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{U/B}");
|
||||||
|
this.expansionSetCode = "SHM";
|
||||||
|
|
||||||
|
this.color.setBlue(true);
|
||||||
|
this.color.setBlack(true);
|
||||||
|
|
||||||
|
// Draw cards equal to the number of cards target opponent discarded this turn.
|
||||||
|
this.getSpellAbility().addEffect(new DreamSalvageEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetOpponent());
|
||||||
|
this.addWatcher(new CardsDiscardedThisTurnWatcher());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public DreamSalvage(final DreamSalvage card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DreamSalvage copy() {
|
||||||
|
return new DreamSalvage(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CardsDiscardedThisTurnWatcher extends Watcher {
|
||||||
|
|
||||||
|
private final Map<UUID, Integer> amountOfCardsDiscardedThisTurn = new HashMap<>();
|
||||||
|
|
||||||
|
public CardsDiscardedThisTurnWatcher() {
|
||||||
|
super("CardsDiscardedThisTurnWatcher", WatcherScope.GAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CardsDiscardedThisTurnWatcher(final CardsDiscardedThisTurnWatcher watcher) {
|
||||||
|
super(watcher);
|
||||||
|
for (Entry<UUID, Integer> entry : watcher.amountOfCardsDiscardedThisTurn.entrySet()) {
|
||||||
|
amountOfCardsDiscardedThisTurn.put(entry.getKey(), entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void watch(GameEvent event, Game game) {
|
||||||
|
if (event.getType() == GameEvent.EventType.DISCARDED_CARD) {
|
||||||
|
UUID playerId = event.getPlayerId();
|
||||||
|
if (playerId != null) {
|
||||||
|
Integer amount = amountOfCardsDiscardedThisTurn.get(playerId);
|
||||||
|
if (amount == null) {
|
||||||
|
amount = 1;
|
||||||
|
} else {
|
||||||
|
amount++;
|
||||||
|
}
|
||||||
|
amountOfCardsDiscardedThisTurn.put(playerId, amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAmountCardsDiscarded(UUID playerId) {
|
||||||
|
Integer amount = amountOfCardsDiscardedThisTurn.get(playerId);
|
||||||
|
if (amount != null) {
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reset() {
|
||||||
|
amountOfCardsDiscardedThisTurn.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CardsDiscardedThisTurnWatcher copy() {
|
||||||
|
return new CardsDiscardedThisTurnWatcher(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DreamSalvageEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public DreamSalvageEffect() {
|
||||||
|
super(Outcome.DrawCard);
|
||||||
|
staticText = "Draw cards equal to the number of cards target opponent discarded this turn";
|
||||||
|
}
|
||||||
|
|
||||||
|
public DreamSalvageEffect(final DreamSalvageEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DreamSalvageEffect copy() {
|
||||||
|
return new DreamSalvageEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
CardsDiscardedThisTurnWatcher watcher = (CardsDiscardedThisTurnWatcher) game.getState().getWatchers().get("CardsDiscardedThisTurnWatcher");
|
||||||
|
Player targetOpponent = game.getPlayer(source.getFirstTarget());
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
if (targetOpponent != null
|
||||||
|
&& controller != null
|
||||||
|
&& watcher != null
|
||||||
|
&& watcher.getAmountCardsDiscarded(targetOpponent.getId()) > 0) {
|
||||||
|
controller.drawCards(watcher.getAmountCardsDiscarded(targetOpponent.getId()), game);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue