nvb-uy / Protection-Balancer

MIT License
2 stars 0 forks source link

[QUESTION] Adding ARMOR_TOUGHNESS to the formula #2

Closed ImWhiff closed 3 months ago

ImWhiff commented 7 months ago

The mod is a lifesaver for rebalancing armor. But I am struggling to add ARMOR_TOUGNESS as part of the formula and just can't seem to figure it out.

Would you perhaps be able to provide me with a sample formula that includes toughness as part of the formula. Maybe 8 tougness value increases DR by 10%, or tougness increases ARMOR value if that may be easier.

Thank you for the great mod!

nvb-uy commented 7 months ago

Im currently really sick sadly so I can't help you currently.

It might sound dumb, but ChatGPT may be able to help you out on that, I know it's terrible at handling math but if you test out the formula and arrange it correctly it should work.

On the other hand, you can probably just copy the same formula for armor, and sum it with armor toughness, make sure to change the max values to be your desired ones

ImWhiff commented 7 months ago

Thanks for the quick suggestions! I'll see what I come up with and comment it here in case anyone else is facing the same issue as I am.

Hooe you're able to recover from your sickness well.

ImWhiff commented 7 months ago

So I've tried several variations of trying to add toughness in the calculation, but everytime the formula includes ARMOR_TOUGHNESS, it crashes. The formula I initially wanted to try was:

max((ARMOR/50.0) 0.9, ((ARMOR/50.0) 0.9) + ARMOR_TOUGHNESS (ARMOR_TOUGHNESS+8.0)/(4.0DAMAGE) / 50.0)"

but didn't work. So I tried if anything works, such as: max((ARMOR/50.0) 0.9, (ARMOR+ARMOR_TOUGHNESS/50.0) 0.9), max((ARMOR+ARMOR_TOUGHNESS/50.0) *0.9, 1.0),

This is crashing after getting hit by a skeleton. latest.log crash-2024-03-30_07.24.32-server.txt

nvb-uy commented 7 months ago

I'll look into it as soon as I get better:)

PraiseTheSeune commented 7 months ago

Hello, just to say that I get the same problem. Everything works but this variable.

ihymyly commented 6 months ago

Hello, any update on the toughness equation? I really like the concept of this mod, but don't want toughness to be redundant.

kineticV commented 6 months ago

@nvb-uy Hey thanks for the mod, I've been looking for something like this for a while. Currently ARMOR_TOUGHNESS can't be used in any formula because the _ underscore in that name is invalid syntax. It causes the server to crash with the below error. A simple fix would be to rename ARMOR_TOUGHNESS to simply TOUGHNESS.

[07:24:32] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.class_148: Ticking entity
    at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:901) ~[client-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:824) ~[client-intermediary.jar:?]
    at net.minecraft.class_1132.method_3748(class_1132.java:105) ~[client-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671) ~[client-intermediary.jar:?]
    at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) ~[client-intermediary.jar:?]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.RuntimeException: Unexpected: _
    at elocindev.protbalancer.math.FormulaParser$1.parse(FormulaParser.java:27) ~[ProtectionBalancer-FABRIC-1.1.0.jar:?]
    at elocindev.protbalancer.math.FormulaParser.evaluateFormula(FormulaParser.java:110) ~[ProtectionBalancer-FABRIC-1.1.0.jar:?]
    at net.minecraft.class_1280.modifyReturnValue$zli000$protbalancer$getDamageLeft(class_1280.java:527) ~[client-intermediary.jar:?]
    at net.minecraft.class_1280.method_5496(class_1280.java:15) ~[client-intermediary.jar:?]
    at net.minecraft.class_1309.method_6132(class_1309.java:1636) ~[client-intermediary.jar:?]
Joshua-z-Luo commented 4 months ago

yea i have the same problem, seems like the underscore is the problem

nvb-uy commented 3 months ago

Fixed on 1.2.0

ihymyly commented 3 months ago

God bless you