Construct's Armory

Construct's Armory

30M Downloads

Tasty seems somewhat erratic

mschwarz1 opened this issue ยท 0 comments

commented

This is probably as designed but it threw me off. I was trying to figure out exactly how tasty works after testing out some armor combinations and that led me to testing out the code for the tasty trait because I didn't understand what you were having it do.

Assuming the player isn't at max health, there is no saturation, and I copied the code correctly here are the chances of eating at each food level,

Food level: 0, chance: 0.0225000003799796
Food level: 1, chance: 0.0200000003799796
Food level: 2, chance: 0.0175000003799796
Food level: 3, chance: 0.0150000003799796
Food level: 4, chance: 0.0125000003799796
Food level: 5, chance: 0.0100000003799796
Food level: 6, chance: 0.00750000037997961
Food level: 7, chance: 0.00500000037997961
Food level: 8, chance: 0.00250000037997961
Food level: 9, chance: 3.79979610276582E-10
Food level: 10, chance: 0.0100000003799796
Food level: 11, chance: 0.0100000003799796
Food level: 12, chance: 0.0100000003799796
Food level: 13, chance: 0.0100000003799796
Food level: 14, chance: 0.0100000003799796
Food level: 15, chance: 0.0100000003799796
Food level: 16, chance: 0.0100000003799796
Food level: 17, chance: 0.0100000003799796
Food level: 18, chance: 0.0100000003799796
Food level: 19, chance: 0.0100000003799796
Food level: 20, chance: 0.0100000003799796

It seems strange to me that there is less of a chance to eat at food level 6-9 then there is at 10.

It's due to it being a potentially negative number in the
chance += (5 - foodStats.getFoodLevel()) * 0.0025f;
line.
It would work out to be cleaner if you swapped the 5 for a 10.

Anyways I thought it was strange behavior so I wanted to point it out. Apologies if that's the intended behavior.