The armor calc equation appears to be this, for what it's worth:
Code:
v3 = sub_506D90(a1, 1); //get overall protection, still dunno head/body mechanics
v4 = sub_506BF0(a1); //get natural protection
v5 = (signed int)((unsigned __int64)(1717986919i64 * ((40 - v3) * v4 + 20)) >> 32) >> 4;
v6 = (signed int)((unsigned __int64)(1717986919i64 * ((40 - v3) * v4 + 20)) >> 32) >> 4;
result = 40;
v2 = ((unsigned int)v6 >> 31) + v5 + v3;
if ( v2 < 40 )
result = v2;
return result;
I guess there's a couple other possibilities, here they are:
Code:
v3 = 2 * sub_506D90(a1, 2); //this and the following 2 lines appear to be calc for head/body/extra prot from bracerish stuff?
v4 = sub_506D90(a1, 3) + v3;
v5 = (v4 + sub_506D90(a1, 4)) / 4;
v6 = sub_506BF0(a1); //get natural prot again
v7 = (signed int)((unsigned __int64)(1717986919i64 * ((40 - v5) * v6 + 20)) >> 32) >> 4;
v8 = (signed int)((unsigned __int64)(1717986919i64 * ((40 - v5) * v6 + 20)) >> 32) >> 4;
result = 40;
v2 = ((unsigned int)v8 >> 31) + v7 + v5;
if ( v2 < 40 )
result = v2;
return result;
and this one, but it appears to mostly be dealing with a faulty unit index?
Code:
v1 = 0;
v8 = 0;
if ( a1 < 0 )
{
result = 0;
}
else
{
sub_49DFA0(a1 >= 140000, "getprot: bad unr");
sub_4478E0(a1);
v2 = 1;
do
{
if ( v2 != 1
|| (v3 = word_1189550[46 * a1], v3 >= 0)
&& !(dword_536228[50 * v3] & 0x10000000)
&& ((v4 = sub_4DFF00(a1, 182, 0), !v4) || BYTE1(v4) & 1 || v4 & 0x80 && !(dword_1189540[23 * a1] & 0x80000000)) )
{
v5 = sub_506D90(a1, v2);
if ( v2 == 2 )
{
v1 += 2 * v5;
v8 += v2;
}
else
{
v1 += v5;
++v8;
}
}
++v2;
}
while ( v2 <= 4 );
v6 = ((40 - v1 / v8) * sub_506BF0(a1) + 20) / 40 + v1 / v8;
if ( v6 < 40 )
result = v6;
else
result = 40;
}
return result;
This isn't against the rules or anything, is it?