if not srb2p return end

freeslot("sfx_rsum1", "sfx_rsum2", "sfx_rsum3", "sfx_rsum4", "sfx_rhrt1", "sfx_rhrt2", "sfx_rhrt3", "sfx_rhrt4", "sfx_rhrt5", "sfx_rhrt6", "sfx_rhrt7", "sfx_rhrt8",
"sfx_rhtx1", "sfx_rhtx2", "sfx_rhtx3", "sfx_rhtx4", "sfx_rhtx5", "sfx_rhtx6", "sfx_rhel1", "sfx_rhel2", "sfx_rhel3", "sfx_rhel1", "sfx_rhel2", "sfx_rhel3", "sfx_rkil1", "sfx_rkil2", "sfx_rkil3", "sfx_rkil4",
"sfx_raoi1", "sfx_raoi2", "sfx_raoa1", "sfx_raor1", "sfx_raor2", "sfx_rmis1", "sfx_rmis2", "sfx_rmis3", "sfx_rdge1", "sfx_rdge2", "sfx_rdge3", "sfx_rdge4",
"sfx_rwin1", "sfx_rwin2", "sfx_rwin3", "sfx_rwin4", "sfx_rwin5", "sfx_rlvl1", "sfx_rlvl2", "sfx_rlvl3",
"sfx_tsum1","sfx_taoi1","sfx_thux1","sfx_tmis1","sfx_thit1")

charStats["ruby"] = {   

  
		-- GENERAL

		name = "Ruby",		-- This is only for bots / enemies
		basehp = 60,			-- base HP for level 1 (Cannot be <= 0)
		basesp = 70,			-- base SP for level 1 (Can be 0, but not < 0!)
		persona = "rubyspersona",		-- Persona to use
		melee_natk = "ruby_atk", -- normal melee attack

		-- Normal attack attributes
		-- Scales with game difficulty
		atk = 35,	-- power (generally < 50)
		acc = 95,	-- accuracy (%)
		crit = 50,	-- crit rate (%)
		
		wep = "r_fists_01",
		weptype = WPT_KNUCKLES,
		-- Note: As of Beta 1.0.0, not all animations are implemented
		-- (* = unimplemented)

		anim_stand = 		{SPR_PLAY, A, 15, "SPR2_STND"},			-- standing
		anim_stand_hurt =	{SPR_PLAY, A, 4, "SPR2_STND"},			-- standing (low HP) *
		anim_stand_bored =	{SPR_PLAY, A, B, C, D, 15, "SPR2_WALK"},			-- standing (occasionally plays after anim_stand has played several times)
		anim_guard = 		{SPR_PLAY, A, 1, "SPR2_STND"},			-- guarding
		anim_move =			{SPR_PLAY, A, B, C, D, 5, "SPR2_WALK"},		-- moving
		anim_run =			{SPR_PLAY, A, B, 3, "SPR2_RUN"},		-- guess what
		anim_atk =			{SPR_PLAY, A, B, C, D, 4, "SPR2_ROLL"},		-- attacking
		anim_aoa_end =		{SPR_PLAY, A, B, C, D, 4, "SPR2_ROLL"},			-- jumping out of all-out attack
		anim_hurt =			{SPR_PLAY, A, 6, "SPR2_PAIN"},			-- taking damage
		anim_getdown =		{SPR_PLAY, A, 6, "SPR2_PAIN"},			-- knocked down from weakness / crit *
		anim_downloop =		{SPR_PLAY, A, 5, "SPR2_PAIN"},			-- is down
		anim_getup =		{SPR_PLAY, A, 5, "SPR2_FALL"},			-- gets up from down
		anim_death =		{SPR_PLAY, A, 30, "SPR2_DEAD"},			-- dies
		anim_revive =		{SPR_PLAY, A, 10, "SPR2_STND"},			-- gets revived
        anim_evoker = 		{SPR_PLAY, A, 8, "SPR2_PNCH"},			-- 
		-- anim_special1 through anim_special32 may also be used for various purposes (ie: attack animations)
		-- HUD DEFINTIIONS
		vfx_summon = {"sfx_rsum1", "sfx_rsum2", "sfx_rsum3", "sfx_rsum4"},
		vfx_skill = {},
		vfx_item = {},
		vfx_hurt = {"sfx_rhrt1", "sfx_rhrt2", "sfx_rhrt3", "sfx_rhrt4", "sfx_rhrt5", "sfx_rhrt6", "sfx_rhrt7", "sfx_rhrt8"}, 
		vfx_hurtx = {"sfx_rhtx1", "sfx_rhtx2", "sfx_rhtx3", "sfx_rhtx4", "sfx_rhtx5", "sfx_rhtx6"},
		vfx_die = {},
		vfx_heal = {"sfx_rhel1", "sfx_rhel2", "sfx_rhel3"},
		vfx_healself = {"sfx_rhel1"},
		vfx_1more = {},
		vfx_crit = {"sfx_rkil3", "sfx_rkil4"},
		vfx_kill = {"sfx_rkil1", "sfx_rkil2", "sfx_rkil3", "sfx_rkil4"},
		vfx_aoaask = {"sfx_raoi1", "sfx_raoi2"},
		vfx_aoado = {"sfx_raoa1"},
		vfx_aoarelent = {"sfx_raor1", "sfx_raor2"},
		vfx_miss = {"sfx_rmis1", "sfx_rmis2", "sfx_rmis3"},
		vfx_dodge = {"sfx_rdge1", "sfx_rdge2", "sfx_rdge3", "sfx_rdge4"},
		vfx_win = {"sfx_rwin1", "sfx_rwin2", "sfx_rwin3", "sfx_rwin4", "sfx_rwin5"},
		vfx_levelup = {"sfx_rlvl1", "sfx_rlvl2", "sfx_rlvl3"},
        


		icon = "ICO_RUBY",
		hudbust = "H_RUBY",	
		hudaoa = "RUBY_AOA",
		aoa_quote = "Kill Kill Kill Kill Kill",
		hudcutin = "RUBY_A",
		hudspr = "",
		tip = "Ruby is a rounded buffer with a bit of Elec skills, buffs and a damage boosting skill. He has a lot of HP and SP so don't be afraid to go all out!"

}
         
