Compare commits
2 Commits
4a28775e9c
...
1d5c39b9e5
| Author | SHA1 | Date |
|---|---|---|
|
|
1d5c39b9e5 | |
|
|
33959e80d0 |
File diff suppressed because it is too large
Load Diff
|
|
@ -86,6 +86,7 @@ public class Test {
|
|||
System.out.println("\ntest");
|
||||
SumResult.sum(Database.Plastic, 4);
|
||||
*/
|
||||
/*
|
||||
Item a = Database.HeavyOilResidue;
|
||||
Item b = Database.Water;
|
||||
Map<Item, Recipe> preferences = Database.preferences;
|
||||
|
|
@ -133,6 +134,10 @@ public class Test {
|
|||
planFor("screw", new Production(Database.ReinforcedIronPlate, 1));
|
||||
planFor("rotor", new Production(Database.Rotor, 1));
|
||||
planFor("mf", new Production(Database.ModularFrame, 10));
|
||||
*/
|
||||
//planFor("aluminumIngot", new Production(Database.AluminumIngot, 240));
|
||||
//planFor("fusedFrame", new Production(Database.FusedModularFrame, 1.5));
|
||||
planFor("p4", new Production(Database.AssemblyDirectorSystem,4), new Production(Database.MagneticFieldGenerator, 4), new Production(Database.ThermalPropulsionRocket, 1), new Production(Database.NuclearPasta, 1));
|
||||
}
|
||||
|
||||
private static void planFor(Item item, int amount, String name) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public abstract class Building {
|
|||
|
||||
public Map<Item, Integer> getCost(int n) {
|
||||
Map<Item, Integer> instances = new HashMap<>();
|
||||
cost.forEach((item, integer) -> instances.put(item, n * integer));
|
||||
getCost().forEach((item, integer) -> instances.put(item, n * integer));
|
||||
return instances;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
package satisfactory.buildings;
|
||||
|
||||
import satisfactory.items.Item;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class DecorationBuilding extends Building {
|
||||
public DecorationBuilding(String name, Map<Item, Integer> cost){
|
||||
super(name);
|
||||
this.cost = cost;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package satisfactory.buildings;
|
||||
|
||||
import satisfactory.items.Item;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ParticleAccelerator extends ProductionBuilding{
|
||||
public ParticleAccelerator(String name, int power, Map<Item, Integer> cost) {
|
||||
super(name, power, cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPower() {
|
||||
return 1000; // TODO calculate
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package satisfactory.buildings;
|
||||
|
||||
import satisfactory.Database;
|
||||
import satisfactory.items.Item;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ResourceWellExtractor extends ProductionBuilding{
|
||||
private final Building dependendBuilding;
|
||||
public ResourceWellExtractor(String name, Map<Item, Integer> cost,Building pressurizer) {
|
||||
super(name, 0, cost);
|
||||
dependendBuilding = pressurizer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Item, Integer> getCost() {
|
||||
Map<Item, Integer> totalCost = new HashMap<>(super.getCost());
|
||||
dependendBuilding.getCost().forEach((item, integer) -> totalCost.merge(item, integer, Integer::sum));
|
||||
return totalCost;
|
||||
}
|
||||
}
|
||||
|
|
@ -13,21 +13,22 @@ import java.util.Set;
|
|||
public abstract class Item {
|
||||
private final String name;
|
||||
private final Set<Recipe> recipes;
|
||||
public final int stackSize;
|
||||
public int sum = 0;
|
||||
protected boolean isRaw = false;
|
||||
private Recipe preference = null;
|
||||
|
||||
protected Item(String name, Set<Recipe> recipes) {
|
||||
protected Item(String name, int stackSize, Set<Recipe> recipes) {
|
||||
this.name = name;
|
||||
this.stackSize = stackSize;
|
||||
this.recipes = recipes;
|
||||
Database.add(this);
|
||||
for (Recipe recipe : recipes) {
|
||||
add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
public Item(String name) {
|
||||
this(name, new HashSet<>());
|
||||
public Item(String name, int stackSize) {
|
||||
this(name, stackSize, new HashSet<>());
|
||||
}
|
||||
|
||||
public static Map<Item, Double> production(Graph<Item, DefaultWeightedEdge> graph) {
|
||||
|
|
@ -95,7 +96,11 @@ public abstract class Item {
|
|||
}
|
||||
|
||||
public String ID() {
|
||||
return getName().replace(" ", "").replace(".", "_");
|
||||
return getName()
|
||||
.replace(" ", "")
|
||||
.replace(".", "_")
|
||||
.replace("-", "")
|
||||
;
|
||||
}
|
||||
|
||||
public Recipe getPreference() {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class RecipeBuilder {
|
|||
this.byProducts.add(byProduct);
|
||||
return this;
|
||||
}
|
||||
public RecipeBuilder setByProducts(Set<Item> byProduct) {
|
||||
public RecipeBuilder setByProducts(Set<Item> byProducts) {
|
||||
this.byProducts = byProducts;// TODO: merge?
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ import satisfactory.items.Item;
|
|||
public abstract class Fluid extends Item {
|
||||
|
||||
public Fluid(String name) {
|
||||
super(name);
|
||||
super(name, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package satisfactory.items.type;
|
|||
|
||||
import satisfactory.items.Item;
|
||||
|
||||
public class Gas extends Item {
|
||||
public class Gas extends Fluid {
|
||||
|
||||
public Gas(String name) {
|
||||
super(name);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import satisfactory.items.Item;
|
|||
|
||||
public class Ingot extends Item {
|
||||
|
||||
public Ingot(String name) {
|
||||
super(name);
|
||||
public Ingot(String name, int stackSize) {
|
||||
super(name, stackSize);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import satisfactory.items.Item;
|
|||
|
||||
public class Ore extends Item {
|
||||
|
||||
public Ore(String name) {
|
||||
super(name);
|
||||
public Ore(String name, int stackSize) {
|
||||
super(name, stackSize);
|
||||
setIsRaw();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import satisfactory.items.Item;
|
|||
|
||||
public class Part extends Item {
|
||||
|
||||
public Part(String name) {
|
||||
super(name);
|
||||
public Part(String name, int stackSize) {
|
||||
super(name, stackSize);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import satisfactory.items.Item;
|
|||
|
||||
public class Pickup extends Item {
|
||||
|
||||
public Pickup(String name) {
|
||||
super(name);
|
||||
public Pickup(String name, int stackSize) {
|
||||
super(name, stackSize);
|
||||
setIsRaw();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import satisfactory.items.Item;
|
|||
|
||||
public class Tool extends Item {
|
||||
|
||||
public Tool(String name) {
|
||||
super(name);
|
||||
public Tool(String name, int stackSize) {
|
||||
super(name, stackSize);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,8 +62,14 @@ class ItemTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void productionRubberAndPlastic() {
|
||||
void productionRubberAndPlastic(
|
||||
) {
|
||||
test("rubberAndPlastic", Database.Rubber, Database.Plastic);
|
||||
}
|
||||
|
||||
@Test
|
||||
void productionAluminumIngot() {
|
||||
test("aluminumIngot", Database.AluminumIngot);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package satisfactory.items;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import satisfactory.Database;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
import static satisfactory.items.TestHelper.test;
|
||||
|
||||
class Phase4Test {
|
||||
|
||||
@Test
|
||||
void testPhase4() {
|
||||
test("phase4", Database.AssemblyDirectorSystem, Database.MagneticFieldGenerator);
|
||||
fail("Missing items!");
|
||||
//test("phase4", Database.AssemblyDirectorSystem, Database.MagneticFieldGenerator, Database.ThermalPropulsionRocket, Database.NuclearPasta);
|
||||
}
|
||||
}
|
||||
|
|
@ -94,6 +94,19 @@ public class ValidatedValues {
|
|||
ref.put(item, 1.);
|
||||
values.put(item, ref);
|
||||
}
|
||||
{
|
||||
Item item = Database.AluminumIngot;
|
||||
Map<Item, Double> ref = new HashMap<>();
|
||||
ref.put(Database.AluminumScrap, 1.5);
|
||||
ref.put(Database.Water, 1.5);
|
||||
ref.put(Database.RawQuartz, 0.5);
|
||||
ref.put(Database.Silica, 1.25);
|
||||
ref.put(Database.AluminaSolution, 1.0);
|
||||
ref.put(Database.Bauxite, 0.5);
|
||||
ref.put(Database.Coal, 0.5);
|
||||
ref.put(item, 1.0);
|
||||
values.put(item, ref);
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<Item, Double> get(Item item) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue