/* ---------------- Metaphysical Claw psi_pow_metaclaw ---------------- 29/10/05 by Stratovarius */ /** @file Metaphysical Claw Psychometabolism Level: Psychic warrior 1 Manifesting Time: 1 standard action Range: Personal Target: You Duration: 1 min./level Power Points: 1 Metapsionics: Extend If you have a claw attack (either from an actual natural weapon or from an effect such as claws of the beast) or a bite attack (which could be a natural bite attack or one you gain by means of the power bite of the wolf), you can use this power to provide your natural weapons a +1 enhancement bonus on attack rolls and damage rolls. Augment: If you spend 4 additional power points, this power’s duration increases to 1 hour per level. In addition, for every 4 additional power points you spend, this power improves the natural weapon’s enhancement bonus on attack rolls and damage rolls by 1. */ #include "psi_inc_psifunc" #include "psi_inc_pwresist" #include "psi_spellhook" #include "prc_alterations" // Cleanup function for Metaphysical Claw virtual enhancements void MetaphysicalClawCleanup(object oManifester, object oTarget, int nSpellID, int nBeatsRemaining) { if(!((nBeatsRemaining-- == 0) || PRCGetDelayedSpellEffectsExpired(nSpellID, oTarget, oManifester) || PRCGetHasEffect(EFFECT_TYPE_POLYMORPH, oTarget)) ) { // Schedule next check DelayCommand(6.0f, MetaphysicalClawCleanup(oManifester, oTarget, nSpellID, nBeatsRemaining)); } // Power expired - clean up variables else { DeleteLocalInt(oTarget, "PRC_NAT_WEAPON_ENHANCE"); DeleteLocalFloat(oTarget, "PRC_NAT_WEAPON_ENH_DUR"); } } void main() { if (!PsiPrePowerCastCode()) { return; } object oManifester = OBJECT_SELF; object oTarget = PRCGetSpellTargetObject(); struct manifestation manif = EvaluateManifestation(oManifester, oTarget, PowerAugmentationProfile(4, 4, PRC_UNLIMITED_AUGMENTATION ), METAPSIONIC_EXTEND ); if(manif.bCanManifest) { int nBonus = 1 + manif.nTimesAugOptUsed_1; object oLClaw = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oTarget); object oRClaw = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oTarget); object oBite = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oTarget); effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE); effect eVis = EffectVisualEffect(VFX_IMP_PULSE_NEGATIVE); itemproperty ipBonus = ItemPropertyEnhancementBonus(nBonus); float fDuration = (manif.nTimesAugOptUsed_1 == 0 ? 60.0f : HoursToSeconds(1)) * manif.nManifesterLevel; if(manif.bExtend) fDuration *= 2; // Check for natural weapons - both physical and virtual int bHasNaturalWeapon = FALSE; int bHasVirtualWeapon = FALSE; // Check physical slots if(GetIsObjectValid(oLClaw) || GetIsObjectValid(oRClaw) || GetIsObjectValid(oBite)) { bHasNaturalWeapon = TRUE; } // ALWAYS check for virtual secondary weapons if(array_exists(oTarget, ARRAY_NAT_SEC_WEAP_RESREF)) { bHasVirtualWeapon = TRUE; bHasNaturalWeapon = TRUE; } // Must have a natural attack if(!bHasNaturalWeapon) { FloatingTextStrRefOnCreature(16826656, oManifester, FALSE); return; } // Apply enhancement to physical weapons if(GetIsObjectValid(oLClaw)) AddItemProperty(DURATION_TYPE_TEMPORARY, ipBonus, oLClaw, fDuration); if(GetIsObjectValid(oRClaw)) AddItemProperty(DURATION_TYPE_TEMPORARY, ipBonus, oRClaw, fDuration); if(GetIsObjectValid(oBite)) AddItemProperty(DURATION_TYPE_TEMPORARY, ipBonus, oBite, fDuration); // Apply enhancement to virtual weapons if(bHasVirtualWeapon) { // Store enhancement on the creature for the virtual weapon system SetLocalInt(oTarget, "PRC_NAT_WEAPON_ENHANCE", nBonus); SetLocalFloat(oTarget, "PRC_NAT_WEAPON_ENH_DUR", fDuration); // Start cleanup monitor - similar to Bite of the Wolf DelayCommand(6.0f, MetaphysicalClawCleanup(oManifester, oTarget, manif.nSpellID, FloatToInt(fDuration) / 6)); } // Do VFX SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget); DelayCommand(1.0, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget)); DelayCommand(2.0, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget)); SPApplyEffectToObject(DURATION_TYPE_INSTANT, eDur, oTarget, fDuration); } } /*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(4, 4, PRC_UNLIMITED_AUGMENTATION ), METAPSIONIC_EXTEND ); if(manif.bCanManifest) { int nBonus = 1 + manif.nTimesAugOptUsed_1; object oLClaw = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oTarget); object oRClaw = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oTarget); object oBite = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oTarget); effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE); effect eVis = EffectVisualEffect(VFX_IMP_PULSE_NEGATIVE); itemproperty ipBonus = ItemPropertyEnhancementBonus(nBonus); float fDuration = (manif.nTimesAugOptUsed_1 == 0 ? 60.0f : HoursToSeconds(1)) * manif.nManifesterLevel; if(manif.bExtend) fDuration *= 2; // Must have a natural attack if(!(GetIsObjectValid(oLClaw) || GetIsObjectValid(oRClaw) || GetIsObjectValid(oBite))) { // "Target does not posses a natural attack!" FloatingTextStrRefOnCreature(16826656, oManifester, FALSE); return; } // Add the enhancement bonus AddItemProperty(DURATION_TYPE_TEMPORARY, ipBonus, oLClaw, fDuration); AddItemProperty(DURATION_TYPE_TEMPORARY, ipBonus, oRClaw, fDuration); AddItemProperty(DURATION_TYPE_TEMPORARY, ipBonus, oBite, fDuration); // Do VFX SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget); DelayCommand(1.0, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget)); DelayCommand(2.0, SPApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget)); SPApplyEffectToObject(DURATION_TYPE_INSTANT, eDur, oTarget, fDuration); }// end if - Successfull manifestation } */