local I=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local x=require((I:WaitForChild("\080\114\111\106\101\099\116")):WaitForChild("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101"))local u=x:GetResource("\069\120\116\101\114\110\097\108\085\116\105\108\046\078\101\120\117\115\073\110\115\116\097\110\099\101\046\078\101\120\117\115\079\098\106\101\099\116")local U=u:Extend()U:SetClassName("\068\101\097\116\104\066\097\108\108\065\116\116\097\099\107")function U.PerformServerAttack(I,x,u)local U=I.Character if U then local I=U:FindFirstChild("\072\117\109\097\110\111\105\100")local k=U:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if I and I.Health>0 then local R=Instance.new("\080\097\114\116")R.Transparency=.5 R.BrickColor=BrickColor.new("\073\110\115\116\117\116\105\111\110\097\108 \119\104\105\116\101")R.Size=Vector3.new(1.6,1.6,1.6)R.Shape=Enum.PartType.Ball R.CFrame=k.CFrame R.CanCollide=false R.Parent=x local p=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")p.MaxForce=Vector3.new(math.huge,math.huge,math.huge)p.Velocity=(CFrame.new(k.CFrame.Position,u)).LookVector*200 p.Parent=R local z z=R.Touched:Connect(function(u)local n=u.Parent if n and n:IsDescendantOf(x)then local x=n:FindFirstChild("\072\117\109\097\110\111\105\100")if x then if n.Name=="\066\108\111\120\104\105\108\100\097"then z:Disconnect()R.CFrame=u.CFrame p.Velocity=(CFrame.new(u.Position,k.CFrame.Position)).LookVector*200 R.Touched:Connect(function(x)if x.Parent==U then I:TakeDamage(I.Health)R:Destroy()end end)else x:TakeDamage(x.Health)R:Destroy()end end end end)delay(3,function()R:Destroy()end)end end end return U
--[[
TheNexusAvenger

Attack for a death ball.
Class is static (should not be created).
--]]

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage"))

local NexusObject = ReplicatedStorageProject:GetResource("ExternalUtil.NexusInstance.NexusObject")

local DeathBallAttack = NexusObject:Extend()
DeathBallAttack:SetClassName("DeathBallAttack")



--[[
Performs the attack on the server.
--]]
function DeathBallAttack.PerformServerAttack(Player,DungeonModel,Target)
    local Character = Player.Character
    if Character then
        local Humanoid = Character:FindFirstChild("Humanoid")
        local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
        if Humanoid and Humanoid.Health > 0 then
            --Create the projectile.
            local DeathBallProjectile = Instance.new("Part")
            DeathBallProjectile.Transparency = 0.5
            DeathBallProjectile.BrickColor = BrickColor.new("Instutional white")
            DeathBallProjectile.Size = Vector3.new(1.6,1.6,1.6)
            DeathBallProjectile.Shape = Enum.PartType.Ball
            DeathBallProjectile.CFrame = HumanoidRootPart.CFrame
            DeathBallProjectile.CanCollide = false
            DeathBallProjectile.Parent = DungeonModel

            local BodyVelocity = Instance.new("BodyVelocity")
            BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
            BodyVelocity.Velocity = CFrame.new(HumanoidRootPart.CFrame.Position,Target).LookVector * 200
            BodyVelocity.Parent = DeathBallProjectile

            --Set up killing the monster.
            local TouchEvent
            TouchEvent = DeathBallProjectile.Touched:Connect(function(TouchPart)
                local MonsterCharacter = TouchPart.Parent
                if MonsterCharacter and MonsterCharacter:IsDescendantOf(DungeonModel) then
                    local MonsterHumanoid = MonsterCharacter:FindFirstChild("Humanoid")
                    if MonsterHumanoid then
                        if MonsterCharacter.Name == "Bloxhilda" then
                            --Reflect the attack to make Bloxhilda not easy.
                            TouchEvent:Disconnect()
                            DeathBallProjectile.CFrame = TouchPart.CFrame
                            BodyVelocity.Velocity = CFrame.new(TouchPart.Position,HumanoidRootPart.CFrame.Position).LookVector * 200

                            --Connect killing the player.
                            DeathBallProjectile.Touched:Connect(function(NewTouchPart)
                                if NewTouchPart.Parent == Character then
                                    Humanoid:TakeDamage(Humanoid.Health)
                                    DeathBallProjectile:Destroy()
                                end
                            end)
                        else
                            --Kill the monster.
                            MonsterHumanoid:TakeDamage(MonsterHumanoid.Health)
                            DeathBallProjectile:Destroy()
                        end
                    end
                end
            end)

            --Clear the projectile.
            delay(3,function()
                DeathBallProjectile:Destroy()
            end)
        end
    end
end



return DeathBallAttack