addHook ("ShouldDamage",function(target, inflictor, source, damage, damagetype)
if inflictor and inflictor.player
and inflictor.player.pizzanoreal
and inflictor.player.DoingKungfu == false
and (target.flags & MF_ENEMY)
and not (target.flags & MF_BOSS)
and not (damagetype & DMG_NUKE)
and not (damagetype & DMG_FIRE)
and inflictor.player.machxdtimerr <= 158
and ((inflictor.state == S_PLAY_JUMPINITIAL)
or (inflictor.state == S_PLAY_FALL)
or (inflictor.state == S_PLAY_JUMP)
or (inflictor.state == S_PLAY_PZNOMACH2JUMPDIVE)
or (inflictor.state == S_PLAY_ROLL)
or (inflictor.state == S_PLAY_PZNOMACH2JUMP))
local player = inflictor.player
P_InstaThrust(target, R_PointToAngle2(0, 0, inflictor.momx, inflictor.momy), 11*FRACUNIT)
P_SetObjectMomZ(target, 5*FRACUNIT, false)
S_StartSound(player.mo, sfx_bump)
inflictor.state = S_PLAY_JUMP
inflictor.player.pznosupertauntcounter = $-1
target.jumped = true
target.tics = 8*TICRATE
return false
end
if target and target.player
and target.player.pizzanoreal
and target.player.DoingKungfu == false
and (inflictor.flags & MF_ENEMY)
and not (inflictor.flags & MF_BOSS)
and not (damagetype & DMG_NUKE)
and not (damagetype & DMG_FIRE)
and target.player.machxdtimerr <= 160
and ((target.state == S_PLAY_RUN))
local player = target.player
P_InstaThrust(inflictor, R_PointToAngle2(0, 0, target.momx, target.momy), target.player.speed+7*FRACUNIT)
P_SetObjectMomZ(inflictor, 5*FRACUNIT, false)
S_StartSound(player.mo, sfx_bump)
inflictor.jumped = true
inflictor.tics = 8*TICRATE
return false
end
end)

//crash into the enemy effect idfk
freeslot("S_CRASHENEMYOOF","SPR_CREN")
states[S_CRASHENEMYOOF] = {
	sprite = SPR_CREN,
	frame = A|FF_ANIMATE,
	tics = 11,
	var1 = 2,
	var2 = 2,
}

addHook("MobjDeath", function(trg, inf, src)
	if not (trg.flags & MF_ENEMY) return end
	if not (trg and trg.valid and inf and inf.valid and inf.player and inf.skin == "pizzano" and not ((inf.player.mo.state ==  S_PLAY_SUPERTAUNT_1) or (inf.player.mo.state ==  S_PLAY_SUPERTAUNT_2) or (inf.player.mo.state ==  S_PLAY_SUPERTAUNT_3)) and (inf.player.machxdtimerr >= 160)) return end
	local p = inf.player
	
	trg.flags2 = $|MF2_DONTDRAW
	local crashh = P_SpawnMobj(trg.x,trg.y,trg.z,MT_THOK)
	crashh.state = S_CRASHENEMYOOF
	local fling = P_SpawnMobjFromMobj(trg, 0, 0, 0, MT_ENEMY_FLYING)
	if fling and fling.valid and trg and trg.valid 
    	trg.tics = -1
		fling.sprite = trg.sprite 
		fling.sprite2 = trg.sprite2 
		fling.frame = trg.frame
		fling.angle = trg.angle
		fling.color = trg.color
		fling.info.deathstate = S_CYBRAKDEMONVILEEXPLOSION1 
		fling.nokilltimer = 3
		fling.info.deathsound = sfx_s3kb4
		S_StopSound(trg)
		P_SetObjectMomZ(fling, 15*FRACUNIT, false)
		P_InstaThrust(fling, inf.player.drawangle, inf.player.speed + 10*FRACUNIT)
	end
end)
addHook("MobjThinker", function(mo)
	if not (mo and mo.valid and mo.health) return end
	if not (mo.secondphase)
		if mo.nokilltimer > 0
			mo.nokilltimer = $ - 1
		end
		if P_IsObjectOnGround(mo) or (FixedHypot(mo.momx, mo.momy) == 0)
			if mo.nokilltimer == 0
				mo.momx = 0
				mo.momy = 0
				mo.momz = 0
				mo.flags = $ | MF_NOGRAVITY
				local flyingenemy = P_SpawnMobjFromMobj(mo, 0, 0, 0, MT_ENEMY_FLYING)
				flyingenemy.sprite = mo.sprite
				flyingenemy.sprite2 = mo.sprite2
				flyingenemy.color = mo.color
				P_KillMobj(mo)
				flyingenemy.target = mo
				flyingenemy.secondphase = true
				flyingenemy.angle = mo.angle
			end
		else
			local cloud = P_SpawnMobj(mo.x,mo.y,mo.z,MT_THOK)
			cloud.state = S_WALKDUST
		end
	else
		if not (mo.target and mo.target.valid)
			P_RemoveMobj(mo)
		else
			mo.momx = 0
			mo.momz = 0
			mo.momy = 0
			if leveltime % 2 == 0
				mo.flags2 = $|MF2_DONTDRAW
			else
				mo.flags2 = $&~MF2_DONTDRAW
			end
		end
	end
end, MT_ENEMY_FLYING)

