[Bug Fix] Increase Precision in CheckDoubleAttack (#3928)

* [Bug Fix] Increase percision on CheckDoubleAttack.

On DA Checks where class was a non skill based DA Attacker (Bard or BST with granted DA) The DA check was too steep and should not have been dividing by 500 but rather 100. Also adjusted logic percision to use floats so loss of data does not occur.

* logging var names update

* Update attack.cpp

---------

Co-authored-by: Alex King <89047260+Kinglykrab@users.noreply.github.com>
This commit is contained in:
Fryguy 2024-01-08 23:34:41 -05:00 committed by GitHub
parent 0418dc4aa3
commit 66d9371714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3720,22 +3720,39 @@ bool Mob::HasRangedProcs() const
bool Client::CheckDoubleAttack()
{
int chance = 0;
int skill = GetSkill(EQ::skills::SkillDoubleAttack);
//Check for bonuses that give you a double attack chance regardless of skill (ie Bestial Frenzy/Harmonious Attack AA)
int bonusGiveDA = aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack;
if (skill > 0)
chance = skill + GetLevel();
else if (!bonusGiveDA)
uint32 bonus_give_double_attack = aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack;
if (!HasSkill(EQ::skills::SkillDoubleAttack) && !bonus_give_double_attack) {
return false;
}
if (bonusGiveDA)
chance += bonusGiveDA / 100.0f * 500; // convert to skill value
int per_inc = aabonuses.DoubleAttackChance + spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance;
if (per_inc)
chance += chance * per_inc / 100;
float chance = 0.0f;
uint16 skill = GetSkill(EQ::skills::SkillDoubleAttack);
return zone->random.Int(1, 500) <= chance;
int32 bonus_double_attack = 0;
if ((GetClass() == Class::Paladin || GetClass() == Class::ShadowKnight) && (!HasTwoHanderEquipped())) {
LogCombatDetail("Knight class without a 2 hand weapon equipped = No DA Bonus!");
} else {
bonus_double_attack = aabonuses.DoubleAttackChance + spellbonuses.DoubleAttackChance + itembonuses.DoubleAttackChance;
}
//Use skill calculations otherwise, if you only have AA applied GiveDoubleAttack chance then use that value as the base.
if (skill) {
chance = (float(skill + GetLevel()) * (float(100.0f + bonus_double_attack + bonus_give_double_attack) / 100.0f)) / 500.0f;
} else {
chance = (float(bonus_give_double_attack + bonus_double_attack) / 100.0f);
}
LogCombatDetail(
"skill [{}] bonus_give_double_attack [{}] bonus_double_attack [{}] chance [{}]",
skill,
bonus_give_double_attack,
bonus_double_attack,
chance
);
return zone->random.Roll(chance);
}
// Admittedly these parses were short, but this check worked for 3 toons across multiple levels