enderalse/source/scripts/_00e_fs_dreameatersc.psc

91 lines
2.6 KiB
Plaintext

Scriptname _00E_FS_DreameaterSC extends activemagiceffect
{Dreameater bonus damage}
;=====================================================================================
; EVENTS
;=====================================================================================
event OnEffectStart(Actor akTarget, Actor akCaster)
if SKSE.GetVersion()
fMagnitude = GetMagnitude()
endif
endevent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
if ! fMagnitude
fMagnitude = akTarget.GetActorValue(sActorValue)
endif
akTarget.RestoreActorValue(sActorValue, fMagnitude)
if akTarget.IsDead()
return
endif
Float fBonusDamage = fMagnitude * akCaster.GetActorValue("Illusion") / 3.0
If fBonusDamage < fMagnitude
fBonusDamage = fMagnitude
EndIf
; Sneak bonus
If IsExtraDamageApplicable(akTarget, akCaster)
Float fStealthModifier = Game.GetGameSettingFloat("fCombatSneakBowMult")
If akCaster.HasPerk(_00E_Class_Infiltrator_P03_B_HeartShot)
fStealthModifier = fStealthModifier * _00E_Class_Infiltrator_P03_B_HeartShot.GetNthEntryValue(0, 0)
EndIf
If akCaster == PlayerREF
_00E_FS_FakeStealthMsg.Show(fStealthModifier)
UISneakAttackM.Play(akCaster)
EndIf
fBonusDamage = fBonusDamage * fStealthModifier
EndIf
; Target's magic resistance
Float fMagicResist = akTarget.GetActorValue("MagicResist")
If fMagicResist > 0
fBonusDamage = fBonusDamage * (100.0 - fMagicResist) / 100.0
EndIf
akTarget.DamageActorValue("Health", fBonusDamage)
If akTarget.HasMagicEffect(_00E_FS_PsychosisWeaknessVisualME)
akTarget.DispelSpell(_00E_FS_PsychosisWeaknessSP)
akTarget.DispelSpell(_00E_FS_PsychosisWeaknessSP_NoSlow)
EndIf
EndEvent
Bool Function IsExtraDamageApplicable(Actor akTarget, Actor akCaster)
If akTarget.HasMagicEffect(_00E_FS_PsychosisWeaknessVisualME)
Return True
EndIf
If akCaster.IsDetectedBy(akTarget) == False
akTarget.GetCombatState()
If akTarget.GetCombatState() != 1
Return True
EndIf
EndIf
Return False
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
float fMagnitude
String Property sActorValue = "FavorActive" Auto
Actor Property PlayerREF Auto
MagicEffect Property _00E_FS_PsychosisWeaknessVisualME Auto
Spell Property _00E_FS_PsychosisWeaknessSP Auto
Spell Property _00E_FS_PsychosisWeaknessSP_NoSlow Auto
Perk Property _00E_Class_Infiltrator_P03_B_HeartShot Auto ; 2.5
Message Property _00E_FS_FakeStealthMsg Auto
Sound Property UISneakAttackM Auto