mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Code cleanup
This commit is contained in:
@@ -28,25 +28,30 @@ public final class InputProliferate extends InputSelectManyBase<GameEntity> {
|
|||||||
protected String getMessage() {
|
protected String getMessage() {
|
||||||
StringBuilder sb = new StringBuilder("Choose permanents and/or players with counters on them to add one more counter of that type.");
|
StringBuilder sb = new StringBuilder("Choose permanents and/or players with counters on them to add one more counter of that type.");
|
||||||
sb.append("\n\nYou've selected so far:\n");
|
sb.append("\n\nYou've selected so far:\n");
|
||||||
if( selected.isEmpty())
|
if (selected.isEmpty()) {
|
||||||
sb.append("(none)");
|
sb.append("(none)");
|
||||||
else
|
}
|
||||||
for(GameEntity ge : selected ) {
|
else {
|
||||||
if( ge instanceof Player )
|
for (GameEntity ge : selected) {
|
||||||
|
if (ge instanceof Player) {
|
||||||
sb.append("* A poison counter to player ").append(ge).append("\n");
|
sb.append("* A poison counter to player ").append(ge).append("\n");
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
sb.append("* ").append(ge).append(" -> ").append(chosenCounters.get(ge)).append("counter\n");
|
sb.append("* ").append(ge).append(" -> ").append(chosenCounters.get(ge)).append("counter\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCardSelected(final Card card, final MouseEvent triggerEvent) {
|
protected void onCardSelected(final Card card, final MouseEvent triggerEvent) {
|
||||||
if( !selectEntity(card) )
|
if (!selectEntity(card)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( selected.contains(card) ) {
|
if (selected.contains(card)) {
|
||||||
final List<CounterType> choices = new ArrayList<CounterType>();
|
final List<CounterType> choices = new ArrayList<CounterType>();
|
||||||
for (final CounterType ct : CounterType.values()) {
|
for (final CounterType ct : CounterType.values()) {
|
||||||
if (card.getCounters(ct) > 0) {
|
if (card.getCounters(ct) > 0) {
|
||||||
@@ -63,18 +68,21 @@ public final class InputProliferate extends InputSelectManyBase<GameEntity> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectPlayer(final Player player) {
|
public void selectPlayer(final Player player) {
|
||||||
if( !selectEntity(player) )
|
if (!selectEntity(player)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isValidChoice(GameEntity choice) {
|
protected boolean isValidChoice(GameEntity choice) {
|
||||||
if (choice instanceof Player)
|
if (choice instanceof Player) {
|
||||||
return ((Player) choice).getPoisonCounters() > 0 && !choice.hasKeyword("You can't get poison counters");
|
return ((Player) choice).getPoisonCounters() > 0 && !choice.hasKeyword("You can't get poison counters");
|
||||||
|
}
|
||||||
|
|
||||||
if (choice instanceof Card)
|
if (choice instanceof Card) {
|
||||||
return ((Card) choice).hasCounters();
|
return ((Card) choice).hasCounters();
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user