mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 09:48:02 +00:00
Merge branch 'master' into 'master'
Adventure fixes. See merge request core-developers/forge!6509
This commit is contained in:
@@ -5,6 +5,9 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import com.badlogic.gdx.utils.Json;
|
import com.badlogic.gdx.utils.Json;
|
||||||
import forge.adventure.util.Config;
|
import forge.adventure.util.Config;
|
||||||
import forge.adventure.util.Paths;
|
import forge.adventure.util.Paths;
|
||||||
|
import forge.util.MyRandom;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data class that will be used to read Json configuration files
|
* Data class that will be used to read Json configuration files
|
||||||
@@ -37,10 +40,12 @@ public class PointOfInterestData {
|
|||||||
return pointOfInterestList;
|
return pointOfInterestList;
|
||||||
}
|
}
|
||||||
public static PointOfInterestData getPointOfInterest(String name) {
|
public static PointOfInterestData getPointOfInterest(String name) {
|
||||||
for(PointOfInterestData data: new Array.ArrayIterator<>(getAllPointOfInterest()))
|
ArrayList<PointOfInterestData> candidates = new ArrayList<PointOfInterestData>();
|
||||||
{
|
for(PointOfInterestData data: new Array.ArrayIterator<>(getAllPointOfInterest())){
|
||||||
if(data.name.equals(name))
|
if(data.name.equals(name)) candidates.add(data); //Populate candidates with specified name.
|
||||||
return data;
|
}
|
||||||
|
if(candidates.size() > 0){ //If we got any candidates, return a random one.
|
||||||
|
return candidates.get(MyRandom.getRandom().nextInt(candidates.size()));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class Config {
|
|||||||
adventures = new File(GuiBase.isAndroid() ? ForgeConstants.ADVENTURE_DIR : path + "/res/adventure").list();
|
adventures = new File(GuiBase.isAndroid() ? ForgeConstants.ADVENTURE_DIR : path + "/res/adventure").list();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
settingsData = new Json().fromJson(SettingData.class, new FileHandle(ForgeConstants.USER_DIR + "/adventure/settings.json"));
|
settingsData = new Json().fromJson(SettingData.class, new FileHandle(ForgeConstants.USER_ADVENTURE_DIR + "settings.json"));
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import forge.adventure.util.Config;
|
|||||||
import forge.adventure.util.SaveFileData;
|
import forge.adventure.util.SaveFileData;
|
||||||
import forge.adventure.util.SignalList;
|
import forge.adventure.util.SignalList;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
|
import forge.localinstance.properties.ForgeConstants;
|
||||||
import forge.localinstance.properties.ForgeProfileProperties;
|
import forge.localinstance.properties.ForgeProfileProperties;
|
||||||
import forge.player.GamePlayerUtil;
|
import forge.player.GamePlayerUtil;
|
||||||
|
|
||||||
@@ -110,11 +111,11 @@ public class WorldSave {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getSaveDir() {
|
public static String getSaveDir() {
|
||||||
return ForgeProfileProperties.getUserDir() + File.separator + "Adventure" + File.separator + Config.instance().getPlane();
|
return ForgeConstants.USER_ADVENTURE_DIR + Config.instance().getPlane();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSaveFile(int slot) {
|
public static String getSaveFile(int slot) {
|
||||||
return ForgeProfileProperties.getUserDir() + File.separator + "Adventure" + File.separator + Config.instance().getPlane() + File.separator + filename(slot);
|
return ForgeConstants.USER_ADVENTURE_DIR + Config.instance().getPlane() + File.separator + filename(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WorldSave getCurrentSave() {
|
public static WorldSave getCurrentSave() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.5" tiledversion="1.7.1" orientation="orthogonal" renderorder="right-down" width="30" height="30" tilewidth="16" tileheight="16" infinite="0" nextlayerid="6" nextobjectid="53">
|
<map version="1.8" tiledversion="1.8.4" orientation="orthogonal" renderorder="right-down" width="30" height="30" tilewidth="16" tileheight="16" infinite="0" nextlayerid="6" nextobjectid="53">
|
||||||
<editorsettings>
|
<editorsettings>
|
||||||
<export target="wastetown..tmx" format="tmx"/>
|
<export target="wastetown..tmx" format="tmx"/>
|
||||||
</editorsettings>
|
</editorsettings>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
</object>
|
</object>
|
||||||
<object id="52" template="../../obj/enemy.tx" x="200" y="151" width="32" height="32">
|
<object id="52" template="../../obj/enemy.tx" x="200" y="151" width="32" height="32">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="enemy" value="Lathliss"/>
|
<property name="enemy" value="Ghalta"/>
|
||||||
</properties>
|
</properties>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ public final class ForgeConstants {
|
|||||||
public static final String USER_CUSTOM_CARDS_DIR = USER_CUSTOM_DIR + "cards" + PATH_SEPARATOR;
|
public static final String USER_CUSTOM_CARDS_DIR = USER_CUSTOM_DIR + "cards" + PATH_SEPARATOR;
|
||||||
public static final String USER_CUSTOM_TOKENS_DIR = USER_CUSTOM_DIR + "tokens" + PATH_SEPARATOR;
|
public static final String USER_CUSTOM_TOKENS_DIR = USER_CUSTOM_DIR + "tokens" + PATH_SEPARATOR;
|
||||||
public static final String USER_FORMATS_DIR = USER_CUSTOM_DIR + "formats" + PATH_SEPARATOR;
|
public static final String USER_FORMATS_DIR = USER_CUSTOM_DIR + "formats" + PATH_SEPARATOR;
|
||||||
|
public static final String USER_ADVENTURE_DIR = USER_DIR + "adventure" + PATH_SEPARATOR;
|
||||||
public static final String DECK_DRAFT_DIR = DECK_BASE_DIR + "draft" + PATH_SEPARATOR;
|
public static final String DECK_DRAFT_DIR = DECK_BASE_DIR + "draft" + PATH_SEPARATOR;
|
||||||
public static final String DECK_WINSTON_DIR = DECK_BASE_DIR + "winston" + PATH_SEPARATOR;
|
public static final String DECK_WINSTON_DIR = DECK_BASE_DIR + "winston" + PATH_SEPARATOR;
|
||||||
public static final String DECK_SEALED_DIR = DECK_BASE_DIR + "sealed" + PATH_SEPARATOR;
|
public static final String DECK_SEALED_DIR = DECK_BASE_DIR + "sealed" + PATH_SEPARATOR;
|
||||||
|
|||||||
Reference in New Issue
Block a user