mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Fix potential crashes in attack.cpp
This commit is contained in:
parent
7a4c9b36a8
commit
00cfe2d25f
@ -3261,7 +3261,7 @@ void Mob::CommonDamage(Mob* attacker, int32 &damage, const uint16 spell_id, cons
|
||||
a->damage = damage;
|
||||
a->spellid = spell_id;
|
||||
a->special = special;
|
||||
a->meleepush_xy = attacker->GetHeading() * 2.0f;
|
||||
a->meleepush_xy = attacker ? attacker->GetHeading() * 2.0f : 0.0f;
|
||||
if (RuleB(Combat, MeleePush) && damage > 0 && !IsRooted() &&
|
||||
(IsClient() || zone->random.Roll(RuleI(Combat, MeleePushChance)))) {
|
||||
a->force = EQEmu::skills::GetSkillMeleePushForce(skill_used);
|
||||
@ -3798,7 +3798,7 @@ void Mob::TryPetCriticalHit(Mob *defender, uint16 skill, int32 &damage)
|
||||
|
||||
void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttackOptions *opts)
|
||||
{
|
||||
if(damage < 1)
|
||||
if(damage < 1 || !defender)
|
||||
return;
|
||||
|
||||
// decided to branch this into it's own function since it's going to be duplicating a lot of the
|
||||
@ -3819,8 +3819,8 @@ void Mob::TryCriticalHit(Mob *defender, uint16 skill, int32 &damage, ExtraAttack
|
||||
bool IsBerskerSPA = false;
|
||||
|
||||
//1: Try Slay Undead
|
||||
if (defender && (defender->GetBodyType() == BT_Undead ||
|
||||
defender->GetBodyType() == BT_SummonedUndead || defender->GetBodyType() == BT_Vampire)) {
|
||||
if (defender->GetBodyType() == BT_Undead ||
|
||||
defender->GetBodyType() == BT_SummonedUndead || defender->GetBodyType() == BT_Vampire) {
|
||||
int32 SlayRateBonus = aabonuses.SlayUndead[0] + itembonuses.SlayUndead[0] + spellbonuses.SlayUndead[0];
|
||||
if (SlayRateBonus) {
|
||||
float slayChance = static_cast<float>(SlayRateBonus) / 10000.0f;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user