-- Challenge Battles --
if not srb2p return end

local function removeSkill(mo, skill, skilltable)
	if skilltable == "skill"
		for i = 1, #mo.skills
			if mo.skills[i] == skill
				table.remove(mo.skills, i)
			end
		end
	elseif skilltable == "passive"
		for i = 1, #mo.passiveskills
			if mo.passiveskills[i] == skill
				table.remove(mo.passiveskills, i)
			end
		end
	end
end

-- EnemyDefs
enemyList["enemy_metal_fl"] = {
	name = "Metal Sonic",
	skillchance = 75,
	level = 50,
	hp = 4130,
	sp = 1770,
	strength = 40,
	magic = 29,
	endurance = 52,
	agility = 29,
	luck = 13,
	melee_natk = "metal_atk1",
	color = SKINCOLOR_COBALT,
	hudcutin = "MSON_A",
	skin = "metalsonic",
	persona = "palladion",
	resist = bionis and ATK_STRIKE|ATK_NUCLEAR|ATK_METAL or ATK_STRIKE|ATK_NUCLEAR,
	weak = bionis and ATK_ELEC|ATK_WATER or ATK_ELEC,
	noroguerandom = true,
	noroguebuff = true,
	boss = true,
	anim_stand = {SPR_PLAY, A, 8, "SPR2_STND"},
	anim_stand_hurt = {SPR_PLAY, A, 1, "SPR2_STND"},
	anim_stand_bored = {SPR_PLAY, A, B, A, B, A, B, A, B, 10, "SPR2_WAIT"},
	anim_guard = {SPR_PLAY, A, 1, "SPR2_WALK"},
	anim_move = {SPR_PLAY, A, 2, "SPR2_WALK"},
	anim_run = {SPR_PLAY, A, 2, "SPR2_RUN"},
	anim_atk = {SPR_PLAY, A, B, C, D, E, 1, "SPR2_ROLL"},
	anim_aoa_end = {SPR_PLAY, E, D, C, B, A, 1, "SPR2_ROLL"},
	anim_hurt = {SPR_PLAY, A, 35, "SPR2_PAIN"},
	anim_getdown = {SPR_PLAY, A, 1, "SPR2_PAIN"},
	anim_downloop = {SPR_PLAY, A, 1, "SPR2_PAIN"},
	anim_getup = {SPR_PLAY, A, B, C, D, E, F, 1, "SPR2_ROLL"},
	anim_death = {SPR_PLAY, A, 30, "SPR2_DEAD"},
	anim_revive = {SPR_PLAY, A, B, C, D, E, F, 1, "SPR2_ROLL"},
	anim_evoker = {SPR_PLAY, A, 8, "SPR2_SPNG"},
	anim_special1 = {SPR_PLAY, A, 2, "SPR2_SPNG"},
	anim_sepcial2 = {SPR_PLAY, A, 2, "SPR2_DASH"},
	vfx_summon = {"sfx_mssum1", "sfx_mssum2"},
    vfx_skill = {"sfx_msskl1", "sfx_msskl2"},
    vfx_item = {"sfx_mssum1", "sfx_mssum2"},
    vfx_hurt = {"sfx_mshrt1", "sfx_mshrt2"},
    vfx_hurtx = {"sfx_msskl2"},
    vfx_die = {"sfx_msmis1"},
    vfx_heal = {"sfx_mssum1", "sfx_mssum2"},
    vfx_healself = {"sfx_mssum1", "sfx_mssum2"},
    vfx_kill = {"sfx_mssum1", "sfx_mssum2"},
    vfx_1more = {"sfx_msdge1"},
    vfx_crit = {"sfx_msskl2"},
    vfx_aoaask = {"sfx_msaoi1"},
    vfx_aoado = {"sfx_msskl2"},
    vfx_aoarelent = {"sfx_msmis1"},
    vfx_miss = {"sfx_msmis1"},
    vfx_dodge = {"sfx_msdge1"},
    vfx_win = {"sfx_mswin1"},
    vfx_levelup = {"sfx_mswin1"},
	skills = {"assault shot", "freila", "matarukaja", "dekunda", "mafreila", "heat wave", "power charge", "swordbreaker"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					mo.thinkturns = $ and $+1 or 1
					local party = mo.allies
					if mo.thinkturns == 1
						removeSkill(mo, "brain buster m1", "skill")
						removeSkill(mo, "brain buster m2", "passive")
						return attackDefs["matarukaja"], party
					end
					local dekundatarget
					local numdebuffed = 0
					for i = 1, #party do
						local bro = party[i]
						if (bro.buffs["atk"][1] <= -50 or bro.buffs["agi"][1] <= -50)
							dekundatarget = bro
							numdebuffed = $+1
						end
					end
					if mo.thinkturns >= 2 and numdebuffed > 0
						return attackDefs["dekunda"], party
					end
					return generalEnemyThinker(mo)
				end,
}

enemyList["enemy_fl_1"] = {
	name = "FL Chan",
	skillchance = 75,
	level = 50,
	hp = 2950,
	sp = 2950,
	strength = 35,
	magic = 35,
	endurance = 24,
	agility = 40,
	luck = 40,
	melee_natk = "flchan_atk1",
	color = SKINCOLOR_GREEN,
	hudcutin = "FLCH_A",
	skin = "flchan",
	persona = "uzume",
	resist = bionis and ATK_ELEC|ATK_PSY|ATK_WATER or ATK_ELEC|ATK_PSY,
	weak = bionis and ATK_SLASH|ATK_EARTH or ATK_SLASH,
	noroguerandom = true,
	noroguebuff = true,
	boss = true,
	anim_stand = {SPR_PLAY, A, 8, "SPR2_STND"},
	anim_stand_hurt = {SPR_PLAY, A, 1, "SPR2_STND"},
	anim_stand_bored = {SPR_PLAY, A, B, A, B, A, B, A, B, 15, "SPR2_WAIT"},
	anim_guard = {SPR_PLAY, A, 1, "SPR2_RUN"},
	anim_move = {SPR_PLAY, A, B, C, D, E, F, G, H, 2, "SPR2_WALK"},
	anim_run = {SPR_PLAY, A, B, C, D, E, F, G, H, 2, "SPR2_RUN"},
	anim_atk = {SPR_PLAY, A, B, C, D, E, F, G, H, 1, "SPR2_ROLL"},
	anim_aoa_end = {SPR_PLAY, H, G, F, E, D, C, B, A, 1, "SPR2_ROLL"},
	anim_hurt = {SPR_PLAY, A, 35, "SPR2_PAIN"},
	anim_getdown = {SPR_PLAY, A, 1, "SPR2_PAIN"},
	anim_downloop = {SPR_PLAY, A, B, 15, "SPR2_CNT1"},
	anim_getup = {SPR_PLAY, A, 1, "SPR2_SPNG"},
	anim_death = {SPR_PLAY, A, 30, "SPR2_DEAD"},
	anim_revive = {SPR_PLAY, A, 1, "SPR2_SPNG"},
	anim_evoker = {SPR_PLAY, A, 8, "SPR2_CLNG"},
	anim_evoker_shoot = {SPR_PLAY, B, 8, "SPR2_CLNG"},
	anim_special1 = {SPR_PLAY, A, B, C, D, E, 2, "SPR2_MLEE"},
	vfx_summon = {"sfx_flsum1", "sfx_flsum2", "sfx_flsum3"},
    vfx_skill = {"sfx_flskl1", "sfx_flskl2", "sfx_flskl3"},
    vfx_item = {"sfx_flitm1", "sfx_flitm2", "sfx_flitm3"},
    vfx_hurt = {"sfx_flhrt1", "sfx_flhrt2", "sfx_flhrt3"},
    vfx_hurtx = {"sfx_flxht1", "sfx_flxht2", "sfx_flxht3"},
    vfx_die = {"sfx_fldie1", "sfx_fldie2", "sfx_fldie3"},
    vfx_heal = {"sfx_flhel1", "sfx_flhel2"},
    vfx_healself = {"sfx_flhel3"},
    vfx_kill = {"sfx_flkll1", "sfx_flkll2", "sfx_flkll3"},
    vfx_1more = {"sfx_fl1mor", "sfx_fl2mor", "sfx_fl3mor"},
    vfx_crit = {"sfx_flcrt1", "sfx_flcrt2", "sfx_flcrt3"},
    vfx_aoaask = {"sfx_flask1", "sfx_flask2", "sfx_flask3"},
    vfx_aoado = {"sfx_fldo1", "sfx_fldo2", "sfx_fldo3"},
    vfx_aoarelent = {"sfx_flrlt1", "sfx_flrlt2"},
    vfx_miss = {"sfx_flmss1", "sfx_flmss2", "sfx_flmss3"},
    vfx_dodge = {"sfx_fldod1", "sfx_fldod2", "sfx_fldod3"},
    vfx_win = {"sfx_flwin1", "sfx_flwin2", "sfx_flwin3"},
    vfx_levelup = {"sfx_fllvl1", "sfx_fllvl2", "sfx_fllvl3"},
	skills = {"zionga", "mediarama", "masukukaja", "fl_brain shake", "mapsio", "fl_illusive dance", "fl_binding cry", "masukunda"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					local party = mo.allies
					mo.thinkturns = $ and $+1 or 1
					if mo.thinkturns == 1
						D_startEvent(mo.battlen, "PP_FLChan_Start")
						removeSkill(mo, "brain buster f", "skill")
						return attackDefs["masukukaja"], party
					end
					local metalishere = 0
					for i = 1, #party do
						local bro = party[i]
						if bro.skin == "metalsonic"
							metalishere = $+1
						end
					end
					local enemies = mo.enemies
					if mo.hp < mo.maxhp*1/2
					and not mo.pinch
						mo.pinch = true
						if metalishere == 1
							D_startEvent(mo.battlen, "PP_FLChan_Pinch")
							return attackDefs["brain buster_warning"], enemies
						elseif metalishere == 0
							mo.fusionprevented = true
							D_startEvent(mo.battlen, "PP_FLChan_Solo")
							return attackDefs["brain buster_fail"], enemies
						end
					end
					if mo.pinch 
					and metalishere == 0 
					and not mo.fusionprevented 
					and not mo.revert
						mo.revert = true
						D_startEvent(mo.battlen, "PP_FLChan_Solo")
						return attackDefs["brain buster_revert"], enemies
					end
					return generalEnemyThinker(mo)
				end,
}

enemyList["enemy_eggman_mb"] = {
	name = "Eggman",
	skillchance = 75,
	level = 50,
	hp = 2950,
	sp = 2650,
	strength = 13,
	magic = 41,
	endurance = 29,
	agility = 24,
	luck = 52,
	melee_natk = "eggman_atk1",
	color = SKINCOLOR_RED,
	hudcutin = "EGGM_A",
	skin = "eggman",
	persona = "samael",
	resist = bionis and ATK_CURSE|ATK_POISON|ATK_METAL or ATK_CURSE,
	weak = bionis and ATK_BLESS|ATK_FOREST or ATK_BLESS,
	noroguerandom = true,
	noroguebuff = true,
	boss = true,
	anim_stand ={SPR_PLAY, A, 8, "SPR2_STND"},
	anim_stand_hurt ={SPR_PLAY, A, 1, "SPR2_STND"},
	anim_stand_bored ={SPR_PLAY, A, B, A, B, A, B, A, B, 10, "SPR2_WAIT"},
	anim_guard ={SPR_PLAY, A, 1, "SPR2_WALK"},
	anim_move ={SPR_PLAY, A, B, C, D, E, F, G, H, 2, "SPR2_WALK"},
	anim_run ={SPR_PLAY, A, B, C, D, 2, "SPR2_RUN_"},
	anim_atk ={SPR_PLAY, A, B, C, D, 1, "SPR2_RUN_"},
	anim_aoa_end ={SPR_PLAY, D, C, B, A, 1, "SPR2_ROLL"},
	anim_hurt ={SPR_PLAY, A, 35, "SPR2_PAIN"},
	anim_getdown ={SPR_PLAY, A, 1, "SPR2_PAIN"},
	anim_downloop ={SPR_PLAY, A, 1, "SPR2_CNT1"},
	anim_getup ={SPR_PLAY, A, B, C, D, 1, "SPR2_RUN_"},
	anim_death ={SPR_PLAY, A, 30, "SPR2_PAIN"},
	anim_revive ={SPR_PLAY, A, B, C, D, 1, "SPR2_RUN_"},
	anim_evoker ={SPR_PLAY, A, 8},
	anim_evoker_shoot ={SPR_PLAY, A, 8},
	anim_stand_super ={SPR_PLAY, A, B, C, B, 4, "SPR2_STND"},
	anim_stand_bored_super ={SPR_PLAY, A, B, C, B, 4, "SPR2_STND"},
	anim_stand_hurt_super ={SPR_PLAY, A, B, C, B, 4, "SPR2_STND"},
	anim_move_super ={SPR_PLAY, A, B, C, B, 4, "SPR2_WALK"},
	anim_run_super ={SPR_PLAY, A, B, C, D, E, F, 4, "SPR2_FLY_"},
	anim_special1 ={SPR_MRSP, A, B, C, D, 2},
	anim_special2 ={SPR_MRSP, A, B, C, D, 1},
	vfx_summon = {"sfx_egsum1", "sfx_egsum2", "sfx_egsum3"},
	vfx_skill = {"sfx_egskl1", "sfx_egskl2", "sfx_egskl3"},
	vfx_item = {"sfx_egskl2"},
	vfx_hurt = {"sfx_eghrt1"},
	vfx_hurtx = {"sfx_egdie1"},
	vfx_die = {"sfx_egdie1", "sfx_egdie2", "sfx_egmis1"},
	vfx_heal = {"sfx_eghel1"},
	vfx_healself = {"sfx_eghel1"},
	vfx_kill = {"sfx_egkll1", "sfx_egkll2"},
	vfx_1more = {"sfx_eg1mr1", "sfx_eg1mr2", "sfx_eg1mr3", "sfx_eg1mr4"},
	vfx_crit = {"sfx_egcrt1", "sfx_egcrt2", "sfx_egcrt3"},
	vfx_aoaask = {"sfx_egaoi1"},
	vfx_aoado = {"sfx_egaoa1", "sfx_egaoa2"},
	vfx_aoarelent = {"sfx_egdge1"},
	vfx_miss = {"sfx_egmis1", "sfx_egmis2"},
	vfx_dodge = {"sfx_egdge1"},
	vfx_win = {"sfx_egwin1"},
	vfx_levelup = {"sfx_eg1mr2", "sfx_eghel1"},
	skills = {"eiga", "maeiga", "maeiha", "mudoon", "life leech", "marakunda", "backup trick", "curse boost"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					mo.thinkturns = $ and $+1 or 1
					local enemies = mo.enemies
					if mo.thinkturns == 1
						D_startEvent(mo.battlen, "HH_Eggman_Start")
						return attackDefs["marakunda"], enemies
					end
					if mo.mindcharge
						return attackDefs["eiga"], {enemies[P_RandomRange(1, #enemies)]}
					end
					return generalEnemyThinker(mo)
				end,
}

enemyList["enemy_moto_1"] = {
	name = "Motobug",
	skillchance = 75,
	level = 50,
	hp = 2650,
	sp = 3240,
	strength = 18,
	magic = 40,
	endurance = 52,
	agility = 24,
	luck = 35,
	melee_natk = "motobug_atk1",
	color = SKINCOLOR_RED,
	hudcutin = "MOTO_A",
	skin = "motobug",
	persona = "hellbiker",
	resist = bionis and ATK_WIND|ATK_NUCLEAR|ATK_METAL or ATK_WIND|ATK_NUCLEAR,
	weak = bionis and ATK_ICE|ATK_WATER or ATK_ICE,
	noroguerandom = true,
	noroguebuff = true,
	boss = true,
	anim_stand = {SPR_PLAY, A, 8, "SPR2_STND"},
	anim_stand_hurt = {SPR_PLAY, A, 1, "SPR2_STND"},
	anim_stand_bored = {SPR_PLAY, A, B, A, B, A, B, A, B, 10, "SPR2_WAIT"},
	anim_guard = {SPR_PLAY, A, 1, "SPR2_ROLL"},
	anim_move = {SPR_PLAY, A, B, C, D, 2, "SPR2_WALK"},
	anim_run = {SPR_PLAY, A, B, C, D, 2, "SPR2_RUN"},
	anim_atk = {SPR_PLAY, A, B, 1, "SPR2_ROLL"},
	anim_aoa_end = {SPR_PLAY, B, A, 1, "SPR2_ROLL"},
	anim_hurt = {SPR_PLAY, A, 35, "SPR2_SPNG"},
	anim_getdown = {SPR_PLAY, B, 1, "SPR2_WAIT"},
	anim_downloop = {SPR_PLAY, A, B, 15, "SPR2_CNT1"},
	anim_getup = {SPR_PLAY, B, A, 1, "SPR2_WAIT"},
	anim_death = {SPR_PLAY, A, 30, "SPR2_DEAD"},
	anim_revive = {SPR_PLAY, A, B, 1, "SPR2_FALL"},
	anim_evoker = {SPR_PLAY, A, 2, "SPR2_CSMN"},
	anim_evoker_shoot = {SPR_PLAY, B, C, D, E, F, G, H, I, J, K, L, M, L, K, 2, "SPR2_CSMN"},
	anim_special1 = {SPR_PLAY, A, B, C, 3, "SPR2_BNCE"},
	vfx_summon = {"sfx_mosum1", "sfx_mosum2", "sfx_mosum3"},
    vfx_skill = {"sfx_moskl1", "sfx_moskl2", "sfx_moskl3"},
    vfx_item = {"sfx_moitm1", "sfx_moitm2"},
    vfx_hurt = {"sfx_mohrt1", "sfx_mohrt2", "sfx_mohrt3"},
    vfx_hurtx = {"sfx_moxht1", "sfx_moxht2", "sfx_moxht3"},
    vfx_die = {"sfx_modie1", "sfx_modie2", "sfx_modie3"},
    vfx_heal = {"sfx_moheal"},
    vfx_healself = {"sfx_moheal"},
    vfx_kill = {"sfx_mokll1", "sfx_mokll2", "sfx_mokll3"},
    vfx_1more = {"sfx_mo1mor", "sfx_mo2mor"},
    vfx_crit = {"sfx_mocrt1", "sfx_mocrt2", "sfx_mocrt3"},
    vfx_aoaask = {"sfx_moask1", "sfx_moask2"},
    vfx_aoado = {"sfx_moaoa1", "sfx_moaoa2", "sfx_moaoa3"},
    vfx_aoarelent = {"sfx_morlt1", "sfx_morlt2"},
    vfx_miss = {"sfx_momss1", "sfx_momss2", "sfx_momss3"},
    vfx_dodge = {"sfx_modod1", "sfx_modod2", "sfx_modod3"},
    vfx_win = {"sfx_mowin1", "sfx_mowin2", "sfx_mowin3"},
    vfx_levelup = {"sfx_molvl1", "sfx_molvl2", "sfx_molvl3"},
	skills = {"freila", "marakukaja", "mafreila", "dekunda", "rage boost", "infuriate", "hell exhaust", "nuke boost", "hell exhaust_boss"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					mo.thinkturns = $ and $+1 or 1
					local party = mo.allies
					if mo.thinkturns == 1
						D_startEvent(mo.battlen, "HH_Motobug_Start")
						return attackDefs["marakukaja"], party
					end
					local dekundatarget
					local numdebuffed = 0
					for i = 1, #party do
						local bro = party[i]
						if (bro.buffs["mag"][1] <= -50 or bro.buffs["def"][1] <= -50)
							dekundatarget = bro
							numdebuffed = $+1
						end
					end
					if mo.thinkturns >= 2 and numdebuffed > 0
						return attackDefs["dekunda"], party
					end
					local eggyishere = 0
					for i = 1, #party do
						local bro = party[i]
						if bro.skin == "eggman"
							eggyishere = $+1
						end
					end
					if mo.hp < mo.maxhp*1/2
					and not mo.pinch
						mo.pinch = true
						if eggyishere == 1
							D_startEvent(mo.battlen, "HH_Motobug_Pinch")
							return attackDefs["high energy_warning"], party
						elseif eggyishere == 0
							mo.fusionprevented = true
							D_startEvent(mo.battlen, "HH_Motobug_Solo")
							return attackDefs["high energy_fail"], party
						end
					end
					if mo.pinch 
					and eggyishere == 0 
					and not mo.fusionprevented 
					and not mo.revert
						mo.revert = true
						D_startEvent(mo.battlen, "HH_Motobug_Solo")
						return attackDefs["high energy_revert"], party
					end
					local enemies = mo.enemies
					if mo.mindcharge
						return attackDefs["freila"], {enemies[P_RandomRange(1, #enemies)]}
					end
					return generalEnemyThinker(mo)
				end,
}

local regaffinities3 = ATK_SLASH|ATK_STRIKE|ATK_PIERCE|ATK_FIRE|ATK_ICE|ATK_WIND|ATK_ELEC
local bioaffinities3 = bionis and ATK_SLASH|ATK_STRIKE|ATK_PIERCE|ATK_FIRE|ATK_ICE|ATK_WIND|ATK_ELEC|ATK_EARTH|ATK_WATER
enemyList["ganon"] = {
	name = "Ganon",
	skillchance = 100,
	level = 85,
	hp = 8000,
	sp = 2500,
	strength = 1,
	magic = 85,
	endurance = 72,
	agility = 30,
	luck = 50,
	melee_natk = "ganon_atk1",
	color = SKINCOLOR_OLIVE,
	hudcutin = "GANO_A",
	drain = bionis and ATK_CURSE|ATK_POISON or ATK_CURSE,
	resist = bioaffinities3 or regaffinities3,
	weak = bionis and ATK_BLESS|ATK_FOREST or ATK_BLESS,
	noroguerandom = true,
	noroguebuff = true,
	turns = 2,
	anim_stand = {SPR_GANO, A, 8},
	anim_stand_hurt = {SPR_GANO, A, 1}, 
	anim_hurt = {SPR_GANO, B, 35},
	anim_evoker = {SPR_GANO, C, 8},
	anim_getdown = {SPR_GANO, D, 1},
	anim_downloop = {SPR_GANO, D, 1},
	anim_special1 = {SPR_GANO, E, 81},
	anim_special2 = {SPR_GANO, F, G, H, I, I, H, H, H, I, I, H, 8},
    vfx_skill = {"sfx_ganywd", "sfx_ganymd"},
	vfx_hurt = {"sfx_ganhrt"},
	vfx_hurtx = {"sfx_ganwek", "sfx_gannoo"},
	vfx_die = {"sfx_gandie"},
	vfx_kill = {"sfx_gankll"},
	vfx_1more = {"sfx_ganchn"},
	vfx_crit = {"sfx_ganpit"},
	vfx_miss = {"sfx_ganmss"},
	vfx_dodge = {"sfx_gandod"},
	skills = {"ganon_atk1", "mabufudyne", "ganon_atk2", "psiodyne", "mapsiodyne", "eigaon", "maeigaon", "mudoon", 
	"ga_energy drain", "megidola", "ghastly wail", "ga_hot dark matter", "ga_spell gloom", "evil smile", "abysmal surge", "curse boost", 
	"death boost"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					local enemies = mo.enemies
					mo.thinkturns = $ and $+1 or 1
					if mo.thinkturns == 1
						D_startEvent(mo.battlen, "TGIK_Ganon_Start")
						return attackDefs["evil smile"], enemies
					end
					local numhexxed = 0
					local wailtarget
					for i = 1, #enemies do
						local en = enemies[i]
						if en.status_condition == COND_HEX
							wailtarget = en
							numhexxed = $+1
						end
					end
					if numhexxed >= 1
						return attackDefs["ghastly wail"], {wailtarget}
					end
					return generalEnemyThinker(mo)
				end,
}

enemyList["enemy_fl_2"] = {
	name = "FL Chan",
	skillchance = 75,
	level = 99,
	hp = 1540,
	sp = 1540,
	strength = 67,
	magic = 67,
	endurance = 46,
	agility = 78,
	luck = 78,
	melee_natk = "flchan_atk1",
	color = SKINCOLOR_GREEN,
	hudcutin = "FLCH_A",
	skin = "flchan",
	persona = "uzume",
	resist = bionis and ATK_ELEC|ATK_PSY|ATK_WATER or ATK_ELEC|ATK_PSY,
	weak = bionis and ATK_SLASH|ATK_EARTH or ATK_SLASH,
	noroguerandom = true,
	noroguebuff = true,
	boss = true,
	anim_stand = {SPR_PLAY, A, 8, "SPR2_STND"},
	anim_stand_hurt = {SPR_PLAY, A, 1, "SPR2_STND"},
	anim_stand_bored = {SPR_PLAY, A, B, A, B, A, B, A, B, 15, "SPR2_WAIT"},
	anim_guard = {SPR_PLAY, A, 1, "SPR2_RUN"},
	anim_move = {SPR_PLAY, A, B, C, D, E, F, G, H, 2, "SPR2_WALK"},
	anim_run = {SPR_PLAY, A, B, C, D, E, F, G, H, 2, "SPR2_RUN"},
	anim_atk = {SPR_PLAY, A, B, C, D, E, F, G, H, 1, "SPR2_ROLL"},
	anim_aoa_end = {SPR_PLAY, H, G, F, E, D, C, B, A, 1, "SPR2_ROLL"},
	anim_hurt = {SPR_PLAY, A, 35, "SPR2_PAIN"},
	anim_getdown = {SPR_PLAY, A, 1, "SPR2_PAIN"},
	anim_downloop = {SPR_PLAY, A, B, 15, "SPR2_CNT1"},
	anim_getup = {SPR_PLAY, A, 1, "SPR2_SPNG"},
	anim_death = {SPR_PLAY, A, 30, "SPR2_DEAD"},
	anim_revive = {SPR_PLAY, A, 1, "SPR2_SPNG"},
	anim_evoker = {SPR_PLAY, A, 8, "SPR2_CLNG"},
	anim_evoker_shoot = {SPR_PLAY, B, 8, "SPR2_CLNG"},
	anim_special1 = {SPR_PLAY, A, B, C, D, E, 2, "SPR2_MLEE"},
	vfx_summon = {"sfx_flsum1", "sfx_flsum2", "sfx_flsum3"},
    vfx_skill = {"sfx_flskl1", "sfx_flskl2", "sfx_flskl3"},
    vfx_item = {"sfx_flitm1", "sfx_flitm2", "sfx_flitm3"},
    vfx_hurt = {"sfx_flhrt1", "sfx_flhrt2", "sfx_flhrt3"},
    vfx_hurtx = {"sfx_flxht1", "sfx_flxht2", "sfx_flxht3"},
    vfx_die = {"sfx_fldie1", "sfx_fldie2", "sfx_fldie3"},
    vfx_heal = {"sfx_flhel1", "sfx_flhel2"},
    vfx_healself = {"sfx_flhel3"},
    vfx_kill = {"sfx_flkll1", "sfx_flkll2", "sfx_flkll3"},
    vfx_1more = {"sfx_fl1mor", "sfx_fl2mor", "sfx_fl3mor"},
    vfx_crit = {"sfx_flcrt1", "sfx_flcrt2", "sfx_flcrt3"},
    vfx_aoaask = {"sfx_flask1", "sfx_flask2", "sfx_flask3"},
    vfx_aoado = {"sfx_fldo1", "sfx_fldo2", "sfx_fldo3"},
    vfx_aoarelent = {"sfx_flrlt1", "sfx_flrlt2"},
    vfx_miss = {"sfx_flmss1", "sfx_flmss2", "sfx_flmss3"},
    vfx_dodge = {"sfx_fldod1", "sfx_fldod2", "sfx_fldod3"},
    vfx_win = {"sfx_flwin1", "sfx_flwin2", "sfx_flwin3"},
    vfx_levelup = {"sfx_fllvl1", "sfx_fllvl2", "sfx_fllvl3"},
	skills = {"ziodyne", "mediarama", "masukukaja", "fl_thunder kick", "mapsiodyne", "fl_mirage dance", "fl_binding cry", "debilitate", "antichthon f"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					mo.thinkturns = $ and $+1 or 1
					local party = mo.allies
					if mo.thinkturns == 1
						D_startEvent(mo.battlen, "VC_FLChan_Start")
						return attackDefs["masukukaja"], party
					end
					local voidyishere = 0
					for i = 1, #party do
						local bro1 = party[i]
						if bro1.skin == "voidy"
							voidyishere = $+1
						end
					end
					if mo.thinkturns >= 2 and voidyishere == 0
						removeSkill(mo, "antichthon f", "skill")
					end
					if bionis
						local motoishere = 0
						for i = 1, #party do
							local bro2 = party[i]
							if bro2.skin == "motobug"
								motoishere = $+1
							end
						end
						if mo.thinkturns >= 2 and motoishere == 0
							removeSkill(mo, "banshee scream f", "skill")
						end
					end
					return generalEnemyThinker(mo)
				end,
}
enemyList["enemy_ember"] = {
	name = "Ember",
	skillchance = 75,
	level = 99,
	hp = 1701,
	sp = 1377,
	strength = 78,
	magic = 46,
	endurance = 56,
	agility = 67,
	luck = 79,
	melee_natk = "ember_atk1",
	color = SKINCOLOR_GOLD,
	hudcutin = "EMBR_A",
	skin = "ember",
	persona = "scathach",
	resist = bionis and ATK_ICE|ATK_CURSE|ATK_FOREST or ATK_ICE|ATK_CURSE,
	weak = bionis and ATK_ELEC|ATK_GRAVITY or ATK_ELEC,
	noroguerandom = true,
	noroguebuff = true,
	boss = true,
	anim_stand = {SPR_PLAY, A, 8, "SPR2_STND"},
	anim_stand_hurt = {SPR_PLAY, A, 1, "SPR2_STND"},
	anim_stand_bored = {SPR_PLAY, A, B, A, B, A, B, A, B, 10, "SPR2_WAIT"},
	anim_guard = {SPR_PLAY, A, 1, "SPR2_WALK"},
	anim_move = {SPR_PLAY, A, B, C, D, 2, "SPR2_WALK"},
	anim_run = {SPR_PLAY, A, B, C, D, 2, "SPR2_RUN_"},
	anim_atk = {SPR_PLAY, A, B, C, D, 1, "SPR2_ROLL"},
	anim_aoa_end = {SPR_PLAY, D, C, B, A, 1, "SPR2_ROLL"},
	anim_hurt = {SPR_PLAY, A, 35, "SPR2_PAIN"},
	anim_getdown = {SPR_PLAY, A, 1, "SPR2_PAIN"},
	anim_downloop = {SPR_PLAY, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, 2, "SPR2_CNT1"},
	anim_getup = {SPR_PLAY, A, B, C, D, 1, "SPR2_ROLL"},
	anim_death = {SPR_PLAY, A, 30, "SPR2_DEAD"},
	anim_revive = {SPR_PLAY, A, B, C, D, 1, "SPR2_ROLL"},
	anim_evoker = {SPR_PLAY, A, 8, "SPR2_MLEE"},
	anim_evoker_shoot = {SPR_PLAY, A, B, C, 8, "SPR2_MLEE"},
	anim_special1 = {SPR_PLAY, A, 1, "SPR2_FIRE"},
	anim_special2 = {SPR_PLAY, A, B, C, 2, "SPR2_FIRE"},
	vfx_summon = {"sfx_emsum1", "sfx_emsum2", "sfx_emsum3"},
    vfx_skill = {"sfx_emskl1", "sfx_emskl2", "sfx_emskl3"},
    vfx_item = {"sfx_emitm1", "sfx_emitm2", "sfx_emitm3"},
    vfx_hurt = {"sfx_emhrt1", "sfx_emhrt2", "sfx_emhrt3"},
    vfx_hurtx = {"sfx_emxht1", "sfx_emxht2", "sfx_emxht3"},
    vfx_die = {"sfx_emdie1", "sfx_emdie2", "sfx_emdie3"},
    vfx_heal = {"sfx_emhel1", "sfx_emhel2", "sfx_emhel3"},
    vfx_healself = {"sfx_emhel4", "sfx_emhel5"},
    vfx_kill = {"sfx_emkll1", "sfx_emkll2", "sfx_emkll3"},
    vfx_1more = {"sfx_em1mor", "sfx_em2mor", "sfx_em3mor"},
    vfx_crit = {"sfx_emcrt1", "sfx_emcrt2", "sfx_emcrt3"},
    vfx_aoaask = {"sfx_emask1", "sfx_emask2", "sfx_emask3"},
    vfx_aoado = {"sfx_emdo1", "sfx_emdo2", "sfx_emdo3"},
    vfx_aoarelent = {"sfx_emrlt1", "sfx_emrlt2", "sfx_emrlt3"},
    vfx_miss = {"sfx_emmss1", "sfx_emmss2", "sfx_emmss3"},
    vfx_dodge = {"sfx_emdod1", "sfx_emdod2", "sfx_emdod3"},
    vfx_win = {"sfx_emwin1", "sfx_emwin2", "sfx_emwin3"},
    vfx_levelup = {"sfx_emlvl1", "sfx_emlvl2", "sfx_emlvl3"},
	skills = {"bufudyne", "em_one shot kill", "matarukaja", "em_brave step", "mudoon", "triple down", "life siphon", "em_auto-brave"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					mo.thinkturns = $ and $+1 or 1
					if mo.thinkturns == 1
						D_startEvent(mo.battlen, "VC_Ember_Start")
						return attackDefs["matarukaja"], mo.allies
					end
					if mo.thinkturns >= 2
						removeSkill(mo, "freikugel e", "skill")
					end
					local party = mo.allies
					local voidyishere = 0
					for i = 1, #party do
						local bro1 = party[i]
						if bro1.skin == "voidy"
							voidyishere = $+1
						end
					end
					local enemies = mo.enemies
					local remaining = 0
					for i = 1, #enemies do
						if enemies[i].hp
							remaining = $ + 1
						end
					end
					local unfortunate_victim = mo.enemies[P_RandomRange(1, #enemies)]
					if (mo.thinkturns%10 == 0) and voidyishere == 1 and remaining > 1
						return attackDefs["freikugel e"], {unfortunate_victim}
					end
					if bionis
						local morshuishere = 0
						for i = 1, #party do
							local bro2 = party[i]
							if bro2.skin == "pmorshu"
								morshuishere = $+1
							end
						end
						if mo.thinkturns >= 2 and morshuishere == 0
							removeSkill(mo, "slush fund e", "skill")
						end
					end
					return generalEnemyThinker(mo)
				end,
}
enemyList["enemy_moto_2"] = {
	name = "Motobug",
	skillchance = 75,
	level = 99,
	hp = 1485,
	sp = 1593,
	strength = 37,
	magic = 78,
	endurance = 99,
	agility = 46,
	luck = 67,
	melee_natk = "motobug_atk1",
	color = SKINCOLOR_RED,
	hudcutin = "MOTO_A",
	skin = "motobug",
	persona = "hellbiker",
	resist = bionis and ATK_WIND|ATK_NUCLEAR|ATK_METAL or ATK_WIND|ATK_NUCLEAR,
	weak = bionis and ATK_ICE|ATK_WATER or ATK_ICE,
	noroguerandom = true,
	noroguebuff = true,
	boss = true,
	anim_stand = {SPR_PLAY, A, 8, "SPR2_STND"},
	anim_stand_hurt = {SPR_PLAY, A, 1, "SPR2_STND"},
	anim_stand_bored = {SPR_PLAY, A, B, A, B, A, B, A, B, 10, "SPR2_WAIT"},
	anim_guard = {SPR_PLAY, A, 1, "SPR2_ROLL"},
	anim_move = {SPR_PLAY, A, B, C, D, 2, "SPR2_WALK"},
	anim_run = {SPR_PLAY, A, B, C, D, 2, "SPR2_RUN"},
	anim_atk = {SPR_PLAY, A, B, 1, "SPR2_ROLL"},
	anim_aoa_end = {SPR_PLAY, B, A, 1, "SPR2_ROLL"},
	anim_hurt = {SPR_PLAY, A, 35, "SPR2_SPNG"},
	anim_getdown = {SPR_PLAY, B, 1, "SPR2_WAIT"},
	anim_downloop = {SPR_PLAY, A, B, 15, "SPR2_CNT1"},
	anim_getup = {SPR_PLAY, B, A, 1, "SPR2_WAIT"},
	anim_death = {SPR_PLAY, A, 30, "SPR2_DEAD"},
	anim_revive = {SPR_PLAY, A, B, 1, "SPR2_FALL"},
	anim_evoker = {SPR_PLAY, A, 2, "SPR2_CSMN"},
	anim_evoker_shoot = {SPR_PLAY, B, C, D, E, F, G, H, I, J, K, L, M, L, K, 2, "SPR2_CSMN"},
	anim_special1 = {SPR_PLAY, A, B, C, 3, "SPR2_BNCE"},
	vfx_summon = {"sfx_mosum1", "sfx_mosum2", "sfx_mosum3"},
    vfx_skill = {"sfx_moskl1", "sfx_moskl2", "sfx_moskl3"},
    vfx_item = {"sfx_moitm1", "sfx_moitm2"},
    vfx_hurt = {"sfx_mohrt1", "sfx_mohrt2", "sfx_mohrt3"},
    vfx_hurtx = {"sfx_moxht1", "sfx_moxht2", "sfx_moxht3"},
    vfx_die = {"sfx_modie1", "sfx_modie2", "sfx_modie3"},
    vfx_heal = {"sfx_moheal"},
    vfx_healself = {"sfx_moheal"},
    vfx_kill = {"sfx_mokll1", "sfx_mokll2", "sfx_mokll3"},
    vfx_1more = {"sfx_mo1mor", "sfx_mo2mor"},
    vfx_crit = {"sfx_mocrt1", "sfx_mocrt2", "sfx_mocrt3"},
    vfx_aoaask = {"sfx_moask1", "sfx_moask2"},
    vfx_aoado = {"sfx_moaoa1", "sfx_moaoa2", "sfx_moaoa3"},
    vfx_aoarelent = {"sfx_morlt1", "sfx_morlt2"},
    vfx_miss = {"sfx_momss1", "sfx_momss2", "sfx_momss3"},
    vfx_dodge = {"sfx_modod1", "sfx_modod2", "sfx_modod3"},
    vfx_win = {"sfx_mowin1", "sfx_mowin2", "sfx_mowin3"},
    vfx_levelup = {"sfx_molvl1", "sfx_molvl2", "sfx_molvl3"},
	skills = {"atomic flare", "marakukaja", "mafreidyne", "dekunda", "rage boost", "infuriate", "mot_hell exhaust", "nuke amp", "hell exhaust_boss", "mad inferno mot"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					mo.thinkturns = $ and $+1 or 1
					local party = mo.allies
					if mo.thinkturns == 1
						D_startEvent(mo.battlen, "VC_Motobug_Start")
						return attackDefs["marakukaja"], party
					end
					local dekundatarget
					local numdebuffed = 0
					for i = 1, #party do
						local bro = party[i]
						if (bro.buffs["atk"][1] <= -50 
						or bro.buffs["mag"][1] <= -50 
						or bro.buffs["def"][1] <= -50 
						or bro.buffs["agi"][1] <= -50)
							dekundatarget = bro
							numdebuffed = $+1
						end
					end
					if mo.thinkturns >= 2 and numdebuffed > 0
						return attackDefs["dekunda"], party
					end
					local morshuishere = 0
					for i = 1, #party do
						local bro1 = party[i]
						if bro1.skin == "pmorshu"
							morshuishere = $+1
						end
					end
					if mo.thinkturns >= 2 and morshuishere == 0
						removeSkill(mo, "mad inferno mot", "skill")
					end
					if bionis
						local flishere = 0
						for i = 1, #party do
							local bro2 = party[i]
							if bro2.skin == "flchan"
								flishere = $+1
							end
						end
						if mo.thinkturns >= 2 and flishere == 0
							removeSkill(mo, "banshee scream m", "skill")
						end
					end
					return generalEnemyThinker(mo)
				end,
}
enemyList["enemy_voidy"] = {
	name = "Voidy",
	skillchance = 75,
	level = 99,
	hp = 1756,
	sp = 1324,
	strength = 90,
	magic = 56,
	endurance = 67,
	agility = 79,
	luck = 24,
	melee_natk = "voidy_atk1",
	color = SKINCOLOR_NEON,
	hudcutin = "VOID_A",
	skin = "voidy",
	persona = "seth",
	block = bionis and ATK_WIND|ATK_GRAVITY or ATK_WIND,
	resist = bionis and ATK_SLASH|ATK_STRIKE|ATK_POISON or ATK_SLASH|ATK_STRIKE,
	weak = bionis and ATK_BLESS|ATK_FOREST or ATK_BLESS,
	noroguerandom = true,
	noroguebuff = true,
	boss = true,
	anim_stand = {SPR_PLAY, A, 8, "SPR2_STND"},
	anim_stand_hurt = {SPR_PLAY, A, 1, "SPR2_STND"},
	anim_stand_bored = {SPR_PLAY, A, B, A, B, A, B, A, B, 15, "SPR2_WAIT"},
	anim_guard = {SPR_PLAY, C, 1, "SPR2_BNCE"},
	anim_move = {SPR_PLAY, A, B, C, D, E, F, G, H, 2, "SPR2_WALK"},
	anim_run = {SPR_PLAY, A, B, C, D, E, F, G, H, 2, "SPR2_RUN_"},
	anim_atk = {SPR_PLAY, A, B, C, D, 2, "SPR2_ROLL"},
	anim_aoa_end = {SPR_PLAY, D, C, B, A, 2, "SPR2_ROLL"},
	anim_hurt = {SPR_PLAY, A, 35, "SPR2_PAIN"},
	anim_getdown = {SPR_PLAY, A, 1, "SPR2_PAIN"},
	anim_downloop = {SPR_PLAY, A, 1, "SPR2_CNT1"},
	anim_getup = {SPR_PLAY, A, B, C, D, 1, "SPR2_ROLL"},
	anim_death = {SPR_PLAY, A, 30, "SPR2_DEAD"},
	anim_revive = {SPR_PLAY, A, B, C, D, 1, "SPR2_ROLL"},
	anim_evoker = {SPR_PLAY, A, 1, "SPR2_FINT"},
	anim_evoker_shoot = {SPR_PLAY, A, B, C, D, E, F, G, 2, "SPR2_TALB"},
	anim_special1 = {SPR_PLAY, A, B, C, 2, "SPR2_MLEE"},
	anim_special2 = {SPR_PLAY, D, E, F, 2, "SPR2_MLEE"},
	anim_special3 = {SPR_PLAY, G, H, I, 2, "SPR2_MLEE"},
	vfx_summon = {"sfx_vosum1", "sfx_vosum2", "sfx_vosum3"},
    vfx_skill = {"sfx_voskl1", "sfx_voskl2", "sfx_voskl3"},
    vfx_item = {"sfx_voitm1", "sfx_voitm2", "sfx_voitm3"},
    vfx_hurt = {"sfx_vohrt1", "sfx_vohrt2", "sfx_vohrt3"},
    vfx_hurtx = {"sfx_voxht1", "sfx_voxht2", "sfx_voxht3"},
    vfx_die = {"sfx_vodie1", "sfx_vodie2", "sfx_vodie3"},
    vfx_heal = {"sfx_vohel1", "sfx_vohel2"},
    vfx_healself = {"sfx_vohel3"},
    vfx_kill = {"sfx_vokll1", "sfx_vokll2", "sfx_vokll3"},
    vfx_1more = {"sfx_vo1mor", "sfx_vo2mor", "sfx_vo3mor"},
    vfx_crit = {"sfx_vocrt1", "sfx_vocrt2", "sfx_vocrt3"},
    vfx_aoaask = {"sfx_voask1", "sfx_voask2", "sfx_voask3"},
    vfx_aoado = {"sfx_vodo1", "sfx_vodo2", "sfx_vodo3"},
    vfx_aoarelent = {"sfx_vorlt1", "sfx_vorlt2", "sfx_vorlt3"},
    vfx_miss = {"sfx_vomss1", "sfx_vomss2", "sfx_vomss3"},
    vfx_dodge = {"sfx_vodod1", "sfx_vodod2", "sfx_vodod3"},
    vfx_win = {"sfx_vowin1", "sfx_vowin2", "sfx_vowin3"},
    vfx_levelup = {"sfx_volvl1", "sfx_volvl2", "sfx_volvl3"},
	skills = {"brave blade", bionis and "grydyne-bionis" or "garudyne", "vo_taunt", "vo_destructive joy", "vicious strike", "megidolaon", "vo_fortify spirit", "mind charge"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					mo.thinkturns = $ and $+1 or 1
					local enemies = mo.enemies
					local party = mo.allies
					local emberishere = 0
					for i = 1, #party do
						local bro2 = party[i]
						if bro2.skin == "ember"
							emberishere = $+1
						end
					end
					local remaining = 0
					for i = 1, #enemies do
						if enemies[i].hp
							remaining = $ + 1
						end
					end
					if (emberishere == 1 and remaining == 1)
						mo.itisuseless = true
					else
						mo.itisuseless = false
					end
					if mo.thinkturns == 1 and not mo.itisuseless	
						D_startEvent(mo.battlen, "VC_Voidy_Start")
						return attackDefs["vo_taunt"], enemies
					elseif mo.thinkturns == 1 and mo.itisuseless
						return attackDefs["freikugel v"], mo.enemies
					end
					if mo.thinkturns >= 2 and mo.itisuseless
						return attackDefs["freikugel v"], mo.enemies
					end
					if mo.thinkturns >= 2 and emberishere == 0
						removeSkill(mo, "freikugel v", "skill")
					end
					local flishere = 0
					for i = 1, #party do
						local bro1 = party[i]
						if bro1.skin == "flchan"
							flishere = $+1
						end
					end
					if mo.thinkturns >= 2 and flishere == 0
						removeSkill(mo, "antichthon v", "skill")
					end
					return generalEnemyThinker(mo)
				end,
}
enemyList["enemy_morshu"] = {
	name = "Morshu",
	skillchance = 75,
	level = 99,
	hp = 1648,
	sp = 1432,
	strength = 24,
	magic = 79,
	endurance = 78,
	agility = 46,
	luck = 90,
	melee_natk = "morshu_atk1",
	color = SKINCOLOR_ORANGE,
	hudcutin = "MORS_A",
	skin = "pmorshu",
	persona = "rubyn",
	resist = bionis and ATK_FIRE|ATK_BLESS|ATK_EARTH or ATK_FIRE|ATK_BLESS,
	weak = bionis and ATK_CURSE|ATK_POISON or ATK_CURSE,
	noroguerandom = true,
	noroguebuff = true,
	boss = true,
	anim_stand = {SPR_PLAY, A, 8, "SPR2_STND"},
	anim_stand_hurt = {SPR_PLAY, A, 1, "SPR2_STND"},
	anim_stand_bored = {SPR_PLAY, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, 8, "SPR2_WAIT"},
	anim_guard = {SPR_PLAY, D, 1, "SPR2_RUN_"},
	anim_move = {SPR_PLAY, A, B, C, D, E, F, 2, "SPR2_WALK"},
	anim_run = {SPR_PLAY, A, B, C, D, E, F, 2, "SPR2_RUN_"},
	anim_atk = {SPR_PLAY, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 2, "SPR2_ROLL"},
	anim_aoa_end = {SPR_PLAY, Z, Y, X, W, V, U, T, S, R, Q, P, O, N, M, L, K, J, I, H, G, F, E, D, C, B, A, 2, "SPR2_ROLL"},
	anim_hurt = {SPR_PLAY, A, 35, "SPR2_PAIN"},
	anim_getdown = {SPR_PLAY, C, 1, "SPR2_PAIN"},
	anim_downloop = {SPR_PLAY, C, 1, "SPR2_PAIN"},
	anim_getup = {SPR_PLAY, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, "SPR2_ROLL"},
	anim_death = {SPR_PLAY, A, 30, "SPR2_DEAD"},
	anim_revive = {SPR_PLAY, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, 1, "SPR2_ROLL"},
	anim_evoker = {SPR_PLAY, Q, 1, "SPR2_DASH"},
	vfx_summon = {"sfx_morsum"},
    vfx_skill = {"sfx_morskl"},
    vfx_item = {"sfx_morsum", "sfx_morskl", "sfx_morcrt"},
    vfx_die = {"sfx_morhel"},
    vfx_heal = {"sfx_morhel"},
    vfx_healself = {"sfx_morhsf"},
    vfx_kill = {"sfx_morcrt"},
    vfx_1more = {"sfx_morhsf"},
    vfx_crit = {"sfx_morcrt"},
    vfx_aoaask = {"sfx_morsum"},
    vfx_aoado = {"sfx_moraoa"},
    vfx_aoarelent = {"sfx_morskl"},
    vfx_miss = {"sfx_morhel"},
    vfx_dodge = {"sfx_mordod"},
    vfx_win = {"sfx_morwin"},
    vfx_levelup = {"sfx_morcrt", "sfx_morhsf"},
	skills = {"mor_discount wares", bionis and "divine judgement" or "mor_eternal light", "mamakakaja", "mor_insta-heal", "mor_doublakarn", "mor_wandbreaker"},
	thinker = 	function(mo)
					local btl = server.P_BattleStatus[mo.battlen]
					mo.thinkturns = $ and $+1 or 1
					local party = mo.allies
					if mo.thinkturns == 1
						D_startEvent(mo.battlen, "VC_Morshu_Start")
						return attackDefs["mamakakaja"], party
					end
					local motoishere = 0
					for i = 1, #party do
						local bro1 = party[i]
						if bro1.skin == "motobug"
							motoishere = $+1
						end
					end
					if mo.thinkturns >= 2 and motoishere == 0
						removeSkill(mo, "mad inferno mor", "skill")
					end
					if bionis
						local emberishere = 0
						for i = 1, #party do
							local bro2 = party[i]
							if bro2.skin == "ember"
								emberishere = $+1
							end
						end
						if mo.thinkturns >= 2 and emberishere == 0
							removeSkill(mo, "slush fund m", "skill")
						end
					end
					return generalEnemyThinker(mo)
				end,
}
if bionis
	table.insert(enemyList["enemy_fl_2"].skills, "banshee scream f")
	table.insert(enemyList["enemy_morshu"].skills, "slush fund m")
	table.insert(enemyList["ganon"].skills, "bufuverse")
	table.insert(enemyList["ganon"].skills, "dokudyne")
	table.insert(enemyList["ganon"].skills, "madokudyne")
	table.insert(enemyList["ganon"].skills, "venom boost")
end


-- Skills
attackDefs["brain buster_warning"] = {
	name = "Brain Buster",
	type = ATK_STRIKE,
	power = 320,
	accuracy = 80,
	critical = 5,
	statuschance = 33,
	status = COND_BRAINWASH,
	costtype = CST_HPPERCENT,
	cost = 22,
	desc = "",
	target = TGT_ALLENEMIES,
	norogue = true,
	norandom = true,
	hudfunc = function(v, mo, timer)
		for i = 1, #mo.allies do
			local target = mo.allies[i]
			local firstt = TICRATE - timer
			local t = (TICRATE - (firstt*2))
			local t2 = (t<<FRACBITS)/3
			local t3 = t2
			local scale = t*FRACUNIT/6
			local trflag = V_70TRANS
			if firstt < 15
				trflag = V_90TRANS - (V_10TRANS)
			end
			if scale > 0
			and timer < TICRATE
				v.drawScaled(160<<FRACBITS, 100<<FRACBITS, scale, v.cachePatch("H_1M_B"), trflag)
				v.drawScaled(160<<FRACBITS, 100<<FRACBITS, scale, v.cachePatch("H_1M_C"))
			end
			t3 = FixedMul(t3, t3)
			t3 = $+ FixedMul(t3, t2)
			local pp = v.cachePatch(charStats[mo.skin] and charStats[mo.skin].hudaoa or "")
			if mo.status_condition == COND_SUPER
			and charStats[mo.skin] and charStats[mo.skin].hudsaoa
				pp = v.cachePatch(charStats[mo.skin].hudsaoa)
			end
			if timer <100
				v.drawScaled((150)<<FRACBITS + t3/3, (80)<<FRACBITS +t3/8, FRACUNIT/2, pp, V_SNAPTOLEFT, v.getColormap(TC_DEFAULT, mo.color))
				pp = v.cachePatch(charStats["metalsonic"] and charStats["metalsonic"].hudaoa or "flchan")
				if target.skin == "metalsonic"
					v.drawScaled((150)<<FRACBITS - t3/3, (80)<<FRACBITS -t3/7, FRACUNIT/2, pp, V_SNAPTOLEFT, v.getColormap(TC_DEFAULT, target.color))
				end
			end
		end
	end,
	anim = function(mo, targets, hittargets, timer)
		for i = 1, #mo.allies do
			local target = mo.allies[i]
			if timer == 1
				if target.skin == "metalsonic"
					VFX_Play(target, VFX_AOADO)
				end
			elseif timer >= 1
				if target.skin == "flchan"
					summonAura(target, SKINCOLOR_TEAL)
				end
				if target.skin == "metalsonic"
					summonAura(target, SKINCOLOR_TEAL)
				end
			end
		end
		if timer == 1
			mo.fangle = 0
			mo.fdist = 400
			mo.columns = {}
			playSound(mo.battlen, sfx_aoado)
			VFX_Play(target, VFX_AOADO)
		end
		for k,v in ipairs(hittargets)
			local target = v
			local time = timer - 6*(k-1)
			local bustcolors = {SKINCOLOR_ROSY, SKINCOLOR_PINK, SKINCOLOR_BLACK}
			if time == 20
				playSound(mo.battlen, sfx_debuff)
				local orb = P_SpawnMobj(target.x, target.y, target.z + 50*FRACUNIT, MT_DUMMY)
				orb.sprite = SPR_DBUF
				orb.frame = A|TR_TRANS30
				orb.scale = FRACUNIT/6
				orb.scalespeed = FRACUNIT/12
				orb.destscale = FRACUNIT*2
				orb.tics = 2*TICRATE-15
				orb.color = SKINCOLOR_BLACK
			elseif time >= 20 and time < 5+2*TICRATE
				if not (time%8)
					local ol = P_SpawnMobj(target.x, target.y, target.z + 50*FRACUNIT, MT_DUMMY)
					ol.sprite = SPR_NTHK
					ol.color = SKINCOLOR_PINK
					ol.scale = 1
					ol.destscale = FRACUNIT*3
					ol.scalespeed = FRACUNIT/5
					ol.frame = B|FF_FULLBRIGHT
					ol.tics = 8
					ol = P_SpawnMobj(target.x, target.y, target.z + 50*FRACUNIT, MT_DUMMY)
					ol.sprite = SPR_NTHK
					ol.color = SKINCOLOR_ROSY
					ol.scale = 1
					ol.destscale = FRACUNIT*3
					ol.scalespeed = FRACUNIT
					ol.frame = B|FF_FULLBRIGHT|TR_TRANS50
					ol.tics = 8
				end
			elseif time == 5+2*TICRATE
				damageObject(target)
				playSound(mo.battlen, sfx_pstop)
				if not target.plyr
					localquake(mo.battlen, 7*FRACUNIT, 5)
				end
				for j = 1, 16
					local orb = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
					orb.momx = P_RandomRange(-16, 16)<<FRACBITS
					orb.momy = P_RandomRange(-16, 16)<<FRACBITS
					orb.momz = P_RandomRange(-16, 16)<<FRACBITS
					orb.destscale = 0
					orb.frame = A
					orb.color = bustcolors[P_RandomRange(1, #bustcolors)]
				end
			end
		end
		if timer == TICRATE*2
			mo.skills = {
				"zionga",
				"mediarama",
				"masukukaja",
				"fl_brain shake",
				"mapsio",
				"fl_illusive dance",
				"fl_binding cry",
				"masukunda",
				"brain buster f",
			}
			BTL_splitSkills(mo)
		end
		if timer == TICRATE*3 + (#hittargets-1)*6
			return true
		end
	end,
}

attackDefs["brain buster_fail"] = {
	name = "Brain Buster?",
	type = ATK_STRIKE,
	power = 320,
	accuracy = 80,
	critical = 999,
	statuschance = 33,
	status = COND_BRAINWASH,
	costtype = CST_HPPERCENT,
	cost = 22,
	desc = "",
	target = TGT_ALLENEMIES,
	norogue = true,
	norandom = true,
	anim = function(mo, targets, hittargets, timer)
		if timer == 1
			BTL_logMessage(mo.battlen, "Nothing happened...")
			playSound(mo.battlen, sfx_not)
		end
		if timer == TICRATE
			return true
		end
	end,
}

attackDefs["brain buster_revert"] = {
	name = "Brain Buster?",
	type = ATK_STRIKE,
	power = 320,
	accuracy = 80,
	critical = 999,
	statuschance = 33,
	status = COND_BRAINWASH,
	costtype = CST_HPPERCENT,
	cost = 22,
	desc = "",
	target = TGT_ALLENEMIES,
	norogue = true,
	norandom = true,
	anim = function(mo, targets, hittargets, timer)
		if timer == 1
			BTL_logMessage(mo.battlen, "Nothing happened...")
			playSound(mo.battlen, sfx_not)
		end
		if timer == TICRATE*2
			mo.skills = {
				"zionga",
				"mediarama",
				"masukukaja",
				"fl_brain shake",
				"mapsio",
				"fl_illusive dance",
				"fl_binding cry",
				"masukunda",
			}
			BTL_splitSkills(mo)
		end
		if timer == TICRATE
			return true
		end
	end,
}

attackDefs["hell exhaust_boss"] = {
	name = "Hell Exhaust",
	type = ATK_WIND,
	power = 240,
	accuracy = 999,
	costtype = CST_HP,
	cost = 15,
	desc = "Medium Wind dmg \nto all enemies and \nnegates enemy buffs.",
	target = TGT_ALLENEMIES,
	norogue = true,
	norandom = true,
	norepel = true,
	anim = function(mo, targets, hittargets, timer)
		local strs = {"atk", "mag", "def", "agi", "crit"}
		for k,e in ipairs(hittargets)
		local target = e
			if timer == 20
				playSound(mo.battlen, sfx_wind2)
				for i = 1, 10
					local g = P_SpawnMobj(target.x, target.y, target.z + P_RandomRange(0, 120)*FRACUNIT, MT_EXHAUST)
					g.target = target
					g.angle = FixedAngle(P_RandomRange(1, 360)*FRACUNIT)
					if i == 1 or i == 8
						g.jizzcolor = true
					end
					if i%2
						g.invertrotation = true
					end
					g.dist = P_RandomRange(45, 140)
					g.tics = 25
					g.lowquality = true
				end
			elseif timer == 30
			or timer == 33
			or timer == 36
			or timer == 39
				local s = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
				s.scale = FRACUNIT/4
				s.sprite = SPR_SLAS
				s.frame = I|TR_TRANS50 + P_RandomRange(0, 3)
				s.destscale = FRACUNIT*9
				s.scalespeed = FRACUNIT
				s.tics = TICRATE/3
			elseif timer == 40
				damageObject(target)
			elseif timer == 41
				playSound(mo.battlen, sfx_status)
				for j = 1, 16
					local orb = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
					orb.momx = P_RandomRange(-16, 16)<<FRACBITS
					orb.momy = P_RandomRange(-16, 16)<<FRACBITS
					orb.momz = P_RandomRange(-16, 16)<<FRACBITS
					orb.destscale = 0
					orb.frame = A
					orb.color = SKINCOLOR_MOSS
				end
				for j = 1, #strs
					local s = strs[j]
					if target.buffs[s][1] > 0
						target.buffs[s][1] = 0
						target.buffs[s][2] = 0
					end
				end
				BTL_logMessage(targets[1].battlen, "Stat increases nullified")
			end
		end
		if timer == 75 + 5*(#hittargets-1)
			return true
		end
	end,
}

attackDefs["high energy_warning"] = {
	name = "High Energy",
	type = ATK_SUPPORT,
	costtype = CST_SP,
	cost = 80,
	desc = "A warning sign \nfor Phase 2.",
	target = TGT_ALLALLIES,
	superbuff = true,
	mindcharge = true,
	norogue = true,
	norandom = true,
	hudfunc = function(v, mo, timer)
		for i = 1, #mo.allies do
			local target = mo.allies[i]
			local firstt = TICRATE - timer
			local t = (TICRATE - (firstt*2))
			local t2 = (t<<FRACBITS)/3
			local t3 = t2
			local scale = t*FRACUNIT/6
			local trflag = V_70TRANS
			if firstt < 15
				trflag = V_90TRANS - (V_10TRANS)
			end
			if scale > 0
			and timer < TICRATE
				v.drawScaled(160<<FRACBITS, 100<<FRACBITS, scale, v.cachePatch("H_1M_B"), trflag)
				v.drawScaled(160<<FRACBITS, 100<<FRACBITS, scale, v.cachePatch("H_1M_C"))
			end
			t3 = FixedMul(t3, t3)
			t3 = $+ FixedMul(t3, t2)
			local pp = v.cachePatch(charStats[mo.skin] and charStats[mo.skin].hudaoa or "")
			if mo.status_condition == COND_SUPER
			and charStats[mo.skin] and charStats[mo.skin].hudsaoa
				pp = v.cachePatch(charStats[mo.skin].hudsaoa)
			end
			if timer <100
				v.drawScaled((150)<<FRACBITS + t3/3, (80)<<FRACBITS +t3/8, FRACUNIT/2, pp, V_SNAPTOLEFT, v.getColormap(TC_DEFAULT, mo.color))
				pp = v.cachePatch(charStats["eggman"] and charStats["eggman"].hudaoa or "motobug")
				if target.skin == "eggman"
					v.drawScaled((150)<<FRACBITS - t3/3, (80)<<FRACBITS -t3/7, FRACUNIT/2, pp, V_SNAPTOLEFT, v.getColormap(TC_DEFAULT, target.color))
				end
			end
		end
	end,
	anim = function(mo, targets, hittargets, timer)
		for i = 1, #mo.allies do
			local target = mo.allies[i]
			if timer == 1
				if target.skin == "eggman"
					VFX_Play(target, VFX_AOADO)
					local fusioncost = ATK_getSkillCost(mo, attackDefs["high energy_warning"])
					damageSP(target, fusioncost)
				end
			elseif timer >= 1
				if target.skin == "motobug"
					summonAura(target, SKINCOLOR_TEAL)
				end
				if target.skin == "eggman"
					summonAura(target, SKINCOLOR_TEAL)
				end
			end
		end
		if timer == 1
			mo.fangle = 0
			mo.fdist = 400
			mo.columns = {}
			playSound(mo.battlen, sfx_aoado)
			VFX_Play(target, VFX_AOADO)
		end
		for i = 1, #targets do
			local target = targets[i]
			if timer == 20 + (i-1)*16
				playSound(mo.battlen, sfx_buff2)
				target.mindcharge = true
				BTL_logMessage(targets[1].battlen, target.name.." is building up Magic power...")
				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_CYAN
					dust.scale = FRACUNIT*2
				end
			elseif timer > 20 + (i-1)*16 and timer <= 50 + (i-1)*16
				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_CYAN
						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_CYAN
					thok.tics = P_RandomRange(10, 35)
				end
			end
		end
		if timer == 59
			mo.skills = {
				"freila",
				"marakukaja",
				"mafreila",
				"dekunda",
				"rage boost",
				"infuriate",
				"mot_hell exhaust",
				"nuke boost",
				"hell exhaust_boss",
				"high energy m",
			}
			BTL_splitSkills(mo)
		end
		if timer == 60 + (#targets-1)*16
			return true
		end
	end,
}

attackDefs["high energy_fail"] = {
	name = "High Energy?",
	type = ATK_SUPPORT,
	costtype = CST_SP,
	cost = 80,
	desc = "Nani the fuck!? \n(The Sequel)",
	target = TGT_ALLALLIES,
	superbuff = true,
	norogue = true,
	norandom = true,
	anim = function(mo, targets, hittargets, timer)
		for i = 1, #targets do
			local target = targets[i]
			if timer == 1 + (i-1)*16
				BTL_logMessage(mo.battlen, "Nothing happened...")
				playSound(mo.battlen, sfx_not)
				target.setonemore = 1
			end
		end
		if timer == 60 + (#targets-1)*16
			return true
		end
	end,
}

attackDefs["high energy_revert"] = {
	name = "High Energy?",
	type = ATK_SUPPORT,
	costtype = CST_SP,
	cost = 80,
	desc = "Nani the fuck!? \n(The Sequel)",
	target = TGT_ALLALLIES,
	superbuff = true,
	norogue = true,
	norandom = true,
	anim = function(mo, targets, hittargets, timer)
		for i = 1, #targets do
			local target = targets[i]
			if timer == 1 + (i-1)*16
				BTL_logMessage(mo.battlen, "Nothing happened...")
				playSound(mo.battlen, sfx_not)
				target.setonemore = 1
			end
		end
		if timer == 59
			mo.skills = {
				"freila",
				"marakukaja",
				"mafreila",
				"dekunda",
				"rage boost",
				"infuriate",
				"mot_hell exhaust",
				"nuke boost",
				"hell exhaust_boss",
			}
			BTL_splitSkills(mo)
		end
		if timer == 60 + (#targets-1)*16
			return true
		end
	end,
}

attackDefs["ganon_atk1"] = {
	name = "Skull Seeker",
	type = ATK_FIRE,
	power = 350,
	accuracy = 90,
	target = TGT_ALLENEMIES,
	costtype = CST_SP,
	cost = 0,
	status = COND_HEX,
	statuschance = 30,
	desc = "Heavy Fire damage to all enemies. \nMay inflict Hex.",
	anim = function(mo, targets, hittargets, timer)
		if timer >= 1
			ANIM_set(mo, mo.anim_special1)
			if mo.stinger and mo.stinger.valid
				mo.stinger.sprite = SPR_GSKL
				mo.stinger.frame = A|FF_FULLBRIGHT
			end
		end
		for k,v in ipairs(hittargets)
			local target = v
			local time = timer - 10*(k-1)
			if time == 10
				playSound(mo.battlen, sfx_fire1)
				local cx = mo.x + 1*cos(mo.angle + ANG1*90)
				local cy = mo.y + 1*sin(mo.angle + ANG1*90)
				mo.stinger = P_SpawnMobj(cx, cy, mo.z+(100*FRACUNIT), MT_DUMMY)
				mo.stinger.momx = (target.x - mo.stinger.x)/50
				mo.stinger.momy = (target.y - mo.stinger.y)/50
				mo.stinger.momz = (target.z - mo.stinger.z)/50
				mo.stinger.angle = R_PointToAngle2(mo.stinger.x, mo.stinger.y, target.x, target.y)
				mo.stinger.tics = 50
			elseif time == 60
				local boom = P_SpawnMobj(target.x, target.y, target.z+20*FRACUNIT, MT_BOSSEXPLODE)
				boom.scale = FRACUNIT*2
				boom.state = S_PFIRE1
				playSound(mo.battlen, sfx_fire2)
				playSound(mo.battlen, sfx_fire1)
				damageObject(target)
			end
		end
		if timer == 81 + (#targets-1)*10
			return true
		end
	end,
}

attackDefs["ganon_atk2"] = {
	name = "Bolt Storm",
	type = ATK_ELEC,
	power = 560,
	accuracy = 70,
	costtype = CST_SP,
	cost = 24,
	status = COND_SHOCK,
	statuschance = 15,
	desc = "x2 Medium Elec dmg to all enemies. \nMay inflict Shock.",
	target = TGT_ALLENEMIES,
	hits = 2,
	anim = function(mo, targets, hittargets, timer)
		if timer == 1
			ANIM_set(mo, mo.anim_special2)
		end
		for k,e in ipairs(hittargets)
		local target = e
			if timer == 20 
			or timer == 60
				lightningblast(target, SKINCOLOR_CYAN, FRACUNIT*3/2)
				localquake(mo.battlen, FRACUNIT*8, 8)
				damageObject(target)
			end
		end
		if timer == 90 + (10*(#hittargets-1))
			return true
		end
	end,
}

attackDefs["ga_energy drain"] = {
	name = "Energy Drain",
	type = ATK_ALMIGHTY,
	power = 400,
	accuracy = 999,
	costtype = CST_SP,
	cost = 18,
	desc = "Drain HP and SP from 1 enemy.",
	target = TGT_ENEMY,
	norogue = true,
	norandom = true,
	anim = function(mo, targets, hittargets, timer)
				local target = hittargets[1]
				if timer >= 20 and timer <= 40
					if timer == 20
						playSound(mo.battlen, sfx_absorb)
					elseif timer == 30
						damageObject(target)
						damageSP(target, 45)
						mo.buf_damage = target.damagetaken
					end
					for i = 1,2
						local thok = P_SpawnMobj(target.x, target.y, target.z+mo.height/2, MT_DUMMY)
						thok.color = SKINCOLOR_RED
						thok.momx = P_RandomRange(-10, 10)*FRACUNIT
						thok.momy = P_RandomRange(-10, 10)*FRACUNIT
						thok.momz = P_RandomRange(-10, 10)*FRACUNIT
						thok.scale = FRACUNIT/10
						thok.destscale = FRACUNIT*2
					end
				elseif timer >= 50 and timer <= 70
					if timer == 60
					and target ~= mo
						mo.atk_attacker = mo
						playSound(mo.battlen, sfx_heal3)
						damageObject(mo, -mo.buf_damage, DMG_NORMAL)
						damageSP(mo, -45)
					end
					local h_angle = P_RandomRange(1, 359)*ANG1
					local v_angle = P_RandomRange(1, 359)*ANG1
					local dist = 256
					local spd = P_RandomRange(40, 50)
					local s_x = mo.x+ dist*FixedMul(cos(h_angle), cos(v_angle))
					local s_y = mo.y+ dist*FixedMul(sin(h_angle), cos(v_angle))
					local s_z = (mo.z+mo.height/2)+ dist* sin(v_angle)
					local s = P_SpawnMobj(s_x, s_y, s_z, MT_DUMMY)
					s.frame = A
					s.color = SKINCOLOR_PERIDOT
					s.scale = FRACUNIT*3/2
					s.destscale = FRACUNIT/5
					s.target = target
					s.tics = 10
					s.momx = (mo.x - s.x)/10
					s.momy = (mo.y - s.y)/10
					s.momz = (mo.z - s.z)/10
				elseif timer == 110
					return true
				end
			end,
}

attackDefs["ga_hot dark matter"] = {
	name = "Hot Dark Matter",
	type = ATK_SUPPORT,
	costtype = CST_SP,
	cost = 36,
	desc = "Maximizes the caster's \nmagic regardless of \nmagic debuffs.",
	target = TGT_CASTER,
	superbuff = true,
	norogue = true,
	norandom = true,
	nocast = 	function(targets, n)
					local target = targets[n]
					if target.buffs["mag"][1] >= 75
						BTL_logMessage(targets[1].battlen, "Limit reached")
						return true
					end
				end,
	anim = function(mo, targets, hittargets, timer)
		local target = hittargets[1]
		if timer == 19
			target.buffs["mag"][1] = 0
		end
		if timer == 20
			playSound(mo.battlen, sfx_buff2)
			buffStat(target, "mag", 75)
			BTL_logMessage(targets[1].battlen, "Magic Attack way up!")
			local barrier = P_SpawnMobj(target.x, target.y, target.z, MT_DUMMY)
			target.elec = barrier
			barrier.scale = FRACUNIT*2
			barrier.state = S_PLAY_STND
			barrier.tics = -1
			barrier.sprite = SPR_ELEC
			barrier.fuse = 40
			barrier.colorized = true
			barrier.color = SKINCOLOR_TEAL
			local g = P_SpawnGhostMobj(barrier)
			g.destscale = FRACUNIT*4
			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_BOXSPARKLE1
					thok.momz = P_RandomRange(3, 10)*FRACUNIT
					thok.color = SKINCOLOR_TEAL
					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_TEAL
				thok.tics = P_RandomRange(10, 35)
			end
		elseif timer == 60
			target.elec = nil
			return true
		end
		if target.elec
		and target.elec.valid
		and not (leveltime%2)
			target.elec.frame = P_RandomRange(A, L)
		end
	end,
}

attackDefs["ga_spell gloom"] = {
	name = "Spell Gloom",
	type = ATK_SUPPORT,
	costtype = CST_SP,
	cost = 30,
	desc = "Lower enemies' magic \nattack by 2 stages.",
	target = TGT_ALLENEMIES,
	superdebuff = true,
	norogue = true,
	norandom = true,
	norepel = true,
	anim = function(mo, targets, hittargets, timer)
		for i = 1, #targets do
			local target = targets[i]
			if timer == 20
				playSound(mo.battlen, sfx_debuff)
				buffStat(target, "mag", -BUFFSTEP*2)
				BTL_logMessage(targets[1].battlen, "Magic Attack drastically down!")
				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_BLACK
					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(100, 150)*FRACUNIT, MT_DUMMY)
						thok.state = S_CDUST1
						thok.momz = P_RandomRange(3, 10)*FRACUNIT*-1
						thok.color = SKINCOLOR_BLACK
						thok.tics = 5
						thok.scale = FRACUNIT*3/2
						thok.flags = MF_NOGRAVITY|MF_NOBLOCKMAP
					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(100, 150)*FRACUNIT, MT_DUMMY)
					thok.sprite = SPR_SUMN
					thok.frame = F|FF_FULLBRIGHT|TR_TRANS50
					thok.momz = P_RandomRange(6, 16)*FRACUNIT*-1
					thok.color = SKINCOLOR_TEAL
					thok.tics = 5
					thok.flags = MF_NOGRAVITY|MF_NOBLOCKMAP
				end
			end
		end
		if timer == 60
			return true
		end
	end,
}

-- Dialogue
eventList["PP_FLChan_Start"] = {
	[1] = {"text", "FL Chan", "Think you can keep up with Metal and I?", nil, nil, nil, {"H_FLCAOA", SKINCOLOR_GREEN}},
}
eventList["PP_FLChan_Pinch"] = {
	[1] = {"text", "FL Chan", "Try not to get knocked out by my charm! Heehee!", nil, nil, nil, {"H_FLCAOA", SKINCOLOR_GREEN}},
}
eventList["PP_FLChan_Solo"] = {
	[1] = {"text", "FL Chan", "Hmm... seems like you somehow defeated Metal before me.", nil, nil, nil, {"H_FLCAOA", SKINCOLOR_GREEN}},
	[2] = {"text", "FL Chan", "But the show must go on, as they say!", nil, nil, nil, {"H_FLCAOA", SKINCOLOR_GREEN}},
}

eventList["HH_Eggman_Start"] = {
	[1] = {"text", nil, "Do you seriously think bringing one of your junkers will itimidate us, Eggman?", nil, nil, nil, nil},
	[2] = {"text", "Eggman", "Silence, fool! This is no ordinary Motobug.", nil, nil, nil, {"H_EGGAOA", SKINCOLOR_RED}},
	[3] = {"text", "Eggman", "You'll soon live to regret underestimating it!", nil, nil, nil, {"H_EGGAOA", SKINCOLOR_RED}},
}
eventList["HH_Motobug_Start"] = {
	[1] = {"text", "Motobug", "Suck on some fumes, half-pints!", nil, nil, nil, {"H_MOTAOA", SKINCOLOR_RED}},
}
eventList["HH_Motobug_Pinch"] = {
	[1] = {"text", "Motobug", "That's it! Prepare to become roadkill!", nil, nil, nil, {"H_MOTAOA", SKINCOLOR_RED}},
}
eventList["HH_Motobug_Solo"] = {
	[1] = {"text", "Motobug", "...", nil, nil, nil, {"H_MOTAOA", SKINCOLOR_RED}},
	[2] = {"text", "Motobug", "I'm screwed, aren't I?", nil, nil, nil, {"H_MOTAOA", SKINCOLOR_RED}},
}

eventList["TGIK_Ganon_Start"] = {
	[1] = {"text", "Ganon", "Join me! And I'll make your faces the GREATEST in Koridai!", nil, nil, nil, nil},
	[2] = {"text", "Ganon", "Or else you will DIE!", nil, nil, nil, nil},
}

eventList["VC_FLChan_Start"] = {
	[1] = {"text", "FL Chan", "I've come this far... I can't lose now!", nil, nil, nil, {"H_FLCAOA", SKINCOLOR_GREEN}},
}
eventList["VC_Ember_Start"] = {
	[1] = {"text", "Ember", "Don't worry. I promise this will only hurt a lot!", nil, nil, nil, {"H_EMBAOA", SKINCOLOR_GOLD}},
}
eventList["VC_Motobug_Start"] = {
	[1] = {"text", "Motobug", "Now I'LL show you what it's like to be easily destroyed!", nil, nil, nil, {"H_MOTAOA", SKINCOLOR_RED}},
}
eventList["VC_Voidy_Start"] = {
	[1] = {"text", "Voidy", "None can match my strength!", nil, nil, nil, {"H_VDYAOA", SKINCOLOR_NEON}},
}
eventList["VC_Morshu_Start"] = {
	[1] = {"text", "Morshu", "Lamp oil, rope, bombs? I've got it all!", nil, nil, nil, {"H_MORAOA", SKINCOLOR_ORANGE}},
}

-- Quest Entries
BTL_challengebtllist[#BTL_challengebtllist+1] = {
	name = "Programmed Pals",
	description = {"Test your strength against FL Chan and", "Metal Sonic, who form a good pair together."},
	level = 50,
	music = "EPIC",
	time = TICRATE*60*20,
	items = {{"silverring", 4}, {"silvercombiring", 4}, {"chewing soul", 4}, {"patra gem", 4}, {"me patra gem", 4}, {"1up", 4}, {"dekunda gem", 4}, {"dekaja gem", 4}},
	subpersonas = {},
	waves = {
		{"enemy_metal_fl", "enemy_fl_1"},
	},
}

BTL_challengebtllist[#BTL_challengebtllist+1] = {
	name = "Hedgehog Haters",
	description = {"Test your strength against Motobug and", "Eggman, who form a good pair together."},
	level = 50,
	music = "EPIC",
	time = TICRATE*60*20,
	items = {{"silverring", 4}, {"silvercombiring", 4}, {"chewing soul", 4}, {"patra gem", 4}, {"me patra gem", 4}, {"1up", 4}, {"dekunda gem", 4}, {"dekaja gem", 4}, {"homunculus", 8}},
	subpersonas = {},
	waves = {
		{"enemy_eggman_mb", "enemy_moto_1"},
	},
}

BTL_challengebtllist[#BTL_challengebtllist+1] = {
	name = "The GREATEST In Koridai",
	description = {"Defeat Ganon, the Prince of Darkness", "from Hyrule who wants to use the Dark ", "Hour for his own evil purposes."},
	level = 85,
	music = "BATKAN",
	time = TICRATE*60*40,
	items = {{"hyperring", 4}, {"hypercombiring", 4}, {"soul food", 4}, {"patra gem", 4}, {"me patra gem", 4}, {"super1up", 4}, {"dekunda gem", 4}, {"dekaja gem", 4}, {"homunculus", 9}, {"soma", 1}},
	subpersonas = {},
	waves = {
		{"ganon"}
	},
}

BTL_challengebtllist[#BTL_challengebtllist+1] = {
	name = "VoidyChars",
	description = {"Test your strength against this", "rag-tag group of juggernauts."},
	level = 99,
	music = "SURVIV",
	time = TICRATE*60*50,
	items = {{"hyperring", 4}, {"hypercombiring", 4}, {"soul food", 4}, {"patra gem", 4}, {"me patra gem", 4}, {"super1up", 4}, {"dekunda gem", 4}, {"dekaja gem", 4}, {"homunculus", 8}, {"soma", 1}},
	subpersonas = {},
	waves = {
		{"enemy_fl_2", "enemy_moto_2", "enemy_voidy", "enemy_morshu", "enemy_ember"},
	},
}