mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Merge pull request #3170 from kevlahnota/newmaster2
update mobile gamestate options
This commit is contained in:
@@ -107,7 +107,7 @@ public abstract class GameState {
|
||||
public GameState() {
|
||||
}
|
||||
|
||||
public abstract IPaperCard getPaperCard(String cardName);
|
||||
public abstract IPaperCard getPaperCard(String cardName, String setCode, int artID);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -258,9 +258,12 @@ public abstract class GameState {
|
||||
|
||||
if (c.hasMergedCard()) {
|
||||
// we have to go by the current top card name here
|
||||
newText.append(c.getTopMergedCard().getPaperCard().getName());
|
||||
newText.append(c.getTopMergedCard().getPaperCard().getName()).append("|Set:")
|
||||
.append(c.getTopMergedCard().getPaperCard().getEdition()).append("|Art:")
|
||||
.append(c.getTopMergedCard().getPaperCard().getArtIndex());
|
||||
} else {
|
||||
newText.append(c.getPaperCard().getName());
|
||||
newText.append(c.getPaperCard().getName()).append("|Set:").append(c.getPaperCard().getEdition())
|
||||
.append("|Art:").append(c.getPaperCard().getArtIndex());
|
||||
}
|
||||
}
|
||||
if (c.isCommander()) {
|
||||
@@ -735,11 +738,13 @@ public abstract class GameState {
|
||||
String id = rememberedEnts.getValue();
|
||||
|
||||
Card exiledWith = idToCard.get(Integer.parseInt(id));
|
||||
if (exiledWith != null) {
|
||||
exiledWith.addExiledCard(c);
|
||||
c.setExiledWith(exiledWith);
|
||||
c.setExiledBy(exiledWith.getController());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int parseTargetInScript(final String tgtDef) {
|
||||
int tgtID;
|
||||
@@ -1196,6 +1201,18 @@ public abstract class GameState {
|
||||
}
|
||||
}
|
||||
|
||||
int artID = -1;
|
||||
for (final String info : cardinfo) {
|
||||
if (info.startsWith("Art:")) {
|
||||
try {
|
||||
artID = Integer.parseInt(info.substring(info.indexOf(':') + 1));
|
||||
} catch (Exception e) {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Card c;
|
||||
boolean hasSetCurSet = false;
|
||||
if (cardinfo[0].startsWith("t:")) {
|
||||
@@ -1212,7 +1229,7 @@ public abstract class GameState {
|
||||
}
|
||||
c = Card.fromPaperCard(token, player, player.getGame());
|
||||
} else {
|
||||
PaperCard pc = StaticData.instance().getCommonCards().getCard(cardinfo[0], setCode);
|
||||
PaperCard pc = StaticData.instance().getCommonCards().getCard(cardinfo[0], setCode, artID);
|
||||
if (pc == null) {
|
||||
System.err.println("ERROR: Tried to create a non-existent card named " + cardinfo[0] + " (set: " + (setCode == null ? "any" : setCode) + ") when loading game state!");
|
||||
continue;
|
||||
|
||||
@@ -29,12 +29,14 @@ import forge.toolbox.GuiChoose;
|
||||
import forge.util.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiMobile implements IGuiBase {
|
||||
private final String assetsDir;
|
||||
private ImageFetcher imageFetcher = new LibGDXImageFetcher();
|
||||
private List<Integer> integerChoices = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
|
||||
|
||||
public GuiMobile(final String assetsDir0) {
|
||||
assetsDir = assetsDir0;
|
||||
@@ -256,12 +258,20 @@ public class GuiMobile implements IGuiBase {
|
||||
|
||||
@Override
|
||||
public String showFileDialog(final String title, final String defaultDir) {
|
||||
return ForgeConstants.USER_GAMES_DIR + "Test.fgs"; //TODO: Show dialog
|
||||
//TODO Android FilePicker varies, since we cant test all possible android versions, just return a selection..
|
||||
List<Integer> v = getChoices(title, 0, 1, integerChoices, null, null);
|
||||
if (v == null || v.isEmpty())
|
||||
return null;
|
||||
return defaultDir + "state" + v.get(0) + ".txt";
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getSaveFile(final File defaultFile) {
|
||||
return defaultFile; //TODO: Show dialog
|
||||
//TODO Android FilePicker varies, since we cant test all possible android versions, just return a selection..
|
||||
List<Integer> v = getChoices(Localizer.getInstance().getMessage("lblSelectGameStateFile"), 0, 1, integerChoices, null, null);
|
||||
if (v == null || v.isEmpty())
|
||||
return null;
|
||||
return new File(ForgeConstants.USER_GAMES_DIR + "state" + v.get(0) + ".txt");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -262,9 +262,9 @@ public class MatchController extends AbstractGuiGame {
|
||||
|
||||
if (ph != null && saveState && ph.isMain()) {
|
||||
phaseGameState = new GameState() {
|
||||
@Override //todo get specific card edition for this function?
|
||||
public IPaperCard getPaperCard(final String cardName) {
|
||||
return FModel.getMagicDb().getCommonCards().getCard(cardName);
|
||||
@Override
|
||||
public IPaperCard getPaperCard(final String cardName, final String setCode, final int artID) {
|
||||
return FModel.getMagicDb().getCommonCards().getCard(cardName, setCode, artID);
|
||||
}
|
||||
};
|
||||
try {
|
||||
|
||||
@@ -2094,8 +2094,8 @@ lblHowManyAdditionalVotesDoYouWant=How many additional votes do you want?
|
||||
lblUnlimitedLands=Play Unlimited Lands
|
||||
lblGenerateMana=Generate Mana
|
||||
lblViewAll=View All Cards
|
||||
lblSetupGame=Setup Game State
|
||||
lblDumpGame=Dump Game State
|
||||
lblSetupGame=Load Game State
|
||||
lblDumpGame=Save Game State
|
||||
lblTutor=Tutor for Card
|
||||
lblRollbackPhase=Rollback Phase
|
||||
lblAddCounterPermanent=Add Counters to Card
|
||||
|
||||
@@ -98,8 +98,8 @@ public class Puzzle extends GameState implements InventoryItem, Comparable<Puzzl
|
||||
this.parse(stateLines);
|
||||
}
|
||||
|
||||
public IPaperCard getPaperCard(final String cardName) {
|
||||
return FModel.getMagicDb().getCommonCards().getCard(cardName);
|
||||
public IPaperCard getPaperCard(final String cardName, final String setCode, final int artID) {
|
||||
return FModel.getMagicDb().getCommonCards().getCard(cardName, setCode, artID);
|
||||
}
|
||||
|
||||
public void setupMaxPlayerHandSize(Game game, int maxHandSize) {
|
||||
|
||||
@@ -2451,8 +2451,8 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
|
||||
private GameState createGameStateObject() {
|
||||
return new GameState() {
|
||||
@Override
|
||||
public IPaperCard getPaperCard(final String cardName) {
|
||||
return FModel.getMagicDb().getCommonCards().getCard(cardName);
|
||||
public IPaperCard getPaperCard(final String cardName, final String setCode, final int artID) {
|
||||
return FModel.getMagicDb().getCommonCards().getCard(cardName, setCode, artID);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user