enderalse/source/scripts/_00e_overstrainsc.psc
2024-02-12 18:21:08 +01:00

105 lines
2.9 KiB
Plaintext

Scriptname _00E_OverstrainSC extends activemagiceffect
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnEffectStart(Actor akTarget, Actor akCaster)
If akTarget.HasMagicEffect(_00E_FS_Overstrain_TimerME)
_00E_FS_OverstrainImmunity.Show()
Else
akTargetREF = akTarget
akCasterREF = akCaster
bAwardXP = (akCasterREF == None || (akCasterREF.GetFactionRank(EPFaction) >= 0) || akCasterREF.HasEffectKeyword(BlameSpellKeyword))
if SKSE.GetVersion()
fMagnitude = GetMagnitude()
endif
fDamageMagnitude = fMagnitude * akCasterREF.GetActorValue("Illusion") / 5
EndIf
EndEvent
Event OnSpellCast(Form akSpell)
CastStun()
EndEvent
Event OnDying(Actor akKiller)
_00E_EPOnDeath akVictim = ((akTargetREF as ObjectReference) as _00E_EPOnDeath)
If iStunStage >= 2 && bAwardXP && akVictim
akVictim.HasBlameSpell = true
EndIf
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function CastStun()
If iStunStage > 0 || akTargetREF == None
Return
EndIf
iStunStage = 1
akTargetREF.PlaceAtMe(_00E_FS_OverstrainEXP)
_00E_Ability_StaggerSelfSpell.RemoteCast(akTargetREF, akCasterREF, akTargetREF)
iStunStage = 2
if SKSE.GetVersion()
_00E_FS_OverstrainDMGSP.SetNthEffectMagnitude(0, fDamageMagnitude)
_00E_FS_OverstrainDMGSP.Cast(akTargetREF, akTargetREF)
else
; taper magnitude = effect magnitude * Taper Weight * Taper Duration / (Taper Curve + 1)
; does not match SKSE damage, needs improvement
akTargetREF.DamageActorValue("Health", fDamageMagnitude + fDamageMagnitude * 0.3 * 1.0 / (2.0 + 1))
endif
IllusionNegativeFXS.Play(akTargetREF)
MAGIllusionReleaseAimedSDM.Play(akTargetREF)
IllusionDark01Imod.Apply()
_00E_FS_OverstrainImmunitySP.Cast(akTargetREF, akTargetREF)
Self.Dispel()
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
Actor akTargetREF
Actor akCasterREF
Bool bAwardXP
Int iStunStage
float fDamageMagnitude
Spell Property _00E_Ability_StaggerSelfSpell Auto
Spell Property _00E_FS_OverstrainDMGSP Auto
Spell Property _00E_FS_OverstrainImmunitySP Auto
Sound Property MAGIllusionReleaseAimedSDM Auto
EffectShader Property IllusionNegativeFXS Auto
MagicEffect Property _00E_FS_Overstrain_TimerME Auto
Message Property _00E_FS_OverstrainImmunity Auto
Explosion Property _00E_FS_OverstrainEXP Auto
ImageSpaceModifier Property IllusionDark01Imod Auto
Keyword Property BlameSpellKeyword Auto
Faction Property EPFaction Auto
Float Property fMagnitude = 7.0 Auto