mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 20:29:19 -08:00
Added F5 button to skip priority until end step of opponent. Added PlayerAction handling.
This commit is contained in:
parent
ebd21eab1d
commit
aa842efacc
17 changed files with 185 additions and 327 deletions
|
|
@ -35,6 +35,7 @@ import mage.cards.decks.DeckCardLists;
|
|||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.ExpansionInfo;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.game.GameException;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
|
|
@ -115,16 +116,10 @@ public interface MageServer {
|
|||
void sendPlayerBoolean(UUID gameId, String sessionId, Boolean data) throws MageException;
|
||||
void sendPlayerInteger(UUID gameId, String sessionId, Integer data) throws MageException;
|
||||
void sendPlayerManaType(UUID gameId, UUID playerId, String sessionId, ManaType data) throws MageException;
|
||||
void concedeGame(UUID gameId, String sessionId) throws MageException;
|
||||
void quitMatch(UUID gameId, String sessionId) throws MageException;
|
||||
void undo(UUID gameId, String sessionId) throws MageException;
|
||||
void setManaPoolMode(UUID gameId, String sessionId, boolean autoPayment) throws MageException;
|
||||
GameView getGameView(UUID gameId, String sessionId, UUID playerId) throws MageException;
|
||||
|
||||
//priority methods
|
||||
void passPriorityUntilNextYourTurn(UUID gameId, String sessionId) throws MageException;
|
||||
void passTurnPriority(UUID gameId, String sessionId) throws MageException;
|
||||
void restorePriority(UUID gameId, String sessionId) throws MageException;
|
||||
// priority, undo, concede, mana pool
|
||||
void sendPlayerAction(PlayerAction playerAction, UUID gameId, String sessionId) throws MageException;
|
||||
|
||||
//tournament methods
|
||||
boolean startTournament(String sessionId, UUID roomId, UUID tableId) throws MageException;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import mage.cards.repository.ExpansionInfo;
|
|||
import mage.cards.repository.ExpansionRepository;
|
||||
import mage.constants.Constants.SessionState;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.game.GameException;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
|
|
@ -1054,21 +1055,6 @@ public class SessionImpl implements Session {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean concedeGame(UUID gameId) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
server.concedeGame(gameId, sessionId);
|
||||
return true;
|
||||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean quitMatch(UUID gameId) {
|
||||
try {
|
||||
|
|
@ -1113,10 +1099,10 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean undo(UUID gameId) {
|
||||
public boolean sendPlayerAction(PlayerAction passPriorityAction, UUID gameId) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
server.undo(gameId, sessionId);
|
||||
server.sendPlayerAction(passPriorityAction, gameId, sessionId);
|
||||
return true;
|
||||
}
|
||||
} catch (MageException ex) {
|
||||
|
|
@ -1126,52 +1112,7 @@ public class SessionImpl implements Session {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean passPriorityUntilNextYourTurn(UUID gameId) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
server.passPriorityUntilNextYourTurn(gameId, sessionId);
|
||||
return true;
|
||||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean passTurnPriority(UUID gameId) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
server.passTurnPriority(gameId, sessionId);
|
||||
return true;
|
||||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean restorePriority(UUID gameId) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
server.restorePriority(gameId, sessionId);
|
||||
return true;
|
||||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean stopWatching(UUID gameId) {
|
||||
try {
|
||||
|
|
@ -1262,21 +1203,6 @@ public class SessionImpl implements Session {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setManaPoolMode(boolean autoPayment, UUID gameId) {
|
||||
try {
|
||||
if (isConnected()) {
|
||||
server.setManaPoolMode(gameId, sessionId, autoPayment);
|
||||
return true;
|
||||
}
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
} catch (Throwable t) {
|
||||
handleThrowable(t);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cheat(UUID gameId, UUID playerId, DeckCardLists deckList) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.remote.interfaces;
|
|||
import java.util.UUID;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.view.DraftPickView;
|
||||
|
||||
/**
|
||||
|
|
@ -53,8 +54,6 @@ public interface GamePlay {
|
|||
|
||||
boolean sendPlayerManaType(UUID gameId, UUID playerId, ManaType data);
|
||||
|
||||
boolean concedeGame(UUID gameId);
|
||||
|
||||
boolean quitMatch(UUID gameId);
|
||||
|
||||
boolean quitTournament(UUID tournamentId);
|
||||
|
|
@ -67,47 +66,18 @@ public interface GamePlay {
|
|||
|
||||
DraftPickView sendCardPick(UUID draftId, UUID cardId);
|
||||
|
||||
boolean undo(UUID gameId);
|
||||
|
||||
/*** Separate methods for priority handling ***/
|
||||
/**
|
||||
* magenoxx:
|
||||
* it should be done separately as sendPlayer* methods calls are injected into the game flow
|
||||
* - this is similar to concedeGame method
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pass priority until next your turn.
|
||||
* Don't stop at all even if something happens.
|
||||
*
|
||||
* @param gameId
|
||||
* @return
|
||||
*/
|
||||
boolean passPriorityUntilNextYourTurn(UUID gameId);
|
||||
|
||||
/**
|
||||
* Passes current turn but stop on pre combat phase.
|
||||
*
|
||||
* @param gameId
|
||||
* @return
|
||||
*/
|
||||
boolean passTurnPriority(UUID gameId);
|
||||
|
||||
/**
|
||||
* This method cancels all other calls made before.
|
||||
*
|
||||
* @param gameId
|
||||
* @return
|
||||
*/
|
||||
boolean restorePriority(UUID gameId);
|
||||
|
||||
/**
|
||||
* This method toggles usage of mana pool
|
||||
*
|
||||
* @param automatic true mana in pool will be used automatically
|
||||
* This method sends player actions for a game
|
||||
* priority handling, undo
|
||||
*
|
||||
* @param passPriorityAction
|
||||
* @param gameId
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
boolean setManaPoolMode(boolean automatic, UUID gameId);
|
||||
boolean sendPlayerAction(PlayerAction passPriorityAction, UUID gameId);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue