If literally everything is going to be percentages, assuming that a maximum amount of something is
100%, then you could say that just changing every creature's max. mana and HP to 100, and making costs and damages of all mechanics use
(between 1 and 100) resource would be a very easy way to go about it. I don't know what you need this for, but making pretty much everything in percentages is very limiting.
In this example, if a creature has 100% health (100 health) and you deal 5 damage to it, you dealt 5% damage.
If some spell costs 20 mana, that's 20% cost, etc.
But this pretty much limits you to work with values between 1-100 all the time.
Either way, to put out some information related to percentages, here are some ways percentage based calculations and costs can already be done in XML in Lua:
Rune and spell costs can already be defined in percentages in spells.xml, like:
which would make this cost 50% mana to use.
In spell formulas, you can use:
Code:
local percent = 65
local damage = (getCreatureMaxHealth(target) * (percent*0.01))
local min = damage
local max = damage
return -min, -max
And now the damage of this is going to be 65% of the target's max health.
For weapon damage you would do the same trick in weapons.xml scripts, if you wanna use scripted weapons, otherwise you would have to go to
weapons.cpp and change
how damage of weapons is interpreted from "1" point being "1" damage to "1" point being "1% of current target's max health".
For monsters, to avoid editing sources, you'd make a new spell called "MonsterMelee" for example, and make that spell use a formula such as the one I wrote above, and make your monsters use this spell for doing damage instead of their regular "melee" or whatever they're using.
Anyway, without being more specific about what your intentions with this percentage stuff are, it's hard to know whether the things I suggested are the most optimal ways of doing it, but that should give you an idea.