4
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

104 lines
2.9 KiB

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