Merge pull request #307 from KayenEQ/Development

Projectile code fix.
This commit is contained in:
Akkadius 2014-12-03 11:53:53 -06:00
commit ff5eb54331

View File

@ -829,6 +829,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)){
@ -845,6 +846,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.
@ -866,7 +869,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){
@ -1383,6 +1386,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)){
@ -1392,6 +1396,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.
@ -1409,7 +1415,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);