Twine Version: 2.1.1
So, in the fiction cum RPG thing I’m working on, the main character can transform themselves to gain the properties of various animals. The strength of an ox, the claws of a tiger, stuff like that. All the forms are stored, effectively, as a variable value to show how much of that transformation you have, and an array, and whenever you transform it gives you all the properties below value in the array (So, like, “Ox” could have “Strength + 5”, “Endurance + 5”, “Agility -5” etc. etc. at various points in the array, and if you had $OxForm 30.0 it’d give you the adjustments from the array from 1-30), mostly taking the place of like, gaining XP and leveling up, instead modifying your character by finding rituals to favor one animal aspect of another.
However, to avoid both the general tomfoolery of being 75% Wolf, 30% Elephant, 50% Ox and “Wait a minute, that’s a lot more than 100% isn’t it?” and also to avoid just, immense stat stacking, the general idea is all your various forms need to add up to 100. And if I was not as I am, this would not be a problem, per se, as I could simply go “Oh, you want to add X amount? Well, divide that by the number of other forms you have and remove that from each of them” (there’s need to be a couple checks to make sure it wasn’t sending things negative, but it wouldn’t be that hard), but in my brain it’d make the most sense that all your other forms are reduced proportionally to how much you currently have them.
For example: If you were 40.0 Ox, 40.0 Wolf and 20.0 Fish (a farcical arrangement, Fish isn’t even a real form) and you wanted to gain 30% more Ox, the easy way would have it end up: 70/25/5, but I’m trying to instead have it go 70/20/10.
The inputs to every transformation change are going to be: An increase amount, and what’s increasing. Given those inputs, is there a clean way to proportionally reduce the rest? The $(Whatever)Form values are not currently in any data structure, but they easily can be.