Apotheosis

Apotheosis

79M Downloads

Min and Max power Function

BanakMael opened this issue ยท 1 comments

commented

Hi,

I'm trying to figure out how the "Max Power Function" and "Min Power Function" works.

This is what I've currently set up with a S:"Max Power"=128.0 in enchantement_module.cfg with a vanilla Protection enchant.

`
# The max level of this enchantment. [range: 1 ~ 127, default: 1]
I:"Max Level"=10

# A function to determine the max enchanting power.  The variable "x" is level.  See: https://github.com/uklimaschewski/EvalEx#usage-examples [default: ]
S:"Max Power Function"=10x

# The min level of this enchantment. [range: 1 ~ 127, default: 1]
I:"Min Level"=1

# A function to determine the min enchanting power. [default: ]
S:"Min Power Function"=10x-5`

What I understood is, let's say I have an option for levels 75-80 enchant power in the enchant table, I should have Protection 8 once enchanted.

Right now, I have random Protection levels only available within the 1 to 10 enchant level.

An example as it would be used in this config file would help a lot. I'm not sure if I have to use the Expression object and write a function like I would do in Java or just use the string expression.

I wanted to use some Math functions like LOG (as described in the link provided in this config file) and I'm getting crashes as LOG isn't recognized.

Version:
Minecraft forge: 1.12.2 - 14.23.5.2838
Apotheosis: 1.10.2

Thanks

commented

The specification for these functions is determined by the EvalEx library: https://github.com/uklimaschewski/EvalEx#usage-examples (See only the parts within "", as thats all you can input). It looks like functions like LOG are supported but only in lowercase, while some functions require uppercase. It's not a perfect implementation but thats how it is.

As for why that doesn't work, 75-80 is before enchantability comes into play. The value that you get is not the level of the table.

 * The possible enchantabilities for an item are equal to:
 * [table level + 1, table level + 1 + (E/4 + 1) + (E/4 + 1)].  E == item enchantability.  (E/4 + 1) is rolled as a random int.

Which means the level you get when you have level 75 available is actually 76 up to 77 + half the item's enchantability value, randomly, making it possible that you never see protection 8 at that level.

The real problem with that formula is that you make protection unavailable for 5 level gaps every 10 levels, which would make it really difficult to see it given how enchantability works. On top of that the parser is really weird so you have to be a bit specific with it.

Change your functions to max: 10 * x and min 10 * x - 9 and you should see the intended effect.