[TLA] Implement Lost Days

This commit is contained in:
theelk801 2025-11-15 10:24:28 -05:00
parent 7f85e6ef3f
commit 886dd1f0b2
5 changed files with 74 additions and 89 deletions

View file

@ -6,21 +6,29 @@ import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
* @author TheElk801
*/
public class PutOnTopOrBottomLibraryTargetEffect extends OneShotEffect {
private final int position;
private final boolean textOwnerOf;
public PutOnTopOrBottomLibraryTargetEffect(boolean textOwnerOf) {
this(1, textOwnerOf);
}
public PutOnTopOrBottomLibraryTargetEffect(int position, boolean textOwnerOf) {
super(Outcome.ReturnToHand);
this.position = position;
this.textOwnerOf = textOwnerOf;
}
private PutOnTopOrBottomLibraryTargetEffect(final PutOnTopOrBottomLibraryTargetEffect effect) {
super(effect);
this.position = effect.position;
this.textOwnerOf = effect.textOwnerOf;
}
@ -35,10 +43,14 @@ public class PutOnTopOrBottomLibraryTargetEffect extends OneShotEffect {
if (player == null) {
return false;
}
String message = position > 1 ? "into your library " + CardUtil.numberToOrdinalText(position) + " from the top or on the" : "on the top or";
boolean onTop = player.chooseUse(
Outcome.Detriment, "Put the targeted object on the top or bottom of your library?",
Outcome.Detriment, "Put the targeted object " + message + " bottom of your library?",
null, "Top", "Bottom", source, game
);
if (onTop && position > 1) {
return new PutIntoLibraryNFromTopTargetEffect(position).apply(game, source);
}
return new PutOnLibraryTargetEffect(onTop).apply(game, source);
}
@ -47,8 +59,23 @@ public class PutOnTopOrBottomLibraryTargetEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
String targetText = getTargetPointer().describeTargets(mode.getTargets(), "that permanent");
return (textOwnerOf ? "the owner of " + targetText : targetText + "'s owner") +
" puts it on their choice of the top or bottom of their library";
if (textOwnerOf) {
sb.append("the owner of ");
sb.append(targetText);
} else {
sb.append(targetText);
sb.append("'s owner");
}
sb.append(" puts it");
if (position > 1) {
sb.append("into their library ");
sb.append(CardUtil.numberToOrdinalText(position));
sb.append(" from the top or on the bottom");
} else {
sb.append("on their choice of the top or bottom of their library");
}
return sb.toString();
}
}