personaList["rubyspersona"] = {
		-- GENERAL
		name = "Ruby",
		arcana = ARCANA_MAGICIAN,

		-- STATS (@ lv10)

		sprite = SPR_NULL,
		anim_idle = 	{SPR_NULL, A},
		anim_atk = 		{SPR_NULL, A},
		startframe = 0,

		strength = 7,
		magic = 8,
		endurance = 10,
		luck = 6,
		agility = 8,
		weak = ATK_ICE,
		resist = ATK_ELEC|ATK_STRIKE,
		skills = {
			{"lunge", 1},{"zio", 3},{"makakaja", 5},{"dia", 7},{"tarukaja", 11},
			/*{"rakukaja", 12},*/{"sukukaja", 14},{"mazio", 15},{"sonic punch", 18, "lunge"},{"zionga", 21, "zio"},
			{"diarama", 23, "dia"},{"assault dive", 25, "sonic punch"},{"ruby_aimbot", 33},{"ruby_magnifier", 35, "mazio"},
			{"ruby_duosukukaja", 36, "sukukaja"},{"matarukaja", 37, "tarukaja"},{"ruby_duomakakaja", 38, "makakaja"},
			{"gigantic fist", 48, "assault dive"},{"ziodyne", 52, "zionga"},{"diarahan", 58, "diarama"},
			{"thunder reign", 85, "ziodyne"},
		}
}

/*
{"lunge", 1},{"sonic punch", 18, "lunge"},{"assault dive", 25, "sonic punch"},{"gigantic fist", 48, "assault dive"},
					{"zio", 3},{"zionga", 21, "zio"},{"ziodyne", 52, "zionga"},{"thunder reign", 85, "ziodyne"},
					{"mazio", 15},{"mazionga", 37, "mazio"},{"maziodyne", 63, "mazionga"},
					{"dia", 7},{"diarama", 23, "dia"},{"diarahan", 58, "diarama"},
					{"tarukaja", 11},{"matarukaja", 38, "tarukaja"},
					{"makakaja", 5},{"mamakakaja", 38, "makakaja"},
					{"rakukaja", 12},{"marakukaja", 38, "rakukaja"},
					{"sukukaja", 14},{"masukukaja", 38, "sukukaja"}
*/

