Merge branch 'master' into 'master'

[Mobile] fix optional discard GUI

See merge request core-developers/forge!3682
This commit is contained in:
Anthony Calosa
2021-01-31 03:57:10 +00:00

View File

@@ -990,7 +990,19 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
@Override
public CardCollectionView chooseCardsToDiscardFrom(final Player p, final SpellAbility sa,
final CardCollection valid, final int min, final int max) {
if (p != player || GuiBase.getInterface().isLibgdxPort()) {
if (GuiBase.getInterface().isLibgdxPort()) {
boolean optional = min == 0;
tempShowCards(valid);
GameEntityViewMap<Card, CardView> gameCacheDiscard = GameEntityView.getMap(valid);
List<CardView> views = getGui().many(String.format(localizer.getMessage("lblChooseMinCardToDiscard"), optional ? max : min),
localizer.getMessage("lblDiscarded"), min, max, gameCacheDiscard.getTrackableKeys(), null);
endTempShowCards();
final CardCollection choices = new CardCollection();
gameCacheDiscard.addToList(views, choices);
return choices;
}
if (p != player) {
tempShowCards(valid);
GameEntityViewMap<Card, CardView> gameCacheDiscard = GameEntityView.getMap(valid);
List<CardView> views = getGui().many(String.format(localizer.getMessage("lblChooseMinCardToDiscard"), min),