mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- Planechase variant now launched from Constructed match setup screen.
- moved random deck checkboxes into deck panel. Only show them when a random deck type is selected. They are still global settings however. - when player 1 name is changed in preferences, switching back to constructed setup screen will reflect the change
This commit is contained in:
@@ -1474,6 +1474,7 @@ public class GameAction {
|
||||
public void startGame(GameOutcome lastGameOutcome) {
|
||||
Player first = determineFirstTurnPlayer(lastGameOutcome);
|
||||
|
||||
List<GameType> variants = game.getRules().getAppliedVariants();
|
||||
GameType gameType = game.getRules().getGameType();
|
||||
do {
|
||||
if (game.isGameOver()) { break; } // conceded during "play or draw"
|
||||
@@ -1493,7 +1494,7 @@ public class GameAction {
|
||||
game.setAge(GameStage.Play);
|
||||
|
||||
//<THIS CODE WILL WORK WITH PHASE = NULL>
|
||||
if (gameType == GameType.Planechase) {
|
||||
if (variants.contains(GameType.Planechase)) {
|
||||
first.initPlane();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package forge.game;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GameRules {
|
||||
private GameType gameType;
|
||||
private boolean manaBurn;
|
||||
@@ -7,6 +10,7 @@ public class GameRules {
|
||||
private int gamesPerMatch = 3;
|
||||
private int gamesToWinMatch = 2;
|
||||
private boolean playForAnte = false;
|
||||
private List<GameType> appliedVariants = new ArrayList<GameType>(4);
|
||||
|
||||
public GameRules(GameType type) {
|
||||
this.gameType = type;
|
||||
@@ -62,6 +66,14 @@ public class GameRules {
|
||||
return gamesToWinMatch;
|
||||
}
|
||||
|
||||
public void setAppliedVariants(List<GameType> appliedVariants) {
|
||||
this.appliedVariants = appliedVariants;
|
||||
}
|
||||
|
||||
public List<GameType> getAppliedVariants() {
|
||||
return appliedVariants;
|
||||
}
|
||||
|
||||
// it's a preference, not rule... but I could hardly find a better place for it
|
||||
public boolean canCloneUseTargetsImage;
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
|
||||
Player next = getNextActivePlayer();
|
||||
|
||||
if (game.getRules().getGameType() == GameType.Planechase) {
|
||||
if (game.getRules().getAppliedVariants().contains(GameType.Planechase)) {
|
||||
for (Card p :game.getActivePlanes()) {
|
||||
if (p != null) {
|
||||
p.setController(next, 0);
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckSection;
|
||||
import forge.game.GameType;
|
||||
import forge.item.PaperCard;
|
||||
import forge.item.IPaperCard;
|
||||
|
||||
@@ -122,11 +123,11 @@ public class RegisteredPlayer {
|
||||
return start;
|
||||
}
|
||||
|
||||
public static RegisteredPlayer forPlanechase(final Deck deck, final Iterable<PaperCard> planes) {
|
||||
/*public static RegisteredPlayer forPlanechase(final Deck deck, final Iterable<PaperCard> planes) {
|
||||
RegisteredPlayer start = new RegisteredPlayer(deck);
|
||||
start.planes = planes;
|
||||
return start;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static RegisteredPlayer forCommander(final Deck deck) {
|
||||
RegisteredPlayer start = new RegisteredPlayer(deck);
|
||||
@@ -135,6 +136,36 @@ public class RegisteredPlayer {
|
||||
return start;
|
||||
}
|
||||
|
||||
public static RegisteredPlayer forVariants(
|
||||
final List<GameType> appliedVariants, final Deck deck, final int team, //General vars
|
||||
final Iterable<PaperCard> schemes, final boolean isPlayerArchenemy, //Archenemy specific vars
|
||||
final Iterable<PaperCard> planes, final PaperCard vanguardAvatar) { //Planechase and Vanguard
|
||||
RegisteredPlayer start = new RegisteredPlayer(deck);
|
||||
if (appliedVariants.contains(GameType.Archenemy)) {
|
||||
if (isPlayerArchenemy) {
|
||||
start.setStartingLife(40); // 904.5: The Archenemy has 40 life.
|
||||
}
|
||||
start.schemes = schemes;
|
||||
}
|
||||
if (appliedVariants.contains(GameType.ArchenemyRumble)) {
|
||||
start.setStartingLife(start.getStartingLife() + 20); // Allow
|
||||
start.schemes = schemes;
|
||||
}
|
||||
if (appliedVariants.contains(GameType.Commander)) {
|
||||
start.commander = deck.get(DeckSection.Commander).get(0);
|
||||
start.setStartingLife(40); // 903.7: ...each player sets his or her life total to 40
|
||||
}
|
||||
if (appliedVariants.contains(GameType.Planechase)) {
|
||||
start.planes = planes;
|
||||
}
|
||||
if (appliedVariants.contains(GameType.Vanguard)) {
|
||||
start.setStartingLife(start.getStartingLife() + vanguardAvatar.getRules().getLife());
|
||||
start.setStartingHand(start.getStartingHand() + vanguardAvatar.getRules().getHand());
|
||||
start.addCardsInCommand(vanguardAvatar);
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
public LobbyPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user