attackDefs["ruby_atk"] = {
		name = "Punch",
		type = ATK_STRIKE,
		power = 35,
		accuracy = 85,
		critical = 7, -- was 7
		target = TGT_ENEMY,
		cost = CST_HP,
		cost = 0,
		desc = "yep its a punch alright",
		anim_norepel = true,	-- do not bounce back our ANIMATION
		physical = true,	-- don't play the summoning anim for phys attacks, duh
		anim = 	function(mo, targets, hittargets, timer)
					local target = targets[1]
					local atarget = hittargets[1]
					local dacam = server.P_BattleStatus[mo.battlen].cam
					if timer == 1
						ANIM_set(mo, mo.anim_run, true)
						mo.reachedtarget = false	-- yeah we can use variables here that you like it or not :^)
						
						mo.stx = mo.x
						mo.sty = mo.y
						mo.stz = mo.z
						S_StartSound(mo, sfx_zoom)
						//mo.momz = 5*FRACUNIT
						mo.angle = R_PointToAngle2(mo.x, mo.y, target.x, target.y)
						mo.stsp = R_PointToDist2(mo.x, mo.y, target.x, target.y)/30
						P_InstaThrust(mo, mo.angle, mo.stsp)
						mo.atktimer = 0
						
						local an = target.angle + 45*ANG1
						local cx = (mo.x+target.x)/2+cos(an)*200
						local cy = (mo.y+target.y)/2+sin(an)*200
						CAM_goto(dacam, cx, cy, target.z + FRACUNIT*30, 20*FRACUNIT)
						CAM_angle(dacam, R_PointToAngle2(cx, cy, target.x, target.y))
					elseif not mo.reachedtarget
						P_InstaThrust(mo, mo.angle, mo.stsp)
						
						if R_PointToDist2(mo.x, mo.y, target.x, target.y) < mo.stsp+FRACUNIT
							//mo.momz = 10*FRACUNIT
							mo.reachedtarget = true
							ANIM_set(mo, mo.anim_evoker, true)
							damageObject(atarget)
							localquake(mo.battlen, FRACUNIT*7, 4)
							playSound(mo.battlen, sfx_phys)
							mo.hittarget = true
							
							mo.atktimer = 1
							
							P_InstaThrust(mo, mo.angle, 0)
						end
					elseif mo.atktimer < 10
						ANIM_set(mo, mo.anim_evoker, true)
						mo.atktimer = $ + 1
					elseif mo.atktimer == 10
						mo.atktimer = $ + 1
						mo.stsp = R_PointToDist2(mo.x, mo.y, mo.stx, mo.sty)/30
						mo.angle = R_PointToAngle2(mo.x, mo.y, mo.stx, mo.sty)
						P_InstaThrust(mo, mo.angle, mo.stsp)
						ANIM_set(mo, mo.anim_run, true)
					elseif R_PointToDist2(mo.x, mo.y, mo.stx, mo.sty) > mo.stsp+FRACUNIT
						P_InstaThrust(mo, mo.angle, mo.stsp)
						/*local cx = mo.x+cos(mo.angle)*300+sin(mo.angle)*200
						local cy = mo.y+sin(mo.angle)*300+cos(mo.angle)*200
						CAM_goto(dacam, cx, cy, mo.z+90*FRACUNIT, 5*FRACUNIT)*/
						CAM_angle(dacam, R_PointToAngle2(dacam.x, dacam.y, (mo.x+target.x), (mo.y+target.y)))
					else
						mo.reachedtarget = nil
						mo.stx = nil
						mo.sty = nil
						mo.stz = nil
						return true
					end
				end
	}

