-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
Code release commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main; | ||
|
||
import types.Trainer; | ||
import types.TrainerClass; | ||
import ui.Screen; | ||
|
||
import java.io.File; | ||
import java.util.LinkedHashMap; | ||
import java.util.LinkedList; | ||
|
||
public class MainActivity { | ||
public static Screen screen; | ||
public static File projectDirectory = null; | ||
|
||
public static String currentTrainer = null; | ||
public static LinkedHashMap<String, Integer> trainerIndexes; | ||
public static LinkedHashMap<String, Integer> partyIndexes; | ||
public static LinkedHashMap<String, TrainerClass> trainerClasses; | ||
public static LinkedList<String> items; | ||
public static LinkedHashMap<String, String> moves; | ||
public static LinkedHashMap<String, String> species; | ||
public static LinkedList<String> music; | ||
public static LinkedList<String> aiFlags; | ||
public static LinkedList<String> picList; | ||
public static LinkedHashMap<String, String> picPaths; | ||
public static LinkedHashMap<String, Trainer> loadedTrainers = new LinkedHashMap<>(); | ||
|
||
public static void main(String[] args){ | ||
screen = new Screen(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main; | ||
|
||
import java.util.List; | ||
|
||
public class Utils { | ||
public static boolean isNumeric(String text){ | ||
if (text == null) return false; | ||
try { | ||
double d = Double.parseDouble(text); | ||
} | ||
catch (NumberFormatException exception) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
public static String getLongestString(List<String> list){ | ||
String longest = list.get(0); | ||
for(String element : list){ | ||
if(element != null) | ||
if(element.length() > longest.length()) longest = element; | ||
} | ||
return longest; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package types; | ||
|
||
import main.MainActivity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.LinkedList; | ||
|
||
public class PartyMember { | ||
public static final String[] fields = {"iv", "lvl", "species", "heldItem", "moves"}; | ||
|
||
public String iv; | ||
public String level; | ||
public String species; | ||
public String heldItem; | ||
public ArrayList<String> moves; | ||
|
||
public PartyMember(){ | ||
iv = "0"; | ||
level = "0"; | ||
LinkedList<String> keys = new LinkedList<>(MainActivity.species.keySet()); | ||
species = keys.get(0); | ||
heldItem = MainActivity.items.get(0); | ||
moves = new ArrayList<>(); | ||
} | ||
|
||
public PartyMember(HashMap<String, String> values){ | ||
iv = values.get("iv"); | ||
level = values.get("lvl"); | ||
species = values.get("species"); | ||
heldItem = values.get("heldItem"); | ||
moves = extractMoves(values.get("moves")); | ||
} | ||
|
||
public static HashMap<String, String> templateValues(){ | ||
HashMap<String, String> template = new HashMap<>(); | ||
for(String field: fields){ | ||
template.put(field, ""); | ||
} | ||
return template; | ||
} | ||
|
||
public static ArrayList<String> extractMoves(String moves){ | ||
if(moves.length() == 0) return new ArrayList<>(); | ||
return new ArrayList<>(Arrays.asList(moves.substring(1, moves.length() - 1).split(","))); | ||
} | ||
|
||
private String buildMoves(){ | ||
String moves = ""; | ||
for (int index = 0; index < this.moves.size(); index++) { | ||
moves += this.moves.get(index); | ||
if (index != this.moves.size() - 1) { | ||
moves += ", "; | ||
} | ||
} | ||
return "{" + moves + "}"; | ||
} | ||
|
||
public boolean hasCustomMoves(){ | ||
boolean hasCustomMoves = false; | ||
LinkedList<String> keys = new LinkedList<>(MainActivity.moves.keySet()); | ||
for (int index = 0; index < this.moves.size(); index++) { | ||
if(!moves.get(index).equals(keys.get(0))) hasCustomMoves = true; | ||
} | ||
return hasCustomMoves; | ||
} | ||
|
||
public String buildMemberStruct(boolean partyHasCustomItems, boolean partyHasCustomMoves){ | ||
String struct = " {" + System.lineSeparator(); | ||
struct += " .iv = " + iv + "," + System.lineSeparator(); | ||
struct += " .lvl = " + level + "," + System.lineSeparator(); | ||
String speciesBuild = " .species = " + this.species; | ||
String heldItemBuild = " .heldItem = " + this.heldItem; | ||
String movesBuild = " .moves = " + buildMoves(); | ||
struct += speciesBuild + "," + System.lineSeparator(); | ||
if(partyHasCustomItems) { | ||
if (!partyHasCustomMoves) struct += heldItemBuild + System.lineSeparator(); | ||
else{ | ||
struct += heldItemBuild + "," + System.lineSeparator(); | ||
struct += movesBuild + System.lineSeparator(); | ||
} | ||
} | ||
else if (partyHasCustomMoves) struct += movesBuild + System.lineSeparator(); | ||
struct += " }"; | ||
return struct; | ||
} | ||
} |