local hkbStateBeforeDeletion = { ["W_MagicFireLeft_Upper"] = true, ["W_MagicFireLeft"] = true, ["W_MagicFireLeftCancel_Upper"] = true, ["W_MagicFireLeftCancel"] = true, ["W_MagicFireLeftJump_Upper"] = true, ["W_MagicFireLeftJump"] = true, ["W_MagicFireLeftJumpCancel_Upper"] = true, ["W_MagicFireLeftJumpCancel"] = true, ["W_MagicFireRight_Upper"] = true, ["W_MagicFireRight"] = true, ["W_MagicFireRightCancel_Upper"] = true, ["W_MagicFireRightCancel"] = true, ["W_MagicFireRightJump_Upper"] = true, ["W_MagicFireRightJump"] = true, ["W_MagicFireRightJumpCancel_Upper"] = true, ["W_MagicFireRightJumpCancel"] = true, ["W_MagicLaunchLeft_Upper"] = true, ["W_MagicLaunchLeft"] = true, ["W_MagicLaunchRight_Upper"] = true, ["W_MagicLaunchRight"] = true, ["W_QuickMagicFireLeftAttackLeft_Upper"] = true, ["W_QuickMagicFireLeftAttackLeft"] = true, ["W_QuickMagicFireLeftAttackRight_Upper"] = true, ["W_QuickMagicFireLeftAttackRight"] = true, ["W_QuickMagicFireLeftBackStep_Upper"] = true, ["W_QuickMagicFireLeftBackStep"] = true, ["W_QuickMagicFireLeftDash_Upper"] = true, ["W_QuickMagicFireLeftDash"] = true, ["W_QuickMagicFireLeftStep_Upper"] = true, ["W_QuickMagicFireLeftStep"] = true, ["W_QuickMagicFireRightAttackLeft_Upper"] = true, ["W_QuickMagicFireRightAttackLeft"] = true, ["W_QuickMagicFireRightAttackRight_Upper"] = true, ["W_QuickMagicFireRightAttackRight"] = true, ["W_QuickMagicFireRightBackStep_Upper"] = true, ["W_QuickMagicFireRightBackStep"] = true, ["W_QuickMagicFireRightDash_Upper"] = true, ["W_QuickMagicFireRightDash"] = true, ["W_QuickMagicFireRightStep_Upper"] = true, ["W_QuickMagicFireRightStep"] = true, ["W_RideMagicFire"] = true, ["W_RideMagicFireCancel"] = true, ["W_RideMagicLaunch"] = true, ["W_RollingMagicLeft_Upper"] = true, ["W_RollingMagicLeft"] = true, ["W_RollingMagicRight_Upper"] = true, ["W_RollingMagicRight"] = true, ["W_StealthMagicLeftFire_Upper"] = true, ["W_StealthMagicLeftFire"] = true, ["W_StealthMagicLeftLaunch_Upper"] = true, ["W_StealthMagicLeftLaunch"] = true, ["W_StealthMagicRightFire_Upper"] = true, ["W_StealthMagicRightFire"] = true, ["W_StealthMagicRightLaunch_Upper"] = true, ["W_StealthMagicRightLaunch"] = true, ["W_SwordArtsBothGuardCounter"] = true, ["W_SwordArtsChargeCancelEarly_Sub"] = true, ["W_SwordArtsChargeCancelEarly"] = true, ["W_SwordArtsChargeCancelLate"] = true, ["W_SwordArtsHalfCharge"] = true, ["W_SwordArtsHalfChargeCancelEarly_Upper"] = true, ["W_SwordArtsHalfChargeCancelEarly"] = true, ["W_SwordArtsHalfOneShot_Upper"] = true, ["W_SwordArtsHalfOneShot"] = true, ["W_SwordArtsHalfOneShotShieldBoth_Upper"] = true, ["W_SwordArtsHalfOneShotShieldBoth"] = true, ["W_SwordArtsHalfOneShotShieldLeft_Upper"] = true, ["W_SwordArtsHalfOneShotShieldLeft"] = true, ["W_SwordArtsLeftGuardCounter"] = true, ["W_SwordArtsOneShot_Sub"] = true, ["W_SwordArtsOneShot"] = true, ["W_SwordArtsOneShotShieldBoth_Cancel"] = true, ["W_SwordArtsOneShotShieldBoth"] = true, ["W_SwordArtsOneShotShieldLeft_Cancel"] = true, ["W_SwordArtsOneShotShieldLeft"] = true, ["W_SwordArtsRolling_SelfTrans"] = true, ["W_SwordArtsRolling_Sub"] = true, ["W_SwordArtsRolling"] = true, ["W_SwordArtsStanceAttackHeavy180"] = true, ["W_SwordArtsStanceAttackHeavyStart"] = true, ["W_SwordArtsStanceAttackLight180"] = true, ["W_SwordArtsStanceAttackLightStart"] = true, ["W_SwordArtsStandDodge"] = true, } local followups = { ["W_MagicFireLeft2_Upper"] = true, ["W_MagicFireLeft2"] = true, ["W_MagicFireLeft3_Upper"] = true, ["W_MagicFireLeft3"] = true, ["W_MagicFireLeftCancel2_Upper"] = true, ["W_MagicFireLeftCancel2"] = true, ["W_MagicFireLeftCancel3_Upper"] = true, ["W_MagicFireLeftCancel3"] = true, ["W_MagicFireRight2_Upper"] = true, ["W_MagicFireRight2"] = true, ["W_MagicFireRight3_Upper"] = true, ["W_MagicFireRight3"] = true, ["W_MagicFireRightCancel2_Upper"] = true, ["W_MagicFireRightCancel2"] = true, ["W_MagicFireRightCancel3_Upper"] = true, ["W_MagicFireRightCancel3"] = true, ["W_MagicInvalid_mirror"] = true, ["W_MagicInvalid_Upper"] = true, ["W_MagicInvalid"] = true, ["W_MagicLoopLeft_Upper"] = true, ["W_MagicLoopLeft"] = true, ["W_MagicLoopRight_Upper"] = true, ["W_MagicLoopRight"] = true, ["W_RideMagicFireCombo1"] = true, ["W_RideMagicFireCombo1Cancel"] = true, ["W_RideMagicFireCombo2"] = true, ["W_RideMagicFireCombo2Cancel"] = true, ["W_RideMagicInvalid"] = true, ["W_RideMagicLoop"] = true, ["W_SwordArtsBothLoopEnd"] = true, ["W_SwordArtsBothLoopLoop"] = true, ["W_SwordArtsChargeCancelEarly2"] = true, ["W_SwordArtsHalfBothLoopEnd_Upper"] = true, ["W_SwordArtsHalfBothLoopEnd"] = true, ["W_SwordArtsHalfBothLoopLoop_Upper"] = true, ["W_SwordArtsHalfBothLoopLoop"] = true, ["W_SwordArtsHalfLeftLoopEnd_Upper"] = true, ["W_SwordArtsHalfLeftLoopEnd"] = true, ["W_SwordArtsHalfLeftLoopLoop_Upper"] = true, ["W_SwordArtsHalfLeftLoopLoop"] = true, ["W_SwordArtsHalfLoopEnd_Upper"] = true, ["W_SwordArtsHalfLoopEnd"] = true, ["W_SwordArtsHalfLoopLoop_Upper"] = true, ["W_SwordArtsHalfLoopLoop"] = true, ["W_SwordArtsHalfOneShotComboEnd_2_Upper"] = true, ["W_SwordArtsHalfOneShotComboEnd_2"] = true, ["W_SwordArtsHalfOneShotComboEnd_Upper"] = true, ["W_SwordArtsHalfOneShotComboEnd"] = true, ["W_SwordArtsLeftLoopEnd"] = true, ["W_SwordArtsLeftLoopLoop"] = true, ["W_SwordArtsLoopEnd"] = true, ["W_SwordArtsLoopLoop"] = true, ["W_SwordArtsOneShotComboEnd_2"] = true, ["W_SwordArtsOneShotComboEnd_MesmerSowrdArts"] = true, ["W_SwordArtsOneShotComboEnd"] = true, ["W_SwordArtsRolling_SelfTrans2"] = true, ["W_SwordArtsRollingOneShotCombo"] = true, } local CorpaMagica_Cooldown = 0 local hasAppliedFourStackBuff = false function CorpaMagica() if env(GetSpEffectID, 1413110) == FALSE or #LAST_HKB_STATES == 0 then hasAppliedFourStackBuff = false return elseif followups[LAST_HKB_STATES[1]] then act(ClearSpEffect, 1413103) act(ClearSpEffect, 1413102) act(ClearSpEffect, 1413101) act(ClearSpEffect, 1413100) hasAppliedFourStackBuff = false return elseif hkbStateBeforeDeletion[LAST_HKB_STATES[1]] == nil then if hkbStateBeforeDeletion[LAST_HKB_STATES[2]] then act(ClearSpEffect, 1413103) act(ClearSpEffect, 1413102) act(ClearSpEffect, 1413101) act(ClearSpEffect, 1413100) hasAppliedFourStackBuff = false end return elseif OnCooldown(0.33, CorpaMagica_Cooldown) then return end CorpaMagica_Cooldown = g_DeltaTimeCount --Log(LAST_HKB_STATES[1], LAST_HKB_STATES[2]) if env(GetSpEffectID, 1413103) == TRUE and not hasAppliedFourStackBuff then hasAppliedFourStackBuff = true act(AddSpEffect, 1413130) if env(GetSpEffectID, Jewel_of_the_Primeval) == TRUE then act(AddSpEffect, 390722) end end end local __hpLastTick = -1 local __manaShieldFullHP = FALSE function ManaShield() if env(GetSpEffectID, 1416000) == FALSE or env(GetHP) <= 0 or env(GetSpEffectID, 148) == TRUE then __hpLastTick = -1 __manaShieldFullHP = FALSE return end if env(GetFP) == 0 then act(ClearSpEffect, 1416000) -- Remove Mana Shield act(AddSpEffect, 1416005) -- Termination VFX SetPointerValue(CHR_INS_BASE.CHR_FLAGS.NO_HIT, FALSE) return end local hp = env(GetHP) if __hpLastTick == -1 then __hpLastTick = hp return end if __manaShieldFullHP == FALSE and hp == env(GetMaxHP) then __manaShieldFullHP = TRUE end local hpLastTick = __hpLastTick __hpLastTick = hp if hp >= hpLastTick then return end local healthLost = math.abs(hp - hpLastTick) local ratio = 3.5 local fpCostInit = math.ceil(healthLost / ratio) local fpCost = fpCostInit + 3 if hp <= 1 then fpCost = fpCost + (env(GetMaxFP) / 3) end -- You run out of FP, remove the shield and take damage equal to the amount of health lost minus the amount of FP you had left if fpCost >= env(GetFP) then act(ClearSpEffect, 1416000) -- Remove Mana Shield act(AddSpEffect, 1416005) -- Termination VFX SetFP(0) CalculatedHeal(env(GetHP) - (hpLastTick - (healthLost - (fpCost * ratio)))) return end -- You are NOT using Mana Shield whilst at full HP if __manaShieldFullHP == FALSE then CalculatedHeal(hpLastTick - env(GetHP)) SetFP(env(GetFP) - fpCost) return end -- Destined Death if env(GetSpEffectID, 6860) == TRUE or env(GetSpEffectID, 6865) == TRUE then CalculatedHeal((env(GetMaxHP) * 0.9) - env(GetHP)) SetFP(env(GetFP) - fpCost) return end FullHeal() SetFP(env(GetFP) - fpCost) end