attackDefs["ruby_magnifier"] = {
		name = "Magnifier",
		type = ATK_SUPPORT,
		target = TGT_ALLY,
		costtype = CST_SP,
		cost = 18,
		desc = "Raise an ally's damage by x2 \nfor their next turn.",
		superbuff = true,				-- powerful buff
		magnifier = true,				-- do not remove power charge status after using this skill.
		nocast = 	function(targets, n)	-- we can't cast this skill if this function returns true
						local target = targets[n]
						if target.magnifiered //or target.powercharge or target.mindcharge
							BTL_logMessage(targets[1].battlen, "Already in effect")
							return true
						end
						if target.powercharge or target.mindcharge
							BTL_logMessage(targets[1].battlen, "Can't stack the buffs for balance's sake")
							return true
						end
					end,
		anim = function(mo, targets, hittargets, timer)
			local target = hittargets[1]

			if timer == 20
				playSound(targets[1].battlen, sfx_buff2)
				target.magnifiered = true
				BTL_logMessage(targets[1].battlen, target.name.." got help building up Damage...")
				for i = 1,16
					local dust = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
					dust.angle = ANGLE_90 + ANG1* (22*(i-1))
					dust.state = S_CDUST1
					P_InstaThrust(dust, dust.angle, 30*FRACUNIT)
					dust.color = SKINCOLOR_NEON
					dust.scale = FRACUNIT*2
				end

			elseif timer > 20 and timer <= 50

				if leveltime%2 == 0
					for i = 1,16

						local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
						thok.state = S_CDUST1
						thok.momz = P_RandomRange(3, 10)*FRACUNIT
						thok.color = SKINCOLOR_NEON
						thok.tics = P_RandomRange(10, 35)
						thok.scale = FRACUNIT*3/2
					end
				end

				for i = 1, 8
					local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
					thok.sprite = SPR_SUMN
					thok.frame = F|FF_FULLBRIGHT|TR_TRANS50
					thok.momz = P_RandomRange(6, 16)*FRACUNIT
					thok.color = SKINCOLOR_NEON
					thok.tics = P_RandomRange(10, 35)
				end
			elseif timer == 60
				return true
			end
		end,		
	}

SRB2P_addHook("ModifyDamage", function(attacker,mo,dmg)
	if attacker.magnifiered then
		return dmg*2
	else
		return dmg
	end
end)

attackDefs["ruby_aimbot"] = {
		name = "Aimbot",
		type = ATK_SUPPORT,
		target = TGT_ALLY,
		costtype = CST_SP,
		cost = 18,
		desc = "Raise an ally's agility by x2 \nfor their next turn.",
		superbuff = true,				-- powerful buff
		aimbot = true,				-- do not remove power charge status after using this skill.
		nocast = 	function(targets, n)	-- we can't cast this skill if this function returns true
						local target = targets[n]
						if target.aimbotted //or target.powercharge or target.mindcharge
							BTL_logMessage(targets[1].battlen, "Already in effect")
							return true
						end
					end,
		anim = function(mo, targets, hittargets, timer)
			local target = hittargets[1]

			if timer == 20
				playSound(targets[1].battlen, sfx_buff2)
				target.aimbotted = true
				target.agility = $*2
				BTL_logMessage(targets[1].battlen, target.name.." got help building up Agility...")
				for i = 1,16
					local dust = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
					dust.angle = ANGLE_90 + ANG1* (22*(i-1))
					dust.state = S_CDUST1
					P_InstaThrust(dust, dust.angle, 30*FRACUNIT)
					dust.color = SKINCOLOR_GREEN
					dust.scale = FRACUNIT*2
				end

			elseif timer > 20 and timer <= 50

				if leveltime%2 == 0
					for i = 1,16

						local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
						thok.state = S_CDUST1
						thok.momz = P_RandomRange(3, 10)*FRACUNIT
						thok.color = SKINCOLOR_GREEN
						thok.tics = P_RandomRange(10, 35)
						thok.scale = FRACUNIT*3/2
					end
				end

				for i = 1, 8
					local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
					thok.sprite = SPR_SUMN
					thok.frame = F|FF_FULLBRIGHT|TR_TRANS50
					thok.momz = P_RandomRange(6, 16)*FRACUNIT
					thok.color = SKINCOLOR_GREEN
					thok.tics = P_RandomRange(10, 35)
				end
			elseif timer == 60
				return true
			end
		end,		
	}

