enderalse/scripts/source/_00e_a2_eldritchbloodplayersc.psc

364 lines
12 KiB
Plaintext
Raw Normal View History

Scriptname _00E_A2_EldritchBloodPlayerSC extends activemagiceffect
Import _00E_TalentLibrary
Import Utility
;=====================================================================================
; EVENTS & STATES
;=====================================================================================
Event OnEffectStart(Actor akTarget, Actor akCaster)
hasAborted = False
iIndex = GetPlayerTalentLevel(_00E_Class_LifeAndDeath_P09b_Talent_EldritchBlood, _00E_Class_LifeAndDeath_P09b_Talent_EldritchBlood2, _00E_Class_LifeAndDeath_P09b_Talent_EldritchBlood3)
If _00E_A2_EldritchBloodGlobal.GetValueInt() == 0
iFrenzyTargetMarked = False
iFrezyAttackTargetMarked = False
GoToState("MarkTargets")
Elseif _00E_A2_EldritchBloodGlobal.GetValueInt() == 1
If iFrenzyTargetMarked
_00E_A2_EldritchBloodGlobal.SetValueInt(2)
GoToState("AddEffect")
Elseif !iFrenzyTargetMarked
_00E_A2_EldritchBloodGlobal.SetValueInt(0)
NotMarkedClearUp()
EndIf
EndIf
EndEvent
Event OnEffectFinish(Actor akTarget, Actor akCaster)
If _00E_A2_EldritchBloodGlobal.GetValueInt() == 1
If iFrenzyTargetMarked && !hasAborted
_00E_A2_EldritchBloodGlobal.SetValueInt(2)
float iRecoveryTime = _00E_A2_EldritchBlood.GetNthRecoveryTime(iIndex - 1)
(PlayerREF as _00E_Game_TalentControlSC).SetTalentRecoveryTime(_00E_A2_EldritchBlood, iRecoveryTime)
GoToState("AddEffect")
Else
NotMarkedClearUp()
EndIf
EndIf
EndEvent
function abort()
hasAborted = true
Self.Dispel()
EndFunction
State MarkTargets
Event OnBeginState()
If _00E_SelectionTutorialShown.GetValueInt() == 0 && _00E_DisableSkillTutorials.GetValueInt() == 0
_00E_Tutorial_SelectionMode.Show()
_00E_SelectionTutorialShown.SetValueInt(1)
EndIf
If _00E_A2_EldritchBloodInDepthTutorial.GetValueInt() == 0 && _00E_DisableSkillTutorials.GetValueInt() == 0
_00E_A2_Tutorial_EldritchBloodDetailed.Show()
_00E_A2_EldritchBloodInDepthTutorial.SetValueInt(1)
EndIf
If _00E_DisableSkillTutorials.GetValueInt() == 0
_00E_A2_Tutorial_EldritchBlood.ShowAsHelpMessage("EldritchBlood", 8, 8, 1)
EndIf
_00E_A2_EldritchBloodGlobal.SetValueInt(1)
(PlayerREF as _00E_Game_TalentControlSC).SetTalentRecoveryTime(_00E_A2_EldritchBlood, 0)
A2_EldritchBlood_Player.ForceRefTo(PlayerREF)
A2_EldritchBlood_PlayerForScript = A2_EldritchBlood_Player as _00E_A2_EldritchBloodPlayerMarkSC
PlayerREF.AddSpell(_00E_A2_EldritchBloodAbSelectionSP, False)
_00E_A2_EldritchBloodSelectionIntroIMOD.Apply()
MarkingLP = _00E_A2_GhostwalkMarkingLPM.Play(playerREF)
MAGConjurePortal.Play(PlayerREF)
A2_EldritchBlood_PlayerForScript.EnterMarkingMode(1800, Self as _00E_A2_EldritchBloodPlayerSC)
Wait(0.5)
_00E_A2_EldritchBloodSelectionHoldIMOD.ApplyCrossFade(1.5)
EndEvent
EndState
State AddEffect
Event OnBeginState()
A2_EldritchBlood_Victim.GetActorReference().RemoveSpell(_00E_A2_EldritchBloodAbMarkedVictimSP)
A2_EldritchBlood_VictimTarget.GetActorReference().RemoveSpell(_00E_A2_EldritchBloodAbMarkedVictimTargetSP)
PlayerREF.RemoveSpell(_00E_A2_EldritchBloodAbSelectionSP)
A2_EldritchBlood_PlayerForScript.ExitMarkingMode()
_00E_A2_EldritchBloodSelectionHoldIMOD.Remove()
Sound.StopInstance(MarkingLP)
QSTDA16SoulGemOffM.Play(PlayerREF)
A2_EldritchBlood_Player.Clear()
A2_EldritchBlood_Rune.GetReference().Delete()
A2_EldritchBlood_VictimRune.GetReference().Delete()
A2_EldritchBlood_Rune.Clear()
A2_EldritchBlood_VictimRune.Clear()
If MarkingRuneREF
MarkingRuneREF.Delete()
EndIf
If MarkingVictimRuneREF
MarkingVictimRuneREF.Delete()
EndIf
AddFrenzySpell()
_00E_A2_EldritchBloodGlobal.SetValueInt(0)
EndEvent
EndState
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function AddFrenzySpell()
float iExpDamage = _00E_A2_EldritchBloodSP.GetNthEffectMagnitude(iIndex - 1)
_00E_A2_EldritchBloodEnchantment.SetNthEffectMagnitude(0, iExpDamage)
_00E_A2_EldritchBloodMarkedVictimFXS.Stop(A2_EldritchBlood_VictimTarget.GetActorReference())
float iFrenzyDMGMult = _00E_A2_EldritchBloodSP.GetNthEffectMagnitude(iIndex + 2)
Int iFrenzyDuration = _00E_A2_EldritchBloodSP.GetNthEffectDuration(iIndex + 2) as Int
_00E_A2_EldritchBloodVictimSP.SetNthEffectMagnitude(0, iFrenzyDMGMult)
_00E_A2_EldritchBloodVictimSP.SetNthEffectDuration(0, iFrenzyDuration)
_00E_A2_EldritchBloodVictimSP.Cast(A2_EldritchBlood_Victim.GetReference(), A2_EldritchBlood_Victim.GetReference())
If iFrezyAttackTargetMarked
A2_EldritchBlood_Victim.GetActorReference().StartCombat(A2_EldritchBlood_VictimTarget.GetActorReference())
Else
A2_EldritchBlood_Victim.GetActorReference().StartCombat(PlayerREF.GetCombatTarget())
EndIf
EndFunction
Function NotMarkedClearUp()
A2_EldritchBlood_Victim.GetActorReference().RemoveSpell(_00E_A2_EldritchBloodAbMarkedVictimSP)
A2_EldritchBlood_VictimTarget.GetActorReference().RemoveSpell(_00E_A2_EldritchBloodAbMarkedVictimTargetSP)
(PlayerREF as _00E_Game_TalentControlSC).SetTalentRecoveryTime(_00E_A2_EldritchBlood, 0)
MAGFail.Play(PlayerREF)
PlayerREF.RemoveSpell(_00E_A2_EldritchBloodAbSelectionSP)
A2_EldritchBlood_PlayerForScript.ExitMarkingMode()
_00E_A2_EldritchBloodSelectionHoldIMOD.Remove()
Sound.StopInstance(MarkingLP)
QSTDA16SoulGemOffM.Play(PlayerREF)
A2_EldritchBlood_Player.Clear()
A2_EldritchBlood_Rune.GetReference().Delete()
A2_EldritchBlood_VictimRune.GetReference().Delete()
_00E_A2_EldritchBloodMarkedVictimFXS.Stop(A2_EldritchBlood_VictimTarget.GetActorReference())
A2_EldritchBlood_Rune.Clear()
A2_EldritchBlood_VictimRune.Clear()
A2_EldritchBlood_VictimTarget.Clear()
A2_EldritchBlood_Victim.Clear()
If MarkingRuneREF
MarkingRuneREF.Delete()
EndIf
If MarkingVictimRuneREF
MarkingVictimRuneREF.Delete()
EndIf
Wait(2)
_00E_A2_EldritchBloodGlobal.SetValueInt(0)
EndFunction
Function SelectEnemy(Actor iVictim)
If IsTargetValid(iVictim)
If !IsTargetMarked(iVictim)
If !iFrenzyTargetMarked
MarkFrenzyVictim(iVictim)
iFrenzyTargetMarked = True
Elseif !iFrezyAttackTargetMarked
MarkFrenzyTargetVictim(iVictim)
iFrezyAttackTargetMarked = True
Else
Levelsystem._00E_Levelsystem_sEnemyAlreadyMarked.Show()
MAGFail.Play(PlayerREF)
EndIf
Else
UnmarkEnemy(iVictim)
EndIf
Else
Return
EndIf
EndFunction
Function MarkFrenzyVictim(Actor iFrenzyVictim)
MarkingRuneREF = iFrenzyVictim.PlaceAtMe(_00E_A2_EldritchBloodMarkedRune, 1)
A2_EldritchBlood_Rune.ForceRefTo(MarkingRuneREF)
A2_EldritchBlood_Victim.ForceRefTo(iFrenzyVictim)
Levelsystem._00E_Levelsystem_sEldritchBloodVictimMarked.Show()
_00E_A2_EldritchBloodMarkedFXS.Play(iFrenzyVictim)
iFrenzyVictim.AddSpell(_00E_A2_EldritchBloodAbMarkedVictimSP)
_00E_A2_GhostwalkSelectM.Play(PlayerREF)
EndFunction
Function MarkFrenzyTargetVictim(Actor iFrenzyTargetVictim)
MarkingVictimRuneREF = iFrenzyTargetVictim.PlaceAtMe(_00E_A2_EldritchBloodMarkedTargetRune, 1)
A2_EldritchBlood_VictimRune.ForceRefTo(MarkingVictimRuneREF)
A2_EldritchBlood_VictimTarget.ForceRefTo(iFrenzyTargetVictim)
Levelsystem._00E_Levelsystem_sEldritchBloodAttackTargetMarked.Show()
_00E_A2_EldritchBloodMarkedVictimFXS.Play(iFrenzyTargetVictim)
iFrenzyTargetVictim.AddSpell(_00E_A2_EldritchBloodAbMarkedVictimTargetSP)
_00E_A2_GhostwalkSelectM.Play(PlayerREF)
EndFunction
Function UnmarkEnemy(Actor iVictim)
bool Cleared
If iVictim.HasSpell(_00E_A2_EldritchBloodAbMarkedVictimSP)
A2_EldritchBlood_Rune.Clear()
A2_EldritchBlood_Victim.Clear()
MarkingRuneREF.Disable()
iFrenzyTargetMarked = False
Levelsystem._00E_Levelsystem_sEldritchBloodVictimMarkingRemoved.Show()
iVictim.RemoveSpell(_00E_A2_EldritchBloodAbMarkedVictimSP)
_00E_A2_EldritchBloodMarkedFXS.Stop(iVictim)
_00E_A2_GhostwalkDeselectM.Play(PlayerREF)
Cleared = True
Elseif iVictim.HasSpell(_00E_A2_EldritchBloodAbMarkedVictimTargetSP)
A2_EldritchBlood_VictimRune.Clear()
A2_EldritchBlood_VictimTarget.Clear()
MarkingVictimRuneREF.Disable()
iFrezyAttackTargetMarked = False
Levelsystem._00E_Levelsystem_sEldritchBloodAttackVictimMarkingRemoved.Show()
iVictim.RemoveSpell(_00E_A2_EldritchBloodAbMarkedVictimTargetSP)
_00E_A2_EldritchBloodMarkedVictimFXS.Stop(iVictim)
_00E_A2_GhostwalkDeselectM.Play(PlayerREF)
Cleared = True
EndIf
EndFunction
bool Function IsTargetValid(Actor CheckVictim)
If CheckVictim.IsInFaction(PlayerAlliesFaction)
Return False
ElseIf CheckVictim.HasKeyword(MagicNoEldritchBlood)
Levelsystem._00E_Levelsystem_sAbilityEnemyLevelTooHigh.Show()
Return False
Elseif CheckVictim == PlayerREF
Return False
Elseif EnemyLevelTooHigh(CheckVictim)
Levelsystem._00E_Levelsystem_sAbilityEnemyLevelTooHigh.Show()
Return False
Else
Return True
EndIf
EndFunction
bool Function EnemyLevelTooHigh(Actor LevelVictim)
Float iAllowedDif = _00E_A2_EldritchBloodSP.GetNthEffectMagnitude(6)
If (LevelVictim.GetLevel() > (PlayerLevel.GetValueInt() + iAllowedDif as Int))
Return True
Else
Return False
EndIf
EndFunction
bool Function IsTargetMarked(Actor iVictim)
If iVictim.HasSpell(_00E_A2_EldritchBloodAbMarkedVictimSP) || iVictim.HasSpell(_00E_A2_EldritchBloodAbMarkedVictimTargetSP)
Return True
Else
Return False
EndIf
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
bool hasAborted
int iIndex
int MarkingLP
; bool Property bTutorialShown Auto Hidden
Bool iFrenzyTargetMarked
Bool iFrezyAttackTargetMarked
_00E_A2_EldritchBloodPlayerMarkSC A2_EldritchBlood_PlayerForScript
_00E_QuestFunctions Property Levelsystem Auto
GlobalVariable Property _00E_A2_EldritchBloodGlobal Auto
GlobalVariable Property PlayerLevel Auto
GlobalVariable Property _00E_SelectionTutorialShown Auto
GlobalVariable Property _00E_A2_EldritchBloodInDepthTutorial Auto
GlobalVariable Property _00E_DisableSkillTutorials Auto
Actor Property PlayerREF Auto
ObjectReference MarkingRuneREF
ObjectReference MarkingVictimRuneREF
ReferenceAlias Property A2_EldritchBlood_Player Auto
ReferenceAlias Property A2_EldritchBlood_Victim Auto
ReferenceAlias Property A2_EldritchBlood_VictimTarget Auto
ReferenceAlias Property A2_EldritchBlood_Rune Auto
ReferenceAlias Property A2_EldritchBlood_VictimRune Auto
Hazard Property _00E_A2_EldritchBloodMarkedRune Auto
Hazard Property _00E_A2_EldritchBloodMarkedTargetRune Auto
EffectShader Property _00E_A2_EldritchBloodMarkedFXS Auto
EffectShader Property _00E_A2_EldritchBloodMarkedVictimFXS Auto
Perk Property _00E_Class_LifeAndDeath_P09b_Talent_EldritchBlood Auto
Perk Property _00E_Class_LifeAndDeath_P09b_Talent_EldritchBlood2 Auto
Perk Property _00E_Class_LifeAndDeath_P09b_Talent_EldritchBlood3 Auto
Shout Property _00E_A2_EldritchBlood Auto
Message Property _00E_A2_Tutorial_EldritchBlood Auto
Message Property _00E_Tutorial_SelectionMode Auto
Message Property _00E_A2_Tutorial_EldritchBloodDetailed Auto
Enchantment Property _00E_A2_EldritchBloodEnchantment Auto
Faction Property PlayerAlliesFaction Auto
Keyword Property MagicNoEldritchBlood Auto
Spell Property _00E_A2_EldritchBloodAbSelectionSP Auto
Spell Property _00E_A2_EldritchBloodAbMarkedVictimTargetSP Auto
Spell Property _00E_A2_EldritchBloodAbMarkedVictimSP Auto
Spell Property _00E_A2_EldritchBloodVictimSP Auto
Spell Property _00E_A2_EldritchBloodSP Auto
Sound Property MAGFail Auto
Sound Property _00E_A2_GhostwalkSelectM Auto
Sound Property _00E_A2_GhostwalkDeselectM Auto
Sound Property _00E_A2_GhostwalkMarkingLPM Auto
Sound Property QSTDA16SoulGemOffM Auto
Sound Property MAGConjurePortal Auto
ImageSpaceModifier Property _00E_A2_EldritchBloodSelectionIntroIMOD Auto
ImageSpaceModifier Property _00E_A2_EldritchBloodSelectionHoldIMOD Auto