[Spells] Rework of Virus Effect code (#1593)

* start of rework

* functional

* virus updates

* Update npc.cpp

* updates

* updates

* update v2

* pre remove old code

* removed old code1

* remove debugs

* description

* Update spell_effects.cpp

* changed function name

* remove unused var

* merge error fix

* fix formating issue

* Update spdat.cpp

* Update spell_effects.cpp

* Convert virus entity range code to use vectors and GetCloseMobList

* Formatting [skip ci]

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
KayenEQ
2021-10-24 19:27:51 -04:00
committed by GitHub
parent 1c5f9f2e0f
commit 060be606e7
13 changed files with 242 additions and 165 deletions
+1 -26
View File
@@ -367,6 +367,7 @@ Mob::Mob(
pet_regroup = false;
_IsTempPet = false;
pet_owner_client = false;
pet_owner_npc = false;
pet_targetlock_id = 0;
attacked_count = 0;
@@ -405,10 +406,6 @@ Mob::Mob(
roamer = false;
rooted = false;
charmed = false;
has_virus = false;
for (int i = 0; i < MAX_SPELL_TRIGGER * 2; i++) {
viral_spells[i] = 0;
}
weaponstance.enabled = false;
weaponstance.spellbonus_enabled = false; //Set when bonus is applied
@@ -4682,28 +4679,6 @@ void Mob::DoGravityEffect()
}
}
void Mob::SpreadVirus(uint16 spell_id, uint16 casterID)
{
int num_targs = spells[spell_id].viral_targets;
Mob* caster = entity_list.GetMob(casterID);
Mob* target = nullptr;
// Only spread in zones without perm buffs
if(!zone->BuffTimersSuspended()) {
for(int i = 0; i < num_targs; i++) {
target = entity_list.GetTargetForVirus(this, spells[spell_id].viral_range);
if(target) {
// Only spreads to the uninfected
if(!target->FindBuff(spell_id)) {
if(caster)
caster->SpellOnTarget(spell_id, target);
}
}
}
}
}
void Mob::AddNimbusEffect(int effectid)
{
SetNimbusEffect(effectid);