[ISD] Corpse Lunge; Memory's Journey; Stitcher's Apprentice

This commit is contained in:
North 2011-10-03 22:31:13 +03:00
parent 2ae25b3c25
commit 4b32d42846
3 changed files with 383 additions and 0 deletions

View file

@ -0,0 +1,113 @@
/*
* 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.innistrad;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author North
*/
public class CorpseLunge extends CardImpl<CorpseLunge> {
public CorpseLunge(UUID ownerId) {
super(ownerId, 93, "Corpse Lunge", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{B}");
this.expansionSetCode = "ISD";
this.color.setBlack(true);
// As an additional cost to cast Corpse Lunge, exile a creature card from your graveyard.
this.getSpellAbility().addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard"))));
// Corpse Lunge deals damage equal to the exiled card's power to target creature.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new CorpseLungeEffect());
}
public CorpseLunge(final CorpseLunge card) {
super(card);
}
@Override
public CorpseLunge copy() {
return new CorpseLunge(this);
}
}
class CorpseLungeEffect extends OneShotEffect<CorpseLungeEffect> {
public CorpseLungeEffect() {
super(Outcome.DrawCard);
this.staticText = "{this} deals damage equal to the exiled card's power to target creature";
}
public CorpseLungeEffect(final CorpseLungeEffect effect) {
super(effect);
}
@Override
public CorpseLungeEffect copy() {
return new CorpseLungeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof ExileFromGraveCost) {
Card card = game.getCard(cost.getTargets().getFirstTarget());
if (card != null) {
amount = card.getPower().getValue();
}
break;
}
}
if (amount > 0) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
permanent.damage(amount, source.getSourceId(), game, true, false);
return true;
}
}
return false;
}
}

View file

@ -0,0 +1,146 @@
/*
* 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.innistrad;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.TimingRule;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
/**
*
* @author North
*/
public class MemorysJourney extends CardImpl<MemorysJourney> {
public MemorysJourney(UUID ownerId) {
super(ownerId, 66, "Memory's Journey", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "ISD";
this.color.setBlue(true);
// Target player shuffles up to three target cards from his or her graveyard into his or her library.
this.getSpellAbility().addEffect(new MemorysJourneyEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new MemorysJourneyTarget());
// Flashback {G}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{G}"), TimingRule.INSTANT));
}
public MemorysJourney(final MemorysJourney card) {
super(card);
}
@Override
public MemorysJourney copy() {
return new MemorysJourney(this);
}
}
class MemorysJourneyEffect extends OneShotEffect<MemorysJourneyEffect> {
public MemorysJourneyEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to three target cards from his or her graveyard into his or her library";
}
public MemorysJourneyEffect(final MemorysJourneyEffect effect) {
super(effect);
}
@Override
public MemorysJourneyEffect copy() {
return new MemorysJourneyEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
List<UUID> targets = source.getTargets().get(1).getTargets();
boolean shuffle = false;
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
if (player.getGraveyard().contains(card.getId())) {
player.getGraveyard().remove(card);
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
shuffle = true;
}
}
}
if (shuffle) {
player.getLibrary().shuffle();
}
return true;
}
return false;
}
}
class MemorysJourneyTarget extends TargetCard<MemorysJourneyTarget> {
public MemorysJourneyTarget() {
super(0, 3, Zone.GRAVEYARD, new FilterCreatureCard());
}
public MemorysJourneyTarget(final MemorysJourneyTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card);
}
}
return false;
}
@Override
public MemorysJourneyTarget copy() {
return new MemorysJourneyTarget(this);
}
}

View file

@ -0,0 +1,124 @@
/*
* 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.innistrad;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author North
*/
public class StitchersApprentice extends CardImpl<StitchersApprentice> {
public StitchersApprentice(UUID ownerId) {
super(ownerId, 81, "Stitcher's Apprentice", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.expansionSetCode = "ISD";
this.subtype.add("Homunculus");
this.color.setBlue(true);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// {1}{U}, {tap}: Put a 2/2 blue Homunculus creature token onto the battlefield, then sacrifice a creature.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new HomunculusToken()), new ManaCostsImpl("{1}{U}"));
ability.addEffect(new StitchersApprenticeEffect());
this.addAbility(ability);
}
public StitchersApprentice(final StitchersApprentice card) {
super(card);
}
@Override
public StitchersApprentice copy() {
return new StitchersApprentice(this);
}
}
class StitchersApprenticeEffect extends OneShotEffect<StitchersApprenticeEffect> {
public StitchersApprenticeEffect() {
super(Outcome.Sacrifice);
this.staticText = "then sacrifice a creature";
}
public StitchersApprenticeEffect(final StitchersApprenticeEffect effect) {
super(effect);
}
@Override
public StitchersApprenticeEffect copy() {
return new StitchersApprenticeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Target target = new TargetControlledPermanent(new FilterControlledCreaturePermanent());
if (target.canChoose(player.getId(), game) && player.choose(Outcome.Sacrifice, target, game)) {
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
return permanent.sacrifice(source.getSourceId(), game);
}
}
}
return false;
}
}
class HomunculusToken extends Token {
public HomunculusToken() {
super("Homunculus", "2/2 blue Homunculus creature");
cardType.add(CardType.CREATURE);
color.setBlue(true);
subtype.add("Homunculus");
power = new MageInt(2);
toughness = new MageInt(2);
}
}