Added Nullptr check + Made mob abilities less frequent

This commit is contained in:
Jade 2020-11-28 03:09:25 +00:00 committed by Gent S
parent b836952356
commit 963205fad6

View File

@ -556,8 +556,12 @@ void MobManager::combatStep(Mob *mob, time_t currTime) {
int distance = hypot(plr->x - mob->appearanceData.iX, plr->y - mob->appearanceData.iY); int distance = hypot(plr->x - mob->appearanceData.iX, plr->y - mob->appearanceData.iY);
int mobRange = (int)mob->data["m_iAtkRange"] + (int)mob->data["m_iRadius"]; int mobRange = (int)mob->data["m_iAtkRange"] + (int)mob->data["m_iRadius"];
if (currTime >= mob->nextAttack) if (currTime >= mob->nextAttack) {
if (mob->nextAttack != 0 || rand()%4 == 0)
useAbilities(mob, currTime); useAbilities(mob, currTime);
if (mob->target == nullptr)
return;
}
/* /*
* If the mob is close enough to attack, do so. If not, get closer. * If the mob is close enough to attack, do so. If not, get closer.
* No, I'm not 100% sure this is how it's supposed to work. * No, I'm not 100% sure this is how it's supposed to work.