//i love the srb2 wiki now
addHook("PlayerThink", function(player)
if player.machxdtimerr >= 160
and player.pizzanoreal
searchBlockmap("objects", function(_, mo)
if not (mo.flags & MF_ENEMY)
or (mo.flags & MF_BOSS)
or R_PointToDist2(player.mo.x, player.mo.y, mo.x, mo.y) > 400*mo.scale
return end
if P_IsObjectOnGround(mo)
and mo.scared == false
P_SetObjectMomZ(mo, 5*FU)
mo.angle = R_PointToAngle2(mo.x, mo.y, player.mo.x, player.mo.y)
mo.momx = 0
mo.momy = 0
mo.state = mo.info.spawnstate
mo.tics = 5*TICRATE
mo.scared = true
end
end, player.mo, player.mo.x-200*FU, player.mo.x+200*FU, player.mo.y-200*FU, player.mo.y+200*FU)
end
end)

//enemy flies when you slammed
addHook("PlayerThink", function(player)
if player.pizzanoreal
and player.mo.state == S_PLAY_BODYSLAMLAND
searchBlockmap("objects", function(_, mo)
if not (mo.flags & MF_ENEMY)
or (mo.flags & MF_BOSS)
or R_PointToDist2(player.mo.x, player.mo.y, mo.x, mo.y) > 400*mo.scale
return end
if P_IsObjectOnGround(mo)
P_SetObjectMomZ(mo, 17*FU)
mo.momx = 0
mo.momy = 0
mo.tics = 8*TICRATE
mo.slammedidk = true
end
end, player.mo, player.mo.x-200*FU, player.mo.x+200*FU, player.mo.y-200*FU, player.mo.y+200*FU)
end
end)

//also stun
addHook("MobjThinker", function(mo)
if mo and mo.valid
and not (mo.flags & MF_ENEMY)
or (mo.flags & MF_BOSS)
return end
if mo.tics >= 1*TICRATE
and mo.slammedidk
mo.momx = 0
mo.momy = 0
mo.rollangle = FixedAngle(180*FRACUNIT)
end
if mo.tics >= 1*TICRATE
and mo.jumped
mo.rollangle = FixedAngle(180*FRACUNIT)
end
if mo.tics == 1*TICRATE
and ((mo.slammedidk)
or (mo.jumped))
mo.slammedidk = false
mo.jumped = false
mo.rollangle = $ + FixedAngle(180*FRACUNIT)
end
if mo.tics == 1*TICRATE
and mo.scared
mo.scared = false
end
end)


addHook ("ShouldDamage",function(target, inflictor, source, damage, damagetype)
if inflictor and inflictor.player
and inflictor.player.pizzanoreal
and (target.flags & MF_ENEMY)
and not (target.flags & MF_BOSS)
and (damagetype & DMG_NUKE)
and not (damagetype & DMG_FIRE)
and ((inflictor.state == S_PLAY_BODYSLAMLAND))
local player = inflictor.player
inflictor.player.pznosupertauntcounter = $-1
return false
end
if inflictor and target.player
and target.player.pizzanoreal
and (inflictor.flags & MF_ENEMY)
and not (inflictor.flags & MF_BOSS)
and inflictor.tics >= 1*TICRATE
return false
end
end)