
local utils = loadCelesteAsset("Assets/CC/HollowKnight/Bosses/HollowKnight/Attacks/utils") --[[@as HKUtils]]
local moveXtowardsFacing = utils.moveXtowardsFacing

--- Go back 0.5 hitboxes over 0.75s
--- Go forward 4 hitboxes in 0.5s
--- Go forward 0.5 hitboxes in 0.25s
function onBegin()
    --log("LUNGE")
    setFlag("hk_change_to_no_head", true)
    playPuppetAnim("lungeS")
    moveXtowardsFacing(-17/2, 0.3)
    wait(0.5)
    moveXtowardsFacing(17*6, 0.4)
    local attack
    if puppet.Facing > 0 then
        attack = getNewBasicAttackEntity(puppet.Position + vector2(-57, 11), getHitbox(47, 15))
    else
        attack = getNewBasicAttackEntity(puppet.Position + vector2(10, 11), getHitbox(47, 15))
    end
	playSound("event:/CC/CC_HollowKnight/SFX/Boss SFX/Dash", puppet.Center)
    attack:Add(getEntityTimer(0.4))
    addEntity(attack)
    addComponentToBoss(getEntityChain(attack))
    wait(0.4)
    playPuppetAnim("lungeE")
    wait(0.1)
    moveXtowardsFacing(17/2, 0.25)
    wait(0.25)
    setFlag("hk_change_to_main", true)
end