if srb2p return end

addHook("PlayerThink", function(player)
	if player.mo and player.mo.skin == "silverp"
	and player.mo.valid
	and not (player.powers[pw_carry] == CR_NIGHTSMODE)
		if player.playerstate == PST_LIVE
			if player.mo.silverhp == nil
				player.mo.silverhp = 3
			end
			if player.mo.silverhp <= 0
				S_StopSound(player.mo)
				P_KillMobj(player.mo)
			end
			if player.mo.silverhp > 3
				player.mo.silverhp = 3
			end
			if player.powers[pw_super]
			and player.mo.silverhp < 3
				player.mo.silverhp = $1 + 1
			end
		elseif player.playerstate == PST_DEAD
			if player.mo.silverhp == nil
				player.mo.silverhp = 0
			end
			if player.mo.silverhp > 0
				player.mo.silverhp = 0
			end
		end
	end
end)

addHook("MobjDamage", function(mo, inf, source)
	if mo and mo.skin == "silverp"
	and mo.player
	and mo.player.playerstate == PST_LIVE
	and not (mo.player.powers[pw_carry] == CR_NIGHTSMODE)
	and not mo.player.powers[pw_shield]
		if inf
		and inf.valid
		end
		if mo.player.rings > 0
			mo.silverhp = $1 - 1
		else
			mo.silverhp = $1 - 1
			P_DoPlayerPain(mo.player, source, inf)
			P_PlayerWeaponPanelOrAmmoBurst(mo.player)
			P_PlayerEmeraldBurst(mo.player)
			P_PlayerFlagBurst(mo.player)
			P_PlayRinglossSound(mo)
			if source
			and source.valid
			and source.player
				P_AddPlayerScore(source.player, 50)
			end
			return true
		end
	end
end, MT_PLAYER)

addHook("MobjDeath", function(monitor, inf, mo)
	if monitor
	and monitor.type == MT_1UP_BOX
	and monitor.valid
	and monitor.flags & MF_MONITOR
		if mo
		and mo.player
		and mo.player.playerstate == PST_LIVE
		and not (mo.player.powers[pw_carry] == CR_NIGHTSMODE)
		and mo.skin == "silverp"
			mo.silverhp = $1 + 1
		end
	end
end, MT_1UP_BOX)

local function hudstuff2(v, player, cam)
	if (player.mo and player.mo.skin == "silverp" and player.mo.silverhp != nil)
		v.drawString(32, 168, "Boss's Lives: " + player.mo.silverhp, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ORANGEMAP)
		v.drawFill(32, 256, player.mo.silverhp/3, 32)
	end
end

hud.add(hudstuff2, player)