mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
Merge branch 'master' of https://github.com/magefree/mage.git
This commit is contained in:
commit
80beadbee2
12 changed files with 306 additions and 65 deletions
|
|
@ -28,9 +28,6 @@
|
|||
|
||||
package mage.game;
|
||||
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageItem;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -44,6 +41,10 @@ import mage.cards.Card;
|
|||
import mage.cards.Cards;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.choices.Choice;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.MultiplayerAttackOption;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.combat.Combat;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -65,7 +66,6 @@ import mage.util.functions.ApplyToPermanent;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import mage.constants.Duration;
|
||||
|
||||
public interface Game extends MageItem, Serializable {
|
||||
|
||||
|
|
@ -225,4 +225,9 @@ public interface Game extends MageItem, Serializable {
|
|||
// controlling the behaviour of replacement effects
|
||||
void setScopeRelevant(boolean scopeRelevant);
|
||||
public boolean getScopeRelevant();
|
||||
|
||||
// players' timers
|
||||
void initTimer(UUID playerId);
|
||||
void resumeTimer(UUID playerId);
|
||||
void pauseTimer(UUID playerId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
package mage.game;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.constants.CardType;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
|
|
@ -49,12 +48,14 @@ import mage.actions.impl.MageAction;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.choices.Choice;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterPlaneswalkerPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.NamePredicate;
|
||||
|
|
@ -89,8 +90,6 @@ import java.io.IOException;
|
|||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
|
||||
|
||||
public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializable {
|
||||
|
|
@ -590,6 +589,7 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
protected void init(UUID choosingPlayerId, GameOptions gameOptions) {
|
||||
for (Player player: state.getPlayers().values()) {
|
||||
player.beginTurn(this);
|
||||
initTimer(player.getId());
|
||||
}
|
||||
if (startMessage == null || startMessage.isEmpty()) {
|
||||
startMessage = "Game has started";
|
||||
|
|
@ -1946,4 +1946,20 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
|
|||
public void setStartMessage(String startMessage) {
|
||||
this.startMessage = startMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initTimer(UUID playerId) {
|
||||
tableEventSource.fireTableEvent(EventType.INIT_TIMER, playerId, null, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeTimer(UUID playerId) {
|
||||
tableEventSource.fireTableEvent(EventType.RESUME_TIMER, playerId, null, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseTimer(UUID playerId) {
|
||||
tableEventSource.fireTableEvent(EventType.PAUSE_TIMER, playerId, null, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ import java.util.UUID;
|
|||
public class TableEvent extends EventObject implements ExternalEvent, Serializable {
|
||||
|
||||
public enum EventType {
|
||||
UPDATE, INFO, STATUS, REVEAL, LOOK, START_DRAFT, START_MATCH, SIDEBOARD, CONSTRUCT, SUBMIT_DECK, END, ERROR
|
||||
UPDATE, INFO, STATUS, REVEAL, LOOK, START_DRAFT, START_MATCH, SIDEBOARD, CONSTRUCT, SUBMIT_DECK, END, ERROR,
|
||||
INIT_TIMER, RESUME_TIMER, PAUSE_TIMER
|
||||
}
|
||||
|
||||
private Game game;
|
||||
|
|
|
|||
|
|
@ -299,4 +299,18 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
*
|
||||
*/
|
||||
void revealFaceDownCard(Card card, Game game);
|
||||
|
||||
/**
|
||||
* Set seconds left to play the game.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
void setPriorityTimeLeft(int timeLeft);
|
||||
|
||||
/**
|
||||
* Returns seconds left to play the game.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getPriorityTimeLeft();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@
|
|||
|
||||
package mage.players;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.*;
|
||||
|
|
@ -46,10 +44,13 @@ import mage.actions.MageDrawAction;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.constants.*;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.counters.Counters;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.common.FilterCreatureForCombat;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
|
|
@ -59,11 +60,13 @@ import mage.game.events.DamagedPlayerEvent;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.net.UserData;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetAmount;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetDiscard;
|
||||
import mage.watchers.common.BloodthirstWatcher;
|
||||
|
|
@ -72,11 +75,6 @@ import org.apache.log4j.Logger;
|
|||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
import mage.cards.SplitCard;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
|
||||
public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Serializable {
|
||||
|
||||
|
|
@ -108,6 +106,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
protected boolean passedTurn;
|
||||
protected int turns;
|
||||
protected int storedBookmark = -1;
|
||||
protected int priorityTimeLeft;
|
||||
|
||||
/**
|
||||
* This indicates that player passed all turns until his own turn starts.
|
||||
|
|
@ -1793,4 +1792,14 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
this.revealCards(name, cards, game);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPriorityTimeLeft(int timeLeft) {
|
||||
priorityTimeLeft = timeLeft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriorityTimeLeft() {
|
||||
return priorityTimeLeft;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue