//:://///////////////////////////////////////////// //:: Keen Edge //:: X2_S0_KeenEdge //:: Copyright (c) 2001 Bioware Corp. //::////////////////////////////////////////////// /* Adds the keen property to one melee weapon, increasing its critical threat range. */ //::////////////////////////////////////////////// //:: Created By: Andrew Nobbs //:: Created On: Nov 28, 2002 //::////////////////////////////////////////////// //:: Updated by Andrew Nobbs May 08, 2003 //:: 2003-07-07: Stacking Spell Pass, Georg Zoeller //:: 2003-07-17: Complete Rewrite to make use of Item Property System #include "x2_i0_spells" #include "x2_inc_spellhook" void AddKeenEffectToWeapon(object oWeapon, float fDuration) { IPSafeAddItemProperty(oWeapon, ItemPropertyKeen(), fDuration, X2_IP_ADDPROP_POLICY_KEEP_EXISTING, TRUE, TRUE); } void main() { // Spellcast Hook Code // Added 2003-07-07 by Georg Zoeller // If you want to make changes to all spells, // check x2_inc_spellhook.nss to find out more if ( !X2PreSpellCastCode() ) // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell. return; // End of Spellcast Hook. // Declare major variables. int nMetaMagic = GetMetaMagicFeat(); float fDuration = TurnsToSeconds(10 * GetCasterLevel(OBJECT_SELF)); if ( nMetaMagic == METAMAGIC_EXTEND ) fDuration *= 2.0; // Duration is +100%. // Get the true target. object oWeapon = IPGetTargetedOrEquippedMeleeWeapon(); if ( GetIsObjectValid(oWeapon) ) { object oPossessor = GetItemPossessor(oWeapon); SignalEvent(oPossessor, EventSpellCastAt(OBJECT_SELF, GetSpellId(), FALSE)); // Only works on slashing weapons. if ( GetSlashingWeapon(oWeapon) ) { if ( fDuration > 0.0 ) { // Impact visual effect. ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_SUPER_HEROISM), oPossessor); // Spell expiration visual. ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE), oPossessor, fDuration); // Add the bonus to the weapon. AddKeenEffectToWeapon(oWeapon, fDuration); } } else FloatingTextStrRefOnCreature(83621, OBJECT_SELF); // "* Invalid Target - This spell must be cast on a slashing weapon *" } else FloatingTextStrRefOnCreature(83615, OBJECT_SELF); // "* Spell Failed - Target must be a melee weapon or creature with a melee weapon equipped *" }