[ALL] fixed text generation on "opponent chooses" cards

This commit is contained in:
Evan Kranzler 2022-04-06 07:12:06 -04:00
parent 80f9fdfb79
commit 9f08fdda7f
2 changed files with 22 additions and 15 deletions

View file

@ -25,10 +25,10 @@ public final class LibraryOfLatNam extends CardImpl {
this.getSpellAbility().getModes().setModeChooser(TargetController.OPPONENT);
// You draw three cards at the beginning of the next turn's upkeep;
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(3)), false));
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(3).setText("you draw three cards")), false));
// or you search your library for a card, put that card into your hand, then shuffle your library.
this.getSpellAbility().addMode(new Mode(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(), false, true)));
this.getSpellAbility().addMode(new Mode(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(), false, true).setText("you search your library for a card, put that card into your hand, then shuffle")));
}
private LibraryOfLatNam(final LibraryOfLatNam card) {

View file

@ -473,20 +473,27 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
if (mayChooseNone) {
sb.append("you may ");
}
if (this.chooseText != null) {
sb.append(chooseText);
} else if (this.getMinModes() == 0 && this.getMaxModes(null, null) == 1) {
sb.append("choose up to one");
} else if (this.getMinModes() == 0 && this.getMaxModes(null, null) > 2) {
sb.append("choose any number");
} else if (this.getMinModes() == 1 && this.getMaxModes(null, null) == 2) {
sb.append("choose one or both");
} else if (this.getMinModes() == 1 && this.getMaxModes(null, null) > 2) {
sb.append("choose one or more");
} else if (this.getMinModes() == this.getMaxModes(null, null)) {
sb.append("choose " + CardUtil.numberToText(this.getMinModes()));
if (this.chooseText == null) {
if (modeChooser == TargetController.OPPONENT) {
sb.append("an opponent chooses ");
} else {
sb.append("choose ");
}
if (this.getMinModes() == 0 && this.getMaxModes(null, null) == 1) {
sb.append("up to one");
} else if (this.getMinModes() == 0 && this.getMaxModes(null, null) > 2) {
sb.append("any number");
} else if (this.getMinModes() == 1 && this.getMaxModes(null, null) == 2) {
sb.append("one or both");
} else if (this.getMinModes() == 1 && this.getMaxModes(null, null) > 2) {
sb.append("one or more");
} else if (this.getMinModes() == this.getMaxModes(null, null)) {
sb.append(CardUtil.numberToText(this.getMinModes()));
} else {
throw new UnsupportedOperationException("no text available for this selection of min and max modes");
}
} else {
throw new UnsupportedOperationException("no text available for this selection of min and max modes");
sb.append(chooseText);
}
if (isEachModeOnlyOnce() && this.getMaxModesFilter() == null) {