Support double-click and Shift+left click to tap all lands in the same stack

This commit is contained in:
drdev
2014-11-26 20:47:47 +00:00
parent 61af57d7ba
commit 043304e35b
3 changed files with 34 additions and 6 deletions

View File

@@ -177,15 +177,15 @@ public class CardDetailPanel extends SkinnedPanel {
setInfoLabel.setOpaque(false); setInfoLabel.setOpaque(false);
setInfoLabel.setBorder(null); setInfoLabel.setBorder(null);
cdArea.setText(""); cdArea.setText("");
if (card == null) {
final CardStateView state = card.getState(isInAltState);
if (card == null || state == null) {
updateBorder(null, false); updateBorder(null, false);
return; return;
} }
boolean canShow = MatchUtil.canCardBeShown(card); boolean canShow = MatchUtil.canCardBeShown(card);
final CardStateView state = card.getState(isInAltState);
if (state.getManaCost().isNoCost() || !canShow) { if (state.getManaCost().isNoCost() || !canShow) {
nameCostLabel.setText(CardDetailUtil.formatCardName(card, canShow, isInAltState)); nameCostLabel.setText(CardDetailUtil.formatCardName(card, canShow, isInAltState));
} }

View File

@@ -542,7 +542,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
if (selectOtherCardsInStack) { if (selectOtherCardsInStack) {
if (stack != null) { if (stack != null) {
for (CardPanel p : stack) { for (CardPanel p : stack) {
if (p != panel && p.getCard() != null) { if (p != panel && p.getCard() != null && p.getStack() == stack) {
if (otherCardViewsToSelect == null) { if (otherCardViewsToSelect == null) {
otherCardViewsToSelect = new ArrayList<CardView>(); otherCardViewsToSelect = new ArrayList<CardView>();
} }

View File

@@ -17,6 +17,7 @@
*/ */
package forge.match.input; package forge.match.input;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import forge.game.Game; import forge.game.Game;
@@ -131,9 +132,36 @@ public class InputPassPriority extends InputSyncronizedBase {
return false; return false;
} }
return selectAbility(player.getController().getAbilityToPlay(abilities, triggerEvent)); final SpellAbility ability = player.getController().getAbilityToPlay(abilities, triggerEvent);
if (selectAbility(ability)) {
if (otherCardsToSelect != null && ability.isManaAbility()) {
//if mana ability activated, activate same ability on other cards to select if possible
String abStr = ability.toUnsuppressedString();
final List<SpellAbility> otherAbilitiesToPlay = new ArrayList<SpellAbility>();
for (Card c : otherCardsToSelect) {
for (SpellAbility ab : c.getAllPossibleAbilities(player, true)) {
if (ab.toUnsuppressedString().equals(abStr)) {
otherAbilitiesToPlay.add(ab);
break;
}
}
}
if (otherAbilitiesToPlay.size() > 0) {
ThreadUtil.invokeInGameThread(new Runnable() { //must execute other abilities on game thread
@Override
public void run() {
for (SpellAbility ab : otherAbilitiesToPlay) {
player.getController().playChosenSpellAbility(ab);
}
}
});
}
}
return true;
}
return false;
} }
@Override @Override
public boolean selectAbility(final SpellAbility ab) { public boolean selectAbility(final SpellAbility ab) {
if (ab != null) { if (ab != null) {