mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 13:30:06 +00:00
Added Nullptr check + Made mob abilities less frequent
This commit is contained in:
parent
b836952356
commit
963205fad6
@ -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) {
|
||||||
useAbilities(mob, currTime);
|
if (mob->nextAttack != 0 || rand()%4 == 0)
|
||||||
|
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user