In my project, I've allowed the player to increase their stats as they level up. One of these stats is the Pharmacology stat. Some items, such as healing potions, become more potent with the users PHA.
This is what the formula looks like: a.pha/2 * 30
The scaling is meant to be a base of 30 HP recovered, adding in the users PHA stat, halved. Of course, PHA being a percentage, I must combine it using a multiplier, not an addition.
All well and good and it's very balanced for someone who went a PHA build. However, for the people who didn't invest in PHA, an unforeseen (but, in hindsight, pretty obvious) problem has arisen. You'll heal 15 HP, because if your base PHA is 100%, then it's cut in half, it becomes 50%, which of course halves the end-result.
So, my question is, is there any way to enforce a minimum? Like, if the user has less than 100% total PHA after calculation, set the PHA in the calculation to 100%.
In example, if Actor 1 has 140% PHA, but because it's cut in half for this particular formula, ends up having 70% PHA just for sake of this formula, their PHA is calculated as 100% after being cut in half instead, this way actors that aren't heavily invested in the PHA stat don't get so heavily punished.
A possibility is checking the users base PHA. For example, knowing it will be halved, it can be something like, if the users base PHA is less than 200% for the calculation, then disregard the PHA check in the formula entirely, because after that less-than-200% is halved, it would of course be less than 100%.
Just not sure how to go about implementing it. Any help is appreciated.
This is what the formula looks like: a.pha/2 * 30
The scaling is meant to be a base of 30 HP recovered, adding in the users PHA stat, halved. Of course, PHA being a percentage, I must combine it using a multiplier, not an addition.
All well and good and it's very balanced for someone who went a PHA build. However, for the people who didn't invest in PHA, an unforeseen (but, in hindsight, pretty obvious) problem has arisen. You'll heal 15 HP, because if your base PHA is 100%, then it's cut in half, it becomes 50%, which of course halves the end-result.
So, my question is, is there any way to enforce a minimum? Like, if the user has less than 100% total PHA after calculation, set the PHA in the calculation to 100%.
In example, if Actor 1 has 140% PHA, but because it's cut in half for this particular formula, ends up having 70% PHA just for sake of this formula, their PHA is calculated as 100% after being cut in half instead, this way actors that aren't heavily invested in the PHA stat don't get so heavily punished.
A possibility is checking the users base PHA. For example, knowing it will be halved, it can be something like, if the users base PHA is less than 200% for the calculation, then disregard the PHA check in the formula entirely, because after that less-than-200% is halved, it would of course be less than 100%.
Just not sure how to go about implementing it. Any help is appreciated.