Author Topic: Protection Domain Bugged?  (Read 403 times)

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Protection Domain Bugged?
« on: October 22, 2011, 03:50:55 am »


               Evening all.

Playtesting a character idea, I noticed something, or at least I think I did. ':bandit:'

I created a level 20 Cleric; gave him the Protection Domain, even took GSF: Abjuration.  He had a max WIS score of 32, and a max CHR of 30.  Yet, when I cast Sanctuary, the save DC was 26.  Looking at NWN Wiki, the Protection Domain grants an improved form of Sanctuary, with a save calculated as follows:

Divine Protection - The cleric is able to cast an improved form of sanctuary that sets the save DC at 10 + charisma modifier + clerical level. The effect has a duration of 1 round per caster level + charisma modifier.


Given all my stats, I should have had a save DC of 44.

So, I went digging.  '<img'>  It appears that Sanctuary (nw_s0_sanctuary) does not reference at all the enhanced form granted by the Protection Domain.  That code is found at nw_s2_divprot.  So, what I did was simply add an if statement to the original sanctuary spell ...

if (GetHasFeat(FEAT_PROTECTION_DOMAIN_POWER))

...then, append the code found at nw_s2_divprot to my original and voila, it gave me a DC of 40.

But wait, it should be 44...and here is my question.

I took GSF: Abjuration.  But somehow, the save DC does not take that into account.  Now, since creatures have to make a will save against the spell, I assume this is an adverse affect to them; e.g. it should be no different than if I cast a fireball at them with GSF: Evocation; the DC rises.

Can anyone tell me why this would be?

And, if possible, how would I repair that oversight on the part of Bioware?

Attached below is the new code for the original Sanctuary spell for you viewing pleasure.  '<img'>

//::///////////////////////////////////////////////
//:: Sanctuary
//:: NW_S0_Sanctuary.nss
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Makes the target creature invisible to hostile
    creatures unless they make a Will Save to ignore
    the Sanctuary Effect
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: Jan 7, 2002
//:://////////////////////////////////////////////

#include "x2_inc_spellhook"

void main()
{

/*
  Spellcast Hook Code
  Added 2003-06-23 by GeorgZ
  If you want to make changes to all spells,
  check x2_inc_spellhook.nss to find out more

*/

    if (!X2PreSpellCastCode())
    {
    // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
        return;
    }

// End of Spell Cast Hook
if (GetHasFeat(FEAT_PROTECTION_DOMAIN_POWER))
    {
    //Declare major variables
    object oTarget = GetSpellTargetObject();
    effect eVis = EffectVisualEffect(VFX_DUR_SANCTUARY);
    effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
    int nDC = 10 + GetAbilityModifier(ABILITY_CHARISMA) + GetLevelByclass(class_TYPE_CLERIC);
    effect eSanc = EffectSanctuary(nDC);

    effect eLink = EffectLinkEffects(eVis, eSanc);
    eLink = EffectLinkEffects(eLink, eDur);
    //Fire cast spell at event for the specified target
    SignalEvent(OBJECT_SELF, EventSpellCastAt(OBJECT_SELF, SPELLABILITY_DIVINE_PROTECTION, FALSE));

    int nDuration = GetCasterLevel(OBJECT_SELF) + GetAbilityModifier(ABILITY_CHARISMA);

    if ( nDuration < 1 )
    {
        nDuration = 1;
    }
    //Enter Metamagic conditions
    int nMetaMagic = GetMetaMagicFeat();
    if (nMetaMagic == METAMAGIC_EXTEND)
    {
        nDuration = nDuration *2; //Duration is +100%
    }

    //Apply the VFX impact and effects
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(nDuration));
    }

else
    {
    //Declare major variables
    object oTarget = GetSpellTargetObject();
    effect eVis = EffectVisualEffect(VFX_DUR_SANCTUARY);
    effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
    effect eSanc = EffectSanctuary(GetSpellSaveDC());

    effect eLink = EffectLinkEffects(eVis, eSanc);
    eLink = EffectLinkEffects(eLink, eDur);

    int nDuration = GetCasterLevel(OBJECT_SELF);
    //Enter Metamagic conditions
    int nMetaMagic = GetMetaMagicFeat();
    if (nMetaMagic == METAMAGIC_EXTEND)
    {
        nDuration = nDuration *2; //Duration is +100%
    }
    //Fire cast spell at event for the specified target
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_SANCTUARY, FALSE));
    //Apply the VFX impact and effects
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, RoundsToSeconds(nDuration));
    }
}

               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Protection Domain Bugged?
