mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Game: fixed wrong booster pass order in drafts (#8075);
This commit is contained in:
parent
2efdb464fc
commit
65761b085f
8 changed files with 23 additions and 16 deletions
|
@ -171,7 +171,7 @@
|
|||
int left = draftView.getPlayers().size() - right;
|
||||
int height = left * 18;
|
||||
lblTableImage.setSize(new Dimension(lblTableImage.getWidth(), height));
|
||||
Image tableImage = ImageHelper.getImageFromResources((draftView.getBoosterNum() + 1) % 2 == 1 ? "/draft/table_left.png" : "/draft/table_right.png");
|
||||
Image tableImage = ImageHelper.getImageFromResources(draftView.getBoosterNum() % 2 == 1 ? "/draft/table_left.png" : "/draft/table_right.png");
|
||||
BufferedImage resizedTable = ImageHelper.getResizedImage(BufferedImageBuilder.bufferImage(tableImage, BufferedImage.TYPE_INT_ARGB), lblTableImage.getWidth(), lblTableImage.getHeight());
|
||||
lblTableImage.setIcon(new ImageIcon(resizedTable));
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ public class DraftView implements Serializable {
|
|||
|
||||
private final List<String> sets = new ArrayList<>();
|
||||
private final List<String> setCodes = new ArrayList<>();
|
||||
private final int boosterNum;
|
||||
private final int cardNum;
|
||||
private final int boosterNum; // starts with 1
|
||||
private final int cardNum; // starts with 1
|
||||
private final List<String> players = new ArrayList<>();
|
||||
|
||||
public DraftView(Draft draft) {
|
||||
|
|
|
@ -84,7 +84,7 @@ class ChaosMoonEffect extends OneShotEffect {
|
|||
StaticFilters.FILTER_PERMANENT, source.getSourceId(), source.getControllerId(), game
|
||||
);
|
||||
// Odd
|
||||
if (permanentsInPlay % 2 != 0) {
|
||||
if (permanentsInPlay % 2 == 1) {
|
||||
game.addEffect(new BoostAllEffect(1, 1, Duration.EndOfTurn, filter, false), source);
|
||||
new CreateDelayedTriggeredAbilityEffect(new ChaosMoonOddTriggeredAbility()).apply(game, source);
|
||||
} // Even
|
||||
|
|
|
@ -24,10 +24,11 @@ public class BoosterDraft extends DraftImpl {
|
|||
cardNum = 1;
|
||||
fireUpdatePlayersEvent();
|
||||
while (!isAbort() && pickCards()) {
|
||||
if ((boosterNum + 1) % 2 == 1) {
|
||||
passLeft();
|
||||
// pass booster order: left -> right -> left
|
||||
if (boosterNum % 2 == 1) {
|
||||
passBoosterToLeft();
|
||||
} else {
|
||||
passRight();
|
||||
passBoosterToRight();
|
||||
}
|
||||
fireUpdatePlayersEvent();
|
||||
}
|
||||
|
|
|
@ -149,11 +149,11 @@ public abstract class DraftImpl implements Draft {
|
|||
this.addPick(playerId, booster.get(booster.size()-1).getId(), null);
|
||||
}
|
||||
|
||||
protected void passLeft() {
|
||||
protected void passBoosterToLeft() {
|
||||
synchronized (players) {
|
||||
UUID startId = table.get(0);
|
||||
UUID currentId = startId;
|
||||
UUID nextId = table.getNext();
|
||||
UUID nextId = table.getNext(); // getNext return left player by default
|
||||
DraftPlayer current = players.get(currentId);
|
||||
DraftPlayer next = players.get(nextId);
|
||||
List<Card> currentBooster = current.booster;
|
||||
|
@ -170,11 +170,11 @@ public abstract class DraftImpl implements Draft {
|
|||
}
|
||||
}
|
||||
|
||||
protected void passRight() {
|
||||
protected void passBoosterToRight() {
|
||||
synchronized (players) {
|
||||
UUID startId = table.get(0);
|
||||
UUID currentId = startId;
|
||||
UUID prevId = table.getPrevious();
|
||||
UUID prevId = table.getPrevious(); // getPrevious return right player by default
|
||||
DraftPlayer current = players.get(currentId);
|
||||
DraftPlayer prev = players.get(prevId);
|
||||
List<Card> currentBooster = current.booster;
|
||||
|
|
|
@ -32,7 +32,8 @@ public class RichManBoosterDraft extends DraftImpl {
|
|||
cardNum = 1;
|
||||
fireUpdatePlayersEvent();
|
||||
while (!isAbort() && pickCards()) {
|
||||
passLeft();
|
||||
// new booster each time, so order is irrelevant
|
||||
passBoosterToLeft();
|
||||
fireUpdatePlayersEvent();
|
||||
}
|
||||
boosterNum++;
|
||||
|
@ -42,7 +43,7 @@ public class RichManBoosterDraft extends DraftImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void passLeft() {
|
||||
protected void passBoosterToLeft() {
|
||||
synchronized (players) {
|
||||
UUID startId = table.get(0);
|
||||
UUID currentId = startId;
|
||||
|
|
|
@ -30,7 +30,8 @@ public class RichManCubeBoosterDraft extends DraftImpl {
|
|||
cardNum = 1;
|
||||
fireUpdatePlayersEvent();
|
||||
while (!isAbort() && pickCards()) {
|
||||
passLeft();
|
||||
// new booster each time, so order is irrelevant
|
||||
passBoosterToLeft();
|
||||
fireUpdatePlayersEvent();
|
||||
}
|
||||
boosterNum++;
|
||||
|
@ -40,7 +41,7 @@ public class RichManCubeBoosterDraft extends DraftImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void passLeft() {
|
||||
protected void passBoosterToLeft() {
|
||||
synchronized (players) {
|
||||
UUID startId = table.get(0);
|
||||
UUID currentId = startId;
|
||||
|
|
|
@ -6,6 +6,8 @@ import mage.util.CircularList;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Default players order: left (next player seated to the active player's left)
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class PlayerList extends CircularList<UUID> {
|
||||
|
@ -34,7 +36,9 @@ public class PlayerList extends CircularList<UUID> {
|
|||
}
|
||||
|
||||
/**
|
||||
* checkNextTurnReached - use it turns/priority code only to mark leaved player as "reached next turn end" (need for some continous effects)
|
||||
* Find next player. Default order: next player from the left
|
||||
*
|
||||
* @checkNextTurnReached - use it turns/priority code only to mark leaved player as "reached next turn end" (need for some continous effects)
|
||||
*/
|
||||
public Player getNext(Game game, boolean checkNextTurnReached) {
|
||||
UUID start = this.get();
|
||||
|
|
Loading…
Reference in a new issue