Some fixes and imporovements

This commit is contained in:
LevelX2 2012-09-24 08:05:49 +02:00
parent 70b78f6de5
commit 8b776bf379
6 changed files with 136 additions and 101 deletions

View file

@ -44,6 +44,7 @@ public class CrackTheEarth extends CardImpl<CrackTheEarth> {
public CrackTheEarth(UUID ownerId) {
super(ownerId, 98, "Crack the Earth", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{R}");
this.expansionSetCode = "BOK";
this.subtype.add("Arcane");
this.color.setRed(true);
// Each player sacrifices a permanent.
this.getSpellAbility().addEffect(new SacrificeAllEffect(1, new FilterControlledPermanent("permanent to sacrifice")));

View file

@ -51,7 +51,7 @@ import mage.target.common.TargetLandPermanent;
*/
public class Floodbringer extends CardImpl<Floodbringer> {
private final static FilterControlledPermanent filter = new FilterControlledPermanent("a land");
private final static FilterControlledPermanent filter = new FilterControlledPermanent("a land (return to hand)");
static {
filter.add(new CardTypePredicate(CardType.LAND));

View file

@ -39,7 +39,6 @@ import mage.abilities.common.DiesAttachedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.ReturnToHandAttachedEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.continious.BecomesCreatureAttachedEffect;
import mage.abilities.keyword.EnchantAbility;

View file

@ -28,20 +28,12 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.abilities.effects.common.ExileTargetAndSearchGraveyardHandLibraryEffect;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
/**
@ -62,12 +54,9 @@ public class Scour extends CardImpl<Scour> {
this.color.setWhite(true);
// Exile target enchantment.
this.getSpellAbility().addEffect(new ScourExileTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
// Search its controller's graveyard, hand, and library for all cards with the same name as that enchantment and exile them. Then that player shuffles his or her library.
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addEffect(new ExileTargetAndSearchGraveyardHandLibraryEffect());
}
public Scour(final Scour card) {
@ -78,86 +67,4 @@ public class Scour extends CardImpl<Scour> {
public Scour copy() {
return new Scour(this);
}
private class ScourExileTargetEffect extends OneShotEffect<ScourExileTargetEffect> {
private String exileZone = null;
private UUID exileId = null;
public ScourExileTargetEffect() {
super(Constants.Outcome.Exile);
this.staticText = "Exile target enchantment. Search its controller's graveyard, hand, and library for all cards with the same name as that enchantment and exile them. Then that player shuffles his or her library";
}
public ScourExileTargetEffect(final ScourExileTargetEffect effect) {
super(effect);
this.exileZone = effect.exileZone;
this.exileId = effect.exileId;
}
@Override
public ScourExileTargetEffect copy() {
return new ScourExileTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
boolean result;
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (exileId == null) {
exileId = getId();
}
if (permanent != null) {
Player targetPlayer = game.getPlayer(permanent.getOwnerId());
Player you = game.getPlayer(source.getControllerId());
Card chosenCard = permanent;
result = permanent.moveToExile(exileId, exileZone, source.getSourceId(), game);
if (targetPlayer != null && you != null) {
//cards in Library
Cards cardsInLibrary = new CardsImpl(Constants.Zone.LIBRARY);
cardsInLibrary.addAll(targetPlayer.getLibrary().getCards(game));
you.lookAtCards("Scour search of Library", cardsInLibrary, game);
// cards in Graveyard
Cards cardsInGraveyard = new CardsImpl(Constants.Zone.GRAVEYARD);
cardsInGraveyard.addAll(targetPlayer.getGraveyard());
// cards in Hand
Cards cardsInHand = new CardsImpl(Constants.Zone.HAND);
cardsInHand.addAll(targetPlayer.getHand());
you.lookAtCards("Scour search of Hand", cardsInHand, game);
// exile same named cards from zones
for (Card checkCard : cardsInLibrary.getCards(game)) {
if (checkCard.getName().equals(chosenCard.getName())) {
checkCard.moveToExile(id, "Library", id, game);
}
}
for (Card checkCard : cardsInGraveyard.getCards(game)) {
if (checkCard.getName().equals(chosenCard.getName())) {
checkCard.moveToExile(id, "Graveyard", id, game);
}
}
for (Card checkCard : cardsInHand.getCards(game)) {
if (checkCard.getName().equals(chosenCard.getName())) {
checkCard.moveToExile(id, "Hand", id, game);
}
}
targetPlayer.shuffleLibrary(game);
}
return result;
}
return false;
}
}
}

View file

@ -0,0 +1,130 @@
/*
* 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.championsofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.watchers.common.DamagedByWatcher;
/**
* @author LevelX
*/
public class KumanosPupils extends CardImpl<KumanosPupils> {
private final static FilterControlledPermanent filter = new FilterControlledPermanent("a land");
static {
filter.add(new CardTypePredicate(CardType.LAND));
}
public KumanosPupils(UUID ownerId) {
super(ownerId, 177, "Kumano's Pupils", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{R}");
this.expansionSetCode = "CHK";
this.subtype.add("Human");
this.subtype.add("Shaman");
this.color.setRed(true);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// If a creature dealt damage by Kumano's Pupils this turn would die, exile it instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new KumanosPupilsEffect()));
this.addWatcher(new DamagedByWatcher());
}
public KumanosPupils(final KumanosPupils card) {
super(card);
}
@Override
public KumanosPupils copy() {
return new KumanosPupils(this);
}
}
class KumanosPupilsEffect extends ReplacementEffectImpl<KumanosPupilsEffect> {
public KumanosPupilsEffect() {
super(Duration.EndOfTurn, Outcome.Exile);
staticText = "If a creature dealt damage by {this} this turn would die, exile it instead";
}
public KumanosPupilsEffect(final KumanosPupilsEffect effect) {
super(effect);
}
@Override
public KumanosPupilsEffect copy() {
return new KumanosPupilsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
if (permanent != null) {
return permanent.moveToExile(null, "", source.getId(), game);
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
if (watcher != null) {
return watcher.damagedCreatures.contains(event.getTargetId());
}
}
return false;
}
}

View file

@ -46,10 +46,7 @@ import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.counters.CounterType;
import mage.filter.Filter;
import mage.filter.common.FilterArtifactCard;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -211,6 +208,7 @@ public class NightDealings extends CardImpl<NightDealings> {
name = sourceCard.getName();
}
player.revealCards(name, cards, game);
game.informPlayers(player.getName() + " reveals " + card.getName());
}
player.shuffleLibrary(game);
return true;