spjspj - Implement a 'Use the first available mana ability for a land mode'.

This allows people to float mana more easily and to not have to get the popup forcing them to select which mana ability they would like to activate.
There's a new option in the menu system under the Mana Payment section which is set via pressing 'Alt' and the number '1' key (aka Alt+1) (and is unset by releasing Alt+1).
Or they can set it from the right click menu as well.
This commit is contained in:
spjspj 2016-04-04 20:30:28 +10:00
parent 65b2d0f9fe
commit e5ca1bd6d2
10 changed files with 115 additions and 10 deletions

View file

@ -53,6 +53,8 @@ public enum PlayerAction {
MANA_AUTO_PAYMENT_OFF,
MANA_AUTO_PAYMENT_RESTRICTED_ON,
MANA_AUTO_PAYMENT_RESTRICTED_OFF,
USE_FIRST_MANA_ABILITY_ON,
USE_FIRST_MANA_ABILITY_OFF,
RESET_AUTO_SELECT_REPLACEMENT_EFFECTS,
REVOKE_PERMISSIONS_TO_SEE_HAND_CARDS,
REQUEST_PERMISSION_TO_SEE_HAND_CARDS,

View file

@ -0,0 +1,12 @@
package mage.constants;
/**
* Allows user to either tap a land for the first mode directly (shortcut)
* or have the normal method which pops up a menu
*
* @author spjspj
*/
public enum UseFirstManaAbilityMode {
NORMAL, FIRST
}

View file

@ -348,6 +348,8 @@ public interface Game extends MageItem, Serializable {
void setManaPaymentMode(UUID playerId, boolean autoPayment);
void setManaPaymentModeRestricted(UUID playerId, boolean autoPaymentRestricted);
void setUseFirstManaAbility(UUID playerId, boolean useFirstManaAbility);
void undo(UUID playerId);

View file

@ -1238,6 +1238,14 @@ public abstract class GameImpl implements Game, Serializable {
}
}
@Override
public synchronized void setUseFirstManaAbility(UUID playerId, boolean useFirstManaAbility) {
Player player = state.getPlayer(playerId);
if (player != null) {
player.getUserData().setUseFirstManaAbility(useFirstManaAbility);
}
}
@Override
public void playPriority(UUID activePlayerId, boolean resuming) {
int errorContinueCounter = 0;

View file

@ -22,6 +22,7 @@ public class UserData implements Serializable {
protected boolean passPriorityCast;
protected boolean passPriorityActivation;
protected boolean autoOrderTrigger;
protected boolean useFirstManaAbility;
protected String matchHistory;
protected int matchQuitRatio;
@ -31,7 +32,7 @@ public class UserData implements Serializable {
public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced,
boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps,
String flagName, boolean askMoveToGraveOrder, boolean manaPoolAutomatic, boolean manaPoolAutomaticRestricted,
boolean passPriorityCast, boolean passPriorityActivation, boolean autoOrderTrigger) {
boolean passPriorityCast, boolean passPriorityActivation, boolean autoOrderTrigger, boolean useFirstManaAbility) {
this.groupId = userGroup.getGroupId();
this.avatarId = avatarId;
this.showAbilityPickerForced = showAbilityPickerForced;
@ -45,6 +46,7 @@ public class UserData implements Serializable {
this.passPriorityCast = passPriorityCast;
this.passPriorityActivation = passPriorityActivation;
this.autoOrderTrigger = autoOrderTrigger;
this.useFirstManaAbility = useFirstManaAbility;
this.matchHistory = "";
this.matchQuitRatio = 0;
this.tourneyHistory = "";
@ -65,10 +67,11 @@ public class UserData implements Serializable {
this.passPriorityCast = userData.passPriorityCast;
this.passPriorityActivation = userData.passPriorityActivation;
this.autoOrderTrigger = userData.autoOrderTrigger;
this.useFirstManaAbility = useFirstManaAbility;
}
public static UserData getDefaultUserDataView() {
return new UserData(UserGroup.DEFAULT, 0, false, false, true, null, getDefaultFlagName(), false, true, true, false, false, false);
return new UserData(UserGroup.DEFAULT, 0, false, false, true, null, getDefaultFlagName(), false, true, true, false, false, false, false);
}
public void setGroupId(int groupId) {
@ -175,6 +178,14 @@ public class UserData implements Serializable {
this.autoOrderTrigger = autoOrderTrigger;
}
public boolean isUseFirstManaAbility() {
return useFirstManaAbility;
}
public void setUseFirstManaAbility(boolean useFirstManaAbility) {
this.useFirstManaAbility = useFirstManaAbility;
}
public String getHistory() {
if (UserGroup.COMPUTER.equals(this.groupId)) {
return "";