74 lines
2.2 KiB
Plaintext
74 lines
2.2 KiB
Plaintext
Scriptname _00E_FS_FortifySummonsSC extends activemagiceffect
|
|
|
|
Actor Property PlayerREF Auto
|
|
Perk Property _00E_FS_PhasmalistEnchantment Auto
|
|
|
|
Actor Target
|
|
|
|
Event OnEffectStart(Actor akTarget, Actor akCaster)
|
|
Target = akTarget
|
|
|
|
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
|
|
EndEvent
|
|
|
|
Event OnUpdate()
|
|
AdjustValues(False)
|
|
RegisterForSingleUpdate(3)
|
|
EndEvent
|
|
|
|
Function AdjustValues(Bool bForceEnchantmentStrength)
|
|
Float fNewModifier = PlayerREF.GetActorValue("FavorPointsBonus") / 100.0
|
|
Float fOldModifier = Target.GetActorValue("FavorPointsBonus") / 100.0
|
|
|
|
If (fNewModifier != fOldModifier) || bForceEnchantmentStrength
|
|
_00E_FS_PhasmalistEnchantment.SetNthEntryValue(0, 0, 1.0 + fNewModifier)
|
|
EndIf
|
|
|
|
If fNewModifier == fOldModifier
|
|
Return ; Nothing changed
|
|
EndIf
|
|
|
|
Float fMaxHealth = GetTargetMaxValue("Health")
|
|
Float fMaxMagicka = GetTargetMaxValue("Magicka")
|
|
|
|
Target.SetActorValue("FavorPointsBonus", fNewModifier * 100.0)
|
|
Target.ModActorValue("AttackDamageMult", fNewModifier - fOldModifier)
|
|
|
|
if fMaxHealth > 0
|
|
AdjustTargetMainValue("Health", "FavorsPerDay", fMaxHealth, fNewModifier)
|
|
endif
|
|
|
|
if fMaxMagicka > 0
|
|
AdjustTargetMainValue("Magicka", "FavorsPerDayTimer", fMaxMagicka, fNewModifier)
|
|
endif
|
|
|
|
EndFunction
|
|
|
|
Float Function GetTargetMaxValue(String sValueName)
|
|
Float fValue = Target.GetActorValue(sValueName)
|
|
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
|
|
|
|
Float Function AdjustTargetMainValue(String sValueName, String sStoreValueName, Float fMaxValue, Float fNewModifier)
|
|
Float fNewBuff = Math.Floor(fMaxValue * fNewModifier)
|
|
Float fOldBuff = Target.GetActorValue(sStoreValueName)
|
|
If fNewBuff != fOldBuff
|
|
Target.ModActorValue(sValueName, fNewBuff - fOldBuff)
|
|
Target.SetActorValue(sStoreValueName, fNewBuff)
|
|
EndIf
|
|
EndFunction
|