derfloh205 / CraftSim

MIT License
14 stars 37 forks source link

Concentration profit per point values are wrong when negative numbers are involved #591

Closed razko closed 5 days ago

razko commented 5 days ago

It seems like the way craftsim calcs concentration value is wrong when there are negative profit values.

Here's an example: https://i.imgur.com/0apycWr.png Nothing special going on here yet. This is an unspecced Scribe looking at Boundless Cipher (R2 mats, simming +151 skill as that's exactly what's needed to reach R2 guarantee and unlock R3 with concentration). The important thing to take note of here are two things: the profit (-345.0380g) and the Concentration per point value (2.8538g).

Here's what happens if I now click the Concentration button: https://i.imgur.com/s4XsPkQ.png You might look at this and think "this look ok", but if we actually do the math, going from -345.0380g to 938.9155g means we gained 1283.9535g, while using 329 concentration, which means every concentration was worth 3.9025g and not 2.8538g.

The interesting thing is that, if we instead assume that we started at 0 gold profit and only look at the +938.9155g part, dividing it by 329 does result in the projected 2.8538g exactly. So, craftsim simply ignored the -profit it had to begin with when making this calc!

Now here's another case that looks bugged to me with negative values: https://i.imgur.com/v46enVF.png

Craftsim here saying that concentration is worth -2.0134g here... even though R2 Codified Greenwood is clearly worth more than R1 Codified Greenwood. Every case where the profit is negative both before and after concentration has this bug. This is probably related to the bug above, too.

derfloh205 commented 5 days ago

Hi, the way you describe it that it should work was how it previously worked However a user made note that this is actually not how we should look at it

In the end only the profit should be considered

cause if you would go from -500g to -200g for 300 concentration that means u essentially use 300 concentration and then you lose 200 gold

if you have another recipe where you got from -5000g to -200g for 300 concentration .. if you sell the resulting item(s) you used 300 concentration and lose 200 gold

so the profit of the non concentration quality or the crafting cost actually does not influence the profit per concentration point at all

razko commented 5 days ago

Ah yeah, thinking about it in a "you used x concentration and gained (or lost) y gold" way does make sense and the negative numbers line up correctly as well then

I guess I'll close this. Thanks!