Diet (Fabric/Forge/Quilt)

Diet (Fabric/Forge/Quilt)

6M Downloads

[Bug?] Attribute multiply operations are both additive

Endgineer opened this issue ยท 2 comments

commented

Great mod, thanks for working on it. I currently have the following in diet-effects.toml:

[[effects]]

	[[effects.attributes]]
		amount = 0.1
		name = "minecraft:generic.attack_damage"
		operation = "multiply_total"

	[[effects.conditions]]
		below = 1.0
		match = "every"
		above = 0.5
		groups = ["proteins", "fruits", "vegetables", "grains", "sugars"]

There seems to be no difference between setting multiply_total or multiply_base here (both are additive). When all 5 groups are >0.5, the effect reads +50% attack damage. I tried making a separate effect for each group (using multiply_total as well), and the result is +10% attack damage +10% attack damage +10% attack damage +10% attack damage +10% attack damage. Attacking with a diamond sword in both cases deals only 10.5 hearts (confirming the +50% attack damage in both). Basically, no matter what I try, the groups always contribute additively.

From what I understood from the wiki, multiply_total is supposed to be multiplicative. Expected behavior is more like:
1 group ... +10%
2 groups ... +21%
3 groups ... +33.1%
4 groups ... +46.41%
5 groups ... +61.051%

Might be a bug or maybe I misunderstood? Currently using diet-forge-1.16.5-0.11 on 1.16.5 Forge 36.0.43. Let me know if I need to provide anything else.

commented

Before I get into it, one clarification: You would have to set up multiple effects to properly accumulate the values like you want them (basically how you set them up in the second scenario). This is because the "every" method will multiply the 0.1 first and then apply it, so it will always be additive if you put them all into a single effect.

How are you testing the damage values? Because doing this:

[[effects]]

	[[effects.attributes]]
		amount = 0.1
		name = "minecraft:generic.attack_damage"
		operation = "multiply_total"

	[[effects.conditions]]
		below = 1.0
		match = "all"
		above = 0.5
		groups = ["fruits"]

to all five food groups gives me the five +10% Attack Damage like you observed, but my total damage with a Diamond Sword is ~11.2, which is essentially +61.051%.

Then changing them to multiply_base, my damage comes down to 10.5, as expected. So I'm not sure why multiply_total is behaving differently for you unless you may have mistaken the damage somehow.

commented

Thanks for the clarification, that makes sense.

You're right. I was using Jade to measure the damage (in hearts) and unfortunately failed to notice how both 10.5 (5.25 hearts) and 11.2 (5.6 hears) display as 5.5 hearts (visually) on the overlay. Switched to a numerical overlay and I can confirm no issue. Lesson learnt, sorry for the silly mistake.