local CultSpellStack = 0 local CultSpellStackMaxCapacity = 15 local CultSpellStackMaxConsume = 15 function CultSpellStack_Add(spEffect, addition) if env(GetSpEffectID, spEffect) == FALSE then return end act(ClearSpEffect, spEffect) if env(GetSpEffectID, Jewel_of_the_Ancients) == TRUE then addition = addition + 1 end CultSpellStack = math.min(CultSpellStack + addition, CultSpellStackMaxCapacity) CultSpellStack_Visibility() end function CultSpellStack_Use(checkSpEffect, subtraction) if env(GetSpEffectID, checkSpEffect) == FALSE or CultSpellStack == 0 then return end act(ClearSpEffect, checkSpEffect) if subtraction == CultSpellStackMaxConsume then if CultSpellStackMaxCapacity > CultSpellStackMaxConsume then CultSpellStack = CultSpellStack - CultSpellStackMaxConsume else CultSpellStack = 0 end else if CultSpellStack < subtraction then return end CultSpellStack = CultSpellStack - subtraction end local highestTierAvailable = math.min(subtraction, CultSpellStackMaxConsume) if env(GetSpEffectID, 1504200) == TRUE then -- Death Knight's Supplication (Heal) act(AddSpEffect, 1504249 + highestTierAvailable) end CultSpellStack_Visibility() end function CultSpellStack_Apply(magicParam, appliedSpeffect, reduction) local _, currentMagicParam = GetSelectedEquipMagicData() if currentMagicParam ~= magicParam then return end if reduction == CultSpellStackMaxConsume then if CultSpellStack > 0 then for i = 1, CultSpellStackMaxConsume, 1 do act(ClearSpEffect, appliedSpeffect + i) end local highestTierAvailable = math.min(CultSpellStack, CultSpellStackMaxConsume) act(AddSpEffect, appliedSpeffect + highestTierAvailable) end elseif CultSpellStack >= reduction then act(AddSpEffect, appliedSpeffect) else act(ClearSpEffect, appliedSpeffect) end end function CultSpellStack_BuffSpell(identifierSpEffect, appliedSpeffect) if env(GetSpEffectID, identifierSpEffect) == FALSE then return end act(ClearSpEffect, identifierSpEffect) local highestTierAvailable = math.min(CultSpellStack, CultSpellStackMaxConsume) act(AddSpEffect, appliedSpeffect + highestTierAvailable) if CultSpellStackMaxCapacity > CultSpellStackMaxConsume then CultSpellStack = CultSpellStack - CultSpellStackMaxConsume else CultSpellStack = 0 end CultSpellStack_Visibility() end function CultSpellStack_AddLib() if CultSpellStack == CultSpellStackMaxCapacity then return end CultSpellStack_Add(8000800, 1) -- Generates 1 CultSpellStack_Add(8000801, 2) -- Generates 2 CultSpellStack_Add(8000802, 3) -- Generates 3 CultSpellStack_Add(8000803, 4) -- Generates 4 CultSpellStack_Add(8000810, 0.2) -- Generates .2 end --- Consumes X amount of stacks when the Identifier spEffect is found on the player function CultSpellStack_UseLib() if CultSpellStack == 0 then return end CultSpellStack_Use(8001000, 1) -- Lightning Channel CultSpellStack_Use(8001001, 2) -- Lightning Strike CultSpellStack_Use(8001002, 1) -- Lightning Orb CultSpellStack_Use(8001003, 2) -- Ancient Lightning Stake CultSpellStack_Use(8001004, 4) -- Ancient Lightning Beacon CultSpellStack_Use(8001005, 1) -- Electrocution CultSpellStack_Use(8001006, 3) -- Ancient Lightning Strike CultSpellStack_Use(8001007, 3) -- Fortissax's Lightning Stake CultSpellStack_Use(8001008, 5) -- Ancient Lightning Storm CultSpellStack_Use(8001009, 4) -- Lansseax’s Glaive CultSpellStack_Use(8001010, 4) -- Death Lightning Storm CultSpellStack_Use(8001011, 3) -- Death Lightning Stake CultSpellStack_Use(8001013, CultSpellStackMaxConsume) -- Will of the Lichdragon CultSpellStack_Use(8001050, CultSpellStackMaxConsume) -- Ire of the Dragon God CultSpellStack_Use(8001012, CultSpellStackMaxConsume) -- Death Lightning Barrage end --- Applies a SpEffect to the player when they are casting a spell, if they have enough stacks function CultSpellStack_ApplyLib() CultSpellStack_Apply(6901, 8000900, 1) -- Lightning Channel CultSpellStack_Apply(6920, 8000901, 2) -- Lightning Strike CultSpellStack_Apply(6902, 8000902, 1) -- Lightning Orb CultSpellStack_Apply(6940, 8000903, 2) -- Ancient Lightning Stake CultSpellStack_Apply(6932, 8000904, 4) -- Ancient Lightning Beacon CultSpellStack_Apply(6992, 8000905, 1) -- Electrocution CultSpellStack_Apply(6922, 8000906, 3) -- Ancient Lightning Strike CultSpellStack_Apply(6941, 8000907, 3) -- Fortissax's Lightning Stake CultSpellStack_Apply(6910, 8000908, 5) -- Ancient Lightning Storm CultSpellStack_Apply(6950, 8000909, 4) -- Lansseax’s Glaive CultSpellStack_Apply(5040, 8000910, 4) -- Death Lightning Storm CultSpellStack_Apply(5043, 8000911, 3) -- Death Lightning Stake CultSpellStack_Apply(6980, 8000974, CultSpellStackMaxConsume) -- Will of the Lichdragon CultSpellStack_Apply(6981, 8000949, CultSpellStackMaxConsume) -- Ire of the Dragon God CultSpellStack_Apply(5044, 8000924, CultSpellStackMaxConsume) -- Death Lightning Barrage end function CultSpellStack_BuffSpellLib() CultSpellStack_BuffSpell(1699020, 1699000) -- Time Warp CultSpellStack_BuffSpell(1699350, 1699300) -- Ageless Innervation end function CultSpellStack_Visibility() CultSpellStack = math.max(0, CultSpellStack) act(AddSpEffect, 8000850 + math.floor(CultSpellStack)) -- Icon if env(GetSpEffectID, 1504200) == FALSE then -- Death Knight's Supplication (FP regen) return end for i = 1, 3, 1 do act(ClearSpEffect, 1504210 + i) end if CultSpellStack > 0 then local supplicationStacks = math.floor(CultSpellStack / 5) supplicationStacks = math.min(supplicationStacks, 3) act(AddSpEffect, 1504210 + supplicationStacks) end end function CultSpellStack_GraceClean() if env(GetSpEffectID, 100) == FALSE then return end CultSpellStack = 0 -- Clear all stacks on grace rest CultSpellStack_Visibility() end function CultSpellStack_Update() CultSpellStack_UseLib() CultSpellStack_GraceClean() if StaggerExecution(6) then IsUsingClassWeapon(true, false, false, PARAM.EquipParamWeapon.LIGHTNING_DAMAGE, 391905) CultSpellStack_BuffSpellLib() CultSpellStack_AddLib() end end local hkbStatesToAllowLoop = { ["W_SwordArtsOneShot"] = true, ["W_SwordArtsOneShotComboEnd"] = true, } local LightningArts = { { artsID = 381, boostSpEffect = 391930, secondaryCondition = true }, -- Ancient Thunderclap +DMG { artsID = 061, boostSpEffect = 391931, secondaryCondition = true }, -- Call to Thunder +DMG to alt attack { artsID = 062, boostSpEffect = 391932, secondaryCondition = true }, -- Thunderclap +DMG { artsID = 063, boostSpEffect = 391933, secondaryCondition = true }, -- Thunderbolt Slash +DMG { artsID = 064, boostSpEffect = 391932, secondaryCondition = true }, -- Thunderbolt +DMG { artsID = 065, boostSpEffect = 391933, secondaryCondition = true }, -- Lightning Slash +DMG { artsID = 113, boostSpEffect = 391934, secondaryCondition = true }, -- Lightning Ram +Speed x2 { artsID = 135, boostSpEffect = 391935, secondaryCondition = true }, -- Storm of the Ancients +DMG { artsID = 159, boostSpEffect = 391936, secondaryCondition = true }, -- Wrath of the Ancients +DMG { artsID = 190, boostSpEffect = 391938, secondaryCondition = true }, -- Storm Kick +DMG { artsID = 226, boostSpEffect = 391939, secondaryCondition = true }, -- Thundercloud Form +Root Motion x1.35 { artsID = 249, boostSpEffect = 391940, secondaryCondition = true }, -- Ancient Lightning Spear +Speed x1.4 { artsID = 280, boostSpEffect = 391943, secondaryCondition = true }, -- Blinkbolt +Root Motion x1.7 { artsID = 307, boostSpEffect = 391941, secondaryCondition = true }, -- Dragon Lord's Recall +Bullet on jump { artsID = 314, boostSpEffect = 391944, secondaryCondition = true }, -- Blinkbolt: Twinaxe +Root Motion x1.7 { artsID = 315, boostSpEffect = 391945, secondaryCondition = true }, -- Blinkbolt: Long-hafted Axe +Root Motion x1.7 { artsID = 321, boostSpEffect = 391946, secondaryCondition = true }, -- Dragon Cult Twin Daggers +Trick Weapon Logic +DMG { artsID = 349, boostSpEffect = 391947, secondaryCondition = true }, -- Flower Dragonbolt +DMG +Speed x1.4 } local CultArts_Cooldown = 0 function CultArtsStack_Apply() if OnCooldown(0.33, CultArts_Cooldown) or #LAST_HKB_STATES == 0 or hkbStatesToAllowLoop[LAST_HKB_STATES[1]] or env(HasEnoughArtsPoints, ACTION_ARM_L2, c_SwordArtsHand) == FALSE then return end CultArts_Cooldown = g_DeltaTimeCount local target = -1 for i = 1, #LightningArts, 1 do if LightningArts[i].artsID == c_SwordArtsID and LightningArts[i].secondaryCondition and env(GetSpEffectID, Jewel_of_the_Ancients) == TRUE then target = i elseif env(GetSpEffectID, LightningArts[i].boostSpEffect) == TRUE then act(ClearSpEffect, LightningArts[i].boostSpEffect) end end if target == -1 then return elseif CultSpellStack < 3 then if env(GetSpEffectID, LightningArts[target].boostSpEffect) == TRUE then act(ClearSpEffect, LightningArts[target].boostSpEffect) end return end if env(GetSpEffectID, LightningArts[target].boostSpEffect) == FALSE then act(AddSpEffect, LightningArts[target].boostSpEffect) end CultSpellStack = CultSpellStack - 3 CultSpellStack_Visibility() end function CultStacks_HandleJewelSwap(activeJewelSpEffect) if activeJewelSpEffect == Jewel_of_the_Ancients then CultSpellStackMaxCapacity = 30 return end CultSpellStackMaxCapacity = 15 if activeJewelSpEffect ~= 0 then -- Another jewel CultSpellStack = 0 elseif CultSpellStack > CultSpellStackMaxCapacity then CultSpellStack = CultSpellStackMaxCapacity end CultSpellStack_Visibility() end