2021-10-05 22:15:58 +00:00
|
|
|
Scriptname _00E_FS_FortifySummonsSC extends activemagiceffect
|
|
|
|
|
|
|
|
Actor Property PlayerREF Auto
|
|
|
|
Perk Property _00E_FS_PhasmalistEnchantment Auto
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Actor Target
|
|
|
|
|
2021-10-05 22:15:58 +00:00
|
|
|
Event OnEffectStart(Actor akTarget, Actor akCaster)
|
2021-10-05 22:59:59 +00:00
|
|
|
Target = akTarget
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
If Target
|
|
|
|
If PlayerREF == None
|
|
|
|
PlayerREF = Game.GetPlayer()
|
|
|
|
EndIf
|
|
|
|
If _00E_FS_PhasmalistEnchantment == None
|
|
|
|
_00E_FS_PhasmalistEnchantment = Game.GetFormFromFile(0x102F5A1, "Enderal - Forgotten Stories.esm") as Perk
|
|
|
|
EndIf
|
|
|
|
AdjustValues(True)
|
|
|
|
RegisterForSingleUpdate(3)
|
|
|
|
EndIf
|
2021-10-05 22:15:58 +00:00
|
|
|
EndEvent
|
|
|
|
|
|
|
|
Event OnUpdate()
|
2021-10-05 22:59:59 +00:00
|
|
|
AdjustValues(False)
|
2021-10-05 22:15:58 +00:00
|
|
|
RegisterForSingleUpdate(3)
|
|
|
|
EndEvent
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Function AdjustValues(Bool bForceEnchantmentStrength)
|
2023-12-08 02:45:53 +00:00
|
|
|
Float fNewModifier = PlayerREF.GetActorValue("FavorPointsBonus") / 100.0
|
|
|
|
Float fOldModifier = Target.GetActorValue("FavorPointsBonus") / 100.0
|
2021-10-05 22:59:59 +00:00
|
|
|
|
|
|
|
If (fNewModifier != fOldModifier) || bForceEnchantmentStrength
|
|
|
|
_00E_FS_PhasmalistEnchantment.SetNthEntryValue(0, 0, 1.0 + fNewModifier)
|
2021-10-05 22:15:58 +00:00
|
|
|
EndIf
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
If fNewModifier == fOldModifier
|
|
|
|
Return ; Nothing changed
|
|
|
|
EndIf
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Float fMaxHealth = GetTargetMaxValue("Health")
|
|
|
|
Float fMaxMagicka = GetTargetMaxValue("Magicka")
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2023-12-08 02:45:53 +00:00
|
|
|
Target.SetActorValue("FavorPointsBonus", fNewModifier * 100.0)
|
|
|
|
Target.ModActorValue("AttackDamageMult", fNewModifier - fOldModifier)
|
2021-12-06 15:30:02 +00:00
|
|
|
|
|
|
|
if fMaxHealth > 0
|
|
|
|
AdjustTargetMainValue("Health", "FavorsPerDay", fMaxHealth, fNewModifier)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if fMaxMagicka > 0
|
|
|
|
AdjustTargetMainValue("Magicka", "FavorsPerDayTimer", fMaxMagicka, fNewModifier)
|
|
|
|
endif
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
EndFunction
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Float Function GetTargetMaxValue(String sValueName)
|
2023-12-08 02:45:53 +00:00
|
|
|
Float fValue = Target.GetActorValue(sValueName)
|
2021-10-05 22:59:59 +00:00
|
|
|
Float fPercentage = Target.GetActorValuePercentage(sValueName)
|
|
|
|
If fValue > 0.0 && fPercentage > 0.0
|
|
|
|
Return Math.Ceiling(fValue / fPercentage)
|
|
|
|
Else
|
|
|
|
Return -1.0 ; We are dealing with bad numbers, nothing good would come out of (fValue / fPercentage)
|
|
|
|
EndIf
|
|
|
|
EndFunction
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Float Function AdjustTargetMainValue(String sValueName, String sStoreValueName, Float fMaxValue, Float fNewModifier)
|
|
|
|
Float fNewBuff = Math.Floor(fMaxValue * fNewModifier)
|
2023-12-08 02:45:53 +00:00
|
|
|
Float fOldBuff = Target.GetActorValue(sStoreValueName)
|
2021-10-05 22:59:59 +00:00
|
|
|
If fNewBuff != fOldBuff
|
2023-12-08 02:45:53 +00:00
|
|
|
Target.ModActorValue(sValueName, fNewBuff - fOldBuff)
|
|
|
|
Target.SetActorValue(sStoreValueName, fNewBuff)
|
2021-10-05 22:59:59 +00:00
|
|
|
EndIf
|
|
|
|
EndFunction
|