comments = {}
commands = {"Check", "Kick"}
randomdialogue = {"[next]"}

sprite = "empty"
name = "Sans"
hp = 10000
def = 99999
atk = 5
check = ""
dialogbubble = "leftwide"
canspare = false
cancheck = false

SetActive(false)

function HandleAttack(attackstatus)
    if attackstatus == -1 then
		Encounter["StatusPhase3"][Encounter["progress"] + 1] = "Miss Sans"
    else
		if Encounter["FUN"][1] == "Rare" and Encounter["FUN"][2] == 2 then
			Encounter.Call("KillSans")
			Hitted = true
			hp = 1
		end
		Encounter["StatusPhase3"][Encounter["progress"] + 1] = "Fight Sans"
    end
end

function BeforeDamageCalculation()
	if Encounter["FUN"][1] == "Rare" and Encounter["FUN"][2] == 2 then
		SetDamage(9999999)
	else
		Encounter.Call("Dodge")
	end
	Encounter.Call("SetHead","Happy")
end

function HandleCustomCommand(command)
	if command == "CHECK" then
		BattleDialog({"[effect:none]SANS - 20 ATK 1 DEF[w:10]\nSomehow he got stronger.[w:10]\nCan dodge attacks.[func:Wink]"})
		if string.sub(GetAlMightyGlobal("ProgresoProgresivamenteProgresante1"), 4, 4) == "0" then
			SetAlMightyGlobal("ProgresoProgresivamenteProgresante1", string.sub(GetAlMightyGlobal("ProgresoProgresivamenteProgresante1"), 1, 3).."1"..string.sub(GetAlMightyGlobal("ProgresoProgresivamenteProgresante1"), 5))
			if GetAlMightyGlobal("ProgresoProgresivamenteProgresante1") == "111111" then
				SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 8).."1"..string.sub(GetAlMightyGlobal("Archivimentazo"), 10))
				Encounter["LogroDesbloqueado"] = {Timer = 0, Icon = 9}
			end
		end
		Encounter["StatusPhase3"][Encounter["progress"] + 1] = "Check Sans"
	elseif command == "CHECAR" then
		BattleDialog({"[effect:none]SANS - 20 ATK 1 DEF[w:10]\nDe alguna manera es más fuerte.[w:10]\nPuede esquivar ataques.[func:Wink]"})
		if string.sub(GetAlMightyGlobal("ProgresoProgresivamenteProgresante1"), 4, 4) == "0" then
			SetAlMightyGlobal("ProgresoProgresivamenteProgresante1", string.sub(GetAlMightyGlobal("ProgresoProgresivamenteProgresante1"), 1, 3).."1"..string.sub(GetAlMightyGlobal("ProgresoProgresivamenteProgresante1"), 5))
			if GetAlMightyGlobal("ProgresoProgresivamenteProgresante1") == "111111" then
				SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 8).."1"..string.sub(GetAlMightyGlobal("Archivimentazo"), 10))
				Encounter["LogroDesbloqueado"] = {Timer = 0, Icon = 9}
			end
		end
		Encounter["StatusPhase3"][Encounter["progress"] + 1] = "Check Sans"
	elseif command == "ПРОВЕРИТЬ" then
		BattleDialog({"[effect:none]САНС - 20 АТК 1 ЗЩТ[w:10]\nКаким-то образом стал сильнее.[w:10]\nМожет уворачиваться от атак.[func:Wink]"})
		if string.sub(GetAlMightyGlobal("ProgresoProgresivamenteProgresante1"), 4, 4) == "0" then
			SetAlMightyGlobal("ProgresoProgresivamenteProgresante1", string.sub(GetAlMightyGlobal("ProgresoProgresivamenteProgresante1"), 1, 3).."1"..string.sub(GetAlMightyGlobal("ProgresoProgresivamenteProgresante1"), 5))
			if GetAlMightyGlobal("ProgresoProgresivamenteProgresante1") == "111111" then
				SetAlMightyGlobal("Archivimentazo", string.sub(GetAlMightyGlobal("Archivimentazo"), 1, 8).."1"..string.sub(GetAlMightyGlobal("Archivimentazo"), 10))
				Encounter["LogroDesbloqueado"] = {Timer = 0, Icon = 9}
			end
		end
		Encounter["StatusPhase3"][Encounter["progress"] + 1] = "Check Sans"
	elseif command == "KICK" then
		Encounter.Call("Kick")
		BattleDialog({"[noskip][effect:none]You kick the bottle of ketchup\ron the floor.[w:10]\nSans catches it."})
		Encounter["StatusPhase3"][Encounter["progress"] + 1] = "Kick"
	elseif command == "PATEAR" then
		Encounter.Call("Kick")
		BattleDialog({"[noskip][effect:none]Pateas la botella de ketchup\rdel suelo.[w:10]\nSans lo atrapa."})
		Encounter["StatusPhase3"][Encounter["progress"] + 1] = "Kick"
	elseif command == "ПНУТЬ" then
		Encounter.Call("Kick")
		BattleDialog({"[noskip][effect:none]Вы пинаете бутылку кетчупа,\rкоторая была на полу.[w:10]\nСанс её ловит."})
		Encounter["StatusPhase3"][Encounter["progress"] + 1] = "Kick"
	end
end

function Wink(bool)
	Encounter.Call("Wink")
end