[Rules] ResurrectionEffectBlock to prevent/allow/move buffs. (#3288)

* [Rules] ResurrectionEffectsBlock to prevent/allow/move buffs.

This removes the rule ResurrectionEffectsBlock (Bool) and creates ResurrectionEffectsBlock (Int)

Default = 2

Setting to 0 = Functions as it did before any blocking changes, Focus of Spirit and Strength buffs can overwrite Resurrection Effects.

Setting to 1 = Blocks all buffs that could overwrite Resurrection Effects.

Setting to 2 = Allows all buffs that would overwrite Resurrection Effects to land, however they will be moved to a new buff slot if one is available to allow both the beneficial buff to land and detrimental effects of Resurrection Effects to stay in effect until the duration is expired.

* Update logging

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
nytmyr
2023-05-08 08:32:21 -05:00
committed by GitHub
parent 434f270f68
commit 93a4153a4b
4 changed files with 60 additions and 11 deletions
+30 -4
View File
@@ -3037,6 +3037,12 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2,
if(sp1_value < overwrite_below_value)
{
if (IsResurrectionEffects(spellid1)) {
int8 res_effect_check = GetResurrectionSicknessCheck(spellid1, spellid2);
if (res_effect_check != 0) {
return res_effect_check;
}
}
LogSpells("Overwrite spell because sp1_value < overwrite_below_value");
return 1; // overwrite spell if its value is less
}
@@ -3162,6 +3168,13 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2,
if(sp2_value < 0)
sp2_value = 0 - sp2_value;
if (IsResurrectionEffects(spellid1)) {
int8 res_effect_check = GetResurrectionSicknessCheck(spellid1, spellid2);
if (res_effect_check != 0) {
return res_effect_check;
}
}
if(sp2_value < sp1_value) {
LogSpells("Spell [{}] (value [{}]) is not as good as [{}] (value [{}]). Rejecting [{}]",
sp2.name, sp2_value, sp1.name, sp1_value, sp2.name);
@@ -3170,10 +3183,6 @@ int Mob::CheckStackConflict(uint16 spellid1, int caster_level1, uint16 spellid2,
if (sp2_value != sp1_value)
values_equal = false;
if (RuleB(Spells, ResurrectionEffectsBlock) && IsResurrectionEffects(spellid1)) {
LogSpells("ResurrectionEffectsBlock triggered -- [{}] is blocked by [{}]", sp2.name, sp1.name);
return -1; // can't stack
}
//we dont return here... a better value on this one effect dosent mean they are
//all better...
@@ -3364,6 +3373,10 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
will_overwrite = true;
overwrite_slots.push_back(buffslot);
}
if (ret == 2) { //ResurrectionEffectBlock handling to move potential overwrites to a new buff slock while keeping Res Sickness
LogSpells("Adding buff [{}] will overwrite spell [{}] in slot [{}] with caster level [{}], but ResurrectionEffectBlock is set to 2. Attempting to move [{}] to an empty buff slot.",
spell_id, curbuf.spellid, buffslot, curbuf.casterlevel, spell_id);
}
} else {
if (emptyslot == -1) {
if (buffslot >= start_slot && buffslot < end_slot) {
@@ -3521,6 +3534,19 @@ int Mob::CanBuffStack(uint16 spellid, uint8 caster_level, bool iFailIfOverwrite)
LogAIDetail("Buff [{}] would conflict with [{}] in slot [{}], reporting stack failure", spellid, curbuf.spellid, i);
return -1; // stop the spell, can't stack it
}
if (ret == 2) { //ResurrectionEffectBlock handling to move potential overwrites to a new buff slock while keeping Res Sickness
LogAIDetail("Adding buff [{}] will overwrite spell [{}] in slot [{}] with caster level [{}], but ResurrectionEffectBlock is set to 2. Attempting to move [{}] to an empty buff slot.",
spellid, curbuf.spellid, i, curbuf.casterlevel, spellid);
for (int x = 0; x < buff_count; x++) {
const Buffs_Struct& curbuf = buffs[x];
if (IsValidSpell(curbuf.spellid)) {
continue;
}
else {
firstfree = x;
}
}
}
}
LogAIDetail("Reporting that buff [{}] could successfully be placed into slot [{}]", spellid, firstfree);