[Spells] Illusions will now persist onto the corpse when mob is killed. (#1960)

* illusion applies to corpse

* Update spell_effects.cpp

* [Spells] Illusions will now persist onto the corpse when mob is killed.

addressed comments
This commit is contained in:
KayenEQ 2022-02-04 21:14:29 -05:00 committed by GitHub
parent 0400504adc
commit d300e78b39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 11 deletions

View File

@ -1891,6 +1891,8 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQ::skills::Skill
//m_epp.perAA = 0; //reset to no AA exp on death. //m_epp.perAA = 0; //reset to no AA exp on death.
} }
int32 illusion_spell_id = spellbonuses.Illusion;
//this generates a lot of 'updates' to the client that the client does not need //this generates a lot of 'updates' to the client that the client does not need
BuffFadeNonPersistDeath(); BuffFadeNonPersistDeath();
if (RuleB(Character, UnmemSpellsOnDeath)) { if (RuleB(Character, UnmemSpellsOnDeath)) {
@ -1936,13 +1938,12 @@ bool Client::Death(Mob* killerMob, int32 damage, uint16 spell, EQ::skills::Skill
} }
} }
} }
entity_list.AddCorpse(new_corpse, GetID()); entity_list.AddCorpse(new_corpse, GetID());
SetID(0); SetID(0);
//send the become corpse packet to everybody else in the zone. //send the become corpse packet to everybody else in the zone.
entity_list.QueueClients(this, &app2, true); entity_list.QueueClients(this, &app2, true);
ApplyIllusionToCorpse(illusion_spell_id, new_corpse);
LeftCorpse = true; LeftCorpse = true;
} }
} }
@ -2340,6 +2341,8 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy
if (p_depop == true) if (p_depop == true)
return false; return false;
int32 illusion_spell_id = spellbonuses.Illusion;
HasAISpellEffects = false; HasAISpellEffects = false;
BuffFadeAll(); BuffFadeAll();
uint8 killed_level = GetLevel(); uint8 killed_level = GetLevel();
@ -2595,8 +2598,8 @@ bool NPC::Death(Mob* killer_mob, int32 damage, uint16 spell, EQ::skills::SkillTy
// entity_list.RemoveMobFromCloseLists(this); // entity_list.RemoveMobFromCloseLists(this);
close_mobs.clear(); close_mobs.clear();
this->SetID(0); this->SetID(0);
ApplyIllusionToCorpse(illusion_spell_id, corpse);
if (killer != 0 && emoteid != 0) if (killer != 0 && emoteid != 0)
corpse->CastToNPC()->DoNPCEmote(AFTERDEATH, emoteid); corpse->CastToNPC()->DoNPCEmote(AFTERDEATH, emoteid);

View File

@ -3546,7 +3546,7 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne
} }
case SE_Illusion: case SE_Illusion:
new_bonus->Illusion = true; new_bonus->Illusion = spell_id;
break; break;
case SE_IllusionPersistence: case SE_IllusionPersistence:

View File

@ -559,7 +559,7 @@ struct StatBonuses {
int32 WeaponStance[WEAPON_STANCE_TYPE_MAX +1];// base = trigger spell id, base2 = 0 is 2h, 1 is shield, 2 is dual wield, [0]spid 2h, [1]spid shield, [2]spid DW int32 WeaponStance[WEAPON_STANCE_TYPE_MAX +1];// base = trigger spell id, base2 = 0 is 2h, 1 is shield, 2 is dual wield, [0]spid 2h, [1]spid shield, [2]spid DW
bool ZoneSuspendMinion; // base 1 allows suspended minions to zone bool ZoneSuspendMinion; // base 1 allows suspended minions to zone
bool CompleteHealBuffBlocker; // Use in SPA 101 to prevent recast of complete heal from this effect till blocker buff is removed. bool CompleteHealBuffBlocker; // Use in SPA 101 to prevent recast of complete heal from this effect till blocker buff is removed.
bool Illusion; // check if illusion is present. int32 Illusion; // illusion spell id
// AAs // AAs
int32 TrapCircumvention; // reduce chance to trigger a trap. int32 TrapCircumvention; // reduce chance to trigger a trap.

View File

@ -357,6 +357,7 @@ public:
void ConeDirectional(uint16 spell_id, int16 resist_adjust); void ConeDirectional(uint16 spell_id, int16 resist_adjust);
void TryOnSpellFinished(Mob *caster, Mob *target, uint16 spell_id); void TryOnSpellFinished(Mob *caster, Mob *target, uint16 spell_id);
void ApplySpellEffectIllusion(int32 spell_id, Mob* caster, int buffslot, int base, int limit, int max); void ApplySpellEffectIllusion(int32 spell_id, Mob* caster, int buffslot, int base, int limit, int max);
void ApplyIllusionToCorpse(int32 spell_id, Corpse* new_corpse);
void SendIllusionWearChange(Client* c); void SendIllusionWearChange(Client* c);
//Buff //Buff

View File

@ -8982,6 +8982,24 @@ void Mob::SendIllusionWearChange(Client* c) {
} }
} }
void Mob::ApplyIllusionToCorpse(int32 spell_id, Corpse* new_corpse) {
//Transfers most illusions over to the corpse upon death
if (!IsValidSpell(spell_id)) {
return;
}
if (!new_corpse) {
return;
}
for (int i = 0; i < EFFECT_COUNT; i++){
if (spells[spell_id].effect_id[i] == SE_Illusion) {
new_corpse->ApplySpellEffectIllusion(spell_id, nullptr, -1, spells[spell_id].base_value[i], spells[spell_id].limit_value[i], spells[spell_id].max_value[i]);
return;
}
}
}
void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, int base, int limit, int max) void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, int base, int limit, int max)
{ {
@ -9091,6 +9109,7 @@ void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, in
SendWearChange(x); SendWearChange(x);
} }
if (buffslot != -1) {
if (caster == this && spell_id != SPELL_MINOR_ILLUSION && spell_id != SPELL_ILLUSION_TREE && if (caster == this && spell_id != SPELL_MINOR_ILLUSION && spell_id != SPELL_ILLUSION_TREE &&
(spellbonuses.IllusionPersistence || aabonuses.IllusionPersistence || itembonuses.IllusionPersistence)) { (spellbonuses.IllusionPersistence || aabonuses.IllusionPersistence || itembonuses.IllusionPersistence)) {
buffs[buffslot].persistant_buff = 1; buffs[buffslot].persistant_buff = 1;
@ -9098,6 +9117,7 @@ void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, in
else { else {
buffs[buffslot].persistant_buff = 0; buffs[buffslot].persistant_buff = 0;
} }
}
} }
bool Mob::HasPersistDeathIllusion(int32 spell_id) { bool Mob::HasPersistDeathIllusion(int32 spell_id) {