Modified spBounceTgt - added Drawback and fixed the target selection prompt string to take the different destinations into account.

This commit is contained in:
jendave
2011-08-06 05:59:05 +00:00
parent 4d501a1925
commit 23aaf0f5cd

View File

@@ -2558,13 +2558,43 @@ public class CardFactory implements NewConstants {
//non-White, non-Blue, non-Black, non-Red, non-Green, non-Colorless, non-MultiColor //non-White, non-Blue, non-Black, non-Red, non-Green, non-Colorless, non-MultiColor
final String Tgts[] = Targets.split(","); final String Tgts[] = Targets.split(",");
String tmpDesc = card.getText().substring(15);
int i = tmpDesc.indexOf(".");
tmpDesc = tmpDesc.substring(0, i);
final String Selec = "Select a target " + tmpDesc + " to return.";
final String Destination = k[2]; final String Destination = k[2];
final String Drawback[] = {"none"};
if (k.length > 3)
{
if (k[3].contains("Drawback$"))
Drawback[0] = k[3];
}
final String Selec[] = {"Select a target "};
String tgtType = "";
if (Destination.equals("Hand"))
{
tgtType = card.getSpellText().substring("Return target ".length());
int i = tgtType.indexOf(" to its owner's hand.");
tgtType = tgtType.substring(0, i);
Selec[0] += tgtType + " to return.";
}
else if (Destination.equals("Exile"))
{
tgtType = card.getSpellText().substring("Exile target ".length());
int i = tgtType.indexOf(".");
tgtType = tgtType.substring(0, i);
Selec[0] += tgtType + " to exile.";
}
else if (Destination.equals("TopofLibrary"))
{
tgtType = card.getSpellText().substring("Put target ".length());
int i = tgtType.indexOf(" on top of its owner's library.");
tgtType = tgtType.substring(0, i);
Selec[0] += tgtType + " to put on top of the library.";
}
else
{
Selec[0] = card.getSpellText();
}
card.clearSpellAbility(); card.clearSpellAbility();
final SpellAbility spBnceTgt = new Spell(card) { final SpellAbility spBnceTgt = new Spell(card) {
@@ -2616,50 +2646,40 @@ public class CardFactory implements NewConstants {
} }
@Override @Override
public void resolve() { public void resolve()
if(AllZone.GameAction.isCardInPlay(getTargetCard()) {
&& CardFactoryUtil.canTarget(card, getTargetCard())) { Card tgtC = getTargetCard();
if(getTargetCard().isToken()) AllZone.getZone(getTargetCard()).remove(getTargetCard());
else { if(Destination.equals("TopofLibrary")) AllZone.GameAction.moveToTopOfLibrary(getTargetCard());
else if(Destination.equals("ShuffleIntoLibrary")) {
AllZone.GameAction.moveToTopOfLibrary(getTargetCard());
AllZone.GameAction.shuffle(getTargetCard().getOwner());
}
else if(Destination.equals("Exile")) AllZone.GameAction.removeFromGame(getTargetCard());
else if(Destination.equals("Hand")) {
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, getTargetCard().getOwner());
AllZone.GameAction.moveTo(hand, getTargetCard());
}
}
}
if(AllZone.GameAction.isCardInPlay(tgtC)
&& CardFactoryUtil.canTarget(card, tgtC))
{
if(getTargetCard().isToken())
AllZone.getZone(tgtC).remove(tgtC);
else
{
if(Destination.equals("TopofLibrary"))
AllZone.GameAction.moveToTopOfLibrary(tgtC);
else if(Destination.equals("ShuffleIntoLibrary"))
{
AllZone.GameAction.moveToTopOfLibrary(tgtC);
AllZone.GameAction.shuffle(tgtC.getOwner());
}
else if(Destination.equals("Exile"))
AllZone.GameAction.removeFromGame(tgtC);
else if(Destination.equals("Hand"))
{
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, tgtC.getOwner());
AllZone.GameAction.moveTo(hand, tgtC);
}
}
if (!Drawback[0].equals("none"))
CardFactoryUtil.doDrawBack(Drawback[0], 0, card.getController(), AllZone.GameAction.getOpponent(card.getController()), tgtC.getController(), card, tgtC);
}
} }
}; //SpBnceTgt }; //SpBnceTgt
Input InGetTarget = CardFactoryUtil.input_targetValid(spBnceTgt, Tgts, Selec); Input InGetTarget = CardFactoryUtil.input_targetValid(spBnceTgt, Tgts, Selec[0]);
/*new Input() {
private static final long serialVersionUID = -152897134770L;
@Override
public void showMessage() {
CardList allCards = new CardList();
allCards.addAll(AllZone.Human_Play.getCards());
allCards.addAll(AllZone.Computer_Play.getCards());
/ *allCards.filter(new CardListFilter() {
public boolean addCard(Card c) {
return (CardFactoryUtil.canTarget(card, c));
}
});* ///Input_targetSpecific already checks for this
CardList choices = allCards.getValidCards(Tgts);
boolean free = false;
if(this.isFree()) free = true;
stopSetNext(CardFactoryUtil.input_targetSpecific(spBnceTgt, choices, Selec, true, free));
}
};*///InGetTarget
//card.clearSpellAbility();
card.setSVar("PlayMain1", "TRUE"); card.setSVar("PlayMain1", "TRUE");
@@ -2676,7 +2696,7 @@ public class CardFactory implements NewConstants {
bbBnceTgt.setDescription("Buyback " + bbCost + "(You may pay an additional " + bbCost + " as you cast this spell. If you do, put this card into your hand as it resolves.)"); bbBnceTgt.setDescription("Buyback " + bbCost + "(You may pay an additional " + bbCost + " as you cast this spell. If you do, put this card into your hand as it resolves.)");
bbBnceTgt.setIsBuyBackAbility(true); bbBnceTgt.setIsBuyBackAbility(true);
bbBnceTgt.setBeforePayMana(CardFactoryUtil.input_targetValid(bbBnceTgt, Tgts, Selec)); bbBnceTgt.setBeforePayMana(CardFactoryUtil.input_targetValid(bbBnceTgt, Tgts, Selec[0]));
card.addSpellAbility(bbBnceTgt); card.addSpellAbility(bbBnceTgt);
} }