mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Improve message for Devour
This commit is contained in:
@@ -100,7 +100,7 @@ public class Lang {
|
||||
}
|
||||
|
||||
public static <T> String nounWithNumeral(int cnt, String noun) {
|
||||
String countedForm = cnt <= 1 ? noun : getPlural(noun);
|
||||
String countedForm = cnt == 1 ? noun : getPlural(noun);
|
||||
return getNumeral(cnt) + " " + countedForm;
|
||||
}
|
||||
|
||||
@@ -130,8 +130,9 @@ public class Lang {
|
||||
public static String getNumeral(int n) {
|
||||
String prefix = n < 0 ? "minus " : "";
|
||||
n = Math.abs(n);
|
||||
if (n >= 0 && n < 20)
|
||||
if (n >= 0 && n < 20) {
|
||||
return prefix + numbers0[n];
|
||||
}
|
||||
if (n < 100) {
|
||||
int n1 = n % 10;
|
||||
String ones = n1 == 0 ? "" : numbers0[n1];
|
||||
|
||||
@@ -3164,8 +3164,8 @@ public class CardFactoryUtil {
|
||||
String abStr = "DB$ ChangeZone | Hidden$ True | Origin$ All | Destination$ Battlefield"
|
||||
+ " | Defined$ ReplacedCard | SubAbility$ DevourCleanup";
|
||||
String dbStr = "DB$ Sacrifice | Defined$ You | Amount$ DevourSacX | "
|
||||
+ "References$ DevourSacX | SacValid$ Creature.Other | SacMessage$ creature (Devour "
|
||||
+ magnitude + ") | RememberSacrificed$ True | Optional$ True | "
|
||||
+ "References$ DevourSacX | SacValid$ Creature.Other | SacMessage$ creature | "
|
||||
+ "RememberSacrificed$ True | Optional$ True | "
|
||||
+ "Devour$ True | SubAbility$ DevourCounters";
|
||||
String counterStr = "DB$ PutCounter | Defined$ Self | CounterType$ P1P1 | CounterNum$ DevourX"
|
||||
+ " | References$ DevourX,DevourSize | SubAbility$ DevourETB";
|
||||
|
||||
@@ -19,9 +19,9 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
|
||||
super(Math.min(min, validChoices.size()), Math.min(max, validChoices.size()));
|
||||
this.validChoices = validChoices;
|
||||
|
||||
if ( min > validChoices.size() )
|
||||
if (min > validChoices.size()) {
|
||||
System.out.println(String.format("Trying to choose at least %d cards from a list with only %d cards!", min, validChoices.size()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,14 +69,10 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
|
||||
protected boolean hasEnoughTargets() { return selected.size() >= min; }
|
||||
protected boolean hasAllTargets() { return selected.size() >= max; }
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
* @return
|
||||
*/
|
||||
protected String getMessage() {
|
||||
return max == Integer.MAX_VALUE
|
||||
? String.format(message, selected.size())
|
||||
: String.format(message, max - selected.size());
|
||||
? String.format(message, selected.size())
|
||||
: String.format(message, max - selected.size());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -200,24 +200,28 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
|
||||
@Override
|
||||
public List<Card> choosePermanentsToSacrifice(SpellAbility sa, int min, int max, List<Card> valid, String message) {
|
||||
String outerMessage = "Select %d " + message + "(s) to sacrifice";
|
||||
return choosePermanentsTo(min, max, valid, outerMessage);
|
||||
return choosePermanentsTo(min, max, valid, message, "sacrifice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Card> choosePermanentsToDestroy(SpellAbility sa, int min, int max, List<Card> valid, String message) {
|
||||
String outerMessage = "Select %d " + message + "(s) to be destroyed";
|
||||
return choosePermanentsTo(min, max, valid, outerMessage);
|
||||
return choosePermanentsTo(min, max, valid, message, "destroy");
|
||||
}
|
||||
|
||||
private List<Card> choosePermanentsTo(int min, int max, List<Card> valid, String outerMessage) {
|
||||
private List<Card> choosePermanentsTo(int min, int max, List<Card> valid, String message, String action) {
|
||||
max = Math.min(max, valid.size());
|
||||
if (max <= 0) {
|
||||
return new ArrayList<Card>();
|
||||
}
|
||||
|
||||
InputSelectCardsFromList inp = new InputSelectCardsFromList(min == 0 ? 1 : min, max, valid);
|
||||
inp.setMessage(outerMessage);
|
||||
StringBuilder builder = new StringBuilder("Select ");
|
||||
if (min == 0) {
|
||||
builder.append("up to ");
|
||||
}
|
||||
builder.append("%d " + message + "(s) to " + action + ".");
|
||||
|
||||
InputSelectCardsFromList inp = new InputSelectCardsFromList(min, max, valid);
|
||||
inp.setMessage(builder.toString());
|
||||
inp.setCancelAllowed(min == 0);
|
||||
inp.showAndWait();
|
||||
return Lists.newArrayList(inp.getSelected());
|
||||
|
||||
Reference in New Issue
Block a user