-
Автор темы
- #1
scale damage:
unsigned int __usercall Autowall::ScaleDamage@<eax>(int a1@<edx>, int a2@<ecx>, int a3, float *cur_dmg, char a5)
{
float v7; // xmm0_4
float damage; // xmm0_4
unsigned int result; // eax
float v10; // xmm3_4
float v11; // xmm4_4
float v12; // xmm1_4
float v13; // xmm3_4
float v14; // xmm2_4
float v15; // xmm4_4
float v16; // xmm2_4
if ( a5 )
{
if ( (a1 - 6) < 2 )
{
damage = *cur_dmg * 0.75;
}
else if ( a1 == 3 )
{
damage = *cur_dmg * 1.25;
}
else
{
if ( a1 != 1 )
goto LABEL_13;
if ( *(*__readfsdword(0x2Cu) + 4) < 0 )
sub_3DBD770(&dword_40A866C);
v7 = *cur_dmg;
if ( *((__readfsdword(0x20u) ^ 0x687B643D) + a2) )
damage = v7 + v7;
else
damage = v7 * 4.0;
}
*cur_dmg = damage;
}
LABEL_13:
if ( *(*__readfsdword(0x2Cu) + 4) < 0 )
sub_3DBD770(&dword_409DC98);
result = __readfsdword(0x20u) ^ 0xC9975657;
if ( *(result + a2) > 0 )
{
result = a1 - 2;
if ( (a1 - 2) < 4 || !a1 )
goto LABEL_17;
if ( a1 == 1 )
{
if ( *(*__readfsdword(0x2Cu) + 4) < 0 )
sub_3DBD770(&dword_409FD7C);
result = __readfsdword(0x20u) ^ 0xB977C600;
if ( *(result + a2) )
{
LABEL_17:
v10 = *(a3 + 248);
if ( *(*__readfsdword(0x2Cu) + 4) < 0 )
sub_3DBD770(&dword_40A866C);
if ( *((__readfsdword(0x20u) ^ 0x687B643D) + a2) )
{
v10 = *(a3 + 248) * 0.5;
v11 = 0.33000001;
v12 = 0.33000001;
}
else
{
v12 = 0.5;
v11 = 1.0;
}
v13 = v10 * 0.5;
v14 = *cur_dmg * v13;
if ( *(*__readfsdword(0x2Cu) + 4) < 0 )
sub_3DBD770(&dword_40A866C);
if ( *((__readfsdword(0x20u) ^ 0x687B643D) + a2) )
v14 = v14 * 0.85000002;
v15 = (v11 * v12) * (*cur_dmg - (v13 * *cur_dmg));
if ( *(*__readfsdword(0x2Cu) + 4) < 0 )
sub_3DBD770(&dword_409DC98);
result = __readfsdword(0x20u) ^ 0xC9975657;
if ( v15 > *(result + a2) )
{
v16 = *cur_dmg;
if ( *(*__readfsdword(0x2Cu) + 4) < 0 )
sub_3DBD770(&dword_409DC98);
result = __readfsdword(0x20u) ^ 0xC9975657;
v14 = v16 - (*(result + a2) / v12);
}
*cur_dmg = v14;
}
}
}
return result;
}
scale damage:
void c_autowall::scale_damage(const int hitgroup, const c_game_trace* trace, float& damage) const
{
const auto player = static_cast<c_base_player*>(trace->m_hit_entity);
if (!player || !player->is_alive() || !player->is_enemy())
return;
if (g_sdk.m_local_data->m_weapon->get_idx() != idx_t::weapon_taser)
{
if ((hitgroup - 6) < 2)
damage *= 0.75f;
else if (hitgroup == 3)
damage *= 1.25f;
else
{
if (hitgroup != 1)
return;
if (player->has_heavy_armor())
damage *= 2.0f; /* damage = damage + damage */
else
damage *= 4.0;
}
}
if (player->get_armor_value() > 0)
{
if ((hitgroup - 2) < 4 || !hitgroup)
return;
if (hitgroup == 1)
{
if (player->has_helmet())
{
float ratio = g_sdk.m_local_data->m_weapon_data->m_armor_ratio;
float heavy_ratio{};
float bonus_ratio{};
if (player->has_heavy_armor())
{
ratio = g_sdk.m_local_data->m_weapon_data->m_armor_ratio * 0.5f;
heavy_ratio = 0.33f;
bonus_ratio = 0.33f;
}
else
{
bonus_ratio = 0.5f;
heavy_ratio = 1.0f;
}
const float final_ratio = ratio * 0.5f;
float new_damage = damage * final_ratio;
if (player->has_heavy_armor())
new_damage = new_damage * 0.85f;
const float calc = (heavy_ratio * bonus_ratio) * damage - (final_ratio * damage);
if (calc > player->get_armor_value())
new_damage = damage - player->get_armor_value() / bonus_ratio;
damage = new_damage;
}
}
}
}
Не совсем правильная реализация.
Рекомендую к использованию:
Пожалуйста, авторизуйтесь для просмотра ссылки.