Welp,
here is what I've got thus far.
Some notes on the mechanics:
- Most bonuses are additive. That includes ATK?%, DEF?%, Enemy+% and Enemy*3 (which function as +300% except for the first one, which is +200%) geo effects, as well as combo bonus and staff mastery bonus for spells. For example, for an enemy standing on an "ATK+50% | Enemy boost x6" panel with staff level 5, the spell power bonus factor is 1 + 0.5 + 5 + 0.03*5. Such bonuses are capped at -1 and 20, which allows the factor to span the range from 0 to 21.
- Combo bonus is +0.1 to attack and -0.1 to defense when performed by allies; and +0.15/-0.15 when performed by enemies.
- Special mastery factor is applied separately. Its value is determined from a table (which is also given in the link above) and it spans the range from 0.9 to 4. Therefore, theoretical maximum for the combined factor is 21*4=82.
- Disregarding multipliers, the average damage dealt by most weapons is ATK*0.5 - DEF*0.26; for guns it's HIT*0.37 - DEF*0.19; for bows it's (ATK+HIT)*0.25 - DEF*0.26. Magical attacks on average deal INT*0.33 - RES*0.18. "Attack" bonuses are applied to the left side of subtraction, "defense" ones - to the right side. Yes, ATK?% and DEF?% affect magical attacks the same way as physical.
- Some units are inherently "magic-resistant". When one is a target of a magical attack, the left-hand side receives an additional factor of 0.5. According to my observation, they usually have double RES and half DEF compared to otherwise identical "non-magic-resistant" units, though the stats and the resistivity are separate characteristics and may not always be related.
- Units may be inherently "damage-resistant". When one is a target of any attack, the resulting damage is halved. Though these are possible, I have never noticed the game actually spawning one.
- Each action has an additional "power" factor, which is applied to the resulting healing/damage. For example, different "Heal" spells have powers of 0.25, 1, 3 and 10.
- Elemental resistance is applied as yet another factor, clamped between 0.1 and 2.
- Under certain conditions determined by the unit, which I don't know exactly, the damage may be nullified. I haven't noticed such behavior in the actual game either.
...Maybe I should write a Steam guide. For instance, the fact that magic-resistant units exist seems kind of obscure, judging by questions like "why after 3*3 alpha uber star some sentinels stand with 2/3 their hp while others are dead immediately??? herp derp" and answers like "dunno i think it's because their res is abnormally high!!! hurr durr".