[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
5 changed files with 35 additions and 11 deletions
+26 -6
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)
{
@@ -9091,12 +9109,14 @@ void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, in
SendWearChange(x);
}
if (caster == this && spell_id != SPELL_MINOR_ILLUSION && spell_id != SPELL_ILLUSION_TREE &&
(spellbonuses.IllusionPersistence || aabonuses.IllusionPersistence || itembonuses.IllusionPersistence)) {
buffs[buffslot].persistant_buff = 1;
}
else {
buffs[buffslot].persistant_buff = 0;
if (buffslot != -1) {
if (caster == this && spell_id != SPELL_MINOR_ILLUSION && spell_id != SPELL_ILLUSION_TREE &&
(spellbonuses.IllusionPersistence || aabonuses.IllusionPersistence || itembonuses.IllusionPersistence)) {
buffs[buffslot].persistant_buff = 1;
}
else {
buffs[buffslot].persistant_buff = 0;
}
}
}