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

145 lines
5.4 KiB
Plaintext

Scriptname _00E_A1_QyraiStanceSC extends activemagiceffect
Import _00E_TalentLibrary
Import Math
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnEffectStart(Actor akTarget, Actor akCaster)
If akCaster.HasPerk(_00E_A1_QyranianStanceBlockPerk) && akCaster.HasPerk(_00E_A1_QyranianStanceEnemyCritPerk)
akCaster.RemoveSpell(_00E_A1_QyraiStanceAb)
akCaster.RemoveSpell(_00E_A1_QyraiStanceDisplay01)
akCaster.RemoveSpell(_00E_A1_QyraiStanceDisplay02)
akCaster.RemoveSpell(_00E_A1_QyraiStanceDisplay03)
akCaster.RemovePerk(_00E_A1_QyranianStanceBlockPerk)
akCaster.RemovePerk(_00E_A1_QyranianStanceEnemyCritPerk)
Debug.Notification(Levelsystem._00E_Levelsystem_sAbilityStanceQyrai.GetName() + " " + Levelsystem._00E_Levelsystem_sAbilityStanceEnded.GetName())
_00E_DispelStance.Play(akCaster)
Else
If akCaster.HasMagicEffectWithKeyword(StanceKeyword)
_00E_A1_SkaraggStanceSP.Cast(akCaster)
EndIf
If _00E_DisableSkillTutorials.GetvalueInt() == 0
_00E_A1_Tutorial_Stances.ShowAsHelpMessage("Stance", 5, 1, 1)
EndIf
iIndex = GetPlayerTalentLevel(_00E_Class_Derwish_P05_Talent_QyraiStance, _00E_Class_Derwish_P05_Talent_QyraiStance2, _00E_Class_Derwish_P05_Talent_QyraiStance3)
AdjustStancePerk()
_00E_A1_QyraiStanceImod.Apply()
if !akCaster.HasSpell(_00E_A1_QyraiStanceAb)
akCaster.AddSpell(_00E_A1_QyraiStanceAb, False)
EndIf
if !akCaster.HasPerk(_00E_A1_QyranianStanceBlockPerk)
akCaster.AddPerk(_00E_A1_QyranianStanceBlockPerk)
EndIf
if !akCaster.HasPerk(_00E_A1_QyranianStanceEnemyCritPerk)
akCaster.AddPerk(_00E_A1_QyranianStanceEnemyCritPerk)
EndIf
if iIndex == 1
if !akCaster.HasSpell(_00E_A1_QyraiStanceDisplay01)
akCaster.AddSpell(_00E_A1_QyraiStanceDisplay01, False)
EndIf
elseif iIndex == 2
if !akCaster.HasSpell(_00E_A1_QyraiStanceDisplay02)
akCaster.AddSpell(_00E_A1_QyraiStanceDisplay02, False)
EndIf
elseif iIndex == 3
if !akCaster.HasSpell(_00E_A1_QyraiStanceDisplay03)
akCaster.AddSpell(_00E_A1_QyraiStanceDisplay03, False)
EndIf
EndIf
NPCKillSwordSpinM.Play(akCaster)
GhostFXShader.Play(akCaster)
Debug.Notification(Levelsystem._00E_Levelsystem_sAbilityStanceQyrai.GetName() + " " + Levelsystem._00E_Levelsystem_sAbilityStanceStarted.GetName())
Utility.Wait(4)
GhostFXShader.Stop(akCaster)
Endif
EndEvent
;=====================================================================================
; Function
;=====================================================================================
Function AdjustStancePerk()
float iWPNSpeedBonus = abs((_00E_A1_QyraiStanceSP.GetNthEffectMagnitude(iIndex)/100) + 1)
float iBlockMalus = abs((_00E_A1_QyraiStanceSP.GetNthEffectMagnitude(iIndex + 3)/100) - 1)
float iEnemyCritChance = abs((_00E_A1_QyraiStanceSP.GetNthEffectMagnitude(iIndex + 6)/100) + 1)
float iSpeedBonus = abs((_00E_A1_QyraiStanceSP.GetNthEffectMagnitude(iIndex + 9)/100)) * (PlayerREF.GetActorValue("Speedmult"))
If PlayerREF.HasSpell(PerkBlutsrunst13) || PlayerREF.HasSpell(PerkBlutsrunst10)
If PlayerREF.GetEquippedItemType(1) == 5 || PlayerREF.GetEquippedItemType(1) == 6 && !PlayerREF.HasSpell(PerkBlutsrunst10)
iWPNSpeedBonus = iWPNSpeedBonus + 0.05
Elseif PlayerREF.GetEquippedItemType(1) == 5 || PlayerREF.GetEquippedItemType(1) == 6 && PlayerREF.HasSpell(PerkBlutsrunst10)
iWPNSpeedBonus = iWPNSpeedBonus + 0.10
EndIf
EndIf
If PlayerREF.HasSpell(PerkDualFlurry30)
If (PlayerREF.GetEquippedItemType(1) > 0 && PlayerREF.GetEquippedItemType(1) <= 4) && (PlayerREF.GetEquippedItemType(0) > 0 && PlayerREF.GetEquippedItemType(0) <= 4)
iWPNSpeedBonus = iWPNSpeedBonus + 0.15
EndIf
EndIf
_00E_A1_QyranianStanceBlockPerk.SetNthEntryValue(0, 0, iBlockMalus)
_00E_A1_QyranianStanceEnemyCritPerk.SetNthEntryValue(0, 0, iEnemyCritChance)
_00E_A1_QyraiStanceAb.SetNthEffectMagnitude(0, iWPNSpeedBonus)
_00E_A1_QyraiStanceAb.SetNthEffectMagnitude(1, iSpeedBonus)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
int iIndex
_00E_QuestFunctions Property Levelsystem Auto
Actor Property PlayerREF Auto
Perk Property _00E_A1_QyranianStanceBlockPerk Auto
Perk Property _00E_A1_QyranianStanceEnemyCritPerk Auto
Keyword Property StanceKeyword Auto
Perk Property _00E_Class_Derwish_P05_Talent_QyraiStance Auto
Perk Property _00E_Class_Derwish_P05_Talent_QyraiStance2 Auto
Perk Property _00E_Class_Derwish_P05_Talent_QyraiStance3 Auto
ImageSpaceModifier Property _00E_A1_QyraiStanceImod Auto
Sound Property NPCKillSwordSpinM Auto
Sound Property _00E_DispelStance Auto
Message Property _00E_A1_Tutorial_Stances Auto
Spell Property _00E_A1_QyraiStanceSP Auto
Spell Property _00E_A1_QyraiStanceAb Auto
Spell Property _00E_A1_QyraiStanceDisplay01 Auto
Spell Property _00E_A1_QyraiStanceDisplay02 Auto
Spell Property _00E_A1_QyraiStanceDisplay03 Auto
Spell Property PerkBlutsrunst10 Auto
Spell Property PerkBlutsrunst13 Auto
Spell Property PerkDualFlurry30 Auto
Spell Property _00E_A1_SkaraggStanceSP Auto
EffectShader Property GhostFXShader Auto
GlobalVariable Property _00E_DisableSkillTutorials Auto