Advertisement
geethepaster

Untitled

Aug 5th, 2022
830
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 = .7
  161.     statusInfo.StatusValue = 5
  162.     StatusModule.AddStatus(char, statusInfo)
  163.     CombatModule.Cooldowns(plr, "LightATK", true, 1.6)
  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 = 12
  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 = 1
  197.     statusInfo.StatusValue = 5
  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.2)
  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.     local ClientTable = {}
  285.     ClientTable.Character = char
  286.     ClientTable.Effect = "Flame Bolts"
  287.     ClientTable.Class = "Mage"
  288.     ClientTable.EnemyChar = nil
  289.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  290.  
  291.     local anim = CombatModule.LoadAnimation(Assets.Animations.FireBall, plr)
  292.     anim:Play()
  293.     local mouseTargets = HitModule.CheckForPlayersNearPos(InputTable.MousePos, {char})
  294.     if #mouseTargets > 0 then
  295.         target = mouseTargets[1].HumanoidRootPart
  296.     end  
  297.  
  298.     local stunnedEvent = StatusModule.StatusAdded(char, {"Stunned"})
  299.  
  300.     stunnedEvent.Event:Connect(function(AddedStatus)
  301.         if hyperArmor == true then return end
  302.         cancelled = true
  303.     end)
  304.  
  305.     task.wait(.8)
  306.     if cancelled == true then return end
  307.     hyperArmor = true
  308.     anim:AdjustSpeed(1)
  309.     for i=1, 3 do
  310.         local Bolt = game.ReplicatedStorage.ClassAssets.Mage.Skills.Effects.SmallFireball:Clone()
  311.         local bp = Instance.new("BodyPosition", Bolt)
  312.         bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  313.         local OrbPos = {
  314.             CFrame.new(-12, 0, 7),
  315.             CFrame.new(12, 0, 7),
  316.             CFrame.new(0, 7, 7),
  317.         }
  318.         Bolt.CFrame = Hrm.CFrame-- + OrbPos[1]
  319.         local endpos = InputTable.MousePos.p
  320.         Bolt.Name = "FlameBolt"--..tostring(i)
  321.         Bolt.Parent = char.ClassItems
  322.         bp.Position = (Hrm.CFrame * OrbPos[i]).p
  323.  
  324.         task.wait(.5)
  325.         bp:Destroy()
  326.         Bolt.Anchored = true
  327.         local Args = {}
  328.         Args.Character = char
  329.         Args.Part = Bolt
  330.         Args.Speed = .9
  331.         Args.MaxDist = 100
  332.         Args.Direction = Bolt.CFrame.LookVector
  333.         Args.Endpos = endpos
  334.         Args.Target = target
  335.         local hitbox = HitModule.CreateRayProjectile(Args)
  336.  
  337.         hitbox.Event:Connect(function(rayResult)
  338.             local hit = rayResult.Instance
  339.             if hit.Name == "FlameBolt" then return end
  340.             print(hit.Name)
  341.             --if hit.Name == "Baseplate" then return end
  342.             Bolt.Anchored = true
  343.             local Effect = Instance.new("StringValue", Bolt)
  344.             Effect.Name = "Effect"
  345.             local HitPlrs = HitModule.CreateHitbox(Bolt.CFrame, Vector3.new(6,6,6), {char})
  346.             for i, echar in pairs(HitPlrs) do
  347.                 DamageModule.Damage(char, echar, 10, damagedata)
  348.                 hitbox:Destroy()
  349.             end
  350.             task.delay(0.5, function()
  351.                 Bolt:Destroy()
  352.             end)
  353.         end)
  354.  
  355.         game:GetService("Debris"):AddItem(Bolt,7)
  356.         task.wait(.03)
  357.     end
  358. end
  359.  
  360. MageSkills["Thunder Spear"] = function(plr, InputTable)
  361.     local char = plr.Character
  362.     local Hrm = char.HumanoidRootPart
  363.     local orb = char.Orb
  364.     local hyperArmor = false
  365.     local cancelled = false
  366.     local damagedata = {
  367.         Blockbreak = true,
  368.         Knockback = false,
  369.         Stuntime = 1.5,
  370.         KnockbackType = "Ground"
  371.     }
  372.  
  373.     if CombatModule.Cooldowns(plr, "Mage_ThunderSpear", false) ~= "OffCooldown" then return end
  374.     if not StatusModule.CanAttack(plr.Character) then return end
  375.     local statusInfo = {}
  376.     statusInfo.Character = ""
  377.     statusInfo.StatusName = "Attacking"
  378.     statusInfo.DeleteCopy = false
  379.     statusInfo.Duration = 2.5
  380.     statusInfo.StatusValue = 0
  381.     StatusModule.AddStatus(char, statusInfo)
  382.     CombatModule.Cooldowns(plr, "Mage_ThunderSpear", true, 5)
  383.  
  384.  
  385.     local hitboxEvent
  386.     local target
  387.     local Hitbox = Assets.Skills.Effects.ThunderSpearPart:Clone()
  388.     Hitbox.Parent = char.ClassItems
  389.     Hitbox.CFrame = Hrm.CFrame * CFrame.new(5, 1.5, 0)
  390.     Hitbox.Anchored = true
  391.     Hitbox.CFrame = CFrame.lookAt(Hitbox.Position, InputTable.MousePos.Position)
  392.  
  393.     local ClientTable = {}
  394.     ClientTable.Character = char
  395.     ClientTable.Effect = "Thunder Spear"
  396.     ClientTable.Class = "Mage"
  397.     ClientTable.EffectPart = Hitbox.ThunderSpear
  398.     ClientTable.EnemyChar = nil
  399.     ClientTable.Animation = Assets.Animations.ThunderSpear
  400.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  401.  
  402.     local stunnedEvent = StatusModule.StatusAdded(char, {"Stunned"}, 5, "ThunderSpear")
  403.  
  404.     stunnedEvent.Event:Connect(function(AddedStatus)
  405.         if hyperArmor == true then return end
  406.         StatusModule.DeleteStatus(char, "Attacking")
  407.         cancelled = true
  408.     end)
  409.  
  410.     task.wait(1.5)
  411.     if cancelled == true then
  412.         Hitbox:Destroy()
  413.         return
  414.     end
  415.     hyperArmor = true
  416.  
  417.     local MousePos = InputModule.GetMousePos(plr)
  418.     local mouseTargets = HitModule.CheckForPlayersNearPos(MousePos, {char})
  419.     local Args = {}
  420.     Args.Character = char
  421.     Args.Part = Hitbox
  422.     Args.Speed = 2
  423.     Args.MaxDist = 300
  424.     if #mouseTargets > 0 then
  425.         target = mouseTargets[1].HumanoidRootPart
  426.         Args.Direction = (target.Position - Args.Part.Position).Unit
  427.         Args.Endpos = target.Position
  428.     else
  429.         Args.Direction = (MousePos.Position - Args.Part.Position).Unit
  430.         Args.Endpos = MousePos.Position
  431.     end
  432.     local hitbox = HitModule.CreateRayProjectile(Args, true)
  433.     hitbox.Event:Connect(function(rayResult)
  434.         if rayResult == "Finished" then
  435.             Hitbox.Anchored = true
  436.             local Effect = Instance.new("StringValue", Hitbox)
  437.             Effect.Name = "Effect"
  438.             Effect.Value = "Part"
  439.             hitbox:Destroy()
  440.             game.Debris:AddItem(Hitbox, 2)
  441.             return
  442.         end
  443.         local hit = rayResult.Instance
  444.         if hit.Parent == char then return end
  445.         if hit.Parent:FindFirstChild("Humanoid") then -- make sure to add some checks to make sure the enemy isnt blocking
  446.             task.wait(0.3)
  447.             print("we hit something")
  448.             local Values = DamageModule.Damage(char, hit.Parent, 15, damagedata)
  449.             if Values.Damaged == true then
  450.                 delay(1.5, function()
  451.                     DamageModule.Damage(char, hit.Parent, 10, damagedata)
  452.                 end)
  453.                 local eHRM = hit.Parent:FindFirstChild("HumanoidRootPart")
  454.                 Hitbox.Position = eHRM.Position
  455.                 Hitbox.Anchored = true
  456.                 local Effect = Instance.new("StringValue", Hitbox)
  457.                 Effect.Name = "Effect"
  458.                 Effect.Value = "Person"
  459.                 hitbox:Destroy()
  460.                 game.Debris:AddItem(Hitbox, 2)
  461.             else
  462.                 Hitbox.Anchored = true
  463.                 local Effect = Instance.new("StringValue", Hitbox)
  464.                 Effect.Name = "Effect"
  465.                 Effect.Value = "Part"
  466.                 hitbox:Destroy()
  467.                 game.Debris:AddItem(Hitbox, 2)
  468.             end
  469.  
  470.             return
  471.         else
  472.             Hitbox.Anchored = true
  473.             local Effect = Instance.new("StringValue", Hitbox)
  474.             Effect.Name = "Effect"
  475.             Effect.Value = "Part"
  476.             hitbox:Destroy()
  477.             game.Debris:AddItem(Hitbox, 2)
  478.             return
  479.         end
  480.     end)
  481.  
  482.     game.Debris:AddItem(Hitbox, 10)
  483. end
  484.  
  485.  
  486. MageSkills["Freezing Winds"] = function(plr, InputTable)
  487.     local char = plr.Character
  488.     local Hrm = char.HumanoidRootPart
  489.     local orb = char.Orb
  490.     local hyperArmor = false
  491.     local cancelled = false
  492.     local damagedata = {
  493.         Stun = true,
  494.         Stuntime = game.ReplicatedStorage.GlobalValues.Hitstun.Value,
  495.         KnockbackType = "Ground"
  496.     }
  497.  
  498.     if CombatModule.Cooldowns(plr, "Mage_FreezingWinds", false) ~= "OffCooldown" then return end
  499.     if not StatusModule.CanAttack(plr.Character) then return end
  500.     local statusInfo = {}
  501.     statusInfo.Character = ""
  502.     statusInfo.StatusName = "Attacking"
  503.     statusInfo.DeleteCopy = false
  504.     statusInfo.StatusValue = 5
  505.     statusInfo.Duration = 6.5
  506.     StatusModule.AddStatus(char, statusInfo)
  507.     CombatModule.Cooldowns(plr, "Mage_FreezingWinds", true, 20)
  508.  
  509.     local stunnedEvent = StatusModule.StatusAdded(char, {"Stunned"}, 5)
  510.  
  511.     stunnedEvent.Event:Connect(function(AddedStatus)
  512.         if hyperArmor == true then return end
  513.         StatusModule.DeleteStatus(char, "Attacking")
  514.         cancelled = true
  515.     end)
  516.  
  517.     task.wait(1)
  518.     if cancelled == true then
  519.         return
  520.     end
  521.     hyperArmor = true
  522.  
  523.     local Hitbox = Assets.Skills.Effects.FreezingWinds:Clone()
  524.     Hitbox:SetPrimaryPartCFrame(Hrm.CFrame * CFrame.new(0,0.5, -2))
  525.     local weld = Instance.new("WeldConstraint", Hrm)
  526.     weld.Part0 = weld.Parent
  527.     weld.Part1 = Hitbox.PrimaryPart
  528.     Hitbox.Parent = char.ClassItems
  529.  
  530.     local ClientTable = {}
  531.     ClientTable.Character = char
  532.     ClientTable.Effect = "Freezing Winds"
  533.     ClientTable.Class = "Mage"
  534.     ClientTable.EnemyChar = nil
  535.     ClientTable.EffectPart = Hitbox
  536.     ClientTable.EffectValue = 5
  537.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  538.  
  539.     local ZoneArgs = {}
  540.     ZoneArgs.Container = Hitbox
  541.     ZoneArgs.Duration = 5
  542.     local ignoreList = {char}
  543.     local PlayersInZone, ZoneEvent = HitModule.CreateZoneHitbox(ZoneArgs, ignoreList)
  544.  
  545.     ZoneEvent.Event:Connect(function(model, Func)
  546.         if Func == "Entered" then
  547.             table.insert(PlayersInZone, model)
  548.         elseif Func == "Exited" then
  549.             local pos = table.find(PlayersInZone, model)
  550.             if pos then
  551.                 table.remove(PlayersInZone, pos)
  552.             end
  553.         end
  554.     end)
  555.  
  556.     local function DamageCheck(damage)
  557.         for i, echar in pairs(PlayersInZone) do
  558.             local Values = DamageModule.Damage(char, echar, damage, damagedata)
  559.         end
  560.     end
  561.  
  562.     DamageModule.DamageOverTime(DamageCheck, 20, 5, 0.2)
  563.  
  564.     game.Debris:AddItem(Hitbox, 7)
  565. end
  566.  
  567.  
  568.  
  569. MageSkills["Gaia's Protection"] = function(plr, InputTable)
  570.     local char = plr.Character
  571.     local Hrm = char.HumanoidRootPart
  572.     local orb = char.Orb
  573.     local hyperArmor = false
  574.     local cancelled = false
  575.     if CombatModule.Cooldowns(plr, "Mage_GaiaProtection", false) ~= "OffCooldown" then return end
  576.     if not StatusModule.CanAttack(plr.Character) then return end
  577.     local statusInfo = {}
  578.     statusInfo.Character = ""
  579.     statusInfo.StatusName = "Attacking"
  580.     statusInfo.DeleteCopy = false
  581.     statusInfo.StatusValue = 1
  582.     statusInfo.Duration = 2
  583.     StatusModule.AddStatus(char, statusInfo)
  584.     CombatModule.Cooldowns(plr, "Mage_GaiaProtection", true, 40)
  585.  
  586.     local stunnedEvent = StatusModule.StatusAdded(char, {"Stunned"}, 5)
  587.  
  588.     stunnedEvent.Event:Connect(function(AddedStatus)
  589.         if hyperArmor == true then return end
  590.         StatusModule.DeleteStatus(char, "Attacking")
  591.         cancelled = true
  592.     end)
  593.  
  594.     task.wait(1)
  595.     if cancelled == true then
  596.         return
  597.     end
  598.     hyperArmor = true
  599.  
  600.     local OldPos = {}
  601.     local Pillars = script.RockWall:Clone()
  602.     Pillars:SetPrimaryPartCFrame(Hrm.CFrame * CFrame.new(0,5,-18))
  603.     for i, pillar in pairs(Pillars:GetChildren()) do
  604.         OldPos[pillar.Name] = pillar.Position
  605.         pillar.CFrame = pillar.CFrame * CFrame.new(0,-pillar.Size.Y, 0)
  606.     end
  607.     Pillars.Parent = workspace.ServerStuff
  608.     local main = Pillars.RockPillarMain
  609.     TweenPos(Pillars.RockPillarMain, OldPos[main.Name], .1)
  610.     task.wait(.2)
  611.     for i=1, 11 do
  612.         local pillar = Pillars:FindFirstChild("RockPillar"..tostring(i))
  613.         TweenPos(pillar, OldPos[pillar.Name], .2)
  614.         task.wait(.2)
  615.     end
  616.     task.delay(8, function()
  617.         for i, pillar in pairs(Pillars:GetChildren()) do
  618.             TweenPos(pillar, (pillar.CFrame * CFrame.new(0,-pillar.Size.Y, 0)).Position, 1)
  619.             game.Debris:AddItem(Pillars, 3)
  620.         end
  621.     end)
  622. end
  623.  
  624. MageSkills["Mana Bomb"] = function(plr, InputTable)
  625.     local char = plr.Character
  626.     local Hrm = char.HumanoidRootPart
  627.     local orb = char.Orb
  628.     local damageChecked = false
  629.     local damagedata = {
  630.         Stun = true,
  631.         Stuntime = game.ReplicatedStorage.GlobalValues.Hitstun.Value,
  632.         KnockbackType = "Ground"
  633.     }
  634.  
  635.     if CombatModule.Cooldowns(plr, "Mage_ManaBomb", false) ~= "OffCooldown" then return end
  636.     if not StatusModule.CanAttack(plr.Character) then return end
  637.     local statusInfo = {}
  638.     statusInfo.Character = ""
  639.     statusInfo.StatusName = "Attacking"
  640.     statusInfo.DeleteCopy = false
  641.     statusInfo.StatusValue = 0
  642.     statusInfo.Duration = 7
  643.     StatusModule.AddStatus(char, statusInfo)
  644.     CombatModule.Cooldowns(plr, "Mage_ManaBomb", true, 30)
  645.  
  646.     local flyArgs = {}
  647.     flyArgs.Responsiveness = 10
  648.     flyArgs.Endpos = (Hrm.CFrame * CFrame.new(0, 20, 0)).Position
  649.     flyArgs.Duration = 6
  650.     local ap = MiscFunctions.TrackingProjectile(Hrm, flyArgs)
  651.     task.wait(1)
  652.  
  653.     local ClientTable = {}
  654.     ClientTable.Character = char
  655.     ClientTable.Effect = "Mana Bomb"
  656.     ClientTable.Class = "Mage"
  657.     ClientTable.EnemyChar = nil
  658.     ClientTable.EffectValue = 0
  659.     Events.ClientEvent:FireAllClients("Effect", ClientTable)
  660.     task.wait(3.5)
  661.  
  662.     local MainProjectile = Assets.Skills.Effects.SmallManaBomb:Clone()
  663.     MainProjectile.CFrame = Hrm.CFrame * CFrame.new(0,6,0)
  664.     MainProjectile.Parent = char.ClassItems
  665.     local MousePos = InputModule.GetMousePos(plr)
  666.  
  667.     task.wait(1)
  668.     local Args = {}
  669.     Args.Character = char
  670.     Args.Part = MainProjectile
  671.     Args.Speed = 1.5
  672.     Args.MaxDist = 300
  673.     Args.Direction = (MousePos.Position - MainProjectile.Position).Unit
  674.     Args.Endpos = MousePos.Position
  675.     local hitbox = HitModule.CreateRayProjectile(Args, true)
  676.  
  677.     hitbox.Event:Connect(function(rayResult)
  678.         local hit = rayResult.Instance
  679.         task.wait(0.2)
  680.         local Effect = Instance.new("StringValue", MainProjectile)
  681.         Effect.Name = "Effect"
  682.         task.delay(1, function()
  683.             MainProjectile:Destroy()
  684.         end)
  685.         task.wait(0.7)
  686.  
  687.         local explosion = Assets.Skills.Effects.ManaBombExplosion:Clone()
  688.         explosion.CFrame = MainProjectile.CFrame
  689.         explosion.Parent = char.ClassItems
  690.         local size = Vector3.new(30,30,30)
  691.         MiscFunctions.TweenSize(explosion, size, .2)
  692.  
  693.         local ZoneArgs = {}
  694.         ZoneArgs.Container = explosion
  695.         ZoneArgs.Duration = 5
  696.         local ignoreList = {char}
  697.         local PlayersInZone, ZoneEvent = HitModule.CreateZoneHitbox(ZoneArgs, ignoreList)
  698.  
  699.         ZoneEvent.Event:Connect(function(model, Func)
  700.             if Func == "Entered" then
  701.                 table.insert(PlayersInZone, model)
  702.             elseif Func == "Exited" then
  703.                 local pos = table.find(PlayersInZone, model)
  704.                 if pos then
  705.                     table.remove(PlayersInZone, pos)
  706.                 end
  707.             end
  708.         end)
  709.  
  710.         local function DamageCheck(damage)
  711.  
  712.             for i, echar in pairs(PlayersInZone) do
  713.                 local Values = DamageModule.Damage(char, echar, damage, damagedata)
  714.             end
  715.         end
  716.  
  717.         if damageChecked == false then
  718.             damageChecked = true
  719.             DamageModule.DamageOverTime(DamageCheck, 40, 5, 0.2)
  720.         end
  721.  
  722.  
  723.  
  724.         task.wait(0.3)
  725.         task.delay(5, function()
  726.             explosion.Transparency = 1
  727.             game.Debris:AddItem(explosion, 4)
  728.         end)
  729.         for i=1, 5 do
  730.             local size = explosion.Size + Vector3.new(2,2,2)
  731.             MiscFunctions.TweenSize(explosion, size, 1, Enum.EasingStyle.Bounce)
  732.             task.wait(1)
  733.         end
  734.  
  735.     end)
  736. end
  737.  
  738.  
  739. return MageSkills
  740.  
Advertisement
RAW Paste Data Copied
Advertisement