enderalse/scripts/source/_00e_theriantrophist_chymikum.psc
2021-10-06 00:59:59 +02:00

104 lines
2.9 KiB
Plaintext

Scriptname _00E_Theriantrophist_Chymikum extends _00E_Theriantrophist_WerewolfPotion
; base script for all chymikums, that provides the basic functionality
; concrete chymikums should extend this script and override at least OnChymikumEffectStart
; and OnChymikumEffectEnd, optionally they can also override OnPlayerLoadGame and OnCombatHit
; if this functionality is required
import EnderalLib
_00E_Theriantrophist_PlayerAsWerewolf Property playerWhileTransformedAlias Auto
Message Property _00E_Theriantrophist_CannotDrinkPotion Auto
Message Property _00E_Theriantrophist_TooManyChyimkums Auto
Perk Property _00E_Class_Theriantrophist_P01_StrongBlood Auto
Spell Property _00E_Theriantrophist_PoisonOnWerewolfPotion Auto
Quest Property FS_NQ11 Auto
GlobalVariable Property _00E_FS_Theriantrophist_MaxChymikums Auto
bool active
Event OnEffectStart(Actor akTarget, Actor akCaster)
if akTarget == Game.GetPlayer()
if !akTarget.HasPerk(_00E_Class_Theriantrophist_P01_StrongBlood)
_00E_Theriantrophist_CannotDrinkPotion.Show()
_00E_Theriantrophist_PoisonOnWerewolfPotion.Cast(akTarget)
self.dispel()
return
Endif
if playerWhileTransformedAlias.CalcRegisteredChymikumCount() > (_00E_FS_Theriantrophist_MaxChymikums.GetValueInt() - 1)
Debug.Notification(_00E_Theriantrophist_TooManyChyimkums.getName())
_00E_Theriantrophist_PoisonOnWerewolfPotion.Cast(akTarget)
self.dispel()
return
Endif
playerWhileTransformedAlias.RegisterChymikum(self)
if (playerWhileTransformedAlias.IsTransformed())
active = true
OnChymikumEffectStart(akTarget)
Endif
endif
Endevent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
playerWhileTransformedAlias.UnRegisterChymikum(self)
if (active)
active = false
OnChymikumEffectFinish(akTarget)
Endif
Self.Dispel()
Endevent
Function OnWolfFormStart()
active = true
OnChymikumEffectStart(self.GetTargetActor())
EndFunction
Function OnWolfFormFinish()
active = false
OnChymikumEffectFinish(self.getTargetActor())
EndFunction
Bool Function isActive()
return active
Endfunction
Function OnPlayerLoadGame()
Endfunction
Function OnCombatHit(Actor target)
EndFunction
Function OnChymikumEffectStart(Actor target)
;Debug.Notification("Chymikum effect started")
MagicEffect[] effects = new MagicEffect[1]
effects[0] = self.getBaseObject()
float[] magnitudes = new float[1]
magnitudes[0] = 0
int[] areas = new int[1]
areas[0] = 0
int[] durations = new int[1]
durations[0] = 100
Potion pot = EnderalLib.createPotion(effects, magnitudes, areas, durations, 1)
Game.getPlayer().addItem(pot)
If !FS_NQ11.IsObjectiveCompleted(25)
FS_NQ11.SetObjectiveCompleted(25)
EndIf
EndFunction
Function OnChymikumEffectFinish(Actor target)
; Nothing
Endfunction
_00E_Theriantrophist_DetoxEffCarrier Function GetDetoxificationEffectCarrier()
return (self as activemagiceffect) as _00E_Theriantrophist_DetoxEffCarrier
EndFunction