enderalse/source/scripts/_00e_fs_psychosissc.psc

81 lines
2.4 KiB
Plaintext

Scriptname _00E_FS_PsychosisSC extends activemagiceffect
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnEffectStart(Actor akTarget, Actor akCaster)
caster = akCaster
akVictim = akTarget
CheckForPsychosis()
EndEvent
Event OnEffectFinish(Actor akCaster, Actor akTarget)
akVictim.RemoveSpell(_00E_FS_PsychosisCounter_01_SP)
akVictim.RemoveSpell(_00E_FS_PsychosisCounter_02_SP)
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function CheckForPsychosis()
If !akVictim.HasSpell(_00E_FS_PsychosisWeaknessSP)
If !akVictim.HasSpell(_00E_FS_PsychosisCounter_01_SP)
akVictim.AddSpell(_00E_FS_PsychosisCounter_01_SP, False)
ElseIf akVictim.HasSpell(_00E_FS_PsychosisCounter_01_SP) && !akVictim.HasSpell(_00E_FS_PsychosisCounter_02_SP)
akVictim.AddSpell(_00E_FS_PsychosisCounter_02_SP, false)
Else
AddDebuff()
EndIf
EndIf
EndFunction
Function AddDebuff()
If caster == PlayerREF
_00E_FS_Psychosis_Weakened.Show()
EndIf
float fResist = caster.GetActorValue("Illusion")/2
_00E_FS_PsychosisWeaknessSP.SetNthEffectMagnitude(0, fResist)
_00E_FS_PsychosisWeaknessSP.SetNthEffectMagnitude(1, fResist)
_00E_FS_PsychosisWeaknessSP.SetNthEffectMagnitude(2, fResist)
_00E_FS_PsychosisWeaknessSP.SetNthEffectMagnitude(3, fResist)
_00E_FS_PsychosisWeaknessSP.SetNthEffectMagnitude(4, fResist)
_00E_FS_PsychosisWeaknessSP.SetNthEffectMagnitude(5, fResist)
_00E_FS_PsychosisWeaknessSP.Cast(akVictim, akVictim)
akVictim.RemoveSpell(_00E_FS_PsychosisCounter_01_SP)
akVictim.RemoveSpell(_00E_FS_PsychosisCounter_02_SP)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
Actor akVictim
Actor caster
Actor Property PlayerREF Auto
Spell Property _00E_FS_PsychosisWeaknessSP Auto
Spell Property _00E_FS_PsychosisCounter_01_SP Auto
Spell Property _00E_FS_PsychosisCounter_02_SP Auto
Message Property _00E_FS_Psychosis_Weakened Auto