addHook("MobjThinker", function(mo)
	if not mo or not mo.valid or not mo.hp return end
	if mo.hp <= 0 return end
	
	if mo.magnifiered
		if not (leveltime%4)
			local elec = P_SpawnMobj(mo.x, mo.y, mo.z + mo.height, MT_DUMMY)
			elec.sprite = SPR_DELK
			elec.frame = P_RandomRange(0, 7)|FF_FULLBRIGHT
			elec.destscale = FRACUNIT*4
			elec.scalespeed = FRACUNIT/4
			elec.tics = TICRATE/8
			elec.color = SKINCOLOR_PURPLE
		end

		if leveltime %4 == 0
			local a = R_PointToAngle(mo.x, mo.y)
			local x = mo.x - cos(a)
			local y = mo.y - sin(a)

			local dummy = P_SpawnMobj(x, y, mo.z, MT_DUMMY)
			if mo.skin
				dummy.skin = mo.skin
			end
			dummy.state = mo.state
			dummy.sprite = mo.sprite
			dummy.sprite2 = mo.sprite2
			dummy.frame = mo.frame
			dummy.angle = mo.angle
			dummy.scale = mo.scale
			dummy.colorized = true
			dummy.color = SKINCOLOR_PURPLE
			dummy.fuse = 2
		end
		
		if mo == server.P_BattleStatus[mo.battlen].turnorder[1] then
			if server.P_BattleStatus[mo.battlen].battlestate == BS_ENDTURN then
				if not attackDefs[mo.attackref].magnifier
					mo.magnifiered = nil	-- remove charge
				end
			end
		end
	end
	
	if mo.aimbotted
		if not (leveltime%4)
			local elec = P_SpawnMobj(mo.x, mo.y, mo.z + mo.height, MT_DUMMY)
			elec.sprite = SPR_DELK
			elec.frame = P_RandomRange(0, 7)|FF_FULLBRIGHT
			elec.destscale = FRACUNIT*4
			elec.scalespeed = FRACUNIT/4
			elec.tics = TICRATE/8
			elec.color = SKINCOLOR_GREEN
		end

		if leveltime %4 == 0
			local a = R_PointToAngle(mo.x, mo.y)
			local x = mo.x - cos(a)
			local y = mo.y - sin(a)

			local dummy = P_SpawnMobj(x, y, mo.z, MT_DUMMY)
			if mo.skin
				dummy.skin = mo.skin
			end
			dummy.state = mo.state
			dummy.sprite = mo.sprite
			dummy.sprite2 = mo.sprite2
			dummy.frame = mo.frame
			dummy.angle = mo.angle
			dummy.scale = mo.scale
			dummy.colorized = true
			dummy.color = SKINCOLOR_GREEN
			dummy.fuse = 2
		end
		
		if mo == server.P_BattleStatus[mo.battlen].turnorder[1] then
			if server.P_BattleStatus[mo.battlen].battlestate == BS_ENDTURN then
				if not attackDefs[mo.attackref].aimbot
					mo.aimbotted = nil	-- remove charge
					mo.agility = $/2
				end
			end
		end
	end
end, MT_PFIGHTER)


attackDefs["ruby_duosukukaja"] = {
		name = "Duosukukaja",
		type = ATK_SUPPORT,
		costtype = CST_SP,
		cost = 12,
		desc = "Raise one ally's agility \nby 2 stages.",
		target = TGT_ALLY,
		buff = true,
		norepel = true,
		nocast = 	function(targets, n)	-- we can't cast this skill if this function returns true
						local target = targets[n]
						if target.buffs["agi"][2] >= 9
							BTL_logMessage(targets[1].battlen, "Limit reached!")
							return true
						end
					end,
		anim = function(mo, targets, hittargets, timer)
			local target = hittargets[1]

			if timer == 20
				playSound(mo.battlen, sfx_buff)
				buffStat(target, "agi")
				for i = 1,16
					local dust = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
					dust.angle = ANGLE_90 + ANG1* (22*(i-1))
					dust.state = S_CDUST1
					P_InstaThrust(dust, dust.angle, 30*FRACUNIT)
					dust.color = SKINCOLOR_GREEN
					dust.scale = FRACUNIT*2
				end

			elseif timer > 20 and timer <= 50

				if leveltime%2 == 0
					for i = 1,16

						local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
						thok.state = S_CDUST1
						thok.momz = P_RandomRange(3, 10)*FRACUNIT
						thok.color = SKINCOLOR_GREEN
						thok.tics = P_RandomRange(10, 35)
						thok.scale = FRACUNIT*3/2
					end
				end

				local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
				thok.sprite = SPR_SUMN
				thok.frame = F|FF_FULLBRIGHT|TR_TRANS50
				thok.momz = P_RandomRange(6, 16)*FRACUNIT
				thok.color = SKINCOLOR_GREEN
				thok.tics = P_RandomRange(10, 35)
			end
			if timer == 50
				playSound(mo.battlen, sfx_buff)
				buffStat(target, "agi")
				for i = 1,16
					local dust = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
					dust.angle = ANGLE_90 + ANG1* (22*(i-1))
					dust.state = S_CDUST1
					P_InstaThrust(dust, dust.angle, 30*FRACUNIT)
					dust.color = SKINCOLOR_GREEN
					dust.scale = FRACUNIT*2
				end

			elseif timer > 50 and timer <= 80

				if leveltime%2 == 0
					for i = 1,16

						local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
						thok.state = S_CDUST1
						thok.momz = P_RandomRange(3, 10)*FRACUNIT
						thok.color = SKINCOLOR_GREEN
						thok.tics = P_RandomRange(10, 35)
						thok.scale = FRACUNIT*3/2
					end
				end

				local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
				thok.sprite = SPR_SUMN
				thok.frame = F|FF_FULLBRIGHT|TR_TRANS50
				thok.momz = P_RandomRange(6, 16)*FRACUNIT
				thok.color = SKINCOLOR_GREEN
				thok.tics = P_RandomRange(10, 35)
			elseif timer == 90
				return true
			end
		end,
	}

