[WHO] Implement Day of the Moon

This commit is contained in:
theelk801 2025-05-05 14:39:38 -04:00
parent 507991b9e2
commit 550562b1a9
4 changed files with 130 additions and 13 deletions

View file

@ -50,14 +50,7 @@ public class ChooseACardNameEffect extends OneShotEffect {
return nameSupplier.get();
}
public String getChoice(Game game, Ability source) {
return getChoice(game.getPlayer(source.getControllerId()), game, source, true);
}
public String getChoice(Player player, Game game, Ability source, boolean setValue) {
if (player == null) {
return null;
}
public Choice makeChoiceObject() {
Choice cardChoice = new ChoiceImpl(true, ChoiceHintType.CARD);
Set<String> names = this.getNames();
if (names.isEmpty()) {
@ -68,6 +61,18 @@ public class ChooseACardNameEffect extends OneShotEffect {
cardChoice.setChoices(names);
cardChoice.setMessage(CardUtil.getTextWithFirstCharUpperCase(this.getMessage()));
cardChoice.clearChoice();
return cardChoice;
}
public String getChoice(Game game, Ability source) {
return getChoice(game.getPlayer(source.getControllerId()), game, source, true);
}
public String getChoice(Player player, Game game, Ability source, boolean setValue) {
if (player == null) {
return null;
}
Choice cardChoice = makeChoiceObject();
player.choose(Outcome.Detriment, cardChoice, game);
String cardName = cardChoice.getChoice();
if (cardName == null) {

View file

@ -724,7 +724,7 @@ public class GameState implements Serializable, Copyable<GameState> {
/**
* Returns a list of all players of the game ignoring range or if a player
* has lost or left the game.
*
* <p>
* Warning, it's ignore range, must be used by game engine only.
*/
public PlayerList getPlayerList() {
@ -734,7 +734,7 @@ public class GameState implements Serializable, Copyable<GameState> {
/**
* Returns a list of all active players of the game, setting the playerId to
* the current player of the list.
*
* <p>
* Warning, it's ignore range, must be used by game engine only.
*/
public PlayerList getPlayerList(UUID playerId) {
@ -1369,8 +1369,9 @@ public class GameState implements Serializable, Copyable<GameState> {
* @param valueId
* @param value
*/
public void setValue(String valueId, Object value) {
public <T> T setValue(String valueId, T value) {
values.put(valueId, value);
return value;
}
/**