/* ---------------- Bestow Power psi_pow_bstpwr ---------------- 22/10/04 by Stratovarius */ /** @file Bestow Power Telepathy [Mind-Affecting] Level: Psion/wilder 2 Manifesting Time: 1 standard action Range: 20 ft. Target: One psionic creature Duration: Instantaneous Saving Throw: None Power Resistance: No Power Points: 3 Metapsionics: Twin You link your mind with another psionic creature’s mind, creating a brief conduit through which mental energy can be shared. When you manifest this power, the subject gains up to 2 power points. You can transfer only as many power points to a subject as it has manifester levels. Because of the intimate nature of this power, it cannot be fabricated into a psionic item - only power points generated by a psionic creature in the moment can be shared using bestow power. Augment: For every 3 additional power points you spend, the subject gains 2 additional power points. */ //:: Updated for .35 by Jaysyn 2023/03/10 #include "psi_inc_psifunc" #include "psi_inc_pwresist" #include "psi_spellhook" #include "prc_inc_spells" void main() { /* Spellcast Hook Code Added 2004-11-02 by Stratovarius If you want to make changes to all powers, check psi_spellhook to find out more */ if (!PsiPrePowerCastCode()) { // If code within the PrePowerCastHook (i.e. UMD) reports FALSE, do not run this spell return; } // End of Spell Cast Hook object oManifester = OBJECT_SELF; object oTarget = PRCGetSpellTargetObject(); struct manifestation manif = EvaluateManifestation(oManifester, oTarget, PowerAugmentationProfile(PRC_NO_GENERIC_AUGMENTS, 3, PRC_UNLIMITED_AUGMENTATION ), METAPSIONIC_TWIN ); if(manif.bCanManifest) { // Determine the target's manifester level int n = 0; int nTargetManifesterLevel; int nTemp; while(n <= 8) { if(GetClassByPosition(n, oTarget) != CLASS_TYPE_INVALID) { nTemp = GetManifesterLevel(oTarget, GetClassByPosition(n, oTarget), -1); if(nTemp > nTargetManifesterLevel) nTargetManifesterLevel = nTemp; } n++; } /* int nTargetManifesterLevel = PRCMax(PRCMax(GetClassByPosition(1, oTarget) != CLASS_TYPE_INVALID ? GetManifesterLevel(oTarget, GetClassByPosition(1, oTarget)) : 0, GetClassByPosition(2, oTarget) != CLASS_TYPE_INVALID ? GetManifesterLevel(oTarget, GetClassByPosition(2, oTarget)) : 0 ), GetClassByPosition(3, oTarget) != CLASS_TYPE_INVALID ? GetManifesterLevel(oTarget, GetClassByPosition(3, oTarget)) : 0 ); */ int nPPGiven = 2 + 2 * manif.nTimesAugOptUsed_1; // Can't give more than the target has manifester levels nPPGiven = PRCMin(nPPGiven, nTargetManifesterLevel); // Let the AI know the power was used on it PRCSignalSpellEvent(oTarget, FALSE, manif.nSpellID, oManifester); // Apply the PP Boost to target GainPowerPoints(oTarget, nPPGiven, TRUE, TRUE); if(manif.bTwin) GainPowerPoints(oTarget, nPPGiven, TRUE, TRUE); // Do VFX effect eVis = EffectVisualEffect(VFX_DUR_MIND_AFFECTING_POSITIVE); SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget); if(manif.bTwin) DelayCommand(0.2f, SPApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oTarget, 2.5f, FALSE)); } }