enderalse/source/scripts/_00e_fs_psychosissc.psc

81 lines
2.6 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.HasMagicEffect(_00E_FS_PsychosisWeaknessVisualME) == False
If akVictim.HasSpell(_00E_FS_PsychosisCounter_01_SP) == False
akVictim.AddSpell(_00E_FS_PsychosisCounter_01_SP, False)
ElseIf akVictim.HasSpell(_00E_FS_PsychosisCounter_02_SP) == False
akVictim.AddSpell(_00E_FS_PsychosisCounter_02_SP, False)
Else
AddDebuff()
EndIf
EndIf
EndFunction
Function AddDebuff()
Spell weaknessSpell = _00E_FS_PsychosisWeaknessSP_NoSlow
If caster == PlayerREF
If PlayerREF.HasPerk(_00E_Class_Sinistrope_P08_C_Illusionist)
weaknessSpell = _00E_FS_PsychosisWeaknessSP
EndIf
_00E_FS_Psychosis_Weakened.Show()
EndIf
Float fResist = caster.GetActorValue("Illusion") * 0.5
weaknessSpell.SetNthEffectMagnitude(0, fResist)
weaknessSpell.SetNthEffectMagnitude(1, fResist)
weaknessSpell.SetNthEffectMagnitude(2, fResist)
weaknessSpell.SetNthEffectMagnitude(3, fResist)
weaknessSpell.SetNthEffectMagnitude(4, fResist)
weaknessSpell.SetNthEffectMagnitude(5, fResist)
weaknessSpell.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
Perk Property _00E_Class_Sinistrope_P08_C_Illusionist Auto
Spell Property _00E_FS_PsychosisWeaknessSP Auto
Spell Property _00E_FS_PsychosisWeaknessSP_NoSlow Auto
MagicEffect Property _00E_FS_PsychosisWeaknessVisualME Auto
Spell Property _00E_FS_PsychosisCounter_01_SP Auto
Spell Property _00E_FS_PsychosisCounter_02_SP Auto
Message Property _00E_FS_Psychosis_Weakened Auto