enderalse/scripts/source/_00e_theriantrophist_detoxification.psc

62 lines
2.6 KiB
Plaintext

Scriptname _00E_Theriantrophist_Detoxification extends activemagiceffect
Activator Property _00E_A4_Theriantrophist_DetoxificationPoisonCloud Auto
Spell Property _00E_A4_Theriantrophist_DetoxificationPoisonSP Auto
_FS_TheriantrophistControlQuest Property TheriantrophistControlQuest Auto
Hazard Property _00E_A4_Theriantrophist_DetoxificationPoisonCloudInvisibleHazard Auto
Message Property _00E_Theriantrophist_NotInWolfForm Auto
GlobalVariable Property _00E_Theriantrophist_Detoxification_ParalysisEnabled Auto
Shout Property _00E_A4_Theriantrophist_Detoxification Auto
Perk Property _00E_Class_Theriantrophist_P08_Detoxification_01 Auto
Perk Property _00E_Class_Theriantrophist_P08_Detoxification_02 Auto
Perk Property _00E_Class_Theriantrophist_P08_Detoxification_03 Auto
ObjectReference poisonCloudVisual
ObjectReference poisonCloudEffect
Event OnEffectStart(Actor akTarget, Actor akCaster)
if TheriantrophistControlQuest.IsTransformed()
_SpawnPoisonCloud(akTarget)
Else
_00E_Theriantrophist_NotInWolfForm.Show()
(akCaster as _00E_Game_TalentControlSC).SetTalentRecoveryTime(_00E_A4_Theriantrophist_Detoxification, 0)
Endif
EndEvent
Function _SpawnPoisonCloud(Actor akTarget)
poisonCloudVisual = akTarget.PlaceAtMe(_00E_A4_Theriantrophist_DetoxificationPoisonCloud, abInitiallyDisabled = true)
_AdjustPoisonSpell()
poisonCloudVisual.moveto(akTarget, 0, 0, 200)
poisonCloudVisual.enable()
Utility.Wait(0.5)
poisonCloudEffect = akTarget.PlaceAtMe(_00E_A4_Theriantrophist_DetoxificationPoisonCloudInvisibleHazard)
poisonCloudVisual.playAnimation("playAnim02")
EndFunction
Function _AdjustPoisonSpell()
Int talentLevel = _00E_TalentLibrary.GetPlayerTalentLevel(_00E_Class_Theriantrophist_P08_Detoxification_01, _00E_Class_Theriantrophist_P08_Detoxification_02, _00E_Class_Theriantrophist_P08_Detoxification_03)
Float chanceToKeepChymikum = (talentLevel - 1) * 0.25
_00E_Theriantrophist_Detoxification_ParalysisEnabled.SetValue(0)
Int i = _00E_A4_Theriantrophist_DetoxificationPoisonSP.getNumEffects()
While i > 0
i = i - 1
_00E_A4_Theriantrophist_DetoxificationPoisonSP.SetNthEffectMagnitude(i, 0)
Endwhile
_00E_Theriantrophist_PlayerAsWerewolf werewolf = TheriantrophistControlQuest.playerWhileTransformed
i = werewolf.CalcRegisteredChymikumCount()
While i > 0
i = i - 1
_00E_Theriantrophist_Chymikum chymikum = werewolf.CalcNthRegisteredChymikum(i)
chymikum.GetDetoxificationEffectCarrier().PrepareEffect()
if Utility.RandomFloat() >= chanceToKeepChymikum
chymikum.dispel()
Endif
EndWhile
EndFunction
Event OnEffectFinish(Actor akTarget, Actor akCaster)
poisonCloudVisual.delete()
poisonCloudEffect.delete()
Endevent