Help with if then code
I'm working on a RPG character sheet..
I'm trying to calculate a characters total armor class..
I have all the fields set up and labeled..
The total AC bonus = 10 + DEX mod+ proficiency bonus +item bonus..
I have a field that already calculates and generates the "DEX Modifier" field.
The problem is, if you wear a suit of armor it allows you to add your Dex modifier to the ac total
BUT only upto the armors max..
Let's say you wear leather, it allows you to use only +4 max bonus.
So if I have a Dex mod of say +5 it needs to only add the +4 ..
My fields in question is "Dex modifier",
"Ac Dex modifier", " ac Dex modifier max"
I've tried
var A = this.getField("DEX Modifier").value;
var B = this.getField("ac Dex mod max").value;
If (A>B) {event.value = B}
So if ac Dex mod = Dex mod,
But if the Dex mod is greater than the ac Dex mod max, the Dex mod @= ac Dex mod max
Any help is greatly appriciated
