PRC8_fork/nwn/nwnprc/trunk/DevNotes/power_template.nss
Jaysyn904 6ec137a24e Updated AMS marker feats
Updated AMS marker feats.  Removed arcane & divine marker feats.  Updated Dread Necromancer for epic progression. Updated weapon baseitem models.  Updated new weapons for crafting & npc equip.
 Updated prefix.  Updated release archive.
2024-02-11 14:01:05 -05:00

86 lines
2.4 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 "psi_inc_psifunc"
#include "psi_inc_pwresist"
#include "psi_spellhook"
#include "prc_sp_func"
int DoPower(object oManifester, object oTarget, struct manifestation manif)
{
int nPen = GetPsiPenetration(oManifester);
int nDamage, nTouchAttack;
int bHit = 0;
SPRaiseSpellCastAt(oTarget, TRUE, manif.nSpellID, oManifester);
int nRepeats = manif.bTwin ? 2 : 1;
for(; nRepeats > 0; nRepeats--)
{
nTouchAttack = PRCDoMeleeTouchAttack(oTarget);
if(nTouchAttack > 0)
{
bHit = 1;
if(PRCMyResistPower(oManifester, oTarget, nPen) == POWER_RESIST_FAIL)
{
}
}
}
return bHit; //Held charge is used if at least 1 touch from twinned power hits
}
void main()
{
if(!PsiPrePowerCastCode()) return;
object oManifester = OBJECT_SELF;
object oTarget = PRCGetSpellTargetObject();
struct manifestation manif;
int nEvent = GetLocalInt(oManifester, PRC_SPELL_EVENT); //use bitwise & to extract flags
if(!nEvent) //normal cast
{
manif =
EvaluateManifestation(oManifester, oTarget,
PowerAugmentationProfile(),
METAPSIONIC_NONE
); //fill in augmentation and metapsionic options here
if(manif.bCanManifest)
{
if(GetLocalInt(oManifester, PRC_SPELL_HOLD) && oManifester == oTarget)
{ //holding the charge, manifesting power on self
SetLocalSpellVariables(oManifester, 1); //change 1 to number of charges
SetLocalManifestation(oManifester, PRC_POWER_HOLD_MANIFESTATION, manif);
return;
}
DoPower(oManifester, oTarget, manif);
}
}
else
{
if(nEvent & PRC_SPELL_EVENT_ATTACK)
{
manif = GetLocalManifestation(oManifester, PRC_POWER_HOLD_MANIFESTATION);
if(DoPower(oManifester, oTarget, manif))
DecrementSpellCharges(oManifester);
}
}
}