mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Prevent showing unplayable options in zoom
Prevent showing duplicate cards on field when zoomed
This commit is contained in:
@@ -87,7 +87,6 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
* Uses GUI to learn which spell the player (human in our case) would like to play
|
||||
*/
|
||||
public SpellAbility getAbilityToPlay(List<SpellAbility> abilities, MouseEvent triggerEvent) {
|
||||
if (triggerEvent == null) {
|
||||
if (abilities.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -97,25 +96,6 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
return GuiChoose.oneOrNone("Choose ability to play", abilities);
|
||||
}
|
||||
|
||||
if (abilities.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (abilities.size() == 1 && !abilities.get(0).promptIfOnlyPossibleAbility()) {
|
||||
if (abilities.get(0).canPlay()) {
|
||||
return abilities.get(0); //only return ability if it's playable, otherwise return null
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
for (final SpellAbility ab : abilities) {
|
||||
if (ab.canPlay()) {
|
||||
FControl.getInputProxy().selectAbility(ab);
|
||||
return ab;
|
||||
}
|
||||
}
|
||||
return null; //TODO: delay ability until choice made
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.game.player.PlayerController#mayPlaySpellAbilityForFree(forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,7 @@ import forge.game.phase.PhaseHandler;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.screens.match.FControl;
|
||||
import forge.toolbox.VCardZoom.ZoomController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -77,7 +78,20 @@ public abstract class InputBase implements java.io.Serializable, Input {
|
||||
onCardSelected(card, orderedCardOptions);
|
||||
}
|
||||
|
||||
protected void onCardSelected(final Card card, final List<Card> orderedCardOptions) {}
|
||||
protected void onCardSelected(final Card card, final List<Card> orderedCardOptions) {
|
||||
FControl.getView().getCardZoom().show("", card, orderedCardOptions, new ZoomController<SpellAbility>() {
|
||||
@Override
|
||||
public List<SpellAbility> getOptions(Card card) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean selectOption(Card card, SpellAbility option) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void onPlayerSelected(final Player p) {}
|
||||
protected void onCancel() {}
|
||||
protected void onOk() {}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class InputPassPriority extends InputSyncronizedBase {
|
||||
FControl.getView().getCardZoom().show("Select a spell/ability", card, orderedCardOptions, new ZoomController<SpellAbility>() {
|
||||
@Override
|
||||
public List<SpellAbility> getOptions(Card card) {
|
||||
return card.getAllPossibleAbilities(player, false);
|
||||
return card.getAllPossibleAbilities(player, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -99,6 +99,8 @@ public class VField extends VZoneDisplay {
|
||||
|
||||
@Override
|
||||
protected void doLayout(float width, float height) {
|
||||
startLayout();
|
||||
|
||||
List<FCardPanel> creatures = new ArrayList<FCardPanel>();
|
||||
List<FCardPanel> lands = new ArrayList<FCardPanel>();
|
||||
List<FCardPanel> otherPermanents = new ArrayList<FCardPanel>();
|
||||
|
||||
@@ -89,6 +89,10 @@ public class VZoneDisplay extends FScrollPane {
|
||||
cardPanels.clear();
|
||||
}
|
||||
|
||||
protected void startLayout() {
|
||||
orderedCards.clear();
|
||||
}
|
||||
|
||||
protected final float layoutCardPanel(FCardPanel cardPanel, float x, float y, float cardWidth, float cardHeight) {
|
||||
int count = addCards(cardPanel, x, y, cardWidth, cardHeight);
|
||||
return cardWidth + (count - 1) * cardWidth * CARD_STACK_OFFSET;
|
||||
@@ -110,7 +114,7 @@ public class VZoneDisplay extends FScrollPane {
|
||||
|
||||
@Override
|
||||
protected void doLayout(float width, float height) {
|
||||
orderedCards.clear();
|
||||
startLayout();
|
||||
|
||||
float x = 0;
|
||||
float y = 0;
|
||||
|
||||
Reference in New Issue
Block a user