Well the immunity part is already covered in my half a year old version at vault. Yes its not multilanguaged and if someone thought about way how to make it multilanguaged it would be great but well its a minor issue. I guess I havent expressed myself very well so:
What I want to help with is the caster level increase issue. My solution decreases SR of the creature before using ResistSpell function which doenst work on monks as you said. So im looking for better option. I can fake a feedback like I did for immunity but I dont want to have two feedbacks and I also need this order: immunity - absorption - spell resist.
I see no other way so I take any idea, there is current code:
int MyResistSpell(object oCaster, object oTarget, float fDelay = 0.0)
{
if(fDelay > 0.5)
{
fDelay -= 0.1;
} //aoe spells workaround
int bImmunity, nSpellId = GetEffectSpellId(EffectDazed());
//Shadoow for 1.70: spell immunity goes before spell absorption
if((GetHasSpellEffect(SPELL_LESSER_SPELL_MANTLE,oTarget) ||
GetHasSpellEffect(SPELL_SPELL_MANTLE,oTarget) ||
GetHasSpellEffect(SPELL_GREATER_SPELL_MANTLE,oTarget)) && (
GetHasSpellEffect(SPELL_MINOR_GLOBE_OF_INVULNERABILITY,oTarget) ||
GetHasSpellEffect(SPELL_GREATER_SHADOW_CONJURATION_MINOR_GLOBE,oTarget) ||
GetHasSpellEffect(SPELL_GLOBE_OF_INVULNERABILITY,oTarget) ||
GetHasSpellEffect(SPELL_GHOSTLY_VISAGE,oTarget) ||
GetHasSpellEffect(SPELLABILITY_AS_GHOSTLY_VISAGE,oTarget) ||
GetHasSpellEffect(SPELL_GREATER_SHADOW_CONJURATION_MIRROR_IMAGE,oTarget) || //shadow ghostly visage
GetHasSpellEffect(SPELL_ETHEREAL_VISAGE,oTarget)))
{
int nMaxLevel = 1;
if(GetHasSpellEffect(SPELL_ETHEREAL_VISAGE,oTarget))
{
nMaxLevel = 2;
}
if(GetHasSpellEffect(SPELL_MINOR_GLOBE_OF_INVULNERABILITY,oTarget) || GetHasSpellEffect(SPELL_GREATER_SHADOW_CONJURATION_MINOR_GLOBE,oTarget))
{
nMaxLevel = 3;
}
if(GetHasSpellEffect(SPELL_GLOBE_OF_INVULNERABILITY,oTarget))
{
nMaxLevel = 4;
}
string sCollumn = "Innate";
switch(GetLastSpellCastclass())
{
case class_TYPE_WIZARD:
case class_TYPE_SORCERER:
sCollumn = "Wiz_Sorc";
break;
case class_TYPE_CLERIC:
sCollumn = "Cleric";
break;
case class_TYPE_DRUID:
sCollumn = "Druid";
break;
case class_TYPE_BARD:
sCollumn = "Bard";
break;
case class_TYPE_RANGER:
sCollumn = "Ranger";
break;
case class_TYPE_PALADIN:
sCollumn = "Paladin";
break;
}
sCollumn = Get2DAString("spells",sCollumn,nSpellId);
if(sCollumn != "")
{
bImmunity = StringToInt(sCollumn) <= nMaxLevel;
}
}
if(!bImmunity && nSpellId == SPELL_MAGIC_MISSILE && GetHasSpellEffect(SPELL_SHIELD,oTarget))
{
bImmunity = TRUE;//magic missile on target with Shield spell effect
} //polymorph - pixie
if(!bImmunity && (GetHasSpellEffect(SPELL_SHADOW_SHIELD,oTarget) || GetHasSpellEffect(390,oTarget)))
{
string sSchool = Get2DAString("spells","School",nSpellId);
if(GetHasSpellEffect(SPELL_SHADOW_SHIELD,oTarget))
{
bImmunity = sSchool == "N";//Necromantic spell cast at target with Shadow Shield
}
if(!bImmunity && GetHasSpellEffect(390,oTarget))
{
bImmunity = sSchool == "E";//Enchantment spell cast at target polymorphed into pixie
}
}
//spell should be resisted via various spell immunity!
if(bImmunity)
{
//engine workaround to print "immunity feedback"
string sFeedback = GetStringByStrRef(8342);//this will work pretty well for singleplayer
sFeedback = GetStringLeft(sFeedback,GetStringLength(sFeedback)-10);//but if would someone with non-english language
sFeedback = GetStringRight(sFeedback,GetStringLength(sFeedback)-10);//played english server, then this immunity
sFeedback = "<c›ţţ>"+GetName(oTarget)+"</c> <cÃÅ£>"+sFeedback+" "+GetStringByStrRef(8344)+"</c>";//feedback will be
SendMessageToPC(oTarget,sFeedback);//in english, while normally it would be in his language...
SendMessageToPC(oCaster,sFeedback);
DelayCommand(fDelay,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_GLOBE_USE),oTarget));
return 2;
}
//Shadooow for 1.70: caster level override workaround, since ResistSpell function uses its own values
//and its hardcoded I apply a spell resistance decrease in the appropriate ammount in order to cheat
//this hardcoded function. This works pretty well for non-monks. 12+ lvl monks are immune to this solution.
int clOverride = GetLocalInt(oCaster,"SPECIAL_ABILITY_CASTER_LEVEL_OVERRIDE")+GetLocalInt(GetSpellCastItem(),"ITEM_CASTER_LEVEL_OVERRIDE");
if(GetObjectType(OBJECT_SELF) == OBJECT_TYPE_AREA_OF_EFFECT)
{
clOverride = GetLocalInt(OBJECT_SELF,"AOE_LEVEL");
}
if(clOverride > 0)
{//if overriden above default caster level we must alter spell resistance of our target...
int clDefault = GetCasterLevel(oCaster);
int SR = GetSpellResistance(oTarget);
if(clOverride > clDefault && clDefault < SR && clOverride >= SR)
{//do nothing if default caster level is higher, or if even overriden level is lower than current SR
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectSpellResistanceDecrease(clOverride-clDefault),oTarget,0.01);//should not affect anything else
}
}//end of caster level workaround
int nResist = ResistSpell(oCaster,oTarget);
if(nResist == 1) //Spell Resistance
{
effect eSR = EffectVisualEffect(VFX_IMP_MAGIC_RESISTANCE_USE);
DelayCommand(fDelay,ApplyEffectToObject(DURATION_TYPE_INSTANT,eSR,oTarget));
}
else if(nResist == 2) //Globe
{
effect eGlobe = EffectVisualEffect(VFX_IMP_GLOBE_USE);
DelayCommand(fDelay,ApplyEffectToObject(DURATION_TYPE_INSTANT,eGlobe,oTarget));
}
else if(nResist == 3) //Spell Mantle
{
if(fDelay > 0.5)
{
fDelay -= 0.1;
}
effect eMantle = EffectVisualEffect(VFX_IMP_SPELL_MANTLE_USE);
DelayCommand(fDelay,ApplyEffectToObject(DURATION_TYPE_INSTANT,eMantle,oTarget));
}
return nResist;
}
The code in the public version of my patch does check only for globes, I added check for ghostly visage, ethereal visage, shadow shield, shield and pixie's polymorph otherwise its the same.