make the behavior of Vesuvan Doppelganger granted trigger more consistent with other optional triggers.

This commit is contained in:
slapshot5
2012-02-16 04:09:30 +00:00
parent 778d96d605
commit fc4bb65173

View File

@@ -2252,8 +2252,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
private static void upkeepVesuvanDoppelgangerKeyword() { private static void upkeepVesuvanDoppelgangerKeyword() {
final Player player = AllZone.getPhaseHandler().getPlayerTurn(); final Player player = AllZone.getPhaseHandler().getPlayerTurn();
final String keyword = "At the beginning of your upkeep, you may have this " final String keyword = "At the beginning of your upkeep, you may have this "
+ "creature become a copy of target creature except it doesn't copy that " + "creature become a copy of target creature except it doesn't copy that "
+ "creature's color. If you do, this creature gains this ability."; + "creature's color. If you do, this creature gains this ability.";
CardList list = player.getCardsIn(Zone.Battlefield); CardList list = player.getCardsIn(Zone.Battlefield);
list = list.getKeyword(keyword); list = list.getKeyword(keyword);
@@ -2261,76 +2261,82 @@ public class Upkeep extends Phase implements java.io.Serializable {
final SpellAbility ability = new Ability(c, "0") { final SpellAbility ability = new Ability(c, "0") {
@Override @Override
public void resolve() { public void resolve() {
final Card[] newTarget = new Card[1]; StringBuilder question = new StringBuilder();
newTarget[0] = null; question.append("Use triggered ability of ").append(c).append("?");
question.append("\r\n").append("(").append(keyword).append(")").append("\r\n");
if (GameActionUtil.showYesNoDialog(c, question.toString(), true)) {
final Card[] newTarget = new Card[1];
newTarget[0] = null;
final Ability switchTargets = new Ability(c, "0") { final Ability switchTargets = new Ability(c, "0") {
@Override @Override
public void resolve() { public void resolve() {
if (newTarget[0] != null) {
/*
* 1. need to select new card - DONE 1a. need to
* create the newly copied card with pic and
* setinfo 2. need to add the leaves play
* command 3. need to transfer the keyword 4.
* need to update the clone origin of new card
* and old card 5. remove clone leaves play
* commands from old 5a. remove old from play 6.
* add new to play
*/
final Card newCopy = AllZone.getCardFactory().getCard( if (newTarget[0] != null) {
newTarget[0].getState("Original").getName(), player); /*
newCopy.setCurSetCode(newTarget[0].getCurSetCode()); * 1. need to select new card - DONE 1a. need to
// preserve the image of the Vesuvan * create the newly copied card with pic and
// Doppelganger/whatever the source is * setinfo 2. need to add the leaves play
newCopy.setImageFilename(c.getImageFilename()); * command 3. need to transfer the keyword 4.
* need to update the clone origin of new card
* and old card 5. remove clone leaves play
* commands from old 5a. remove old from play 6.
* add new to play
*/
AllZone.getTriggerHandler().suppressMode("Transformed"); final Card newCopy = AllZone.getCardFactory().getCard(
newCopy.setState(newTarget[0].getCurState()); newTarget[0].getState("Original").getName(), player);
AllZone.getTriggerHandler().clearSuppression("Transformed"); newCopy.setCurSetCode(newTarget[0].getCurSetCode());
// preserve the image of the Vesuvan
// Doppelganger/whatever the source is
newCopy.setImageFilename(c.getImageFilename());
CardFactoryUtil.copyCharacteristics(newCopy, c); AllZone.getTriggerHandler().suppressMode("Transformed");
c.addColor("U"); newCopy.setState(newTarget[0].getCurState());
AllZone.getTriggerHandler().clearSuppression("Transformed");
c.addExtrinsicKeyword(keyword); CardFactoryUtil.copyCharacteristics(newCopy, c);
c.addColor("U");
c.addExtrinsicKeyword(keyword);
}
} }
} };
};
AllZone.getInputControl().setInput(new Input() { AllZone.getInputControl().setInput(new Input() {
private static final long serialVersionUID = 5662272658873063221L; private static final long serialVersionUID = 5662272658873063221L;
@Override @Override
public void showMessage() { public void showMessage() {
Singletons.getControl().getMatchControl().showMessage( Singletons.getControl().getMatchControl().showMessage(
c.getName() + " - Select new target creature. (Click Cancel to remain as is.)"); c.getName() + " - Select target creature.");
ButtonUtil.enableOnlyCancel(); ButtonUtil.enableOnlyCancel();
} }
@Override @Override
public void selectButtonCancel() { public void selectButtonCancel() {
this.stop();
}
@Override
public void selectCard(final Card selectedCard, final PlayerZone z) {
if (z.is(Constant.Zone.Battlefield) && selectedCard.isCreature()
&& selectedCard.canBeTargetedBy(switchTargets)) {
newTarget[0] = selectedCard;
final StringBuilder sb = new StringBuilder();
sb.append(c).append(" - switching to copy " + selectedCard.getName() + ".");
switchTargets.setStackDescription(sb.toString());
AllZone.getStack().add(switchTargets);
this.stop(); this.stop();
} }
}
}); @Override
public void selectCard(final Card selectedCard, final PlayerZone z) {
if (z.is(Constant.Zone.Battlefield) && selectedCard.isCreature()
&& selectedCard.canBeTargetedBy(switchTargets)) {
newTarget[0] = selectedCard;
final StringBuilder sb = new StringBuilder();
sb.append(c).append(" - switching to copy " + selectedCard.getName() + ".");
switchTargets.setStackDescription(sb.toString());
AllZone.getStack().add(switchTargets);
this.stop();
}
}
});
}
} }
}; };
ability.setDescription("At the beginning of your upkeep, you may have this creature become "
+ "a copy of target creature except it doesn't copy that creature's color. If you do, this creature gains this ability."); ability.setDescription(keyword);
ability.setStackDescription(c.getName() + " - you may have this creature become a copy of target creature."); ability.setStackDescription("(OPTIONAL) " + keyword);
AllZone.getStack().addSimultaneousStackEntry(ability); AllZone.getStack().addSimultaneousStackEntry(ability);