pokenew1 = 0
slot2 = 0
for pokenew = 1, 6 do
	if pokemon[pokenew].MAX_HP == 0 and pokenew1 == 0 then
		slot = pokenew
		slot2 = pokenew
		pokenew1 = 1
	end

end

blue = Color.new(56,172,236)
a = 0
file = io.open("./pokemon/swinub/swinub.txt", "r")
pokemon[slot].name = file:read(6)
blank = file:read()
pokemon[slot].exp = 1
pokemon[slot].MAX_HP = file:read("*n")
blank = file:read()
pokemon[slot].STR = file:read("*n")
blank = file:read()
pokemon[slot].DEF = file:read("*n")
blank = file:read()
pokemon[slot].AGI = file:read("*n")
blank = file:read()
pokemon[slot].SPA = file:read("*n")
blank = file:read()
pokemon[slot].SPD = file:read("*n")

file:close()

pokemon[slot].lv = 5
pokemon[slot].C_HP = pokemon[1].MAX_HP
pokemon[slot].pic = Image.load("./pokemon/swinub/swinub.png")
pokemon[slot].picB = Image.load("./pokemon/swinub/swinub_back.png")

slot = slot2 * 100
textbox = Image.load("talkbox.png")
textarrow = Image.load("text_arrow.png")
p = 0
e = 0
attackn = 1
line = 0
file = io.open("./pokemon/swinub/swinub_attacks.txt", "r")
if e == 0 then
	level = file:read("*n")
	if attackn == 1 and pokemon[1].lv >= level then
		p_attacks[slot +1].name = file:read(12)
		p_attacks[slot +1].attribute = file:read(7)
		p_attacks[slot +1].power = file:read("*n")
		p_attacks[slot +1].accuracy = file:read("*n")
		blank = file:read()
		attackn = attackn +1

	end
	level = file:read("*n")
	if attackn == 2 and pokemon[1].lv >= level then
		p_attacks[slot +2].name = file:read(12)
		p_attacks[slot +2].attribute = file:read(7)
		p_attacks[slot +2].power = file:read("*n")
		p_attacks[slot +2].accuracy = file:read("*n")
		blank = file:read()
	attackn = attackn +1	

	end
	level = file:read("*n")
	if attackn == 3 and pokemon[1].lv >= level then
		p_attacks[slot +3].name = file:read(12)
		p_attacks[slot +3].attribute = file:read(7)
		p_attacks[slot +3].power = file:read("*n")
		p_attacks[slot +3].accuracy = file:read("*n")
		blank = file:read()
	attackn = attackn +1
	end
	level = file:read("*n")
	if attackn == 4 and pokemon[1].lv >= level then
		p_attacks[slot +4].name = file:read(12)
		p_attacks[slot +4].attribute = file:read(7)
		p_attacks[slot +4].power = file:read("*n")
		p_attacks[slot +4].accuracy = file:read("*n")
		blank = file:read()
	attackn = attackn +1
	end
	if attackn == 5 then
		e = 1
	end
end
file:close()
while p == 0 do 
pad = Controls.read()
counter = counter +1
screen:blit(71,170, textbox)
screen:print(101, 190, "swinub was a good choice", blue)
screen:blit(351, 250, text_button)
if pad:r() and oldpad:r() ~= pad:r() and counter >= 25 then
	screen:clear()
	p = 1
	s = 0
	oaktalk = 5
end
screen.waitVblankStart()
screen.flip()



oldpad = pad
end