Been fiddling around with the server for a while now and I've turned my eye, briefly, on spell stacking.
I was going through the code trying to figure out why two spells that should stack, don't stack.
Hand of Virtue
1: Stacking: Block new spell if slot 3 is effect 'Max Hitpoints' and < 2405
2: Increase Max Hitpoints by 1405
3: Increase HP when cast by 1405
4: Increase AC by 72
5: Stacking: Overwrite existing spell if slot 3 is effect 'Max Hitpoints' and < 2405
Brell's Stalwart Shield
4: Increase Max Hitpoints by 330.
It puzzled me because the overwrite and block says nothing about slot 4 and the effects in slot 4 don't match at all. Looking for something that could be the problem I noticed two spots in Mob::CheckStackConflict():
Code:
if(effect1 == SE_StackingCommand_Block)
{
blocked_effect = sp1.base[i];
blocked_slot = sp1.formula[i] - 200;
blocked_below_value = sp1.max[i];
if(sp2.effectid[blocked_slot] == blocked_effect)
{
and
Code:
if(effect2 == SE_StackingCommand_Overwrite)
{
overwrite_effect = sp2.base[i];
overwrite_slot = sp2.formula[i] - 200;
overwrite_below_value = sp2.max[i];
if(sp1.effectid[overwrite_slot] == overwrite_effect)
{
This issue I believe after looking through lucy's raw data for the spells in question is the formula. The formula calc for a blocked or overwrite slot 3 effect is '203': 203-200 = 3, so we're referencing sp1.effectid[3] which would be slot 4. So instead of comparing the slot we're supposed to be we're comparing the slot+1 we're supposed to be. I think making these line changes:
Code:
if(sp2.effectid[blocked_slot-1] == blocked_effect)
&
Code:
if(sp1.effectid[overwrite_slot-1] == overwrite_effect)
would fix quite a few stacking issues, not all mind you but yeah, hope I was clear enough.