PRC8/nwn/nwnprc/trunk/spells/x0_s0_owlins.nss
Jaysyn904 5d82529b9d 2025/05/03 Bugfixes
Added Exotic weapon profs to fighter bonus feats.
Fixed possession bug in inc_persist_loc.nss.
Added Fochlucan Lyrist to divine classes in prc_inc_castlvl.nss
Cleaned up Owl's Insight.
2025-05-03 12:54:27 -04:00

61 lines
2.1 KiB
Plaintext

/*
x0_s0_owlins
Target's widsom bonus becomes equal to half caster's level
Duration: 1 hr/ caster level
By: Preston Watamaniuk
Created: Aug 15, 2001
Modified: Jun 29, 2006
*/
#include "prc_sp_func"
//Implements the spell impact, put code here
// if called in many places, return TRUE if
// stored charges should be decreased
// eg. touch attack hits
//
// Variables passed may be changed if necessary
int DoSpell(object oCaster, object oTarget, int nCasterLevel, int nEvent)
{
effect eVis = EffectVisualEffect(VFX_IMP_BONUS_WISDOM);
int nMetaMagic = PRCGetMetaMagicFeat();
int nDuration = nCasterLevel;
if (CheckMetaMagic(nMetaMagic, METAMAGIC_EXTEND))
nDuration *= 2; //Duration is +100%
effect eLink = EffectLinkEffects(EffectAbilityIncrease(ABILITY_WISDOM, PRCMax(12, nCasterLevel / 2)), EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE));
SignalEvent(oTarget, EventSpellCastAt(oCaster, 438, FALSE));
SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oTarget, HoursToSeconds(nDuration),TRUE,-1,nCasterLevel);
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
return TRUE; //return TRUE if spell charges should be decremented
}
void main()
{
object oCaster = OBJECT_SELF;
int nCasterLevel = PRCGetCasterLevel(oCaster);
PRCSetSchool(GetSpellSchool(PRCGetSpellId()));
if (!X2PreSpellCastCode()) return;
object oTarget = PRCGetSpellTargetObject();
int nEvent = GetLocalInt(oCaster, PRC_SPELL_EVENT); //use bitwise & to extract flags
if(!nEvent) //normal cast
{
if(GetLocalInt(oCaster, PRC_SPELL_HOLD) && oCaster == oTarget)
{ //holding the charge, casting spell on self
SetLocalSpellVariables(oCaster, 1); //change 1 to number of charges
return;
}
DoSpell(oCaster, oTarget, nCasterLevel, nEvent);
}
else
{
if(nEvent & PRC_SPELL_EVENT_ATTACK)
{
if(DoSpell(oCaster, oTarget, nCasterLevel, nEvent))
DecrementSpellCharges(oCaster);
}
}
PRCSetSchool();
}