Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //::///////////////////////////////////////////////
- //:: Harpies Captivating Song
- //:: x2_s1_harpycry
- //:: Copyright (c) 2003 Bioware Corp.
- //:://////////////////////////////////////////////
- /*
- Will daze any creature failing saving a will throw
- Dazed creatures will be unable to take any action other than move toward the captivating song
- Captivating song in a 10 meter radius
- If cast by a Shifter
- DC 15 + Shifter Level /3
- Duration 4 rounds + Performance Skill Ranks/4
- Otherwise assume it is a harpy
- DC = 10 + HD/3 + Cha Bonus + (SpellFocusFeats)
- Duration = 2 + HD/3 + Performance Skill Ranks/4
- */
- //:://////////////////////////////////////////////
- //:: Created By: Georg Zoeller 2003/07/08
- //:: Modified: The Magus (2012 feb 20) DC scaling, scry devices
- //:: Modified: The Magus (2012 nov 25) added Captivation behavior - CaptivatedBy()
- //:://////////////////////////////////////////////
- #include "X0_I0_SPELLS"
- effect GetThisSpellEffect(object oTarget, object oCaster, effect eTest);
- void CaptivatedBy(object oHarpy, effect eThis);
- void main()
- {
- object oTarget;
- object oHarpy = OBJECT_SELF;
- string sHarpy = ObjectToString(OBJECT_SELF);
- int nPerform = GetSkillRank(SKILL_PERFORM);
- int nHD = GetHitDice(OBJECT_SELF);
- SetLocalInt(OBJECT_SELF, "CAPTIVATING_INFLUENCE", nHD+GetAbilityScore(OBJECT_SELF,ABILITY_CHARISMA)+nPerform);
- int bPC = GetIsPC(OBJECT_SELF);
- effect eVis = EffectVisualEffect(VFX_IMP_CHARM);
- effect eDaze = EffectDazed();
- eDaze = EffectLinkEffects(EffectVisualEffect(VFX_DUR_MIND_AFFECTING_NEGATIVE), eDaze);
- eDaze = EffectLinkEffects(EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE), eDaze);
- eDaze = SupernaturalEffect(eDaze);
- location lSpLoc = GetLocation(OBJECT_SELF);
- int nSpellId = GetSpellId();
- int nDuration;
- int nSaveDC;
- int nShifter = GetLevelByClass(CLASS_TYPE_SHIFTER);
- if(nShifter)
- {
- nSaveDC = 15+ (nShifter/3);
- nDuration = 4 + (nPerform/4);
- }
- else
- {
- int nDCAdj = GetAbilityModifier(ABILITY_CHARISMA);
- if(nDCAdj<0){nDCAdj=0;}
- if(GetHasFeat(FEAT_SPELL_FOCUS_ENCHANTMENT))
- nDCAdj +=2;
- if(GetHasFeat(FEAT_GREATER_SPELL_FOCUS_ENCHANTMENT))
- nDCAdj +=2;
- nSaveDC = 10 +(nHD/3)+nDCAdj;
- nDuration = 2 +(nHD/3)+(nPerform/4);
- }
- float fDuration = RoundsToSeconds(nDuration);
- // Apply VFX of casting on Self
- int nSong = 1930 + d6(); // new vfxs for captivating song - the magus
- effect eSong = EffectVisualEffect(nSong);
- effect eImpact = EffectVisualEffect(VFX_FNF_LOS_NORMAL_30);
- ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSong, OBJECT_SELF, fDuration);
- ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eImpact, lSpLoc);
- object oSensor;
- //float fDelay;
- oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, lSpLoc);
- while (GetIsObjectValid(oTarget) )
- {
- // Scrying devices link to the caster - MAGUS
- int bSensor;
- oSensor = GetLocalObject(oTarget, "SCRY_PC");
- if(GetIsObjectValid(oSensor))
- {
- oTarget = oSensor;
- bSensor = TRUE;
- }
- if( spellsIsTarget(oTarget, SPELL_TARGET_SELECTIVEHOSTILE, OBJECT_SELF)
- && !GetHasEffect(EFFECT_TYPE_SILENCE,oTarget)
- && !GetHasEffect(EFFECT_TYPE_DEAF,oTarget)
- )
- {
- //Fire cast spell at event for the specified target
- SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, nSpellId));
- //Make an SR check
- if(MyResistSpell(OBJECT_SELF, oTarget)<1)
- {
- //Make a Will save to negate
- if (!MySavingThrow(SAVING_THROW_WILL, oTarget, nSaveDC, SAVING_THROW_TYPE_MIND_SPELLS))
- {
- if(bPC)
- SetPCLike(oTarget, OBJECT_SELF);
- //Apply the VFX impact
- ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
- //Captivate the target - the magus
- ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDaze, oTarget, fDuration);
- if(!bSensor) // not possible to travel toward the harpy
- {
- SetLocalInt(oTarget,"CAPTIVATING_SONG_FIRST_"+sHarpy, TRUE);
- AssignCommand(oTarget, CaptivatedBy( oHarpy, GetThisSpellEffect(oTarget, oHarpy, eDaze) ));
- }
- }
- }
- }
- //Get next target in spell area
- oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, lSpLoc);
- }
- }
- void CaptivatedBy(object oHarpy, effect eThis)
- {
- SetCommandable(TRUE);
- string sID = ObjectToString(oHarpy);
- string sCaptivator = GetLocalString(OBJECT_SELF, "CAPTIVATING_SONG_ID");
- int nSongInfluence = GetLocalInt(OBJECT_SELF, "CAPTIVATING_SONG_INFLUENCE");
- int nCompetingSong = GetLocalInt(oHarpy, "CAPTIVATING_INFLUENCE");
- if( !GetIsEffectValid(GetThisSpellEffect(OBJECT_SELF, oHarpy, eThis))
- || GetIsDead(oHarpy)
- || !GetIsObjectValid(oHarpy)
- || GetIsDead(OBJECT_SELF)
- )
- {
- if(sID==sCaptivator)
- {
- DeleteLocalString(OBJECT_SELF, "CAPTIVATING_SONG_ID");
- DeleteLocalInt(OBJECT_SELF, "CAPTIVATING_SONG_INFLUENCE");
- }
- return;
- }
- if( sCaptivator!=sID)
- {
- if(nSongInfluence<nCompetingSong)
- {
- if(GetLocalInt(OBJECT_SELF,"CAPTIVATING_SONG_FIRST_"+sID))
- {
- DeleteLocalInt(OBJECT_SELF,"CAPTIVATING_SONG_FIRST_"+sID);
- ClearAllActions(TRUE);
- }
- SetLocalString(OBJECT_SELF, "CAPTIVATING_SONG_ID", sID);
- SetLocalInt(OBJECT_SELF, "CAPTIVATING_SONG_INFLUENCE", nCompetingSong);
- }
- else
- {
- DelayCommand(3.0, CaptivatedBy(oHarpy, eThis));
- SetCommandable(FALSE);
- return;
- }
- }
- if(GetCurrentAction()!=ACTION_MOVETOPOINT)
- ActionMoveToObject(oHarpy);
- DelayCommand(3.0, CaptivatedBy(oHarpy, eThis));
- SetCommandable(FALSE);
- }
- effect GetThisSpellEffect(object oTarget, object oCaster, effect eTest)
- {
- effect eEff = GetFirstEffect(oTarget);
- int nLoop;
- while(GetIsEffectValid(eEff))
- {
- if(GetEffectCreator(eEff)==oCaster)
- {
- if(eEff==eTest)
- {
- return eEff;
- }
- }
- eEff = GetNextEffect(oTarget);
- }
- return eEff;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement