diff --git a/.idea/dictionaries/project.xml b/.idea/dictionaries/project.xml new file mode 100644 index 0000000..7104ba6 --- /dev/null +++ b/.idea/dictionaries/project.xml @@ -0,0 +1,7 @@ + + + + Stimpak + + + \ No newline at end of file diff --git a/src/main/java/net/halfheart/lonesomeroad/ID.java b/src/main/java/net/halfheart/lonesomeroad/ID.java new file mode 100644 index 0000000..3f9d2af --- /dev/null +++ b/src/main/java/net/halfheart/lonesomeroad/ID.java @@ -0,0 +1,47 @@ +package net.halfheart.lonesomeroad; + +import net.halfheart.ventricleengine.objects.*; +import net.halfheart.ventricleengine.WeaponsHandler; +import net.halfheart.ventricleengine.ArmorsHandler; +import net.halfheart.ventricleengine.AidModifierHandler; +import net.halfheart.ventricleengine.ItemsHandler; +import net.halfheart.ventricleengine.PlayerHandler; + + +public record ID() { + public static Weapon FISTS = WeaponsHandler.constructWeapon("Fists"); + public static Weapon COMBATKNIFE = WeaponsHandler.constructWeapon("Combat Knife"); + public static Weapon RIPPER = WeaponsHandler.constructWeapon("Ripper"); + public static Weapon CHAINSAW = WeaponsHandler.constructWeapon("Chainsaw"); + public static Weapon BASEBALLBAT = WeaponsHandler.constructWeapon("Baseball Bat"); + public static Weapon POWERFIST = WeaponsHandler.constructWeapon("Power Fist"); + public static Weapon SUPERSLEDGE = WeaponsHandler.constructWeapon("Super Sledge"); + public static Weapon PISTOL10MM = WeaponsHandler.constructWeapon("10mm Pistol"); + public static Weapon HUNTINGRIFLE = WeaponsHandler.constructWeapon("Hunting Rifle"); + + public static Armor NOTHING = ArmorsHandler.constructArmor("Nothing"); + public static Armor LEATHERARMOR = ArmorsHandler.constructArmor("Leather Armor"); + public static Armor STURDYLEATHERARMOR = ArmorsHandler.constructArmor("Sturdy Leather Armor"); + public static Armor RAIDERARMOR = ArmorsHandler.constructArmor("Raider Armor"); + public static Armor METALARMOR = ArmorsHandler.constructArmor("Metal Armor"); + public static Armor COMBATARMOR = ArmorsHandler.constructArmor("Combat Armor"); + public static Armor CENTURIONARMOR = ArmorsHandler.constructArmor("Centurion Armor"); + public static Armor NCRRANGERARMOR = ArmorsHandler.constructArmor("NCR Ranger Armor"); + public static Armor T45POWERARMOR = ArmorsHandler.constructArmor("T-45 Power Armor"); + public static Armor T60POWERARMOR = ArmorsHandler.constructArmor("T-60 Power Armor"); + public static Armor T65POWERARMOR = ArmorsHandler.constructArmor("T-65 Power Armor"); + public static Armor X01POWERARMOR = ArmorsHandler.constructArmor("X-01 Power Armor"); + public static Armor APAMKIORPOWERARMOR = ArmorsHandler.constructArmor("APA MkI Power Armor"); + public static Armor APAMKIIPOWERARMOR = ArmorsHandler.constructArmor("APA MkII Power Armor"); + public static Armor RAIDERPOWERARMOR = ArmorsHandler.constructArmor("Raider Power Armor"); + public static Armor ULTRACITEPOWERARMOR = ArmorsHandler.constructArmor("Ultracite Power Armor"); + public static Armor T51POWERARMOR = ArmorsHandler.constructArmor("T-51 Power Armor"); + public static Armor ENCLAVEUNIFORM = ArmorsHandler.constructArmor("Enclave Uniform"); + public static Armor EXCAVATORPOWERARMOR = ArmorsHandler.constructArmor("Excavator Power Armor"); + + public static Player PLAYER = PlayerHandler.constructPlayer("none"); + + public static Item STIMPAK = ItemsHandler.constructItem("Stimpak"); + + public static AidModifier STIMPAK_M = AidModifierHandler.constructAidModifier("Stimpak"); +} diff --git a/src/main/java/net/halfheart/ventricleengine/AidModifier.java b/src/main/java/net/halfheart/ventricleengine/AidModifier.java deleted file mode 100644 index dd9d9e2..0000000 --- a/src/main/java/net/halfheart/ventricleengine/AidModifier.java +++ /dev/null @@ -1,18 +0,0 @@ -package net.halfheart.ventricleengine; - -public class AidModifier { - String name; - String stat; - String mod; - short value; - int duration; - - - public AidModifier(String name, String stat, String mod, short value, int duration) { - this.name = name; - this.stat = stat; - this.mod = mod; - this.value = value; - this.duration = duration; - } -} diff --git a/src/main/java/net/halfheart/ventricleengine/AidModifierHandler.java b/src/main/java/net/halfheart/ventricleengine/AidModifierHandler.java index 8685dec..22254a0 100644 --- a/src/main/java/net/halfheart/ventricleengine/AidModifierHandler.java +++ b/src/main/java/net/halfheart/ventricleengine/AidModifierHandler.java @@ -1,8 +1,8 @@ package net.halfheart.ventricleengine; - +import net.halfheart.ventricleengine.objects.AidModifier; +import net.halfheart.lonesomeroad.ID; import org.json.JSONArray; import org.json.JSONObject; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -12,7 +12,8 @@ import java.util.Objects; import java.util.stream.Collectors; public class AidModifierHandler { - private static AidModifier constructAidModifier(String aidModifierName) { + // Creates AidModifier object by parsing JSON + public static AidModifier constructAidModifier(String aidModifierName) { String filename = "/aid_modifiers.json"; try (InputStream inputStream = WeaponsHandler.class.getResourceAsStream(filename)) { String jsonText = new BufferedReader( @@ -34,22 +35,35 @@ public class AidModifierHandler { String stat = wantedItem.opt("stat").toString(); String mod = wantedItem.opt("mod").toString(); short value = (short) wantedItem.opt("value"); - int duration = (int) wantedItem.opt("duration"); - return new AidModifier(name, stat, mod, value, duration); + return new AidModifier(name, stat, mod, value); } catch (IOException e) { throw new RuntimeException(e); } } + // Applies requested aid modifier to player public static void applyAid(AidModifier modifier) { if (modifier.stat.equals("hp")) { char action = modifier.mod.charAt(0); switch (action) { - case '+' -> PlayerHandler.PLAYER.hp = (short) (PlayerHandler.PLAYER.hp + modifier.value); + case '+' -> ID.PLAYER.hp = (short) (ID.PLAYER.hp + modifier.value); } } } - public static AidModifier STIMPAK = constructAidModifier("Stimpak"); + // Removes requested aid modifier from player + public static void removeAid(AidModifier modifier) { + if (modifier.name.equals("Stimpak")) { + System.out.println("Invalid Operation: Tried to remove Stimpak modifier from player"); + } + } + + // Returns aidModifier from String of name + public static AidModifier findAid(String aidModifierName) { + return switch (aidModifierName) { + case "Stimpak" -> ID.STIMPAK_M; + default -> null; + }; + } } diff --git a/src/main/java/net/halfheart/ventricleengine/Armor.java b/src/main/java/net/halfheart/ventricleengine/Armor.java deleted file mode 100644 index b1949a1..0000000 --- a/src/main/java/net/halfheart/ventricleengine/Armor.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.halfheart.ventricleengine; - -import java.util.List; - -public class Armor { - String name; - String description; - String resType; - List resistances; - String resUnit; - short cost; - byte weight; - - public Armor( - String name, - String description, - String resType, - List resistances, - String resUnit, - short cost, - byte weight - ) - { - this.name = name; - this.description = description; - this.resType = resType; - this.resistances = resistances; - this.resUnit = resUnit; - this.cost = cost; - this.weight = weight; - } -} diff --git a/src/main/java/net/halfheart/ventricleengine/ArmorsHandler.java b/src/main/java/net/halfheart/ventricleengine/ArmorsHandler.java index 66fee01..83ba36e 100644 --- a/src/main/java/net/halfheart/ventricleengine/ArmorsHandler.java +++ b/src/main/java/net/halfheart/ventricleengine/ArmorsHandler.java @@ -1,4 +1,6 @@ package net.halfheart.ventricleengine; +import net.halfheart.ventricleengine.objects.Armor; +import net.halfheart.lonesomeroad.ID; import org.json.*; import java.io.BufferedReader; @@ -12,7 +14,8 @@ import java.util.Objects; import java.util.stream.Collectors; public class ArmorsHandler { - private static Armor constructArmor(String armorName) { + // Creates Armor object by parsing JSON + public static Armor constructArmor(String armorName) { String filename = "/armors.json"; try (InputStream inputStream = WeaponsHandler.class.getResourceAsStream(filename)) { String jsonText = new BufferedReader( @@ -49,48 +52,29 @@ public class ArmorsHandler { } } + // Returns Armor from String of name public static Armor findArmor(String armorName) { return switch (armorName) { - case "Nothing" -> NOTHING; - case "Leather Armor" -> LEATHERARMOR; - case "Sturdy Leather Armor" -> STURDYLEATHERARMOR; - case "Raider Armor" -> RAIDERARMOR; - case "Metal Armor" -> METALARMOR; - case "Combat Armor" -> COMBATARMOR; - case "Centurion Armor" -> CENTURIONARMOR; - case "NCR Ranger Armor" -> NCRRANGERARMOR; - case "T-45 Power Armor" -> T45POWERARMOR; - case "T-60 Power Armor" -> T60POWERARMOR; - case "T-65 Power Armor" -> T65POWERARMOR; - case "X-01 Power Armor" -> X01POWERARMOR; - case "APA MkI Power Armor" -> APAMKIORPOWERARMOR; - case "APA MkII Power Armor" -> APAMKIIPOWERARMOR; - case "Raider Power Armor" -> RAIDERPOWERARMOR; - case "Ultracite Power Armor" -> ULTRACITEPOWERARMOR; - case "T-51 Power Armor" -> T51POWERARMOR; - case "Enclave Uniform" -> ENCLAVEUNIFORM; - case "Excavator Power Armor" -> EXCAVATORPOWERARMOR; + case "Nothing" -> ID.NOTHING; + case "Leather Armor" -> ID.LEATHERARMOR; + case "Sturdy Leather Armor" -> ID.STURDYLEATHERARMOR; + case "Raider Armor" -> ID.RAIDERARMOR; + case "Metal Armor" -> ID.METALARMOR; + case "Combat Armor" -> ID.COMBATARMOR; + case "Centurion Armor" -> ID.CENTURIONARMOR; + case "NCR Ranger Armor" -> ID.NCRRANGERARMOR; + case "T-45 Power Armor" -> ID.T45POWERARMOR; + case "T-60 Power Armor" -> ID.T60POWERARMOR; + case "T-65 Power Armor" -> ID.T65POWERARMOR; + case "X-01 Power Armor" -> ID.X01POWERARMOR; + case "APA MkI Power Armor" -> ID.APAMKIORPOWERARMOR; + case "APA MkII Power Armor" -> ID.APAMKIIPOWERARMOR; + case "Raider Power Armor" -> ID.RAIDERPOWERARMOR; + case "Ultracite Power Armor" -> ID.ULTRACITEPOWERARMOR; + case "T-51 Power Armor" -> ID.T51POWERARMOR; + case "Enclave Uniform" -> ID.ENCLAVEUNIFORM; + case "Excavator Power Armor" -> ID.EXCAVATORPOWERARMOR; default -> null; }; } - - public static Armor NOTHING = constructArmor("Nothing"); - public static Armor LEATHERARMOR = constructArmor("Leather Armor"); - public static Armor STURDYLEATHERARMOR = constructArmor("Sturdy Leather Armor"); - public static Armor RAIDERARMOR = constructArmor("Raider Armor"); - public static Armor METALARMOR = constructArmor("Metal Armor"); - public static Armor COMBATARMOR = constructArmor("Combat Armor"); - public static Armor CENTURIONARMOR = constructArmor("Centurion Armor"); - public static Armor NCRRANGERARMOR = constructArmor("NCR Ranger Armor"); - public static Armor T45POWERARMOR = constructArmor("T-45 Power Armor"); - public static Armor T60POWERARMOR = constructArmor("T-60 Power Armor"); - public static Armor T65POWERARMOR = constructArmor("T-65 Power Armor"); - public static Armor X01POWERARMOR = constructArmor("X-01 Power Armor"); - public static Armor APAMKIORPOWERARMOR = constructArmor("APA MkI Power Armor"); - public static Armor APAMKIIPOWERARMOR = constructArmor("APA MkII Power Armor"); - public static Armor RAIDERPOWERARMOR = constructArmor("Raider Power Armor"); - public static Armor ULTRACITEPOWERARMOR = constructArmor("Ultracite Power Armor"); - public static Armor T51POWERARMOR = constructArmor("T-51 Power Armor"); - public static Armor ENCLAVEUNIFORM = constructArmor("Enclave Uniform"); - public static Armor EXCAVATORPOWERARMOR = constructArmor("Excavator Power Armor"); } diff --git a/src/main/java/net/halfheart/ventricleengine/Item.java b/src/main/java/net/halfheart/ventricleengine/Item.java deleted file mode 100644 index d9cdc51..0000000 --- a/src/main/java/net/halfheart/ventricleengine/Item.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.halfheart.ventricleengine; - -public class Item { - String name; - String description; - byte weight; - short cost; - boolean consumable; - String aidModifier; - - public Item( - String name, - String description, - byte weight, - short cost, - boolean consumable, - String aidModifier - ){ - this.name = name; - this.description = description; - this.weight = weight; - this.cost = cost; - this.consumable = consumable; - this.aidModifier = aidModifier; - } -} - diff --git a/src/main/java/net/halfheart/ventricleengine/ItemsHandler.java b/src/main/java/net/halfheart/ventricleengine/ItemsHandler.java index fba79c4..130f8a6 100644 --- a/src/main/java/net/halfheart/ventricleengine/ItemsHandler.java +++ b/src/main/java/net/halfheart/ventricleengine/ItemsHandler.java @@ -1,5 +1,7 @@ package net.halfheart.ventricleengine; +import net.halfheart.lonesomeroad.ID; +import net.halfheart.ventricleengine.objects.Item; import org.json.JSONArray; import org.json.JSONObject; @@ -11,10 +13,9 @@ import java.nio.charset.StandardCharsets; import java.util.Objects; import java.util.stream.Collectors; -import static net.halfheart.ventricleengine.AidModifierHandler.STIMPAK; - public class ItemsHandler { - private static Item constructItem(String weaponName) { + // Creates Item by parsing JSON + public static Item constructItem(String itemName) { String filename = "/items.json"; try (InputStream inputStream = WeaponsHandler.class.getResourceAsStream(filename)) { String jsonText = new BufferedReader( @@ -27,7 +28,7 @@ public class ItemsHandler { JSONObject wantedItem = null; for (int i = 0; i < jsonArray.length(); i++) { JSONObject item = jsonArray.getJSONObject(i); - if (item.opt("name").toString().equals(weaponName)) { + if (item.opt("name").toString().equals(itemName)) { wantedItem = item; } } @@ -44,12 +45,11 @@ public class ItemsHandler { } } + // Returns Item from String of name public static Item findItem(String itemName) { return switch (itemName) { - case "Stimpak" -> STIMPAK; + case "Stimpak" -> ID.STIMPAK; default -> null; }; } - - public static Item STIMPAK = constructItem("Stimpak"); } diff --git a/src/main/java/net/halfheart/ventricleengine/Player.java b/src/main/java/net/halfheart/ventricleengine/Player.java deleted file mode 100644 index d4277e2..0000000 --- a/src/main/java/net/halfheart/ventricleengine/Player.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.halfheart.ventricleengine; -import java.util.List; - -public class Player { - String name; - byte strength; - byte perception; - byte endurance; - byte charisma; - byte intelligence; - byte agility; - byte luck; - - short caps; - short pwMoney; - - short hpCap; - short hp; - - short food; - - boolean isRadiated; - byte radSeverity; - byte radPoints; - - int xp; - short level; - - List weapons; - List armors; - List items; - - public Player( - String name, - byte strength, - byte perception, - byte endurance, - byte charisma, - byte intelligence, - byte agility, - byte luck, - short caps, - short pwMoney, - short hpCap, - short hp, - short food, - boolean isRadiated, - byte radSeverity, - byte radPoints, - int xp, - short level, - List weapons, - List armors, - List items - ) - { - this.name = name; - this.strength = strength; - this.perception = perception; - this.endurance = endurance; - this.charisma = charisma; - this.intelligence = intelligence; - this.agility = agility; - this.luck = luck; - this.caps = caps; - this.pwMoney = pwMoney; - this.hpCap = hpCap; - this.hp = hp; - this.food = food; - this.isRadiated = isRadiated; - this.radSeverity = radSeverity; - this.radPoints = radPoints; - this.xp = xp; - this.level = level; - this.weapons = weapons; - this.armors = armors; - this.items = items; - } -} diff --git a/src/main/java/net/halfheart/ventricleengine/PlayerHandler.java b/src/main/java/net/halfheart/ventricleengine/PlayerHandler.java index 2d0620e..90aeb38 100644 --- a/src/main/java/net/halfheart/ventricleengine/PlayerHandler.java +++ b/src/main/java/net/halfheart/ventricleengine/PlayerHandler.java @@ -6,10 +6,13 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; +import net.halfheart.ventricleengine.objects.*; import org.json.*; public class PlayerHandler { - private static Player constructPlayer(String savePath) { + // Creates Player object by parsing JSON + public static Player constructPlayer(String savePath) { + // "none" Used for creating a blank Player for character creation if (savePath.equals("none")) { String name = "No Player Loaded!"; byte strength = 0; @@ -25,13 +28,13 @@ public class PlayerHandler { short hp = 0; short food = 0; boolean isRadiated = false; - byte radSeverity = 0; byte radPoints = 0; int xp = 0; short level = 0; List weaponList = new ArrayList<>(); List armorList = new ArrayList<>(); List itemList = new ArrayList<>(); + List aidList = new ArrayList<>(); return new Player( name, @@ -48,13 +51,13 @@ public class PlayerHandler { hp, food, isRadiated, - radSeverity, radPoints, xp, level, weaponList, armorList, - itemList + itemList, + aidList ); } else { try { @@ -75,7 +78,6 @@ public class PlayerHandler { short hp = (short) saveData.opt("hp"); short food = (short) saveData.opt("food"); boolean isRadiated = (boolean) saveData.opt("isRadiated"); - byte radSeverity = (byte) saveData.opt("radSeverity"); byte radPoints = (byte) saveData.opt("radPoints"); int xp = (int) saveData.opt("xp"); short level = (short) saveData.opt("level"); @@ -83,6 +85,7 @@ public class PlayerHandler { JSONObject weapons = saveData.getJSONObject("weapons"); JSONObject armors = saveData.getJSONObject("armors"); JSONObject items = saveData.getJSONObject("items"); + JSONObject aidModifiers = saveData.getJSONObject("aidModifiers"); List weaponList = new ArrayList<>(); for (String key : weapons.keySet()) { @@ -96,6 +99,10 @@ public class PlayerHandler { for (String key : items.keySet()) { itemList.add(ItemsHandler.findItem(items.opt(key).toString())); } + List aidModifierList = new ArrayList<>(); + for (String key : aidModifiers.keySet()) { + aidModifierList.add(AidModifierHandler.findAid(items.opt(key).toString())); + } return new Player( name, @@ -112,13 +119,13 @@ public class PlayerHandler { hp, food, isRadiated, - radSeverity, radPoints, xp, level, weaponList, armorList, - itemList + itemList, + aidModifierList ); } catch (FileNotFoundException e) { System.out.println("Save file not found at path: "+savePath); @@ -128,6 +135,4 @@ public class PlayerHandler { } return null; } - - public static Player PLAYER = constructPlayer("none"); } diff --git a/src/main/java/net/halfheart/ventricleengine/Weapon.java b/src/main/java/net/halfheart/ventricleengine/Weapon.java deleted file mode 100644 index e3ed6e6..0000000 --- a/src/main/java/net/halfheart/ventricleengine/Weapon.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.halfheart.ventricleengine; - -public class Weapon { - String name; - String description; - String dmgType; - String ammoType; - short damage; - short cost; - byte weight; - - public Weapon( - String name, - String description, - String dmgType, - String ammoType, - short damage, - short cost, - byte weight - ) - { - this.name = name; - this.description = description; - this.dmgType = dmgType; - this.ammoType = ammoType; - this.damage = damage; - this.cost = cost; - this.weight = weight; - } -} diff --git a/src/main/java/net/halfheart/ventricleengine/WeaponsHandler.java b/src/main/java/net/halfheart/ventricleengine/WeaponsHandler.java index 7876b2e..d8850d5 100644 --- a/src/main/java/net/halfheart/ventricleengine/WeaponsHandler.java +++ b/src/main/java/net/halfheart/ventricleengine/WeaponsHandler.java @@ -1,4 +1,6 @@ package net.halfheart.ventricleengine; +import net.halfheart.lonesomeroad.ID; +import net.halfheart.ventricleengine.objects.Weapon; import org.json.*; import java.io.BufferedReader; @@ -10,7 +12,8 @@ import java.util.Objects; import java.util.stream.Collectors; public class WeaponsHandler { - private static Weapon constructWeapon(String weaponName) { + // Creates Weapon object by parsing JSON + public static Weapon constructWeapon(String weaponName) { String filename = "/weapons.json"; try (InputStream inputStream = WeaponsHandler.class.getResourceAsStream(filename)) { String jsonText = new BufferedReader( @@ -41,40 +44,33 @@ public class WeaponsHandler { } } + // Finds Weapon from String of name public static Weapon findWeapon(String weaponName) { return switch (weaponName) { - case "Fists" -> FISTS; - case "Combat Knife" -> COMBATKNIFE; - case "Ripper" -> RIPPER; - case "Chainsaw" -> CHAINSAW; - case "Baseball Bat" -> BASEBALLBAT; - case "Power Fist" -> POWERFIST; - case "Super Sledge" -> SUPERSLEDGE; - case "10mm Pistol" -> PISTOL10MM; - case "Hunting Rifle" -> HUNTINGRIFLE; + case "Fists" -> ID.FISTS; + case "Combat Knife" -> ID.COMBATKNIFE; + case "Ripper" -> ID.RIPPER; + case "Chainsaw" -> ID.CHAINSAW; + case "Baseball Bat" -> ID.BASEBALLBAT; + case "Power Fist" -> ID.POWERFIST; + case "Super Sledge" -> ID.SUPERSLEDGE; + case "10mm Pistol" -> ID.PISTOL10MM; + case "Hunting Rifle" -> ID.HUNTINGRIFLE; default -> null; }; } public static void fistCalc() { - switch (PlayerHandler.PLAYER.strength){ + switch (ID.PLAYER.strength){ case 0 -> { - FISTS.description = FISTS.description+"please don't."; - FISTS.damage = -2; + ID.FISTS.description = ID.FISTS.description+"please don't."; + ID.FISTS.damage = -2; } - case (1|2|3|4) -> FISTS.description = FISTS.description+"a last resort."; - case (5|6|7|8) -> FISTS.description = FISTS.description+"use cautiously."; - case (9|10) -> FISTS.description = FISTS.description+"a formidable weapon."; + case (1|2|3|4) -> ID.FISTS.description = ID.FISTS.description+"a last resort."; + case (5|6|7|8) -> ID.FISTS.description = ID.FISTS.description+"use cautiously."; + case (9|10) -> ID.FISTS.description = ID.FISTS.description+"a formidable weapon."; } } - public static Weapon FISTS = constructWeapon("Fists"); - public static Weapon COMBATKNIFE = constructWeapon("Combat Knife"); - public static Weapon RIPPER = constructWeapon("Ripper"); - public static Weapon CHAINSAW = constructWeapon("Chainsaw"); - public static Weapon BASEBALLBAT = constructWeapon("Baseball Bat"); - public static Weapon POWERFIST = constructWeapon("Power Fist"); - public static Weapon SUPERSLEDGE = constructWeapon("Super Sledge"); - public static Weapon PISTOL10MM = constructWeapon("10mm Pistol"); - public static Weapon HUNTINGRIFLE = constructWeapon("Hunting Rifle"); + } diff --git a/src/main/java/net/halfheart/ventricleengine/objects/AidModifier.java b/src/main/java/net/halfheart/ventricleengine/objects/AidModifier.java new file mode 100644 index 0000000..b77737d --- /dev/null +++ b/src/main/java/net/halfheart/ventricleengine/objects/AidModifier.java @@ -0,0 +1,17 @@ +package net.halfheart.ventricleengine.objects; + + +// AidModifiers are used to break down the JSON data into Java-readable components. +public class AidModifier { + public String name; // Name of the effect, seen in game + public String stat; // Stat that the modifier affects + public String mod; // Operation that the modifier is doing to the stat (e.g. * for multiplying) + public short value; // Value that the operation uses (e.g. 25 for +25 hp) + + public AidModifier(String name, String stat, String mod, short value) { + this.name = name; + this.stat = stat; + this.mod = mod; + this.value = value; + } +} diff --git a/src/main/java/net/halfheart/ventricleengine/objects/Armor.java b/src/main/java/net/halfheart/ventricleengine/objects/Armor.java new file mode 100644 index 0000000..595a72d --- /dev/null +++ b/src/main/java/net/halfheart/ventricleengine/objects/Armor.java @@ -0,0 +1,32 @@ +package net.halfheart.ventricleengine.objects; +import java.util.List; + +// Armor is used to represent each armor as a Java object with values +public class Armor { + public String name; // Name of the armor, seen in game + public String description; // Description seen in pip-boy + public String type; // Armor type, either skin, uarmor, armor, or parmor + public List resistances; // A list of resistance byte values for each damage type + public String resUnit; // Unit the resistances use, either dt or dr for damage threshold and damage resistance + public short cost; // Buy/Sell price + public byte weight; // Weight of item in inventory + + public Armor( + String name, + String description, + String type, + List resistances, + String resUnit, + short cost, + byte weight + ) + { + this.name = name; + this.description = description; + this.type = type; + this.resistances = resistances; + this.resUnit = resUnit; + this.cost = cost; + this.weight = weight; + } +} diff --git a/src/main/java/net/halfheart/ventricleengine/objects/Item.java b/src/main/java/net/halfheart/ventricleengine/objects/Item.java new file mode 100644 index 0000000..0ca31bb --- /dev/null +++ b/src/main/java/net/halfheart/ventricleengine/objects/Item.java @@ -0,0 +1,28 @@ +package net.halfheart.ventricleengine.objects; + +// Item is used to represent each armor as a Java object with values +public class Item { + public String name; // Name of item, seen in game + public String description; // Description seen in pip-boy + public byte weight; // Weight of item in inventory + public short cost; // Buy/Sell value of item + public boolean consumable; // Whether the item can be consumed + public String aidModifier; // Aid modifier that the item applies when consumed + + public Item( + String name, + String description, + byte weight, + short cost, + boolean consumable, + String aidModifier + ){ + this.name = name; + this.description = description; + this.weight = weight; + this.cost = cost; + this.consumable = consumable; + this.aidModifier = aidModifier; + } +} + diff --git a/src/main/java/net/halfheart/ventricleengine/objects/Player.java b/src/main/java/net/halfheart/ventricleengine/objects/Player.java new file mode 100644 index 0000000..8207e96 --- /dev/null +++ b/src/main/java/net/halfheart/ventricleengine/objects/Player.java @@ -0,0 +1,82 @@ +package net.halfheart.ventricleengine.objects; +import java.util.List; + +// Player is used to represent the save data values as a Java object +public class Player { + public String name; // Name of player + // Next 7 lines: S.P.E.C.I.A.L. values of player + public byte strength; + public byte perception; + public byte endurance; + public byte charisma; + public byte intelligence; + public byte agility; + public byte luck; + + public short caps; // Caps the player has, used for vendors + public short pwMoney; // Pre-War Money the player has, used in Enclave vendors + + public short hpCap; // Player health point cap + public short hp; // Current player health + + public short food; // Food the player has, eaten each walk cycle + + public boolean isRadiated; // Whether the player is irradiated + // TODO: Decide function of radPoints + public byte radPoints; // Rad points player has + + public int xp; // Current player xp + public short level; // Current level of player + + public List weapons; // Weapons that the player has in inventory + public List armors; // Armors that the player has in inventory + public List items; // Items that the player has in inventory + public List aidModifiers; // Modifiers currently affecting player + + public Player( + String name, + byte strength, + byte perception, + byte endurance, + byte charisma, + byte intelligence, + byte agility, + byte luck, + short caps, + short pwMoney, + short hpCap, + short hp, + short food, + boolean isRadiated, + byte radPoints, + int xp, + short level, + List weapons, + List armors, + List items, + List aidModifiers + ) + { + this.name = name; + this.strength = strength; + this.perception = perception; + this.endurance = endurance; + this.charisma = charisma; + this.intelligence = intelligence; + this.agility = agility; + this.luck = luck; + this.caps = caps; + this.pwMoney = pwMoney; + this.hpCap = hpCap; + this.hp = hp; + this.food = food; + this.isRadiated = isRadiated; + this.radPoints = radPoints; + this.xp = xp; + this.level = level; + this.weapons = weapons; + this.armors = armors; + this.items = items; + this.aidModifiers = aidModifiers; + } +} diff --git a/src/main/java/net/halfheart/ventricleengine/objects/Weapon.java b/src/main/java/net/halfheart/ventricleengine/objects/Weapon.java new file mode 100644 index 0000000..c5ac3a5 --- /dev/null +++ b/src/main/java/net/halfheart/ventricleengine/objects/Weapon.java @@ -0,0 +1,31 @@ +package net.halfheart.ventricleengine.objects; + +// Weapon is used to represent each weapon as a Java object with values +public class Weapon { + public String name; // Name of weapon, seen in game + public String description; // Description of weapon, seen in pip-boy + public String dmgType; // Type of damage the weapon deals. Laser, Bash, Slash. etc. + public String ammoType; // Ammo the weapon uses. "none" for melee weapons + public short damage; // Damage the weapon deals + public short cost; // Buy/Sell value of weapon + public byte weight; // Weight of weapon in inventory + + public Weapon( + String name, + String description, + String dmgType, + String ammoType, + short damage, + short cost, + byte weight + ) + { + this.name = name; + this.description = description; + this.dmgType = dmgType; + this.ammoType = ammoType; + this.damage = damage; + this.cost = cost; + this.weight = weight; + } +} diff --git a/src/main/resources/aid_modifiers.json b/src/main/resources/aid_modifiers.json index e201f12..8f2cbe5 100644 --- a/src/main/resources/aid_modifiers.json +++ b/src/main/resources/aid_modifiers.json @@ -1,11 +1,10 @@ [ { - "food": { + "Stimpak": { "name": "Stimpak", "stat": "hp", "mod": "+", - "value": "20", - "duration": 0 + "value": "20" } } ] \ No newline at end of file