Research cost multipliers for Serpulo resources
This commit is contained in:
@@ -2891,7 +2891,7 @@ public class Blocks{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
breach = new ItemTurret("breach"){{
|
breach = new ItemTurret("breach"){{
|
||||||
requirements(Category.turret, with(Items.beryllium, 200, Items.silicon, 150, Items.graphite, 80));
|
requirements(Category.turret, with(Items.beryllium, 300, Items.silicon, 150, Items.graphite, 100));
|
||||||
|
|
||||||
Effect sfe = new MultiEffect(Fx.shootBigColor, Fx.colorSparkBig);
|
Effect sfe = new MultiEffect(Fx.shootBigColor, Fx.colorSparkBig);
|
||||||
|
|
||||||
@@ -2929,7 +2929,7 @@ public class Blocks{
|
|||||||
);
|
);
|
||||||
|
|
||||||
//TODO no coolant?
|
//TODO no coolant?
|
||||||
coolantUsage = 10f / 60f;
|
coolantUsage = 15f / 60f;
|
||||||
coolantOverride = Liquids.water;
|
coolantOverride = Liquids.water;
|
||||||
coolantMultiplier = 6f;
|
coolantMultiplier = 6f;
|
||||||
|
|
||||||
@@ -2954,7 +2954,7 @@ public class Blocks{
|
|||||||
//TODO bad name
|
//TODO bad name
|
||||||
sublimate = new ContinuousTurret("sublimate"){{
|
sublimate = new ContinuousTurret("sublimate"){{
|
||||||
//TODO requirements
|
//TODO requirements
|
||||||
requirements(Category.turret, with(Items.tungsten, 120, Items.silicon, 160, Items.oxide, 50));
|
requirements(Category.turret, with(Items.tungsten, 150, Items.silicon, 160, Items.oxide, 50));
|
||||||
|
|
||||||
draw = new DrawTurret("reinforced-"){{
|
draw = new DrawTurret("reinforced-"){{
|
||||||
liquidDraw = Liquids.ozone;
|
liquidDraw = Liquids.ozone;
|
||||||
|
|||||||
@@ -12,14 +12,15 @@ public class ErekirTechTree{
|
|||||||
public static void load(){
|
public static void load(){
|
||||||
Seq<Objective> erekirSector = Seq.with(new OnPlanet(Planets.erekir));
|
Seq<Objective> erekirSector = Seq.with(new OnPlanet(Planets.erekir));
|
||||||
|
|
||||||
//TODO use these multipliers!
|
|
||||||
var costMultipliers = new ObjectFloatMap<Item>();
|
var costMultipliers = new ObjectFloatMap<Item>();
|
||||||
costMultipliers.put(Items.silicon, 4);
|
costMultipliers.put(Items.silicon, 6);
|
||||||
costMultipliers.put(Items.surgeAlloy, 4);
|
costMultipliers.put(Items.surgeAlloy, 4);
|
||||||
costMultipliers.put(Items.thorium, 6);
|
costMultipliers.put(Items.thorium, 7);
|
||||||
costMultipliers.put(Items.graphite, 5);
|
costMultipliers.put(Items.graphite, 6);
|
||||||
|
|
||||||
Planets.erekir.techTree = nodeRoot("erekir", coreBastion, true, () -> {
|
Planets.erekir.techTree = nodeRoot("erekir", coreBastion, true, () -> {
|
||||||
|
context().researchCostMultipliers = costMultipliers;
|
||||||
|
|
||||||
node(duct, () -> {
|
node(duct, () -> {
|
||||||
node(ductRouter, () -> {
|
node(ductRouter, () -> {
|
||||||
node(ductBridge, () -> {
|
node(ductBridge, () -> {
|
||||||
@@ -216,7 +217,6 @@ public class ErekirTechTree{
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class Items{
|
|||||||
|
|
||||||
beryllium = new Item("beryllium", Color.valueOf("3a8f64")){{
|
beryllium = new Item("beryllium", Color.valueOf("3a8f64")){{
|
||||||
hardness = 4;
|
hardness = 4;
|
||||||
cost = 1.3f;
|
cost = 1.2f;
|
||||||
healthScaling = 0.6f;
|
healthScaling = 0.6f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import mindustry.game.Objectives.*;
|
|||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
/** Class for storing a list of TechNodes with some utility tree builder methods; context dependent. See {@link SerpuloTechTree#load} source for example usage. */
|
/** Class for storing a list of TechNodes with some utility tree builder methods; context dependent. See {@link SerpuloTechTree#load} source for example usage. */
|
||||||
public class TechTree{
|
public class TechTree{
|
||||||
private static TechNode context = null;
|
private static TechNode context = null;
|
||||||
@@ -66,6 +68,10 @@ public class TechTree{
|
|||||||
return nodeProduce(content, new Seq<>(), children);
|
return nodeProduce(content, new Seq<>(), children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static @Nullable TechNode context(){
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
/** @deprecated use {@link UnlockableContent#techNode} instead. */
|
/** @deprecated use {@link UnlockableContent#techNode} instead. */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static @Nullable TechNode get(UnlockableContent content){
|
public static @Nullable TechNode get(UnlockableContent content){
|
||||||
@@ -90,6 +96,8 @@ public class TechTree{
|
|||||||
public boolean requiresUnlock = false;
|
public boolean requiresUnlock = false;
|
||||||
/** Requirement node. */
|
/** Requirement node. */
|
||||||
public @Nullable TechNode parent;
|
public @Nullable TechNode parent;
|
||||||
|
/** Multipliers for research costs on a per-item basis. Inherits from parent. */
|
||||||
|
public @Nullable ObjectFloatMap<Item> researchCostMultipliers;
|
||||||
/** Content to be researched. */
|
/** Content to be researched. */
|
||||||
public UnlockableContent content;
|
public UnlockableContent content;
|
||||||
/** Item requirements for this content. */
|
/** Item requirements for this content. */
|
||||||
@@ -102,11 +110,26 @@ public class TechTree{
|
|||||||
public final Seq<TechNode> children = new Seq<>();
|
public final Seq<TechNode> children = new Seq<>();
|
||||||
|
|
||||||
public TechNode(@Nullable TechNode parent, UnlockableContent content, ItemStack[] requirements){
|
public TechNode(@Nullable TechNode parent, UnlockableContent content, ItemStack[] requirements){
|
||||||
if(parent != null) parent.children.add(this);
|
if(parent != null){
|
||||||
|
parent.children.add(this);
|
||||||
|
researchCostMultipliers = parent.researchCostMultipliers;
|
||||||
|
}else if(researchCostMultipliers == null){
|
||||||
|
researchCostMultipliers = new ObjectFloatMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.content = content;
|
this.content = content;
|
||||||
this.depth = parent == null ? 0 : parent.depth + 1;
|
this.depth = parent == null ? 0 : parent.depth + 1;
|
||||||
|
|
||||||
|
if(researchCostMultipliers.size > 0){
|
||||||
|
requirements = ItemStack.copy(requirements);
|
||||||
|
for(ItemStack requirement : requirements){
|
||||||
|
requirement.amount = (int)(requirement.amount * researchCostMultipliers.get(requirement.item, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.info("@ = @", content, Arrays.toString(requirements));
|
||||||
|
}
|
||||||
|
|
||||||
setupRequirements(requirements);
|
setupRequirements(requirements);
|
||||||
|
|
||||||
var used = new ObjectSet<Content>();
|
var used = new ObjectSet<Content>();
|
||||||
|
|||||||
@@ -60,6 +60,14 @@ public class ItemStack implements Comparable<ItemStack>{
|
|||||||
return stacks;
|
return stacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemStack[] copy(ItemStack[] stacks){
|
||||||
|
var out = new ItemStack[stacks.length];
|
||||||
|
for(int i = 0; i < out.length; i++){
|
||||||
|
out[i] = stacks[i].copy();
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(ItemStack itemStack){
|
public int compareTo(ItemStack itemStack){
|
||||||
return item.compareTo(itemStack.item);
|
return item.compareTo(itemStack.item);
|
||||||
|
|||||||
@@ -271,8 +271,6 @@ public class Block extends UnlockableContent{
|
|||||||
public Effect destroyEffect = Fx.dynamicExplosion;
|
public Effect destroyEffect = Fx.dynamicExplosion;
|
||||||
/** Multiplier for cost of research in tech tree. */
|
/** Multiplier for cost of research in tech tree. */
|
||||||
public float researchCostMultiplier = 1;
|
public float researchCostMultiplier = 1;
|
||||||
/** Multipliers for research costs on a per-item basis. Format: ID to multiplier. */
|
|
||||||
public ObjectFloatMap<Item> researchCostMultipliers = new ObjectFloatMap<>();
|
|
||||||
/** Whether this block has instant transfer.*/
|
/** Whether this block has instant transfer.*/
|
||||||
public boolean instantTransfer = false;
|
public boolean instantTransfer = false;
|
||||||
/** Whether you can rotate this block after it is placed. */
|
/** Whether you can rotate this block after it is placed. */
|
||||||
@@ -869,7 +867,7 @@ public class Block extends UnlockableContent{
|
|||||||
public ItemStack[] researchRequirements(){
|
public ItemStack[] researchRequirements(){
|
||||||
ItemStack[] out = new ItemStack[requirements.length];
|
ItemStack[] out = new ItemStack[requirements.length];
|
||||||
for(int i = 0; i < out.length; i++){
|
for(int i = 0; i < out.length; i++){
|
||||||
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.1f) * 20 * researchCostMultiplier * researchCostMultipliers.get(requirements[i].item, 1f), 10);
|
int quantity = 60 + Mathf.round(Mathf.pow(requirements[i].amount, 1.1f) * 20 * researchCostMultiplier, 10);
|
||||||
|
|
||||||
out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity));
|
out[i] = new ItemStack(requirements[i].item, UI.roundAmount(quantity));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ public class ItemTurret extends Turret{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleItem(Building source, Item item){
|
public void handleItem(Building source, Item item){
|
||||||
|
//TODO instead of all this "entry" crap, turrets could just accept only one type of ammo at a time - simpler for both users and the code
|
||||||
|
|
||||||
if(item == Items.pyratite){
|
if(item == Items.pyratite){
|
||||||
Events.fire(Trigger.flameAmmo);
|
Events.fire(Trigger.flameAmmo);
|
||||||
|
|||||||
Reference in New Issue
Block a user