- Fixed sharesNameWith Imprinted

- Converted Haunting Echoes to Script
- Small cleanup in files
This commit is contained in:
Sol
2012-11-27 03:57:04 +00:00
parent 9a7407cd06
commit 0c5b73378c
4 changed files with 6 additions and 120 deletions

View File

@@ -1,7 +1,11 @@
Name:Haunting Echoes
ManaCost:3 B B
Types:Sorcery
Text:Exile all cards from target player's graveyard other than basic land cards. For each card exiled this way, search that player's library for all cards with the same name as that card and exile them. Then that player shuffles his or her library.
Text:no text
A:SP$ ChangeZoneAll | Cost$ 3 B B | Origin$ Graveyard | Destination$ Exile | ValidTgts$ Player | TgtPrompt$ Select target player | ChangeType$ Card.nonBasic | RememberChanged$ True | SubAbility$ DBRepeat | SpellDescription$ Exile all cards from target player's graveyard other than basic land cards. For each card exiled this way, search that player's library for all cards with the same name as that card and exile them. Then that player shuffles his or her library.
SVar:DBRepeat:DB$ RepeatEach | UseImprinted$ True | RepeatCards$ Card.IsRemembered | Zone$ Exile | RepeatSubAbility$ DBRemove | SubAbility$ DBCleanup
SVar:DBRemove:DB$ ChangeZoneAll | Origin$ Library | Defined$ Targeted | Destination$ Exile | Mandatory$ True | ChangeType$ Card.sharesNameWith Imprinted | Shuffle$ True | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/haunting_echoes.jpg

View File

@@ -6638,7 +6638,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
}
return false;
} else if (property.equals("Imprinted")) {
} else if (restriction.equals("Imprinted")) {
for (final Card card : source.getImprinted()) {
if (this.getName().equals(card.getName())) {
return true;

View File

@@ -8,21 +8,15 @@ import forge.Card;
import forge.CardLists;
import forge.Command;
import forge.GameActionUtil;
import forge.Singletons;
import forge.card.spellability.Ability;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.SpellPermanent;
import forge.card.trigger.Trigger;
import forge.card.trigger.TriggerHandler;
import forge.control.input.Input;
import forge.game.GameLossReason;
import forge.game.player.Player;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.gui.GuiChoose;
import forge.gui.match.CMatchUI;
import forge.view.ButtonUtil;
import forge.CardPredicates;
/**

View File

@@ -28,7 +28,6 @@ import java.util.Collections;
import javax.swing.JOptionPane;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import forge.Card;
@@ -436,45 +435,6 @@ public class CardFactorySorceries {
return spell;
}
private final static SpellAbility getHauntingEchoes(final Card card) {
final Predicate<Card> nonBasicLands = Predicates.not(CardPredicates.Presets.BASIC_LANDS);
final Cost cost = new Cost(card, "3 B B", false);
final Target tgt = new Target(card, "Select a Player", "Player");
return new Spell(card, cost, tgt) {
private static final long serialVersionUID = 42470566751344693L;
@Override
public boolean canPlayAI() {
// Haunting Echoes shouldn't be cast if only basic land in
// graveyard or library is empty
final Player ai = getActivatingPlayer();
final Player opp = ai.getOpponent();
final List<Card> graveyard = opp.getCardsIn(ZoneType.Graveyard);
final List<Card> library = opp.getCardsIn(ZoneType.Library);
this.setTargetPlayer(opp);
return Iterables.any(graveyard, nonBasicLands) && !library.isEmpty();
}
@Override
public void resolve() {
final Player player = this.getTargetPlayer();
final List<Card> lib = new ArrayList<Card>(player.getCardsIn(ZoneType.Library));
final List<Card> grave = CardLists.filter(player.getCardsIn(ZoneType.Graveyard), nonBasicLands);
for (final Card c : grave) {
final List<Card> sameName = CardLists.filter(lib, CardPredicates.nameEquals(c.getName()));
for (final Card rem : sameName) {
Singletons.getModel().getGame().getAction().exile(rem);
lib.remove(rem);
}
Singletons.getModel().getGame().getAction().exile(c);
}
}
};
}
private final static void balanceLands(Spell card) {
List<List<Card>> lands = new ArrayList<List<Card>>();
@@ -596,75 +556,6 @@ public class CardFactorySorceries {
}
};
}
/*private final static SpellAbility getSummerBloom(final Card card) {
card.setSVar("PlayMain1", "TRUE");
return new Spell(card) {
private static final long serialVersionUID = 5559004016728325736L;
@Override
public boolean canPlayAI() {
// The computer should only play this card if it has at
// least
// one land in its hand. Because of the way the computer
// turn
// is structured, it will already have played land to it's
// limit
return Iterables.any(getActivatingPlayer().getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS);
}
@Override
public void resolve() {
final Player thePlayer = card.getController();
thePlayer.addMaxLandsToPlay(3);
final Command untilEOT = new Command() {
private static final long serialVersionUID = 1665720009691293263L;
@Override
public void execute() {
thePlayer.addMaxLandsToPlay(-3);
}
};
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
};
}
private final static SpellAbility getExplore(final Card card) {
card.setSVar("PlayMain1", "TRUE");
return new Spell(card) {
private static final long serialVersionUID = 8377957584738695517L;
@Override
public boolean canPlayAI() {
// The computer should only play this card if it has at
// least
// one land in its hand. Because of the way the computer
// turn
// is structured, it will already have played its first
// land.
return Iterables.any(getActivatingPlayer().getCardsIn(ZoneType.Hand), CardPredicates.Presets.LANDS);
}
@Override
public void resolve() {
final Player thePlayer = card.getController();
thePlayer.addMaxLandsToPlay(1);
final Command untilEOT = new Command() {
private static final long serialVersionUID = -2618916698575607634L;
@Override
public void execute() {
thePlayer.addMaxLandsToPlay(-1);
}
};
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
thePlayer.drawCard();
}
};
}*/
private final static SpellAbility getWindfall(final Card card) {
return new Spell(card) {
@@ -1354,10 +1245,7 @@ public class CardFactorySorceries {
if (cardName.equals("Brilliant Ultimatum")) { card.addSpellAbility(getBrilliantUltimatum(card));
} else if (cardName.equals("Global Ruin")) { card.addSpellAbility(getGlobalRuin(card));
} else if (cardName.equals("Haunting Echoes")) { card.addSpellAbility(getHauntingEchoes(card));
} else if (cardName.equals("Balance")) { card.addSpellAbility(getBalance(card));
//} else if (cardName.equals("Summer Bloom")) { card.addSpellAbility(getSummerBloom(card));
//} else if (cardName.equals("Explore")) { card.addSpellAbility(getExplore(card));
} else if (cardName.equals("Windfall")) { card.addSpellAbility(getWindfall(card));
} else if (cardName.equals("Patriarch's Bidding")) { card.addSpellAbility(getPatriarchsBidding(card));
} else if (cardName.equals("Leeches")) { card.addSpellAbility(getLeeches(card));