A、2-1:如果(防御力x地形因素/10+1)/2>攻击方攻击力x攻击方所在地形因素/10
那么伤害A=1;
A、2-2:如果(防御力x地形因素/10+1)/2<=攻击方攻击力x攻击方所在地形因素/10
那么伤害A=攻击力x地形因素/10-防御力x地形因素/10/2
又发现算法的一个问题:
当(防御力x地形因素/10+1)/2 与 攻击方攻击力x攻击方所在地形因素/10 恰好相等时,伤害=攻击力x地形因素/10-防御力x地形因素/10/2,等于0
本来这步应该是为了保证伤害至少为1,结果……
0042A5B7 . C1E8 01 SHR EAX,1 ; (防御力x地形因素/10+1)/2
0042A5BA . 3B45 FC CMP EAX,DWORD PTR SS:[EBP-4]
0042A5BD . 0F82 0C000000 JB EKD2Win.0042A5CF
0042A5C3 . C745 F0 01000>MOV DWORD PTR SS:[EBP-10],1 ;(防御力x地形因素/10+1)/2大于攻击方攻击力x攻击方所在地形因素/10,只受1点伤害
0042A5CA . E9 0E000000 JMP EKD2Win.0042A5DD
0042A5CF > 8B45 FC MOV EAX,DWORD PTR SS:[EBP-4]
0042A5D2 . 8B4D E0 MOV ECX,DWORD PTR SS:[EBP-20]
0042A5D5 . C1E9 01 SHR ECX,1
0042A5D8 . 2BC1 SUB EAX,ECX ;
0042A5DA . 8945 F0 MOV DWORD PTR SS:[EBP-10],EAX ; 小于的话,伤害为:攻击力x地形因素/10-防御力x地形因素/10/2
0042A5DD > 8B4D E4 MOV ECX,DWORD PTR SS:[EBP-1C]
原来你把JB看成JBE了……
---------------------------------------------------------------------------------------
另外还有一个需要确认一下,就是间接攻击(反击、炮车虎兵等的非第一人攻击)对0x22号兵种(就是藤甲兵)的伤害是否永远为0,无论攻击力多少。
关于这个,我仔细看了一下IDA:
signed int __thiscall sub_4238AF(int this, unsigned int a2)
{
signed int result; // eax@26
unsigned int v3; // ebx@6
int v4; // eax@10
int v5; // eax@12
unsigned __int8 v6; // al@14
unsigned int v7; // ebx@14
unsigned __int8 v8; // al@14
unsigned __int8 v9; // al@16
unsigned __int8 v10; // al@17
unsigned int v11; // eax@17
int v12; // [sp+Ch] [bp-14h]@1
char *v13; // [sp+14h] [bp-Ch]@1
int v14; // [sp+18h] [bp-8h]@1
signed int v15; // [sp+1Ch] [bp-4h]@1
signed int v16; // [sp+10h] [bp-10h]@1
v12 = this;
v13 = (char *)&dword_4556E8 + 54 * sub_409130();
v14 = (int)((char *)&dword_4556E8 + 54 * sub_409130());
v15 = 0;
v16 = 0;
switch ( *(_BYTE *)(v12 + 18) )
{
case 1:
v15 = sub_42A4AD(*(_DWORD *)(v12 + 4 * *(_BYTE *)(v12 + 16)), v14, 1);
if ( a2 >= 1 || *(_BYTE *)(v12 + 19) == 1 )
v15 /= 2;
sub_423769(v12);
if ( v15 > 0 )
{
v3 = (unsigned __int8)sub_42A396(*(_DWORD *)(v12 + 4 * *(_BYTE *)(v12 + 16)));
if ( v3 > sub_447328(100) )
{
v15 = 3 * v15 / 2;
v16 = 1;
}
}
break;
case 2:
v4 = v12;
LOBYTE(v4) = *(_BYTE *)(v12 + 19);
v15 = sub_4087E1(v14, v4);
break;
case 3:
v5 = v12;
LOBYTE(v5) = *(_BYTE *)(v12 + 19);
v15 = sub_408907(v14, v5);
break;
}
if ( v15 > 0 )
{
v6 = sub_409280();
v7 = sub_447328(v6);
v8 = sub_409280();
if ( v7 >= sub_447328(v8) && v16 != 1 )
{
v10 = sub_409280();
v11 = sub_447328(v10);
v15 = sub_4472CB(v15, v11 % 6);
}
else
{
v9 = sub_409280();
v15 += sub_447328(v9) % 6u;
}
}
if ( sub_409220() == 1 )
{
if ( !sub_40BAB0() )
v15 = 8 * v15 / 10;
if ( sub_40BAB0() == 2 )
v15 = 12 * v15 / 10;
}
if ( v16 == 1 )
{
if ( v15 > 0 )
{
sub_409580();
sub_438F35(0, (char)(char *)dword_45181C);
}
}
result = *(_DWORD *)(v12 + 4 * *(_BYTE *)(v12 + 17) + 26);
if ( result >= v15 )
result = v15;
*(_DWORD *)(v12 + 42) = result;
return result;
}
就是说,要等反击除以2算完之后才判断是否为零,若等于零则不再算下面的。
[ 本帖最后由 阿尔法孝直 于 2010-7-29 23:51 编辑 ]