addHook("PlayerSpawn", function(player)
    if player.mo and player.mo.skin == "banjokazzoie"
		player.hpmax = 6
		player.mo.health = player.hpmax
	end
end)

addHook("PlayerThink", function(player)
	if player.mo and player.mo.skin == "banjokazzoie"
	and player.mo.health > player.hpmax
		player.mo.health = player.hpmax
	end
	if player.hpmax == nil then
		player.hpmax = 6
	end
end)

addHook("HUD", function(v, player, cam)
	if player.mo and player.mo.skin == "banjokazzoie"
		local xpos = hudinfo[HUD_RINGS].x
		local ypos = hudinfo[HUD_RINGS].y
		if player.mo.health > player.hpmax/2
			v.drawString(xpos, ypos + 20, ("HEALTH: " + (player.mo.health) + " / " + (player.hpmax)), V_PERPLAYER|V_GREENMAP)
		else
			v.drawString(xpos, ypos + 20, ("HEALTH: " + (player.mo.health) + " / " + (player.hpmax)), V_PERPLAYER|V_REDMAP)
		end
	end
end, "game")

addHook("MobjDamage", function(target, inf, src, dmg, dmgType)
	if target.skin == "banjokazzoie" and not target.player.powers[pw_super]
		if inf and inf.valid then
			if inf.player then
				P_AddPlayerScore(inf.player, 50)
			end
		end
		if target.player.powers[pw_shield] then
			target.player.powers[pw_flashing] = 50
			P_DoPlayerPain(target.player, src, inf)
			S_StartSound(target, sfx_s3k9b)
			P_RemoveShield(target.player)
		else
			target.player.powers[pw_flashing] = 50
			target.health = $ - dmg
			P_DoPlayerPain(target.player, src, inf)
			S_StartSound(target, sfx_s3k9b)
			P_PlayerEmeraldBurst(target.player,false)
			P_PlayerWeaponAmmoBurst(target.player)
			P_PlayerFlagBurst(target.player, false)
			if target.health == 0
				P_KillMobj(target,inf,src)
			end
		end
		return true
	end
end, MT_PLAYER)
