Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __thiscall CNWSCreature__ResolveAttackRoll(int this, int a2)
- {
- int v2; // ebp@1
- int v3; // ebx@2
- int v4; // edi@2
- int v5; // esi@2
- void *v6; // eax@3
- _UNKNOWN *v7; // eax@3
- int v8; // edi@5
- int v9; // eax@5
- int v10; // eax@5
- int v11; // eax@9
- int v12; // ecx@12
- int v13; // edx@12
- int v14; // eax@18
- int v15; // eax@22
- int v16; // edi@23
- int v17; // edi@23
- int v18; // eax@23
- int v19; // edi@23
- int v20; // eax@32
- void *v21; // eax@42
- int v22; // ebx@43
- int v23; // eax@45
- int v24; // ST0C_4@45
- int v25; // eax@47
- int v26; // eax@49
- void *v27; // edi@49
- void *v28; // eax@49
- int v29; // ecx@49
- int v30; // [sp+10h] [bp-3Ch]@1
- int v31; // [sp+14h] [bp-38h]@5
- int v32; // [sp+18h] [bp-34h]@2
- int v33; // [sp+20h] [bp-2Ch]@2
- int v34; // [sp+24h] [bp-28h]@2
- int v35; // [sp+28h] [bp-24h]@9
- char v36; // [sp+30h] [bp-1Ch]@9
- char v37; // [sp+38h] [bp-14h]@9
- int v38; // [sp+48h] [bp-4h]@3
- v2 = this;
- v30 = 0;
- if ( !a2 )
- return;
- v4 = *(_DWORD *)(this + 2760);
- LOBYTE(v32) = *(_BYTE *)(v4 + 8468);
- v5 = CNWSCombatRound__GetAttack((void *)v4, (unsigned __int8)v32);
- v33 = *(_DWORD *)(v5 + 52);
- v34 = CNWSCombatRound__GetOffHandAttack(v4);
- v3 = (unsigned __int16)CNWRules__RollDice(1u, 20);
- if ( g_bEnableCombatDebugging )
- {
- v6 = CNWSCreatureStats__GetFullName(*(void **)(v2 + 3172), &v32);
- v38 = 0;
- v7 = CExoString__CStr(v6);
- CExoString__Format(v5 + 104, "%s Attack Roll: %d", v7, v3);
- v38 = -1;
- CExoString___CExoString((int)&v32);
- }
- if ( (*(int (__thiscall **)(int))(*(_DWORD *)a2 + 48))(a2) )
- {
- v9 = (*(int (__thiscall **)(int))(*(_DWORD *)a2 + 48))(a2);
- v32 = *(_DWORD *)(v2 + 3172);
- v8 = v9;
- v30 = v9;
- v10 = (*(int (**)(void))(*(_DWORD *)a2 + 48))();
- v31 = CNWSCreatureStats__GetAttackModifierVersus(v32, v10);
- if ( v8 )
- {
- v32 = (signed __int16)CNWSCreatureStats__GetArmorClassVersus(*(_DWORD *)(v8 + 3172), v2, 0);
- CNWSCreature__ResolveSneakAttack(v2, v8);
- CNWSCreature__ResolveDeathAttack(v2, v8);
- goto LABEL_10;
- }
- }
- else
- {
- v8 = 0;
- v31 = CNWSCreatureStats__GetAttackModifierVersus(*(_DWORD *)(v2 + 3172), 0);
- }
- v32 = 0;
- if ( g_bEnableCombatDebugging )
- {
- CExoString__CExoString(&v36, (const char **)(v5 + 104));
- v38 = 1;
- CNWSpellArray__CNWSpellArray(&v35);
- LOBYTE(v38) = 2;
- CExoString__Format((int)&v35, " Versus AC %d", 0);
- v11 = CExoString__operator_(&v36, (int)&v37, (const char **)&v35);
- LOBYTE(v38) = 3;
- CExoString__operator_(v5 + 104, (const char **)v11);
- LOBYTE(v38) = 2;
- CExoString___CExoString((int)&v37);
- LOBYTE(v38) = 1;
- CExoString___CExoString((int)&v35);
- v38 = -1;
- CExoString___CExoString((int)&v36);
- v8 = v30;
- }
- LABEL_10:
- if ( *(_DWORD *)(v5 + 68) == 1 )
- {
- *(_BYTE *)(v5 + 14) = 20;
- *(_DWORD *)(v5 + 16) = v31;
- *(_BYTE *)(v5 + 80) = 7;
- return;
- }
- v13 = v32;
- *(_DWORD *)(v5 + 16) = v31;
- v12 = 0;
- *(_BYTE *)(v5 + 14) = v3;
- if ( v3 + v31 >= v13 )
- v12 = 1;
- if ( CNWSCreature__ResolveDefensiveEffects(v2, a2, v12) != 1 )
- {
- if ( (*(int (**)(void))(*(_DWORD *)a2 + 48))() )
- {
- if ( v3 != 20 )
- {
- if ( *(_BYTE *)(v8 + 1195) == 1 )
- {
- v14 = *(_DWORD *)(v8 + 2760);
- if ( *(_BYTE *)(v14 + 8528) )
- {
- if ( !*(_DWORD *)(v14 + 8452) )
- {
- if ( *(_BYTE *)(v8 + 2525) != 6 )
- {
- if ( !v33 )
- {
- LOBYTE(v15) = CNWSCreature__GetRangeWeaponEquipped(v8);
- if ( !v15 )
- {
- v17 = *(_DWORD *)(v8 + 3172);
- v18 = (*(int (__thiscall **)(int))(*(_DWORD *)v2 + 16))(v2);
- v19 = CNWSCreatureStats__GetSkillRank(v17, 0xAu, v18, 0);
- v16 = (unsigned __int16)CNWRules__RollDice(1u, 20) + v19;
- if ( v16 >= v3 + v31 )
- {
- if ( v16 - 10 >= v3 + v31 )
- CNWSCombatRound__AddParryAttack(*(_DWORD *)(v30 + 2760), *(_DWORD *)(v2 + 4));
- *(_BYTE *)(v5 + 80) = 2;
- --*(_BYTE *)(*(_DWORD *)(v30 + 2760) + 8528);
- return;
- }
- CNWSCombatRound__AddParryIndex(*(_DWORD *)(v30 + 2760));
- --*(_BYTE *)(*(_DWORD *)(v30 + 2760) + 8528);
- v8 = v30;
- }
- }
- }
- }
- }
- }
- }
- }
- if ( v3 != 1 && (v31 + v3 >= v32 || v3 == 20) )
- {
- if ( v3 >= CNWSCreatureStats__GetCriticalHitRoll(*(void **)(v2 + 3172), v34) )
- {
- LOWORD(v20) = CNWRules__RollDice(1u, 20);
- *(_DWORD *)(v5 + 72) = 1;
- v20 = (unsigned __int16)v20;
- *(_BYTE *)(v5 + 15) = v20;
- if ( v31 + v20 >= v32 )
- {
- if ( !v8 )
- goto LABEL_61;
- if ( CServerExoApp__GetDifficultyOption(*(_DWORD *)(g_pAppManager + 4), 0) == 1
- && (*(_DWORD *)(v8 + 2776) || CNWSCreature__GetIsPossessedFamiliar(v8))
- && !*(_DWORD *)(v2 + 2776)
- && !CNWSCreature__GetIsPossessedFamiliar(v2) )
- {
- *(_BYTE *)(v5 + 80) = 1;
- return;
- }
- if ( !CNWSCreatureStats__GetEffectImmunity(
- *(_DWORD *)(v8 + 3172),
- CNWSEffectListHandler__IMMUNITY_TYPE_CRITICAL_HITS,
- v2)
- && CNWSCreatureStats__HasFeat(*(_DWORD *)(v8 + 3172), 896) != 1 )
- {
- LABEL_61:
- *(_BYTE *)(v5 + 80) = 3;
- return;
- }
- v21 = operator new(0x34u);
- v38 = 4;
- if ( v21 )
- v22 = CNWCCMessageData__CNWCCMessageData(v21);
- else
- v22 = 0;
- v24 = *(_DWORD *)(v8 + 4);
- v38 = -1;
- CNWCCMessageData__SetObjectID(v22, 0, v24);
- CScriptEvent__SetInteger(v22, 0, 126);
- v23 = *(_DWORD *)(v5 + 164);
- if ( *(_DWORD *)(v5 + 160) == v23 )
- {
- if ( v23 )
- v25 = 2 * v23;
- else
- v25 = 16;
- v27 = *(void **)(v5 + 156);
- *(_DWORD *)(v5 + 164) = v25;
- v28 = operator new(4 * v25);
- v29 = *(_DWORD *)(v5 + 160);
- *(_DWORD *)(v5 + 156) = v28;
- v26 = 0;
- if ( v29 > 0 )
- {
- do
- {
- *(_DWORD *)(*(_DWORD *)(v5 + 156) + 4 * v26) = *((_DWORD *)v27 + v26);
- ++v26;
- }
- while ( v26 < *(_DWORD *)(v5 + 160) );
- }
- if ( v27 )
- operator delete(v27);
- }
- *(_DWORD *)(*(_DWORD *)(v5 + 156) + 4 * *(_DWORD *)(v5 + 160)++) = v22;
- }
- }
- *(_BYTE *)(v5 + 80) = 1;
- return;
- }
- *(_BYTE *)(v5 + 80) = 4;
- if ( v3 == 1 )
- *(_BYTE *)(v5 + 20) = 1;
- else
- *(_BYTE *)(v5 + 20) = abs(v3 + v31 - v32);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement