local A=game:GetService("\068\101\098\114\105\115")local g=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")local r={}local i=script:FindFirstAncestor("\067\111\109\098\097\116\083\121\115\116\101\109")local Z=require(i.Modules.DamageBillboardHandler)local M=i.Assets.Sounds local q=i.Assets.Effects local t=i.Configuration function r.createHighlightEffect(r,A)local i=t.VisualEffects if i.Value then local r=q.Highlight:Clone()r.Enabled=true r.Parent=A local i=TweenInfo.new(3,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)local Z=g:Create(r,i,{FillTransparency=1;OutlineTransparency=1})Z.Completed:Once(function()r:Destroy()end)Z:Play()end end function r.playPunchedSoundEffect(r,g)local i=t.SoundEffects if i.Value then local r=M.Punched1:Clone()r.Parent=g r:Play()A:AddItem(r,1)end end function r.playSwingSoundEffect(r,g)local i=t.SoundEffects if i.Value then local r=M.Swing:Clone()r.Parent=g r:Play()A:AddItem(r,1)end end function r.showDamage(r,A,g)local M=i.Configuration.VisualEffects if M.Value then Z:showDamageBillboard(A,g)end end return r
local Debris = game:GetService("Debris")
local TweenService = game:GetService("TweenService")

local EffectsHandler = {}

local CombatSystem = script:FindFirstAncestor("CombatSystem")

local DamageBillboardHandler = require(CombatSystem.Modules.DamageBillboardHandler)

local sounds = CombatSystem.Assets.Sounds
local effects = CombatSystem.Assets.Effects
local configuration = CombatSystem.Configuration

function EffectsHandler:createHighlightEffect(characterOther)
	local visualEffects = configuration.VisualEffects
	if visualEffects.Value then
		local highlightEffect = effects.Highlight:Clone()
		highlightEffect.Enabled = true
		highlightEffect.Parent = characterOther

		local highlightTweenInfo = TweenInfo.new(
			3, -- time
			Enum.EasingStyle.Linear,
			Enum.EasingDirection.Out,
			0, -- repeatCount
			false, -- reverses
			0 -- delayTime
		)
		local highlightTween = TweenService:Create(
			highlightEffect,
			highlightTweenInfo, {
				FillTransparency = 1,
				OutlineTransparency = 1
			}
		)

		highlightTween.Completed:Once(function()
			highlightEffect:Destroy()
		end)

		highlightTween:Play()
	end
end

function EffectsHandler:playPunchedSoundEffect(characterOther)
	local soundEffects = configuration.SoundEffects
	if soundEffects.Value then
		local sound = sounds.Punched1:Clone()
		sound.Parent = characterOther
		sound:Play()

		Debris:AddItem(sound, 1)
	end
end

function EffectsHandler:playSwingSoundEffect(character)
	local soundEffects = configuration.SoundEffects
	if soundEffects.Value then
		local sound = sounds.Swing:Clone()
		sound.Parent = character
		sound:Play()

		Debris:AddItem(sound, 1)
	end
end

-- Function to show damagebilboard
function EffectsHandler:showDamage(adornee, damage)
	local visualEffects = CombatSystem.Configuration.VisualEffects
	if visualEffects.Value then
		DamageBillboardHandler:showDamageBillboard(adornee, damage)
	end
end

return EffectsHandler
