It's not quite the work-around I was hoping for, but it works:
// Store spells-per-day on creature before removing
// equipment that boosts a spell-casting ability
void StoreSpells(object oPC)
{
int i = 0;
int iSpell;
int iSkip;
while (i < 1216)
{//exempt subradial spells
if (i > 102 && i < 107) iSkip = 1;//magic circle
if (i > 135 && i < 141) iSkip = 1;//protect align
if (i > 343 && i < 354) iSkip = 1;//shadow conj & greater
if (i > 386 && i < 397) iSkip = 1;//polymorph & shape change
if (i > 529 && i < 533) iSkip = 1;//vine mine
if (i > 968 && i < 988) iSkip = 1;//shades, meteor, energy imm, blade b
if (i > 1055 && i < 1058) iSkip = 1;//scorch ray
iSpell = GetHasSpell(i, oPC);
if (GetSpellKnown(oPC, i) && iSkip == 0)
{
SetLocalInt(oPC, "Spell"+IntToString(i), iSpell);
}
i++;
iSkip = 0;
}
}
// Reset spells-per-day after ForceRest()
//
// ForceRest() must be called at least two seconds after
// equipment that boosts a spell-casting ability is re-equipped
void RestoreSpells(object oPC)
{
int i = 0;
int iSpell;
int iLocalSpell;
int iSkip;
while (i < 1216)
{//excempt subradial spells
if (i > 102 && i < 107) iSkip = 1;//magic circle
if (i > 135 && i < 141) iSkip = 1;//protect align
if (i > 343 && i < 354) iSkip = 1;//shadow conj & greater
if (i > 386 && i < 397) iSkip = 1;//polymorph & shape change
if (i > 529 && i < 533) iSkip = 1;//vine mine
if (i > 968 && i < 988) iSkip = 1;//shades, meteor, energy imm, blade b
if (i > 1055 && i < 1058) iSkip = 1;//scorch ray
iSpell = GetHasSpell(i, oPC);
iLocalSpell = GetLocalInt(oPC, "Spell"+IntToString(i));
if (GetSpellKnown(oPC, i) && iSpell > iLocalSpell && iSkip == 0)
{
DecrementRemainingSpellUses(oPC, i);
iSpell = GetHasSpell(i, oPC);
}
DeleteLocalInt(oPC, "Spell"+IntToString(i));
i++;
iSkip = 0;
}
}
Modifié par DannJ, 26 octobre 2012 - 01:03 .