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,33 +87,13 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
* Uses GUI to learn which spell the player (human in our case) would like to play
|
* Uses GUI to learn which spell the player (human in our case) would like to play
|
||||||
*/
|
*/
|
||||||
public SpellAbility getAbilityToPlay(List<SpellAbility> abilities, MouseEvent triggerEvent) {
|
public SpellAbility getAbilityToPlay(List<SpellAbility> abilities, MouseEvent triggerEvent) {
|
||||||
if (triggerEvent == null) {
|
|
||||||
if (abilities.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (abilities.size() == 1) {
|
|
||||||
return abilities.get(0);
|
|
||||||
}
|
|
||||||
return GuiChoose.oneOrNone("Choose ability to play", abilities);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (abilities.isEmpty()) {
|
if (abilities.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (abilities.size() == 1 && !abilities.get(0).promptIfOnlyPossibleAbility()) {
|
if (abilities.size() == 1) {
|
||||||
if (abilities.get(0).canPlay()) {
|
return abilities.get(0);
|
||||||
return abilities.get(0); //only return ability if it's playable, otherwise return null
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return GuiChoose.oneOrNone("Choose ability to play", abilities);
|
||||||
for (final SpellAbility ab : abilities) {
|
|
||||||
if (ab.canPlay()) {
|
|
||||||
FControl.getInputProxy().selectAbility(ab);
|
|
||||||
return ab;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null; //TODO: delay ability until choice made
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import forge.game.phase.PhaseHandler;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
|
import forge.toolbox.VCardZoom.ZoomController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -77,7 +78,20 @@ public abstract class InputBase implements java.io.Serializable, Input {
|
|||||||
onCardSelected(card, orderedCardOptions);
|
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 onPlayerSelected(final Player p) {}
|
||||||
protected void onCancel() {}
|
protected void onCancel() {}
|
||||||
protected void onOk() {}
|
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>() {
|
FControl.getView().getCardZoom().show("Select a spell/ability", card, orderedCardOptions, new ZoomController<SpellAbility>() {
|
||||||
@Override
|
@Override
|
||||||
public List<SpellAbility> getOptions(Card card) {
|
public List<SpellAbility> getOptions(Card card) {
|
||||||
return card.getAllPossibleAbilities(player, false);
|
return card.getAllPossibleAbilities(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -99,6 +99,8 @@ public class VField extends VZoneDisplay {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doLayout(float width, float height) {
|
protected void doLayout(float width, float height) {
|
||||||
|
startLayout();
|
||||||
|
|
||||||
List<FCardPanel> creatures = new ArrayList<FCardPanel>();
|
List<FCardPanel> creatures = new ArrayList<FCardPanel>();
|
||||||
List<FCardPanel> lands = new ArrayList<FCardPanel>();
|
List<FCardPanel> lands = new ArrayList<FCardPanel>();
|
||||||
List<FCardPanel> otherPermanents = new ArrayList<FCardPanel>();
|
List<FCardPanel> otherPermanents = new ArrayList<FCardPanel>();
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ public class VZoneDisplay extends FScrollPane {
|
|||||||
cardPanels.clear();
|
cardPanels.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void startLayout() {
|
||||||
|
orderedCards.clear();
|
||||||
|
}
|
||||||
|
|
||||||
protected final float layoutCardPanel(FCardPanel cardPanel, float x, float y, float cardWidth, float cardHeight) {
|
protected final float layoutCardPanel(FCardPanel cardPanel, float x, float y, float cardWidth, float cardHeight) {
|
||||||
int count = addCards(cardPanel, x, y, cardWidth, cardHeight);
|
int count = addCards(cardPanel, x, y, cardWidth, cardHeight);
|
||||||
return cardWidth + (count - 1) * cardWidth * CARD_STACK_OFFSET;
|
return cardWidth + (count - 1) * cardWidth * CARD_STACK_OFFSET;
|
||||||
@@ -110,7 +114,7 @@ public class VZoneDisplay extends FScrollPane {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doLayout(float width, float height) {
|
protected void doLayout(float width, float height) {
|
||||||
orderedCards.clear();
|
startLayout();
|
||||||
|
|
||||||
float x = 0;
|
float x = 0;
|
||||||
float y = 0;
|
float y = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user