attackDefs["ruby_duomakakaja"] = {
		name = "Duomakakaja",
		type = ATK_SUPPORT,
		costtype = CST_SP,
		cost = 12,
		desc = "Raise one ally's magic \nattack by 2 stages.",
		target = TGT_ALLY,
		buff = true,
		norepel = true,
		nocast = 	function(targets, n)	-- we can't cast this skill if this function returns true
						local target = targets[n]
						if target.buffs["mag"][2] >= 9
							BTL_logMessage(targets[1].battlen, "Limit reached!")
							return true
						end
					end,
		anim = function(mo, targets, hittargets, timer)
			local target = hittargets[1]

			if timer == 20
				playSound(mo.battlen, sfx_buff)
				buffStat(target, "mag")
				for i = 1,16
					local dust = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
					dust.angle = ANGLE_90 + ANG1* (22*(i-1))
					dust.state = S_CDUST1
					P_InstaThrust(dust, dust.angle, 30*FRACUNIT)
					dust.color = SKINCOLOR_TEAL
					dust.scale = FRACUNIT*2
				end

			elseif timer > 20 and timer <= 50

				if leveltime%2 == 0
					for i = 1,16

						local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
						thok.state = S_CDUST1
						thok.momz = P_RandomRange(3, 10)*FRACUNIT
						thok.color = SKINCOLOR_TEAL
						thok.tics = P_RandomRange(10, 35)
						thok.scale = FRACUNIT*3/2
					end
				end

				local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
				thok.sprite = SPR_SUMN
				thok.frame = F|FF_FULLBRIGHT|TR_TRANS50
				thok.momz = P_RandomRange(6, 16)*FRACUNIT
				thok.color = SKINCOLOR_TEAL
				thok.tics = P_RandomRange(10, 35)
			end
			if timer == 50
				playSound(mo.battlen, sfx_buff)
				buffStat(target, "mag")
				for i = 1,16
					local dust = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
					dust.angle = ANGLE_90 + ANG1* (22*(i-1))
					dust.state = S_CDUST1
					P_InstaThrust(dust, dust.angle, 30*FRACUNIT)
					dust.color = SKINCOLOR_TEAL
					dust.scale = FRACUNIT*2
				end

			elseif timer > 50 and timer <= 80

				if leveltime%2 == 0
					for i = 1,16

						local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
						thok.state = S_CDUST1
						thok.momz = P_RandomRange(3, 10)*FRACUNIT
						thok.color = SKINCOLOR_TEAL
						thok.tics = P_RandomRange(10, 35)
						thok.scale = FRACUNIT*3/2
					end
				end

				local thok = P_SpawnMobj(target.x+P_RandomRange(-70, 70)*FRACUNIT, target.y+P_RandomRange(-70, 70)*FRACUNIT, target.z+P_RandomRange(0, 50)*FRACUNIT, MT_DUMMY)
				thok.sprite = SPR_SUMN
				thok.frame = F|FF_FULLBRIGHT|TR_TRANS50
				thok.momz = P_RandomRange(6, 16)*FRACUNIT
				thok.color = SKINCOLOR_TEAL
				thok.tics = P_RandomRange(10, 35)
			elseif timer == 90
				return true
			end
		end,
	}