- Joined
- Mar 19, 2017
- Messages
- 248
I also pointed out that behaviour. If you use BonusMod (doubt if there is a GUI system), then together with set armor you have full access to bonus and modified armor (base armor is GetArmor(returns full) minus mods).I have found an inconvenience with the Set Armor function:It takes into account any bonus armor (green +armor) from abilities like devotion aura and items like ring of protection. So if you have a unit with a +100 devotion aura, and set its armor to 0, the unit's base armor will become -100. Obviously this makes the function dangerous to use, as if the unit loses this devotion aura, it will now have -100 armor and the armor calculation will need to be run again (needless to say how inconvenient it is to detect when an armor-giving ability/item is added/removed from a unit).
Unit - Set Armor of (Picked unit) to 0.00
The function should be changed to (or added) Set Base Armor so that it's easier to set the armor of a unit to an intended value even when there are buffs/items involved. I believe i am right in saying that a huge amount of WC3 custom maps contain abilities that temporarily modify armor which in my opinion makes it more apparent at how limited the current Set Armor function is.
Another reason why this quirk irritates me is that the function Set Base Damage is something you could run with Set Armor to endlessly scale the combat stats of units in custom maps. Set Base Damage works perfectly as it ignores green +damage, meaning you can dynamically scale the damage of units all game long without abilities and items skewing calculations, but you can't do the same with armor, because as soon as a unit has a +armor buff or item then you effectively should not run the function on them (or write a massive long calculation to take temporary bonuses into account)
The same can be said for Set Max HP and Set Max Mana; it would be nice to also have Set Base Max HP and Set Base Max Mana. But we already have ways of efficiently adding base HP and base mana to units already (unlike Armour) so they're definitely less important.
If you use GetArmor inside SetArmor (SetArmor(unit, GetArmor + X)) it behaves "properly" (will modify base armor).