mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-10-26 14:24:20 +00:00
Fix Additive Production (#33)
* Fix production modifiers to be additive, fix circuit tooltips for mutation and boolean modifiers * Chocolate frames have left the building kuba told me to kill them * Bruhhhhhhhhhhhh
This commit is contained in:
1 parent
f658e9ec57
commit
22f2eebbd3
11 files changed
+87
-40
No files matched your search
@@ -16,24 +16,40 @@ public class BeeModifierLogic {
|
||||
}
|
||||
|
||||
public float getModifier(EnumBeeModifier modifier, float currentModifier) {
|
||||
if (!modifiers.containsKey(modifier)) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
Float[] values = modifiers.get(modifier);
|
||||
float mult = values[0];
|
||||
float max = values[1];
|
||||
if (max >= 1.0f) {
|
||||
if (max <= currentModifier) {
|
||||
if (modifier == EnumBeeModifier.PRODUCTION) {
|
||||
if (!modifiers.containsKey(modifier)) {
|
||||
return 0.0f;
|
||||
}
|
||||
Float[] values = modifiers.get(modifier);
|
||||
float offset = values[0], max = values[1];
|
||||
if (offset < 0) {// negative modifiers should always apply
|
||||
return offset;
|
||||
}
|
||||
if (currentModifier >= max) {// don't decrease modifiers already over the max, just skip increasing it
|
||||
return 0.0f;
|
||||
}
|
||||
return Math.min(offset, max - currentModifier);
|
||||
} else {
|
||||
if (!modifiers.containsKey(modifier)) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.min(max / currentModifier, mult);
|
||||
|
||||
Float[] values = modifiers.get(modifier);
|
||||
float mult = values[0];
|
||||
float max = values[1];
|
||||
if (max >= 1.0f) {
|
||||
if (max <= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.min(max / currentModifier, mult);
|
||||
}
|
||||
|
||||
if (max >= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.max(max / currentModifier, mult);
|
||||
}
|
||||
|
||||
if (max >= currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
return Math.max(max / currentModifier, mult);
|
||||
}
|
||||
|
||||
public boolean getModifier(EnumBeeBooleanModifier modifier) {
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public enum EnumBeeBooleanModifier {
|
||||
|
||||
SEALED,
|
||||
SELF_LIGHTED,
|
||||
SUNLIGHT_STIMULATED,
|
||||
HELLISH
|
||||
HELLISH;
|
||||
|
||||
public String getName() {
|
||||
return I18N.localise("binniecore.beebooleanmodifier." + name().toLowerCase());
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class ComponentBeeModifier extends MachineComponent implements IBeeModifi
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -36,17 +36,17 @@ public enum EnumHiveFrame implements IHiveFrame, IBeeModifier {
|
||||
|
||||
public static void init() {
|
||||
EnumHiveFrame.Cocoa.logic.setModifier(EnumBeeModifier.LIFESPAN, 0.75f, 0.25f);
|
||||
EnumHiveFrame.Cocoa.logic.setModifier(EnumBeeModifier.PRODUCTION, 1.5f, 5.0f);
|
||||
EnumHiveFrame.Cocoa.logic.setModifier(EnumBeeModifier.PRODUCTION, 0.5f, 2.0f);// was 1.5x lim 5.0x
|
||||
EnumHiveFrame.Cage.logic.setModifier(EnumBeeModifier.TERRITORY, 0.5f, 0.1f);
|
||||
EnumHiveFrame.Cage.logic.setModifier(EnumBeeModifier.LIFESPAN, 0.75f, 0.5f);
|
||||
EnumHiveFrame.Cage.logic.setModifier(EnumBeeModifier.PRODUCTION, 0.75f, 0.5f);
|
||||
EnumHiveFrame.Cage.logic.setModifier(EnumBeeModifier.PRODUCTION, -0.25f, 0.0f);// was 0.75x lim 0.5x
|
||||
EnumHiveFrame.Soul.logic.setModifier(EnumBeeModifier.MUTATION, 1.5f, 5.0f);
|
||||
EnumHiveFrame.Soul.logic.setModifier(EnumBeeModifier.LIFESPAN, 0.75f, 0.5f);
|
||||
EnumHiveFrame.Soul.logic.setModifier(EnumBeeModifier.PRODUCTION, 0.25f, 0.1f);
|
||||
EnumHiveFrame.Soul.logic.setModifier(EnumBeeModifier.PRODUCTION, -0.75f, 0.0f);// was 0.25x lim 0.1x
|
||||
EnumHiveFrame.Soul.setMaxDamage(80);
|
||||
EnumHiveFrame.Clay.logic.setModifier(EnumBeeModifier.LIFESPAN, 1.5f, 5.0f);
|
||||
EnumHiveFrame.Clay.logic.setModifier(EnumBeeModifier.MUTATION, 0.5f, 0.2f);
|
||||
EnumHiveFrame.Clay.logic.setModifier(EnumBeeModifier.PRODUCTION, 0.75f, 0.2f);
|
||||
EnumHiveFrame.Clay.logic.setModifier(EnumBeeModifier.PRODUCTION, -0.25f, 0.0f);// was 0.75x lim 0.2x
|
||||
EnumHiveFrame.Debug.logic.setModifier(EnumBeeModifier.LIFESPAN, 1.0E-4f, 1.0E-4f);
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
|
||||
@@ -152,7 +152,7 @@ public class TileExtraBeeAlveary extends TileEntityMachine implements IAlvearyCo
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
if (getBeeModifier() == null) {
|
||||
return 1.0f;
|
||||
return 0.0f;
|
||||
}
|
||||
return getBeeModifier().getProductionModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class FrameComponentModifier extends ComponentBeeModifier implements IBee
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
IHiveFrame frame = getHiveFrame();
|
||||
if (frame == null) {
|
||||
return 1.0f;
|
||||
return 0.0f;
|
||||
}
|
||||
return frame.getBeeModifier().getProductionModifier(genome, currentModifier);
|
||||
}
|
||||
|
||||
@@ -20,15 +20,17 @@ public enum CircuitType implements IBeeModifier {
|
||||
Territory(2, 10);
|
||||
|
||||
static {
|
||||
CircuitType.LowVoltage.logic.setModifier(EnumBeeModifier.PRODUCTION, 1.5f, 5.0f);
|
||||
CircuitType.HighVoltage.logic.setModifier(EnumBeeModifier.PRODUCTION, 2.5f, 10.0f);
|
||||
CircuitType.LowVoltage.logic.setModifier(EnumBeeModifier.PRODUCTION, 0.5f, 5.0f);
|
||||
CircuitType.HighVoltage.logic.setModifier(EnumBeeModifier.PRODUCTION, 1.5f, 10.0f);
|
||||
CircuitType.Plant.logic.setModifier(EnumBeeModifier.FLOWERING, 1.5f, 5.0f);
|
||||
CircuitType.Death.logic.setModifier(EnumBeeModifier.LIFESPAN, 0.8f, 0.2f);
|
||||
CircuitType.Life.logic.setModifier(EnumBeeModifier.LIFESPAN, 1.5f, 5.0f);
|
||||
CircuitType.Nether.logic.setModifier(EnumBeeBooleanModifier.HELLISH);
|
||||
CircuitType.Mutation.logic.setModifier(EnumBeeModifier.MUTATION, 1.5f, 5.0f);
|
||||
CircuitType.Inhibitor.logic.setModifier(EnumBeeModifier.TERRITORY, 0.4f, 0.1f);
|
||||
CircuitType.Inhibitor.logic.setModifier(EnumBeeModifier.PRODUCTION, 0.9f, 0.5f);
|
||||
CircuitType.Inhibitor.logic.setModifier(EnumBeeModifier.PRODUCTION, -0.1f, 0.0f);// was 0.9x, now -0.1. limit
|
||||
// was 0.5x, now it's 0, but
|
||||
// currently ignored
|
||||
CircuitType.Territory.logic.setModifier(EnumBeeModifier.TERRITORY, 1.5f, 5.0f);
|
||||
for (CircuitType type : values()) {
|
||||
type.logic.setModifier(EnumBeeModifier.GENETIC_DECAY, 1.5f, 10.0f);
|
||||
@@ -48,18 +50,34 @@ public enum CircuitType implements IBeeModifier {
|
||||
|
||||
public void createCircuit(ICircuitLayout layout) {
|
||||
StimulatorCircuit circuit = new StimulatorCircuit(this, layout);
|
||||
for (EnumBeeModifier modifier : EnumBeeModifier.values()) {
|
||||
float mod = logic.getModifier(modifier, 1.0f);
|
||||
if (mod == 1.0f) {
|
||||
continue;
|
||||
for (EnumBeeBooleanModifier modifier : EnumBeeBooleanModifier.values()) {
|
||||
if (logic.getModifier(modifier)) {
|
||||
circuit.addTooltipString("Enables " + modifier.getName());
|
||||
}
|
||||
|
||||
if (mod > 1.0f) {
|
||||
int increase = (int) ((mod - 1.0f) * 100.0f);
|
||||
circuit.addTooltipString("Increases " + modifier.getName() + " by " + increase + "%");
|
||||
}
|
||||
for (EnumBeeModifier modifier : EnumBeeModifier.values()) {
|
||||
if (modifier == EnumBeeModifier.PRODUCTION) {
|
||||
float mod = logic.getModifier(modifier, 0.0f);
|
||||
if (mod == 0.0f) {
|
||||
continue;
|
||||
}
|
||||
if (mod > 0.0f) {
|
||||
circuit.addTooltipString("Increases " + modifier.getName() + " by +" + mod);
|
||||
} else {
|
||||
circuit.addTooltipString("Increases " + modifier.getName() + " by " + mod);
|
||||
}
|
||||
} else {
|
||||
int decrease = (int) ((1.0f - mod) * 100.0f);
|
||||
circuit.addTooltipString("Decreases " + modifier.getName() + " by " + decrease + "%");
|
||||
float mod = logic.getModifier(modifier, 1.0f);
|
||||
if (mod == 1.0f) {
|
||||
continue;
|
||||
}
|
||||
if (mod > 1.0f) {
|
||||
int increase = (int) ((mod - 1.0f) * 100.0f);
|
||||
circuit.addTooltipString("Increases " + modifier.getName() + " by " + increase + "%");
|
||||
} else {
|
||||
int decrease = (int) ((1.0f - mod) * 100.0f);
|
||||
circuit.addTooltipString("Decreases " + modifier.getName() + " by " + decrease + "%");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -100,13 +100,14 @@ public class StimulatorModifierComponent extends ComponentBeeModifier implements
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
float mod = 1.0f;
|
||||
float mod = 0.0f;// production modifiers are now additive, and the "base" value of 1 comes in forestry's
|
||||
// Bee.java and BeeKeepingMode.java
|
||||
if (!powered) {
|
||||
return mod;
|
||||
}
|
||||
|
||||
for (IBeeModifier beeMod : modifiers) {
|
||||
mod *= beeMod.getProductionModifier(genome, mod);
|
||||
mod += beeMod.getProductionModifier(genome, mod);
|
||||
}
|
||||
return mod;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,12 @@ binniecore.beemodifier.mutation=Mutation
|
||||
binniecore.beemodifier.lifespan=Lifespan
|
||||
binniecore.beemodifier.production=Production
|
||||
binniecore.beemodifier.flowering=Flowering
|
||||
binniecore.beemodifier.geneticdecay=Genetic Decay
|
||||
binniecore.beemodifier.genetic_decay=Genetic Decay
|
||||
|
||||
binniecore.beebooleanmodifier.sealed=Rain Protection
|
||||
binniecore.beebooleanmodifier.self_lighted=Self Lighting
|
||||
binniecore.beebooleanmodifier.sunlight_stimulated=Sunlight Stimulation
|
||||
binniecore.beebooleanmodifier.hellish=Hellish Emulation
|
||||
|
||||
binniecore.gui.breedingmessage.species=Species Discovered
|
||||
binniecore.gui.breedingmessage.branch=Branch Discovered
|
||||
|
||||
@@ -182,7 +182,7 @@ binniecore.beemodifier.mutation=Мутация
|
||||
binniecore.beemodifier.lifespan=Время жизни
|
||||
binniecore.beemodifier.production=Продукция
|
||||
binniecore.beemodifier.flowering=Цветы
|
||||
binniecore.beemodifier.geneticdecay=Склонность к вырождению
|
||||
binniecore.beemodifier.genetic_decay=Склонность к вырождению
|
||||
|
||||
binniecore.gui.breedingmessage.species=Видов обнаружено
|
||||
binniecore.gui.breedingmessage.branch=Семейств обнаружено
|
||||
|
||||
@@ -182,7 +182,7 @@ binniecore.beemodifier.mutation=变异
|
||||
binniecore.beemodifier.lifespan=寿命
|
||||
binniecore.beemodifier.production=产物
|
||||
binniecore.beemodifier.flowering=授粉速度
|
||||
binniecore.beemodifier.geneticdecay=基因衰变
|
||||
binniecore.beemodifier.genetic_decay=基因衰变
|
||||
|
||||
binniecore.gui.breedingmessage.species=已发现品种
|
||||
binniecore.gui.breedingmessage.branch=已发现分支
|
||||
|
||||
Reference in new issue
Block a user