enderalse/scripts/source/_00e_a1_skaraggstancesc.psc
2021-10-06 00:59:59 +02:00

124 lines
4.5 KiB
Plaintext

Scriptname _00E_A1_SkaraggStanceSC extends activemagiceffect
Import _00E_TalentLibrary
Import Math
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnEffectStart(Actor akTarget, Actor akCaster)
If akCaster.HasPerk(_00E_A1_SkaraggStanceResistPerk)
akCaster.RemovePerk(_00E_A1_SkaraggStanceResistPerk)
akCaster.RemovePerk(_00E_A1_SkaraggStanceDamagePerk)
akCaster.RemovePerk(_00E_A1_SkaraggStanceStaggerPerk)
akCaster.RemoveSpell(_00E_A1_SkaraggStanceDisplay01)
akCaster.RemoveSpell(_00E_A1_SkaraggStanceDisplay02)
akCaster.RemoveSpell(_00E_A1_SkaraggStanceDisplay03)
Debug.Notification(Levelsystem._00E_Levelsystem_sAbilityStanceSkaragg.GetName() + " " + Levelsystem._00E_Levelsystem_sAbilityStanceEnded.GetName())
_00E_DispelStance.Play(akCaster)
Else
If akCaster.HasMagicEffectWithKeyword(StanceKeyword)
_00E_A1_QyraiStanceSP.Cast(akCaster)
EndIf
If _00E_DisableSkillTutorials.GetvalueInt() == 0
_00E_A1_Tutorial_Stances.ShowAsHelpMessage("Stance", 5, 1, 1)
EndIf
iIndex = GetPlayerTalentLevel(_00E_Class_Rage_P05_Talent_SkaraggStance, _00E_Class_Rage_P05_Talent_SkaraggStance2, _00E_Class_Rage_P05_Talent_SkaraggStance3)
AdjustStancePerk()
_00E_A1_SkaraggStanceIMOD.Apply()
if !akCaster.HasPerk(_00E_A1_SkaraggStanceResistPerk)
akCaster.AddPerk(_00E_A1_SkaraggStanceResistPerk)
EndIf
if !akCaster.HasPerk(_00E_A1_SkaraggStanceDamagePerk)
akCaster.AddPerk(_00E_A1_SkaraggStanceDamagePerk)
EndIf
if !akCaster.HasPerk(_00E_A1_SkaraggStanceStaggerPerk)
akCaster.AddPerk(_00E_A1_SkaraggStanceStaggerPerk)
EndIf
if iIndex == 1
if !akCaster.HasSpell(_00E_A1_SkaraggStanceDisplay01)
akCaster.AddSpell(_00E_A1_SkaraggStanceDisplay01, False)
EndIf
elseif iIndex == 2
if !akCaster.HasSpell(_00E_A1_SkaraggStanceDisplay02)
akCaster.AddSpell(_00E_A1_SkaraggStanceDisplay02, False)
EndIf
elseif iIndex == 3
if !akCaster.HasSpell(_00E_A1_SkaraggStanceDisplay03)
akCaster.AddSpell(_00E_A1_SkaraggStanceDisplay03, False)
EndIf
EndIf
_00E_A1_SkaraggStanceSound.Play(akCaster)
GhostRedFXShader.Play(akCaster)
Debug.Notification(Levelsystem._00E_Levelsystem_sAbilityStanceSkaragg.GetName() + " " + Levelsystem._00E_Levelsystem_sAbilityStanceStarted.GetName())
Utility.Wait(4)
GhostRedFXShader.Stop(akCaster)
Endif
EndEvent
;=====================================================================================
; Function
;=====================================================================================
Function AdjustStancePerk()
float iResistMalus = abs((_00E_A1_SkaraggStanceSP.GetNthEffectMagnitude(iIndex)/100) + 1)
float iDamageBonus = abs((_00E_A1_SkaraggStanceSP.GetNthEffectMagnitude(iIndex + 3)/100) +1)
float iStaggerBonus = abs(_00E_A1_SkaraggStanceSP.GetNthEffectMagnitude(iIndex + 6))
;added in new perks because of strange functionality of SetNthEntryValue()
_00E_A1_SkaraggStanceResistPerk.SetNthEntryValue(0, 0, iResistMalus)
_00E_A1_SkaraggStanceDamagePerk.SetNthEntryValue(0, 0, iDamageBonus)
_00E_A1_SkaraggStanceStaggerPerk.SetNthEntryValue(0, 0, iStaggerBonus)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
int iIndex
_00E_QuestFunctions Property Levelsystem Auto
Perk Property _00E_A1_SkaraggStanceResistPerk Auto
Perk Property _00E_A1_SkaraggStanceDamagePerk Auto
Perk Property _00E_A1_SkaraggStanceStaggerPerk Auto
Keyword Property StanceKeyword Auto
Perk Property _00E_Class_Rage_P05_Talent_SkaraggStance Auto
Perk Property _00E_Class_Rage_P05_Talent_SkaraggStance2 Auto
Perk Property _00E_Class_Rage_P05_Talent_SkaraggStance3 Auto
ImageSpaceModifier Property _00E_A1_SkaraggStanceIMOD Auto
Sound Property _00E_A1_SkaraggStanceSound Auto
Sound Property _00E_DispelStance Auto
Message Property _00E_A1_Tutorial_Stances Auto
Spell Property _00E_A1_SkaraggStanceSP Auto
Spell Property _00E_A1_SkaraggStanceDisplay01 Auto
Spell Property _00E_A1_SkaraggStanceDisplay02 Auto
Spell Property _00E_A1_SkaraggStanceDisplay03 Auto
Spell Property _00E_A1_QyraiStanceSP Auto
EffectShader Property GhostRedFXShader Auto
GlobalVariable Property _00E_DisableSkillTutorials Auto