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.
 
 
 

98 lines
2.6 KiB

Scriptname _00E_BoneSpiritControlScript extends Quest
Event OnInit()
RegisterForSingleUpdate(3.0)
EndEvent
Event OnUpdate()
If bSetupDone == False
Setup()
EndIf
EndEvent
Function Setup()
boneSpiritSpells = New Spell[12]
boneSpiritMagnitudes = New Float[12]
Actor PlayerRef = Game.GetPlayer()
Form[] spells = _00E_FS_Entropy_BoneSpiritSpells.ToArray()
Int Index = 0
Bool bPlayerHasBoneSpirits = False
While Index < spells.Length
boneSpiritSpells[Index] = spells[Index] as Spell
boneSpiritMagnitudes[Index] = boneSpiritSpells[Index].GetNthEffectMagnitude(0)
If bPlayerHasBoneSpirits == False && PlayerRef.HasSpell(boneSpiritSpells[Index])
bPlayerHasBoneSpirits = True
EndIf
Index += 1
EndWhile
; Mid-game version update
If bPlayerHasBoneSpirits
Index = 0
While Index < boneSpiritSpells.Length && boneSpiritSpells[Index]
Spell spellBoneSpirit = boneSpiritSpells[Index]
If spellBoneSpirit == _07E_FS_BoneSpirit
boneSpiritMagnitudes[Index] = 11.0
ElseIf spellBoneSpirit == _17E_FS_BoneSpirit
boneSpiritMagnitudes[Index] = 17.0
ElseIf spellBoneSpirit == _25E_FS_BoneSpirit
boneSpiritMagnitudes[Index] = 22.0
ElseIf spellBoneSpirit == _40E_FS_BoneSpirit
boneSpiritMagnitudes[Index] = 30.0
ElseIf spellBoneSpirit == _50E_FS_BoneSpirit
boneSpiritMagnitudes[Index] = 38.0
EndIf
Index += 1
EndWhile
RestoreSpellMagnitudes()
EndIf
bSetupDone = True
EndFunction
Float Function GetOriginalSpellDamage(Spell spellBoneSpirit)
If bSetupDone == False
Setup()
EndIf
Int Index = 0
While Index < boneSpiritSpells.Length && boneSpiritSpells[Index] && boneSpiritSpells[Index] != spellBoneSpirit
Index += 1
EndWhile
If Index >= boneSpiritSpells.Length
Debug.Trace(self + ", RegisterSpell: ERROR - out of free slots for spells")
Return spellBoneSpirit.GetNthEffectMagnitude(0)
EndIf
If boneSpiritSpells[Index] == None
boneSpiritSpells[Index] = spellBoneSpirit
boneSpiritMagnitudes[Index] = spellBoneSpirit.GetNthEffectMagnitude(0)
EndIf
Return boneSpiritMagnitudes[Index]
EndFunction
Function RestoreSpellMagnitudes()
Int Index = 0
While Index < boneSpiritSpells.Length && boneSpiritSpells[Index]
boneSpiritSpells[Index].SetNthEffectMagnitude(0, boneSpiritMagnitudes[Index])
Index += 1
EndWhile
EndFunction
Spell[] boneSpiritSpells
Float[] boneSpiritMagnitudes
Bool bSetupDone
Formlist Property _00E_FS_Entropy_BoneSpiritSpells Auto
Spell Property _07E_FS_BoneSpirit Auto
Spell Property _17E_FS_BoneSpirit Auto
Spell Property _25E_FS_BoneSpirit Auto
Spell Property _40E_FS_BoneSpirit Auto
Spell Property _50E_FS_BoneSpirit Auto