forked from Jaysyn/PRC8
Updated Release Archive. Fixed Mage-killer prereqs. Removed old LETO & ConvoCC related files. Added organized spell scroll store. Fixed Gloura spellbook. Various TLK fixes. Reorganized Repo. Removed invalid user folders. Added DocGen back in.
76 lines
2.0 KiB
Plaintext
76 lines
2.0 KiB
Plaintext
/*
|
|
<SCRIPT NAME>
|
|
|
|
<DESCRIPTION>
|
|
|
|
By:
|
|
Created:
|
|
Modified:
|
|
|
|
<EXTRA NOTES>
|
|
|
|
<BEGIN NOTES TO SCRIPTER - MAY BE DELETED LATER>
|
|
Modify as necessary
|
|
Most code should be put in DoSpell()
|
|
|
|
PRC_SPELL_EVENT_ATTACK is set when a
|
|
touch or ranged attack is used
|
|
<END NOTES TO SCRIPTER>
|
|
*/
|
|
|
|
#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)
|
|
{
|
|
int nMetaMagic = PRCGetMetaMagicFeat();
|
|
int nSaveDC = PRCGetSaveDC(oTarget, oCaster);
|
|
int nPenetr = nCasterLevel + SPGetPenetr();
|
|
float fMaxDuration = RoundsToSeconds(nCasterLevel); //modify if necessary
|
|
|
|
SPRaiseSpellCastAt(oTarget, TRUE);
|
|
|
|
//INSERT SPELL CODE HERE
|
|
int iAttackRoll = 0; //placeholder
|
|
|
|
int iAttackRoll = PRCDoMeleeTouchAttack(oTarget);
|
|
if (iAttackRoll > 0)
|
|
{
|
|
//Touch attack code goes here
|
|
}
|
|
|
|
return iAttackRoll; //return TRUE if spell charges should be decremented
|
|
}
|
|
|
|
void main()
|
|
{
|
|
object oCaster = OBJECT_SELF;
|
|
int nCasterLevel = PRCGetCasterLevel(oCaster);
|
|
SPSetSchool(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);
|
|
}
|
|
}
|
|
SPSetSchool();
|
|
} |