From 70dd4471563abe283ac8ede9362a20cf1ca59704 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Tue, 2 Dec 2014 03:42:35 -0500 Subject: [PATCH] Fix for error introduced in projectile update for throwing/archery to do hit chance check 2x resulting in much greater chance to miss. --- zone/special_attacks.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index cf6a83c80..8b6f11d96 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -828,6 +828,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite this function is then run again to do the damage portion */ bool LaunchProjectile = false; + bool ProjectileImpact = false; bool ProjectileMiss = false; if (RuleB(Combat, ProjectileDmgOnImpact)){ @@ -844,6 +845,8 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite if (!RangeWeapon && !Ammo && range_id && ammo_id){ + ProjectileImpact = true; + if (weapon_damage == 0) ProjectileMiss = true; //This indicates that MISS was originally calculated. @@ -865,7 +868,7 @@ void Mob::DoArcheryAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else if (AmmoItem) SendItemAnimation(other, AmmoItem, SkillArchery); - if (ProjectileMiss || !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod)) { + if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillArchery, MainPrimary, chance_mod))) { mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ @@ -1382,6 +1385,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite this function is then run again to do the damage portion */ bool LaunchProjectile = false; + bool ProjectileImpact = false; bool ProjectileMiss = false; if (RuleB(Combat, ProjectileDmgOnImpact)){ @@ -1391,6 +1395,8 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else{ if (!RangeWeapon && range_id){ + ProjectileImpact = true; + if (weapon_damage == 0) ProjectileMiss = true; //This indicates that MISS was originally calculated. @@ -1408,7 +1414,7 @@ void Mob::DoThrowingAttackDmg(Mob* other, const ItemInst* RangeWeapon, const Ite else if (AmmoItem) SendItemAnimation(other, AmmoItem, SkillThrowing); - if (ProjectileMiss || !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod)){ + if (ProjectileMiss || (!ProjectileImpact && !other->CheckHitChance(this, SkillThrowing, MainPrimary, chance_mod))){ mlog(COMBAT__RANGED, "Ranged attack missed %s.", other->GetName()); if (LaunchProjectile){ TryProjectileAttack(other, AmmoItem, SkillThrowing, 0, RangeWeapon, nullptr, AmmoSlot, speed);