Add support for tapping the topmost card of a stack to activate the card behind if the card on top has no remaining actions (same as mobile game already supports)

This commit is contained in:
drdev
2014-11-26 20:22:48 +00:00
parent 74c579c286
commit 7c7163b511
12 changed files with 65 additions and 44 deletions

View File

@@ -15,7 +15,7 @@ public interface Input {
boolean selectCard(Card card, final List<Card> otherCardsToSelect, ITriggerEvent triggerEvent);
void selectAbility(SpellAbility ab);
boolean selectAbility(SpellAbility ab);
void selectPlayer(Player player, ITriggerEvent triggerEvent);

View File

@@ -147,7 +147,7 @@ public class InputAttack extends InputSyncronizedBase {
setCurrentDefender(selected);
}
else {
flashIncorrectAction(); // cannot attack that player
MatchUtil.getController().flashIncorrectAction(); // cannot attack that player
}
}
@@ -176,7 +176,6 @@ public class InputAttack extends InputSyncronizedBase {
declareAttacker(card);
}
else {
flashIncorrectAction();
validAction = false;
}
}
@@ -201,7 +200,6 @@ public class InputAttack extends InputSyncronizedBase {
if (activeBand != null && !activeBand.canJoinBand(card)) {
activateBand(null);
updateMessage();
flashIncorrectAction();
return false;
}
@@ -214,7 +212,6 @@ public class InputAttack extends InputSyncronizedBase {
return true;
}
flashIncorrectAction();
return false;
}

View File

@@ -141,7 +141,9 @@ public abstract class InputBase implements java.io.Serializable, Input {
}
@Override
public void selectAbility(final SpellAbility ab) { }
public boolean selectAbility(final SpellAbility ab) {
return false;
}
@Override
public final void selectButtonCancel() {
@@ -173,10 +175,6 @@ public abstract class InputBase implements java.io.Serializable, Input {
MatchUtil.getController().showPromptMessage(getOwner(), message);
}
protected final void flashIncorrectAction() {
MatchUtil.getController().flashIncorrectAction();
}
protected String getTurnPhasePriorityMessage(final Game game) {
final PhaseHandler ph = game.getPhaseHandler();
final StringBuilder sb = new StringBuilder();

View File

@@ -153,8 +153,6 @@ public class InputBlock extends InputSyncronizedBase {
if (isCorrectAction) {
card.getGame().fireEvent(new GameEventCombatChanged());
} else {
flashIncorrectAction();
}
showMessage();

View File

@@ -117,7 +117,6 @@ public class InputConfirmMulligan extends InputSyncronizedBase {
boolean isSerumPowder = c0.getName().equals("Serum Powder");
boolean isLegalChoice = fromHand && (isCommander || isSerumPowder);
if (!isLegalChoice || cardSelectLocked) {
flashIncorrectAction();
return false;
}

View File

@@ -74,7 +74,8 @@ public class InputLockUI implements Input {
return false;
}
@Override
public void selectAbility(SpellAbility ab) {
public boolean selectAbility(SpellAbility ab) {
return false;
}
@Override
public void selectPlayer(Player player, ITriggerEvent triggerEvent) {

View File

@@ -128,19 +128,19 @@ public class InputPassPriority extends InputSyncronizedBase {
//remove unplayable unless triggerEvent specified, in which case unplayable may be shown as disabled options
List<SpellAbility> abilities = card.getAllPossibleAbilities(player, triggerEvent == null);
if (abilities.isEmpty()) {
flashIncorrectAction();
return false;
}
selectAbility(player.getController().getAbilityToPlay(abilities, triggerEvent));
return true;
return selectAbility(player.getController().getAbilityToPlay(abilities, triggerEvent));
}
@Override
public void selectAbility(final SpellAbility ab) {
public boolean selectAbility(final SpellAbility ab) {
if (ab != null) {
chosenSa = ab;
stop();
return true;
}
return false;
}
}

View File

@@ -68,7 +68,6 @@ public abstract class InputPayMana extends InputSyncronizedBase {
@Override
protected boolean onCardSelected(final Card card, final List<Card> otherCardsToSelect, final ITriggerEvent triggerEvent) {
if (card.getManaAbilities().isEmpty()) {
flashIncorrectAction();
return false;
}
// only tap card if the mana is needed
@@ -76,10 +75,11 @@ public abstract class InputPayMana extends InputSyncronizedBase {
}
@Override
public void selectAbility(final SpellAbility ab) {
public boolean selectAbility(final SpellAbility ab) {
if (ab != null && ab.isManaAbility()) {
activateManaAbility(ab.getHostCard(), manaCost, ab);
return activateManaAbility(ab.getHostCard(), manaCost, ab);
}
return false;
}
public List<SpellAbility> getUsefulManaAbilities(Card card) {

View File

@@ -41,7 +41,6 @@ public final class InputSelectCardsForConvoke extends InputSelectManyBase<Card>
protected boolean onCardSelected(final Card card, final List<Card> otherCardsToSelect, final ITriggerEvent triggerEvent) {
if (!availableCreatures.contains(card)) {
// Not in untapped creatures list provided. Not a legal Convoke selection.
flashIncorrectAction();
return false;
}
@@ -52,7 +51,6 @@ public final class InputSelectCardsForConvoke extends InputSelectManyBase<Card>
onSelectStateChanged(card, false);
}
else {
byte chosenColor = player.getController().chooseColorAllowColorless("Convoke " + card.toString() + " for which color?", card, CardUtil.getColors(card));
if (remainingCost.getColorlessManaAmount() > 0 && (chosenColor == 0 || !remainingCost.needsColor(chosenColor, player.getManaPool()))) {
@@ -67,7 +65,7 @@ public final class InputSelectCardsForConvoke extends InputSelectManyBase<Card>
}
}
showMessage("The colors provided by " + card.toString() + " you've chosen cannot be used to decrease the manacost of " + remainingCost.toString());
flashIncorrectAction();
return false;
}
}