-
Автор темы
- #1
Хорошо выбивает дамаг.
C++:
void autowall::scale_damage(player_t* e, CGameTrace& enterTrace, weapon_info_t* weaponData, float& currentDamage)
{
if (!e)
return;
int hitgroup = enterTrace.hitgroup;
auto new_damage = currentDamage;
const auto is_zeus = g_ctx.globals.weapon->m_iItemDefinitionIndex() == WEAPON_TASER;
static auto is_armored = [](player_t* player, int armor, int hitgroup) {
if (player && player->m_ArmorValue() > 0)
{
if (player->m_bHasHelmet() && hitgroup == HITGROUP_HEAD || (hitgroup >= HITGROUP_CHEST && hitgroup <= HITGROUP_RIGHTARM))
return true;
}
return false;
};
if (!is_zeus) {
switch (hitgroup)
{
case HITGROUP_HEAD:
new_damage *= 4.f;
break;
case HITGROUP_STOMACH:
new_damage *= 1.25f;
break;
case HITGROUP_LEFTLEG:
case HITGROUP_RIGHTLEG:
new_damage *= .75f;
break;
}
}
else
new_damage *= 0.92f;
if (!weaponData)
return;
if (is_armored(e, e->m_ArmorValue(), hitgroup))
{
float flHeavyRatio = 1.0f;
float flBonusRatio = 0.5f;
float flRatio = weaponData->flArmorRatio * 0.5f;
float flNewDamage;
if (!e->m_bHasHeavyArmor())
{
flNewDamage = new_damage * flRatio;
}
else
{
flBonusRatio = 0.33f;
flRatio = weaponData->flArmorRatio * 0.5f;
flHeavyRatio = 0.33f;
flNewDamage = (new_damage * (flRatio * 0.5)) * 0.85f;
}
int iArmor = e->m_ArmorValue();
if (((new_damage - flNewDamage) * (flBonusRatio * flHeavyRatio)) > iArmor)
flNewDamage = new_damage - (iArmor / flBonusRatio);
new_damage = flNewDamage;
}
currentDamage = new_damage;
}