Advertisement
geethepaster

RoDevCode

Jul 19th, 2022
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.46 KB | None | 0 0
  1. local MageSkills = {}
  2. local RepModules = game.ReplicatedStorage.Modules
  3. local ServerModules = game.ServerStorage.Modules
  4. local Events = game.ReplicatedStorage.Events
  5. local CombatModule = require(RepModules.CombatModule)
  6. local InputModule = require(RepModules.InputModule)
  7. local DamageModule = require(ServerModules.DamageModule)
  8. local StatusModule = require(RepModules.StatusModule)
  9. local HitModule = require(ServerModules.HitReplicationModule)
  10. local Assets = game.ReplicatedStorage.ClassAssets.Mage
  11. local MiscFunctions = require(RepModules.MiscFunctions)
  12. local tweenservice = game:GetService("TweenService")
  13.  
  14. --make sure to add stun to the player
  15. function lerp(a, b, c)
  16.     return a + (b - a) * c
  17. end
  18.  
  19. local function QuadraticBezier(p0,p1,p2,t)
  20.     local a = p0:Lerp(p1, t)
  21.     local b = p1:Lerp(p2, t)
  22.     return a:Lerp(b, t)
  23. end
  24.  
  25. local function TweenPos(part, pos, dur)
  26.     local tweeninfo = TweenInfo.new(dur, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
  27.     local tweenProps = {
  28.         Position = pos
  29.     }
  30.     local tween = tweenservice:Create(part, tweeninfo, tweenProps)
  31.     tween:Play()
  32. end
  33.  
  34. local function FlyTo(Part, endpos, target)
  35.     local Ap = Instance.new("AlignPosition")
  36.     Ap.MaxForce = 10000
  37.     Ap.MaxVelocity = 100
  38.     Ap.ApplyAtCenterOfMass = true
  39.     --Ap.Responsiveness = 10
  40.     if target ~= nil then
  41.         Ap.Mode = Enum.PositionAlignmentMode.TwoAttachment
  42.         local attach1 = Instance.new("Attachment", Part)
  43.         local attach2 = Instance.new("Attachment", target)
  44.         Ap.Attachment0 = attach1
  45.         Ap.Attachment1 = attach2
  46.     else
  47.         Ap.Mode = Enum.PositionAlignmentMode.OneAttachment
  48.         local attach1 = Instance.new("Attachment", Part)
  49.         Ap.Attachment0 = attach1
  50.         Ap.Position = endpos
  51.     end
  52.     Part.Anchored = false
  53.     Ap.Parent = Part
  54.  
  55.  
  56.     --
  57. end
  58.  
  59.  
  60.  
  61. function lookAt(target, eye)
  62.     local forwardVector = (eye - target).Unit
  63.     local upVector = Vector3.new(0, 1, 0)
  64.     -- You have to remember the right hand rule or google search to get this right
  65.     local rightVector = forwardVector:Cross(upVector)
  66.     local upVector2 = rightVector:Cross(forwardVector)
  67.  
  68.     return CFrame.fromMatrix(eye, rightVector, upVector2)
  69. end
  70.  
  71. function mageBolt(plr, boltargs)
  72.     local bolt = Assets.MageBolt:Clone()
  73.     local char = plr.Character
  74.     local Hrm = char.HumanoidRootPart
  75.     local destroyed = false
  76.     bolt.Parent = char.ClassItems
  77.     bolt.CFrame = boltargs.StartCFrame
  78.  
  79.     task.wait(.1)
  80.     local ClientTable = {}
  81.     ClientTable.Character = char
  82.     ClientTable.Effect = "Mage Bolts"
  83.     ClientTable.Class = "Mage"
  84.     ClientTable.EnemyChar = nil
  85.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  86.     MiscFunctions.TweenTransparency(bolt, 0, .2)
  87.     MiscFunctions.TweenTransparency(bolt.MeshPart, 0, .2)
  88.     bolt.CFrame = boltargs.StartCFrame
  89.  
  90.     local Args = {}
  91.     Args.Character = char
  92.     Args.Part = bolt
  93.     Args.Speed = boltargs.BoltSpeed
  94.     Args.MaxDist = boltargs.MaxDistance
  95.     Args.Direction = boltargs.Direction
  96.     Args.Endpos = boltargs.Endpos
  97.     local hitbox = HitModule.CreateRayProjectile(Args)
  98.  
  99.     task.delay(0.3, function()
  100.         if destroyed ~= true then
  101.             destroyed = true
  102.             local Effect = Instance.new("StringValue", bolt)
  103.             Effect.Name = "Effect"
  104.             MiscFunctions.TweenTransparency(bolt, 1, .2)
  105.             MiscFunctions.TweenTransparency(bolt.MeshPart, 1, .2)
  106.             game.Debris:AddItem(bolt, 0.3)
  107.         end
  108.     end)
  109.  
  110.     hitbox.Event:Connect(function(rayResult)
  111.         local hit = rayResult.Instance
  112.         if hit == nil then return end
  113.         if hit.Name == "MageBolt" then return end
  114.         local echar = hit.Parent or hit.Parent.Parent
  115.         bolt.Position = rayResult.Position
  116.         destroyed = true
  117.         if echar:FindFirstChild("Humanoid") then
  118.             local damagedata = {
  119.                 Blockbreak = false,
  120.                 Knockback = false,
  121.                 Stun = true,
  122.                 Stuntime = game.ReplicatedStorage.GlobalValues.Hitstun.Value,
  123.                 KnockbackType = "Ground"
  124.             }
  125.             DamageModule.Damage(char, echar, boltargs.Damage, damagedata)
  126.         end
  127.         local Effect = Instance.new("StringValue", bolt)
  128.         Effect.Name = "Effect"
  129.  
  130.         hitbox:Destroy()
  131.         MiscFunctions.TweenTransparency(bolt, 1, .2)
  132.         MiscFunctions.TweenTransparency(bolt.MeshPart, 1, .2)
  133.         bolt.Position = rayResult.Position
  134.  
  135.         game.Debris:AddItem(bolt, 0.5)
  136.     end)
  137.  
  138.     return bolt
  139. end
  140.  
  141. MageSkills["LightAttack"] = function(plr, InputTable)
  142.     local damagedata = {
  143.         Blockbreak = false,
  144.         Knockback = false,
  145.         Stun = true,
  146.         Stuntime = game.ReplicatedStorage.GlobalValues.Hitstun.Value,
  147.         KnockbackType = "Ground"
  148.     }
  149.     if CombatModule.Cooldowns(plr, "LightATK", false) == "OnCooldown" then return end
  150.     if not StatusModule.CanAttack(plr.Character) then return end
  151.  
  152.     local char = plr.Character
  153.     local Hrm = char.HumanoidRootPart
  154.     local orb = char.Orb
  155.     local destroyed = false
  156.     local statusInfo = {}
  157.     statusInfo.Character = ""
  158.     statusInfo.StatusName = "Attacking"
  159.     statusInfo.DeleteCopy = false
  160.     statusInfo.Duration = .4
  161.     statusInfo.StatusValue = 16
  162.     StatusModule.AddStatus(char, statusInfo)
  163.     CombatModule.Cooldowns(plr, "LightATK", true, 2)
  164.  
  165.     task.wait(.1)
  166.  
  167.     local BoltArgs = {}
  168.     BoltArgs.BoltSpeed = 1
  169.     BoltArgs.Damage = 4
  170.     BoltArgs.StartCFrame = Hrm.CFrame * CFrame.new(0,0,-0.3)
  171.     BoltArgs.MaxDistance = 17
  172.     BoltArgs.Direction = Hrm.CFrame.lookVector
  173.     mageBolt(plr, BoltArgs)
  174.  
  175. end
  176.  
  177. MageSkills["MediumAttack"] = function(plr, InputTable)
  178.     local damagedata = {
  179.         Blockbreak = false,
  180.         Knockback = false,
  181.         Stun = true,
  182.         Stuntime = game.ReplicatedStorage.GlobalValues.Hitstun.Value,
  183.         KnockbackType = "Ground"
  184.     }
  185.     if CombatModule.Cooldowns(plr, "MediumATK", false) == "OnCooldown" then return end
  186.     if not StatusModule.CanAttack(plr.Character) then return end
  187.  
  188.     local char = plr.Character
  189.     local Hrm = char.HumanoidRootPart
  190.     local orb = char.Orb
  191.     local destroyed = false
  192.     local statusInfo = {}
  193.     statusInfo.Character = ""
  194.     statusInfo.StatusName = "Attacking"
  195.     statusInfo.DeleteCopy = false
  196.     statusInfo.Duration = .5
  197.     statusInfo.StatusValue = 16
  198.     StatusModule.AddStatus(char, statusInfo)
  199.     CombatModule.Cooldowns(plr, "MediumATK", true, 2)
  200.     local endpos = (Hrm.CFrame * CFrame.new(0,0,-15)).Position
  201.     task.wait(0.05)
  202.  
  203.     local BoltArgs = {}
  204.     BoltArgs.BoltSpeed = 1
  205.     BoltArgs.Damage = 4
  206.     BoltArgs.StartCFrame = Hrm.CFrame * CFrame.new(-3,3,0)
  207.     BoltArgs.MaxDistance = 15
  208.     BoltArgs.Direction = (endpos - BoltArgs.StartCFrame.Position).Unit
  209.     BoltArgs.Endpos = endpos
  210.     mageBolt(plr, BoltArgs)
  211.     task.wait(.2)
  212.     BoltArgs.StartCFrame = Hrm.CFrame * CFrame.new(3,3,0)
  213.     BoltArgs.Direction = (endpos - BoltArgs.StartCFrame.Position).Unit
  214.     mageBolt(plr, BoltArgs)
  215. end
  216.  
  217. MageSkills["HeavyAttack"] = function(plr, InputTable)
  218.     if CombatModule.Cooldowns(plr, "HeavyATK", false) == "OnCooldown" then return end
  219.     if not StatusModule.CanAttack(plr.Character) then return end
  220.  
  221.     local char = plr.Character
  222.     local Hrm = char.HumanoidRootPart
  223.     local orb = char.Orb
  224.     local destroyed = false
  225.     local statusInfo = {}
  226.     statusInfo.Character = ""
  227.     statusInfo.StatusName = "Attacking"
  228.     statusInfo.DeleteCopy = false
  229.     statusInfo.Duration = 2
  230.     statusInfo.StatusValue = 5
  231.     StatusModule.AddStatus(char, statusInfo)
  232.     CombatModule.Cooldowns(plr, "HeavyATK", true, 3)
  233.     local endpos = (Hrm.CFrame * CFrame.new(0,0,-18)).Position
  234.     local dashargs = {}
  235.     dashargs.MaxForce = math.huge
  236.     dashargs.Vector = -Hrm.CFrame.lookVector
  237.     dashargs.Speed = 30
  238.     dashargs.Duration = .2
  239.     MiscFunctions.LinearProjectile(Hrm, dashargs)
  240.     task.wait(0.5)
  241.  
  242.     local BoltArgs = {}
  243.     BoltArgs.BoltSpeed = 1
  244.     BoltArgs.Damage = 4
  245.     BoltArgs.StartCFrame = Hrm.CFrame * CFrame.new(-1,-.5,-0.3)
  246.     BoltArgs.MaxDistance = 18
  247.     BoltArgs.Direction = Hrm.CFrame.lookVector
  248.     BoltArgs.Endpos = endpos
  249.     mageBolt(plr, BoltArgs)
  250.     task.wait(.1)
  251.     BoltArgs.StartCFrame = Hrm.CFrame * CFrame.new(1,-.5,-0.3)
  252.     mageBolt(plr, BoltArgs)
  253.     task.wait(.1)
  254.     BoltArgs.StartCFrame = Hrm.CFrame * CFrame.new(0,1,-0.3)
  255.     mageBolt(plr, BoltArgs)
  256. end
  257.  
  258. MageSkills["Flame Bolts"] = function(plr, InputTable)
  259.     --make sure to damage and consistent movement and also tracking
  260.     local char = plr.Character
  261.     local Hrm = char.HumanoidRootPart
  262.     local orb = char.Orb
  263.     local hyperArmor = false
  264.     local cancelled = false
  265.     local target = nil
  266.     local damagedata = {
  267.         Blockbreak = false,
  268.         Knockback = false,
  269.         Stun = true,
  270.         Stuntime = game.ReplicatedStorage.GlobalValues.Hitstun.Value,
  271.         KnockbackType = "Ground"
  272.     }
  273.     if CombatModule.Cooldowns(plr, "Mage_FlameBolts", false) == "OnCooldown" then return end
  274.     if not StatusModule.CanAttack(plr.Character) then return end
  275.     local statusInfo = {}
  276.     statusInfo.Character = ""
  277.     statusInfo.StatusName = "Attacking"
  278.     statusInfo.DeleteCopy = false
  279.     statusInfo.Duration = 1.5
  280.     statusInfo.StatusValue = 5
  281.     StatusModule.AddStatus(char, statusInfo)
  282.     CombatModule.Cooldowns(plr, "Mage_FlameBolts", true, 5)
  283.    
  284.     if char:FindFirstChild("MageShieldActive") then
  285.         hyperArmor = true
  286.     end
  287.  
  288.     local ClientTable = {}
  289.     ClientTable.Character = char
  290.     ClientTable.Effect = "Flame Bolts"
  291.     ClientTable.Class = "Mage"
  292.     ClientTable.EnemyChar = nil
  293.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  294.  
  295.     local anim = CombatModule.LoadAnimation(Assets.Animations.FireBall, plr)
  296.     anim:Play()
  297.     local mouseTargets = HitModule.CheckForPlayersNearPos(InputTable.MousePos, {char})
  298.     if #mouseTargets > 0 then
  299.         target = mouseTargets[1].HumanoidRootPart
  300.     end  
  301.  
  302.     local stunnedEvent = StatusModule.StatusAdded(char, {"Stunned"}, 3, "StunnedCheck")
  303.  
  304.     stunnedEvent.Event:Connect(function(AddedStatus)
  305.         if hyperArmor == true then return end
  306.         cancelled = true
  307.     end)
  308.  
  309.     task.wait(.8)
  310.     if cancelled == true then return end
  311.     hyperArmor = true
  312.     anim:AdjustSpeed(1)
  313.     for i=1, 3 do
  314.         local Bolt = game.ReplicatedStorage.ClassAssets.Mage.Skills.Effects.SmallFireball:Clone()
  315.         local bp = Instance.new("BodyPosition", Bolt)
  316.         bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  317.         local OrbPos = {
  318.             CFrame.new(-12, 0, 7),
  319.             CFrame.new(12, 0, 7),
  320.             CFrame.new(0, 7, 7),
  321.         }
  322.         Bolt.CFrame = Hrm.CFrame-- + OrbPos[1]
  323.         local endpos = InputTable.MousePos.p
  324.         Bolt.Name = "FlameBolt"--..tostring(i)
  325.         Bolt.Parent = char.ClassItems
  326.         bp.Position = (Hrm.CFrame * OrbPos[i]).p
  327.  
  328.         task.wait(.5)
  329.         bp:Destroy()
  330.         Bolt.Anchored = true
  331.         local Args = {}
  332.         Args.Character = char
  333.         Args.Part = Bolt
  334.         Args.Speed = .9
  335.         Args.MaxDist = 100
  336.         Args.Direction = Bolt.CFrame.LookVector
  337.         Args.Endpos = endpos
  338.         Args.Target = target
  339.         local hitbox = HitModule.CreateRayProjectile(Args)
  340.  
  341.         hitbox.Event:Connect(function(rayResult)
  342.             local hit = rayResult.Instance
  343.             if hit == nil then
  344.                 local HitPlrs = HitModule.CreateHitbox(Bolt.CFrame, Vector3.new(6,6,6), {char})
  345.                 for i, echar in pairs(HitPlrs) do
  346.                     DamageModule.Damage(char, echar, 10, damagedata)
  347.                     hitbox:Destroy()
  348.                 end
  349.                 task.delay(0.5, function()
  350.                     Bolt:Destroy()
  351.                 end)
  352.                
  353.                 return
  354.             end
  355.             if hit.Name == "FlameBolt" then return end
  356.             print(hit.Name)
  357.             --if hit.Name == "Baseplate" then return end
  358.             Bolt.Anchored = true
  359.             local Effect = Instance.new("StringValue", Bolt)
  360.             Effect.Name = "Effect"
  361.             local HitPlrs = HitModule.CreateHitbox(Bolt.CFrame, Vector3.new(6,6,6), {char})
  362.             for i, echar in pairs(HitPlrs) do
  363.                 DamageModule.Damage(char, echar, 10, damagedata)
  364.                 hitbox:Destroy()
  365.             end
  366.             task.delay(0.5, function()
  367.                 Bolt:Destroy()
  368.             end)
  369.         end)
  370.  
  371.         game:GetService("Debris"):AddItem(Bolt,7)
  372.         task.wait(.03)
  373.     end
  374. end
  375.  
  376. MageSkills["Thunder Spear"] = function(plr, InputTable)
  377.     local char = plr.Character
  378.     local Hrm = char.HumanoidRootPart
  379.     local orb = char.Orb
  380.     local hyperArmor = false
  381.     local cancelled = false
  382.     local damagedata = {
  383.         Blockbreak = true,
  384.         Knockback = false,
  385.         Stuntime = 1.5,
  386.         KnockbackType = "Ground"
  387.     }
  388.  
  389.     if CombatModule.Cooldowns(plr, "Mage_ThunderSpear", false) ~= "OffCooldown" then return end
  390.     if not StatusModule.CanAttack(plr.Character) then return end
  391.     local statusInfo = {}
  392.     statusInfo.Character = ""
  393.     statusInfo.StatusName = "Attacking"
  394.     statusInfo.DeleteCopy = false
  395.     statusInfo.Duration = 2.5
  396.     statusInfo.StatusValue = 4
  397.     StatusModule.AddStatus(char, statusInfo)
  398.     CombatModule.Cooldowns(plr, "Mage_ThunderSpear", true, 20)
  399.  
  400.     if char:FindFirstChild("MageShieldActive") then
  401.         hyperArmor = true
  402.     end
  403.     local hitboxEvent
  404.     local target
  405.     local Hitbox = Assets.Skills.Effects.ThunderSpearPart:Clone()
  406.     Hitbox.Parent = char.ClassItems
  407.     Hitbox.CFrame = Hrm.CFrame * CFrame.new(5, 1.5, 0)
  408.     Hitbox.Anchored = true
  409.     Hitbox.CFrame = CFrame.lookAt(Hitbox.Position, InputTable.MousePos.Position)
  410.  
  411.     local ClientTable = {}
  412.     ClientTable.Character = char
  413.     ClientTable.Effect = "Thunder Spear"
  414.     ClientTable.Class = "Mage"
  415.     ClientTable.EffectPart = Hitbox.ThunderSpear
  416.     ClientTable.EnemyChar = nil
  417.     ClientTable.Animation = Assets.Animations.ThunderSpear
  418.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  419.    
  420.     if char:FindFirstChild("MageShieldActive") then
  421.         hyperArmor = true
  422.     end
  423.  
  424.     local stunnedEvent = StatusModule.StatusAdded(char, {"Stunned"}, 5, "ThunderSpear")
  425.  
  426.     stunnedEvent.Event:Connect(function(AddedStatus)
  427.         if hyperArmor == true then return end
  428.         StatusModule.DeleteStatus(char, "Attacking")
  429.         cancelled = true
  430.         Hitbox:Destroy()
  431.     end)
  432.  
  433.     task.wait(1.5)
  434.     if cancelled == true then
  435.         return
  436.     end
  437.     hyperArmor = true
  438.  
  439.     local MousePos = InputModule.GetMousePos(plr)
  440.     local mouseTargets = HitModule.CheckForPlayersNearPos(MousePos, {char})
  441.     local Args = {}
  442.     Args.Character = char
  443.     Args.Part = Hitbox
  444.     Args.Speed = 2
  445.     Args.MaxDist = 300
  446.     if #mouseTargets > 0 then
  447.         target = mouseTargets[1].HumanoidRootPart
  448.         Args.Direction = (target.Position - Args.Part.Position).Unit
  449.         Args.Endpos = target.Position
  450.     else
  451.         Args.Direction = (MousePos.Position - Args.Part.Position).Unit
  452.         Args.Endpos = MousePos.Position
  453.     end
  454.     local hitbox = HitModule.CreateRayProjectile(Args, true)
  455.     hitbox.Event:Connect(function(rayResult)
  456.         if rayResult == "Finished" then
  457.             Hitbox.Anchored = true
  458.             local Effect = Instance.new("StringValue", Hitbox)
  459.             Effect.Name = "Effect"
  460.             Effect.Value = "Part"
  461.             hitbox:Destroy()
  462.             game.Debris:AddItem(Hitbox, 2)
  463.             return
  464.         end
  465.         local hit = rayResult.Instance
  466.         if hit.Parent == char then return end
  467.         if hit.Parent:FindFirstChild("Humanoid") then -- make sure to add some checks to make sure the enemy isnt blocking
  468.             task.wait(0.3)
  469.             print("we hit something")
  470.             local Values = DamageModule.Damage(char, hit.Parent, 15, damagedata)
  471.             if Values.Damaged == true then
  472.                 delay(1.5, function()
  473.                     DamageModule.Damage(char, hit.Parent, 10, damagedata)
  474.                 end)
  475.                 local eHRM = hit.Parent:FindFirstChild("HumanoidRootPart")
  476.                 Hitbox.Position = eHRM.Position
  477.                 Hitbox.Anchored = true
  478.                 local Effect = Instance.new("StringValue", Hitbox)
  479.                 Effect.Name = "Effect"
  480.                 Effect.Value = "Person"
  481.                 hitbox:Destroy()
  482.                 game.Debris:AddItem(Hitbox, 2)
  483.             else
  484.                 Hitbox.Anchored = true
  485.                 local Effect = Instance.new("StringValue", Hitbox)
  486.                 Effect.Name = "Effect"
  487.                 Effect.Value = "Part"
  488.                 hitbox:Destroy()
  489.                 game.Debris:AddItem(Hitbox, 2)
  490.             end
  491.  
  492.             return
  493.         else
  494.             Hitbox.Anchored = true
  495.             local Effect = Instance.new("StringValue", Hitbox)
  496.             Effect.Name = "Effect"
  497.             Effect.Value = "Part"
  498.             hitbox:Destroy()
  499.             game.Debris:AddItem(Hitbox, 2)
  500.             return
  501.         end
  502.     end)
  503.  
  504.     game.Debris:AddItem(Hitbox, 10)
  505. end
  506.  
  507.  
  508. MageSkills["Freezing Winds"] = function(plr, InputTable)
  509.     local char = plr.Character
  510.     local Hrm = char.HumanoidRootPart
  511.     local orb = char.Orb
  512.     local hyperArmor = false
  513.     local cancelled = false
  514.     local damagedata = {
  515.         Stun = true,
  516.         Stuntime = game.ReplicatedStorage.GlobalValues.Hitstun.Value,
  517.         KnockbackType = "Ground"
  518.     }
  519.  
  520.     if CombatModule.Cooldowns(plr, "Mage_FreezingWinds", false) ~= "OffCooldown" then return end
  521.     if not StatusModule.CanAttack(plr.Character) then return end
  522.     local statusInfo = {}
  523.     statusInfo.Character = ""
  524.     statusInfo.StatusName = "Attacking"
  525.     statusInfo.DeleteCopy = false
  526.     statusInfo.StatusValue = 5
  527.     statusInfo.Duration = 6.5
  528.     StatusModule.AddStatus(char, statusInfo)
  529.     CombatModule.Cooldowns(plr, "Mage_FreezingWinds", true, 20)
  530.     if char:FindFirstChild("MageShieldActive") then
  531.         hyperArmor = true
  532.     end
  533.     local stunnedEvent = StatusModule.StatusAdded(char, {"Stunned"}, 3, "StunnedCheck")
  534.  
  535.     stunnedEvent.Event:Connect(function(AddedStatus)
  536.         if hyperArmor == true then return end
  537.         StatusModule.DeleteStatus(char, "Attacking")
  538.         cancelled = true
  539.     end)
  540.  
  541.     task.wait(1)
  542.     if cancelled == true then
  543.         return
  544.     end
  545.     hyperArmor = true
  546.  
  547.     local Hitbox = Assets.Skills.Effects.FreezingWinds:Clone()
  548.     Hitbox:SetPrimaryPartCFrame(Hrm.CFrame * CFrame.new(0,0.5, -2))
  549.     local weld = Instance.new("WeldConstraint", Hrm)
  550.     weld.Part0 = weld.Parent
  551.     weld.Part1 = Hitbox.PrimaryPart
  552.     Hitbox.Parent = char.ClassItems
  553.  
  554.     local ClientTable = {}
  555.     ClientTable.Character = char
  556.     ClientTable.Effect = "Freezing Winds"
  557.     ClientTable.Class = "Mage"
  558.     ClientTable.EnemyChar = nil
  559.     ClientTable.EffectPart = Hitbox
  560.     ClientTable.EffectValue = 5
  561.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  562.  
  563.     local ZoneArgs = {}
  564.     ZoneArgs.Container = Hitbox
  565.     ZoneArgs.Duration = 5
  566.     local ignoreList = {char}
  567.     local PlayersInZone, ZoneEvent = HitModule.CreateZoneHitbox(ZoneArgs, ignoreList)
  568.  
  569.     ZoneEvent.Event:Connect(function(model, Func)
  570.         if Func == "Entered" then
  571.             table.insert(PlayersInZone, model)
  572.         elseif Func == "Exited" then
  573.             local pos = table.find(PlayersInZone, model)
  574.             if pos then
  575.                 table.remove(PlayersInZone, pos)
  576.             end
  577.         end
  578.     end)
  579.  
  580.     local function DamageCheck(damage)
  581.         for i, echar in pairs(PlayersInZone) do
  582.             local Values = DamageModule.Damage(char, echar, damage, damagedata)
  583.         end
  584.     end
  585.  
  586.     DamageModule.DamageOverTime(DamageCheck, 20, 5, 0.2)
  587.  
  588.     game.Debris:AddItem(Hitbox, 7)
  589. end
  590.  
  591.  
  592.  
  593. MageSkills["Mana Shield"] = function(plr, InputTable)
  594.     local char = plr.Character
  595.     local Hrm = char.HumanoidRootPart
  596.     local orb = char.Orb
  597.     local hyperArmor = false
  598.     local cancelled = false
  599.     local destroyed = false
  600.    
  601.     if CombatModule.Cooldowns(plr, "Mage_ManaShield", false) ~= "OffCooldown" then return end
  602.     if not StatusModule.CanAttack(plr.Character) then return end
  603.     local statusInfo = {}
  604.     statusInfo.Character = ""
  605.     statusInfo.StatusName = "Attacking"
  606.     statusInfo.DeleteCopy = false
  607.     statusInfo.StatusValue = 16
  608.     statusInfo.Duration = .7
  609.     StatusModule.AddStatus(char, statusInfo)
  610.  
  611.     local stunnedEvent = StatusModule.StatusAdded(char, {"Stunned"}, 1, "StunnedCheck")
  612.  
  613.     stunnedEvent.Event:Connect(function(AddedStatus)
  614.         if hyperArmor == true then return end
  615.         StatusModule.DeleteStatus(char, "Attacking")
  616.         cancelled = true
  617.     end)
  618.  
  619.     task.wait(.5)
  620.     if cancelled == true then
  621.         return
  622.     end
  623.     hyperArmor = true
  624.    
  625.     local ClientTable = {}
  626.     ClientTable.Character = char
  627.     ClientTable.Effect = "Mana Shield"
  628.     ClientTable.Class = "Mage"
  629.     ClientTable.EnemyChar = nil
  630.     ClientTable.EffectValue = 0
  631.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  632.    
  633.     local MageShieldVal = Instance.new("BoolValue")
  634.     MageShieldVal.Name = "MageShieldActive"
  635.     MageShieldVal.Value = true
  636.     MageShieldVal.Parent = char
  637.     char.ShieldBar.Value = char.ShieldBar.Value + 25
  638.     char.ShieldBar.Changed:Connect(function()
  639.         if char.ShieldBar.Value <= 0 then
  640.             destroyed = true
  641.             MageShieldVal:Destroy()
  642.             CombatModule.Cooldowns(plr, "Mage_ManaShield", true, 15)
  643.         end
  644.     end)
  645.  
  646.     task.delay(30, function()
  647.         if destroyed == true then return end
  648.         destroyed = true
  649.         MageShieldVal:Destroy()
  650.         char.ShieldBar.Value = 0
  651.     end)
  652. end
  653.  
  654. MageSkills["Mana Bomb"] = function(plr, InputTable)
  655.     local char = plr.Character
  656.     local Hrm = char.HumanoidRootPart
  657.     local orb = char.Orb
  658.     local damageChecked = false
  659.     local damagedata = {
  660.         Stun = true,
  661.         Stuntime = game.ReplicatedStorage.GlobalValues.Hitstun.Value,
  662.         KnockbackType = "Ground"
  663.     }
  664.  
  665.     if CombatModule.Cooldowns(plr, "Mage_ManaBomb", false) ~= "OffCooldown" then return end
  666.     if not StatusModule.CanAttack(plr.Character) then return end
  667.     local statusInfo = {}
  668.     statusInfo.Character = ""
  669.     statusInfo.StatusName = "Attacking"
  670.     statusInfo.DeleteCopy = false
  671.     statusInfo.StatusValue = 0
  672.     statusInfo.Duration = 7
  673.     StatusModule.AddStatus(char, statusInfo)
  674.     CombatModule.Cooldowns(plr, "Mage_ManaBomb", true, 30)
  675.  
  676.     local flyArgs = {}
  677.     flyArgs.Responsiveness = 10
  678.     flyArgs.Endpos = (Hrm.CFrame * CFrame.new(0, 20, 0)).Position
  679.     flyArgs.Duration = 6
  680.     local ap = MiscFunctions.TrackingProjectile(Hrm, flyArgs)
  681.     task.wait(1)
  682.  
  683.     local ClientTable = {}
  684.     ClientTable.Character = char
  685.     ClientTable.Effect = "Mana Bomb"
  686.     ClientTable.Class = "Mage"
  687.     ClientTable.EnemyChar = nil
  688.     ClientTable.EffectValue = 0
  689.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  690.     task.wait(3.5)
  691.  
  692.     local MainProjectile = Assets.Skills.Effects.SmallManaBomb:Clone()
  693.     MainProjectile.CFrame = Hrm.CFrame * CFrame.new(0,6,0)
  694.     MainProjectile.Parent = char.ClassItems
  695.     local MousePos = InputModule.GetMousePos(plr)
  696.  
  697.     task.wait(1)
  698.     local Args = {}
  699.     Args.Character = char
  700.     Args.Part = MainProjectile
  701.     Args.Speed = 1.5
  702.     Args.MaxDist = 300
  703.     Args.Direction = (MousePos.Position - MainProjectile.Position).Unit
  704.     Args.Endpos = MousePos.Position
  705.     local hitbox = HitModule.CreateRayProjectile(Args, true)
  706.  
  707.     hitbox.Event:Connect(function(rayResult)
  708.         local hit = rayResult.Instance
  709.         task.wait(0.2)
  710.         local Effect = Instance.new("StringValue", MainProjectile)
  711.         Effect.Name = "Effect"
  712.         task.delay(1, function()
  713.             MainProjectile:Destroy()
  714.         end)
  715.         task.wait(0.7)
  716.  
  717.         local explosion = Assets.Skills.Effects.ManaBombExplosion:Clone()
  718.         explosion.CFrame = MainProjectile.CFrame
  719.         explosion.Parent = char.ClassItems
  720.         local size = Vector3.new(30,30,30)
  721.         MiscFunctions.TweenSize(explosion, size, .2)
  722.  
  723.         local ZoneArgs = {}
  724.         ZoneArgs.Container = explosion
  725.         ZoneArgs.Duration = 5
  726.         local ignoreList = {char}
  727.         local PlayersInZone, ZoneEvent = HitModule.CreateZoneHitbox(ZoneArgs, ignoreList)
  728.  
  729.         ZoneEvent.Event:Connect(function(model, Func)
  730.             if Func == "Entered" then
  731.                 table.insert(PlayersInZone, model)
  732.             elseif Func == "Exited" then
  733.                 local pos = table.find(PlayersInZone, model)
  734.                 if pos then
  735.                     table.remove(PlayersInZone, pos)
  736.                 end
  737.             end
  738.         end)
  739.  
  740.         local function DamageCheck(damage)
  741.  
  742.             for i, echar in pairs(PlayersInZone) do
  743.                 local Values = DamageModule.Damage(char, echar, damage, damagedata)
  744.             end
  745.         end
  746.  
  747.         if damageChecked == false then
  748.             damageChecked = true
  749.             DamageModule.DamageOverTime(DamageCheck, 40, 5, 0.2)
  750.         end
  751.  
  752.  
  753.  
  754.         task.wait(0.3)
  755.         task.delay(5, function()
  756.             explosion.Transparency = 1
  757.             game.Debris:AddItem(explosion, 4)
  758.         end)
  759.         for i=1, 5 do
  760.             local size = explosion.Size + Vector3.new(2,2,2)
  761.             MiscFunctions.TweenSize(explosion, size, 1, Enum.EasingStyle.Bounce)
  762.             task.wait(1)
  763.         end
  764.  
  765.     end)
  766. end
  767.  
  768.  
  769. return MageSkills
  770.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement