local celeste = require("#celeste.celeste")

function onDash()

    if getCurrentPatternID() >= 4 then puppet:removeSelf() end

    log(getCurrentPatternID())

    local p = getEntity("Player")
    --local b = getEntity("BossPuppet")

    p:FinalBossPushLaunch(sign(-(puppet.Position.X - p.Position.X)))
    celeste.Freeze(0.1)
    decreaseHealth()
    playSound("event:/game/general/wall_break_ice")

    if getHealth() <= 5*(3 - getCurrentPatternID()) then
        startAttackPattern(getCurrentPatternID() + 1)
    end

    if getCurrentPatternID() >= 4 then puppet:removeSelf() end

end

function setup()
    playPuppetAnim("idle")

end

function sign(x)
    return (x<0 and -1) or 1
end 