[Spells] Updates and fixes to Target Locked Pets (#1932)

* start of rework

* reworked v2 no timer

* fix

* more mechanics

* Update pets.cpp

* move to pet.cpp

* [Spells] Updates and fixes to Target Locked Pets

* [Spells] Updates and fixes to Target Locked Pets
This commit is contained in:
KayenEQ
2022-01-18 21:48:36 -05:00
committed by GitHub
parent 176bfc8524
commit 71c53cb18b
6 changed files with 71 additions and 42 deletions
+6 -28
View File
@@ -509,12 +509,8 @@ void NPC::SetTarget(Mob* mob) {
if(mob == GetTarget()) //dont bother if they are allready our target
return;
//This is not the default behavior for swarm pets, must be specified from quest functions or rules value.
if(GetSwarmInfo() && GetSwarmInfo()->target && GetTarget() && (GetTarget()->GetHP() > 0)) {
Mob *targ = entity_list.GetMob(GetSwarmInfo()->target);
if(targ != mob){
return;
}
if (GetPetTargetLockID()) {
TryDepopTargetLockedPets(mob);
}
if (mob) {
@@ -847,6 +843,10 @@ bool NPC::Process()
SpellProcess();
if (swarm_timer.Check()) {
DepopSwarmPets();
}
if (mob_close_scan_timer.Check()) {
entity_list.ScanCloseMobs(close_mobs, this, IsMoving());
}
@@ -3091,28 +3091,6 @@ void NPC::DepopSwarmPets()
Depop();
return;
}
if (GetSwarmInfo()->target) {
Mob *targMob = entity_list.GetMob(GetSwarmInfo()->target);
if(!targMob || (targMob && targMob->IsCorpse())){
Mob* owner = entity_list.GetMobID(GetSwarmInfo()->owner_id);
if (owner) {
owner->SetTempPetCount(owner->GetTempPetCount() - 1);
}
Depop();
return;
}
}
}
if (IsPet() && GetPetType() == petTargetLock && GetPetTargetLockID()){
Mob *targMob = entity_list.GetMob(GetPetTargetLockID());
if(!targMob || (targMob && targMob->IsCorpse())){
Kill();
return;
}
}
}