PRC8_fork/trunk/psionics/psi_pow_dsspttch.nss
Jaysyn904 1662218bb4 Initial upload.
Adding base PRC 4.19a files to repository.
2022-10-07 13:51:24 -04:00

112 lines
3.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/** @file psi_pow_dsspttch
Dissipating Touch
Psychoportation (Teleportation)
Level: Psion/wilder 1, psychic warrior 1
Manifesting Time: 1 standard action
Range: Touch
Target: Creature touched
Duration: Instantaneous
Saving Throw: None
Power Resistance: Yes
Power Points: 1
Metapsionics: Empower, Maximize, Twin
Your mere touch can disperse the surface material of a foe, sending a tiny
portion of it far away. This effect is disruptive; thus, your successful
melee touch attack deals 1d6 points of damage.
Augment: For every additional power point you spend, this powers damage
increases by 1d6 points.
@author Stratovarius
@date Created: Oct 27, 2005
@date Modified: Jul 3, 2006
*/
#include "psi_inc_psifunc"
#include "psi_inc_pwresist"
#include "psi_spellhook"
#include "prc_sp_func"
#include "prc_inc_teleport"
#include "prc_inc_sp_tch"
int DoPower(object oManifester, object oTarget, struct manifestation manif)
{
int nPen = GetPsiPenetration(oManifester);
int nNumberOfDice = 1 + manif.nTimesAugOptUsed_1;
int nDieSize = 6;
int nTouchAttack, nDamage;
effect eVis = EffectVisualEffect(VFX_FNF_LOS_NORMAL_10);
int bHit = 0;
PRCSignalSpellEvent(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)
{
// Check if the target can be teleported
if(GetCanTeleport(oTarget, GetLocation(oTarget), FALSE))
{
// Roll damage
nDamage = MetaPsionicsDamage(manif, nDieSize, nNumberOfDice, 0, 0, TRUE, TRUE);
// Target-specific stuff
nDamage = GetTargetSpecificChangesToDamage(oTarget, oManifester, nDamage, TRUE, FALSE);
// Apply VFX and damage
SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
ApplyTouchAttackDamage(oManifester, oTarget, nTouchAttack, nDamage, DAMAGE_TYPE_MAGICAL);
}
}
}
}
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(PRC_NO_GENERIC_AUGMENTS,
1, PRC_UNLIMITED_AUGMENTATION
),
METAPSIONIC_EMPOWER | METAPSIONIC_MAXIMIZE | METAPSIONIC_TWIN
);
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);
}
}
}