« Reply #1 on: October 22, 2011, 04:06:09 am »


               

WoC_Builder wrote...

I created a level 20 Cleric; gave him the Protection Domain, even took GSF: Abjuration.  He had a max WIS score of 32, and a max CHR of 30.  Yet, when I cast Sanctuary, the save DC was 26.  Looking at NWN Wiki, the Protection Domain grants an improved form of Sanctuary, with a save calculated as follows:


Divine Protection - The cleric is able to cast an improved form of sanctuary that sets the save DC at 10 + charisma modifier + clerical level. The effect has a duration of 1 round per caster level + charisma modifier.

Given all my stats, I should have had a save DC of 44.

44?  

sets the save DC at 10 + charisma modifier + clerical level.

Charisma Modifier = (30 -10)/2 = 10
Character level = 20
DC = 10 + 10 + 20 = 40

I get 40.  Am I missing something for how you came up with 44?  
               
               

               


                     Modifié par Lightfoot8, 22 octobre 2011 - 03:07 .
                     
                  


            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Protection Domain Bugged?
« Reply #2 on: October 22, 2011, 04:14:45 am »


               All right, some more research.  '<img'>

NWN Wiki states...

Greater spell focus does not apply to spells that are granted as special abilities.


So, in my original testing, the DC was correct, as

DC = 10 + spell level + ability modifier + feat modifier.
So...

10 + 1 + 11+ 4 = 26

or, after I fixed it (as Lightfoot8 pointed out)

Charisma Modifier = (30 -10)/2 = 10
Character level = 20
DC = 10 + 10 + 20 = 40

However, Sanctuary is not granted as a special ability to Clerics, it is an inherent spell, for all that it is enhanced by the Protection Domain.  So, as I see it, the DC should be 4 points higher in my case, due to the feat of Greater Spell Focus: Abjuration.

Which still leaves me with wondering how I can have the spell calculate my feat selection, and grant me the additional 4 points to the DC.

'<img'>
               
               

               


                     Modifié par WoC_Builder, 22 octobre 2011 - 03:55 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Protection Domain Bugged?
« Reply #3 on: October 22, 2011, 05:04:15 am »


               int nDC = 10 + GetAbilityModifier(ABILITY_CHARISMA) + GetLevelByclass(class_TYPE_CLERIC);
   // Enter the correct numbers Im guessing
   if (GetHasFeat(FEAT_EPIC_SPELL_FOCUS_ABJURATION))       nDC+= 6;
   else if(GetHasFeat(FEAT_GREATER_SPELL_FOCUS_ABJURATION))nDC+= 4;
   else if(GetHasFeat(FEAT_SPELL_FOCUS_ABJURATION))        nDC+= 2;
               
               

               
            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Protection Domain Bugged?
« Reply #4 on: October 22, 2011, 05:20:21 am »


               Worked like a charm.  '<img'>

Thank you, Sir.  '<img'>
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Protection Domain Bugged?
« Reply #5 on: October 22, 2011, 05:47:02 am »


               

WoC_Builder wrote...

However, Sanctuary is not granted as a special ability to Clerics, it is an inherent spell, for all that it is enhanced by the Protection Domain.  So, as I see it, the DC should be 4 points higher in my case, due to the feat of Greater Spell Focus: Abjuration.


It is given of the class feat radial (pre-quickslotted if cleric was your original class).  The spells are 11 + charisma modifier + feats, but the feat ability is 10 + 1/2 cleric level + charisma modifier. 
               
               

               
            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Protection Domain Bugged?
« Reply #6 on: October 22, 2011, 06:38:31 am »


               LOL...I just came here to post that I was an idiot.  '<img'>

I noticed that they had indeed done just what you said.  ':pinched:'

However, I still like my fix better, so may keep it in place.  ':whistle:'