-- Persona Support --
if not srb2p return end

-- Stats
charStats["flchan"] = {
	-- GENERAL
	name = "FL Chan", -- Only for bots/enemies
	basehp = 50, -- Base HP/SP at level 1
	basesp = 50,
	persona = "uzume", -- Determines actual stats
	melee_natk = "flchan_atk1", -- Normal melee attack
	wep = "flchan_weapon1", -- Default weapon
	weptype = WPT_HAMMER, -- Equippable weapon type(s)
	atk = 35, -- Attack power of physical attacks
	acc = 80, -- Accuracy of physical attacks
	crit = 5, -- Critical rate of physical attacks
	supercolor_start = SKINCOLOR_SUPERPERIDOT1, -- If Super Form is applicable, will use this flash
	-- ANIMS
	anim_stand = {SPR_PLAY, A, 8, "SPR2_STND"}, -- Standing
	anim_stand_hurt = {SPR_PLAY, A, 1, "SPR2_STND"}, -- Standing (Low HP)
	anim_stand_bored = {SPR_PLAY, A, B, A, B, A, B, A, B, 15, "SPR2_WAIT"}, -- Standing (Rare)
	anim_guard = {SPR_PLAY, A, 1, "SPR2_RUN"}, -- Guarding
	anim_move = {SPR_PLAY, A, B, C, D, E, F, G, H, 2, "SPR2_WALK"}, -- Moving
	anim_run = {SPR_PLAY, A, B, C, D, E, F, G, H, 2, "SPR2_RUN"}, -- Running
	anim_atk = {SPR_PLAY, A, B, C, D, E, F, G, H, 1, "SPR2_ROLL"}, -- Attacking
	anim_aoa_end = {SPR_PLAY, H, G, F, E, D, C, B, A, 1, "SPR2_ROLL"}, -- Jumping out from All Out Attack
	anim_hurt = {SPR_PLAY, A, 35, "SPR2_PAIN"}, -- Taking damage
	anim_getdown = {SPR_PLAY, A, 1, "SPR2_PAIN"}, -- Knocked down from weakness/crit
	anim_downloop = {SPR_PLAY, A, B, 15, "SPR2_CNT1"}, -- Is down
	anim_getup = {SPR_PLAY, A, 1, "SPR2_SPNG"}, -- Gets up from down
	anim_death = {SPR_PLAY, A, 30, "SPR2_DEAD"}, -- Dies
	anim_revive = {SPR_PLAY, A, 1, "SPR2_SPNG"}, -- Gets revived
	anim_evoker = {SPR_PLAY, A, 8, "SPR2_CLNG"}, -- Uses evoker
	anim_evoker_shoot = {SPR_PLAY, B, 8, "SPR2_CLNG"},
	anim_special1 = {SPR_PLAY, A, B, C, D, E, 2, "SPR2_MLEE"}, -- Custom stuff. Can have up to 32
	-- VOICES
	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"},
	-- HUD/UI
	hudaoa = "H_FLCAOA", -- Patch for All Out Attack hud
	hudbust = "H_FLCBAR", -- Patch to draw on the stat hud
	icon = "ICO_FLCH", -- Icon for net select and other menus
	hudcutin = "FLCH_A", -- Cut in
	aoa_quote = "Let's make these guys \nchange their tune!", -- Something to say when in a Hold-Up
	tip = "Learns Elec, Healing, Strike, and Psy. A Jack-Of-All-Trades kind of support, albeit her low Endurance. She'll eventually be able to avoid her Slash weakness more often by combining Agility buffs, Agility debuffs, and dodge passives." -- A brief description of how the character generally plays in battle
}

VFX_freeslotC("flchan")

-- Persona
personaList["uzume"] = {
	-- GENERAL
	name = "Ame-no-Uzume",
	arcana = ARCANA_AEON,
	sprite = SPR_UZUM,
	startframe = 0,
	anim_idle = {SPR_UZUM, A, B, C, D, E, D, C, B, A, 8},
	anim_atk = {SPR_UZUM, F, G, H, I, J, K, L, M, N, O, P, Q, 2},
	-- STATS (At level 10)
	strength = 8,
	magic = 8,
	endurance = 6,
	luck = 9,
	agility = 9,
	-- AFFINITIES
	resist = bionis and ATK_ELEC|ATK_PSY|ATK_WATER or ATK_ELEC|ATK_PSY,
	weak = bionis and ATK_SLASH|ATK_EARTH or ATK_SLASH,
	-- SKILLSET
	skills = {
		{"zio", 1}, {"media", 4},
		{"sukukaja", 9}, {"lunge", 14},
		{"mapsi", 16}, {"fl_swift dance", 18},
		{"zionga", 20}, {"sukunda", 22},
		
		{"mediarama", 23, "media"}, {"mapsio", 26, "mapsi"},
		{"fl_shibaboo", 28, "zio"}, {"fl_illusive dance", 32, "fl_swift dance"},
		{"masukukaja", 35, "sukukaja"}, {"masukunda", 38, "sukunda"},
		{"fl_brain shake", 42, "lunge"}, {"fl_binding cry", 46, "fl_shibaboo"},
		
		{"ziodyne", 52, "zionga"}, {"mediarahan", 62, "mediarama"},
		{"mapsiodyne", 66, "mapsio"}, {"fl_mirage dance", 69, "fl_illusive dance"},
		{"debilitate", 72, "masukunda"}, {"fl_thunder kick", 82, "fl_brain shake"},
		
		// Zio > Zionga > Ziodyne
		// Media > Mediarama > Mediarahan
		// Sukukaja > Masukukaja
		// Lunge > Brain Shake
		// Mapsi > Mapsio > Mapsiodyne
		// Swift Dance > Illusive Dance > Mirage Dance
		// Shibaboo > Binding Cry
		// Sukunda > Masukunda > Debilitate
	},
}
-- Dungeon Ability
DNG_Abilities["flchan"] = {
	jfunc = 	function(p)
					local mo = p.mo
					P_SetObjectMomZ(mo, FRACUNIT*10)
					mo.state = S_MDAIR
					local pmic = P_SpawnMobjFromMobj(mo, 0, 0, 0, MT_DROPPEDMIC)
					S_StartSound(pmic, sfx_brakrl)
					pmic.target = mo
				end,
	func =		function(p)
					local mo = p.mo
					if mo.p_abl
						if ((mo.eflags & MFE_VERTICALFLIP) and mo.momz < 0)
						or (not (mo.eflags & MFE_VERTICALFLIP) and mo.momz > 0)
						else
							mo.state = S_PLAY_FALL
							p.pflags = $ & ~PF_JUMPED
							mo.p_abl = false
						end
					end
				end,
}

-- Weapons
weaponsList["flchan_weapon1"] = {
	name = "Seis Mic",
	type = WPT_HAMMER,
	rarity = 1,
	element = nil,
	atk = 350,
	acc = 80,
	crit = 5,
	desc = "FL Chan's starting weapon. \nA microphone that converts the singer's \npassion into energy, channeling it into visible \nshockwaves when it's dropped hard enough.",
	slot = "hard knuckle",
}

weaponsList["flchan_weapon2"] = {
	name = "Dyna Mic",
	type = WPT_HAMMER,
	rarity = 3,
	element = ATK_ELEC,
	atk = 1050,
	acc = 80,
	crit = 5,
	desc = "FL Chan's 2nd tier weapon. \nA microphone that produces so much static, \nthat lightning can even come out at times.",
	ag = 1,
	lu = 1,
	slot = "shock boost",
}

weaponsList["flchan_weapon3"] = {
	name = "Rhyth Mic",
	type = WPT_HAMMER,
	rarity = 5,
	element = ATK_PSY,
	atk = 1750,
	acc = 80,
	crit = 5,
	desc = "FL Chan's 3rd tier weapon. \nA microphone that automatically creates \nholographic visual effects based on the song \nas well as the efforts of the singer.",
	ag = 3,
	lu = 3,
	slot = "serene grace",
}

-- Velvet Shop
table.insert(shopList["velvet_shop_mp1"].weapons, {makeWeapon("flchan_weapon1", 10), 800, nil, 4})
table.insert(shopList["velvet_shop_mp1"].weapons, {makeWeapon("flchan_weapon2"), 4000, 3})
table.insert(shopList["velvet_shop_mp1"].weapons, {makeWeapon("flchan_weapon3"), 12500, 6})

-- Void Shop
table.insert(shopList["void_shop"].weapons, {makeWeapon("flchan_weapon1", 10), 700, nil, 6})
table.insert(shopList["void_shop"].weapons, {makeWeapon("flchan_weapon2"), 1500, 6, 12})
table.insert(shopList["void_shop"].weapons, {makeWeapon("flchan_weapon3"), 2000, 12})

-- Bionis Shop
if bionis
	table.insert(shopList["shop_bionis"].weapons, {makeWeapon("flchan_weapon1", 10), 800, nil, 4})
	table.insert(shopList["shop_bionis"].weapons, {makeWeapon("flchan_weapon2"), 4000, 3})
	table.insert(shopList["shop_bionis"].weapons, {makeWeapon("flchan_weapon3"), 12500, 6})
	table.insert(shopList["shop_ameno"].weapons, {makeWeapon("flchan_weapon2", 10), 8000, 3})
	table.insert(shopList["shop_ameno"].weapons, {makeWeapon("flchan_weapon3", 10), 25000, 6})
end

-- Skills
attackDefs["flchan_atk1"] = {
	name = "Mic Drop",
	type = ATK_STRIKE,
	power = 35,
	accuracy = 80,
	statuschance = 2,
	status = COND_SHOCK,
	costtype = CST_HP,
	cost = 0,
	desc = "Miniscule Strike damage to \nall enemies. \nMay inflict Shock.",
	target = TGT_ALLENEMIES,
	physical = true,
	anim_norepel = true,
	norandom = true,
	anim = function(mo, targets, hittargets, timer)
		if timer == TICRATE/3
			ANIM_set(mo, mo.anim_special1, false)
		end
		if timer == TICRATE/2
		or timer == TICRATE/2 + 8
			if timer == TICRATE/2
				localquake(mo.battlen, 30*FRACUNIT, 5)
				playSound(mo.battlen, sfx_pstop)
			end
			local ang = 0
			for i = 1, 24 do
				local m = P_SpawnMobj(mo.x, mo.y, mo.z, MT_DUMMY)
				m.state = S_MUSICNOTE2
				m.scale = FRACUNIT/2
				m.fuse = TICRATE
				m.destscale = FRACUNIT*4
				m.friction = FRACUNIT
				m.angle = ang
				P_InstaThrust(m, m.angle, 50*FRACUNIT)
				m = P_SpawnMobj(mo.x, mo.y, mo.z, MT_DUMMY)
				m.state = S_QUICKBOOM1
				m.scale = FRACUNIT
				m.fuse = TICRATE
				m.friction = FRACUNIT
				m.destscale = FRACUNIT*4
				m.angle = ang
				m.color = SKINCOLOR_LAVENDER
				P_InstaThrust(m, m.angle, 60*FRACUNIT)
				for i = 1, 8
					m = P_SpawnMobj(mo.x, mo.y, mo.z + (mo.height*2), MT_DUMMY)
					m.state = S_MUSICNOTE1
					m.fuse = TICRATE
					m.friction = FRACUNIT
					m.scale = FRACUNIT
					m.destscale = FRACUNIT*4
					m.angle = ang + P_RandomRange(-15, 15)*ANG1
					P_InstaThrust(m, m.angle, 50*FRACUNIT + P_RandomRange(-16, 16)*FRACUNIT)
				end
				ang = $ + (360/24)*ANG1
			end
		end
		if timer == TICRATE/2 + 10
			for k,v in ipairs(hittargets)
				damageObject(v)
			end
		end
		if timer == TICRATE*2
			return true
		end
	end,
}

attackDefs["fl_swift dance"] = {
	name = "Swift Dance",
	type = ATK_PASSIVE|ATK_SLASH|ATK_STRIKE|ATK_PIERCE,
	desc = "Boost Evasion rate \nagainst Physical attacks \nby 15%",
	power = 15,
	passive = PSV_DODGE,
	norogue = true,
	norandom = true,
}

attackDefs["fl_shibaboo"] = {
	name = "Shibaboo",
	type = ATK_SUPPORT,
	power = 0,
	accuracy = 60,
	statuschance = 60,
	status = COND_SHOCK,
	costtype = CST_SP,
	luckbased = true,
	cost = 5,
	desc = "High chance of inflicting \nShock on 1 enemy.",
	target = TGT_ENEMY,
	norogue = true,
	norandom = true,
	anim = function(mo, targets, hittargets, timer)
			local target = hittargets[1]
			if timer == 10
				playSound(mo.battlen, sfx_absorb)
			end
			if timer <= 30
				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_GOLD
				thok.tics = P_RandomRange(10, 35)
				thok.scale = FRACUNIT*3/2
			end
			if timer == 20
				damageObject(target)
			elseif timer == 42
				return true
			end
	end,
}

attackDefs["fl_illusive dance"] = {
	name = "Illusive Dance",
	type = ATK_PASSIVE|ATK_SLASH|ATK_STRIKE|ATK_PIERCE,
	desc = "Boost Evasion rate \nagainst Physical attacks \nby 30%",
	power = 30,
	passive = PSV_DODGE,
	norogue = true,
	norandom = true,
}

attackDefs["fl_brain shake"] = {
	name = "Brain Shake",
	type = ATK_STRIKE,
	power = 180,
	accuracy = 90,
	critical = 5,
	statuschance = 45,
	status = COND_BRAINWASH,
	costtype = CST_HPPERCENT,
	cost = 9,
	desc = "Medium Strike dmg to one foe. \n45% Brainwash chance.",
	target = TGT_ENEMY,
	norogue = true,
	norandom = true,
	anim = function(mo, targets, hittargets, timer)
		if timer == 1
			mo.fangle = 0
			mo.fdist = 400
			mo.columns = {}
		end
		local target = hittargets[1]
		local bustcolors = {SKINCOLOR_ROSY, SKINCOLOR_PINK, SKINCOLOR_BLACK}
		if timer == 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 timer >= 20 and timer < 5+2*TICRATE
			if not (timer%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 timer == 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
		if timer == TICRATE*3
			return true
		end
	end,
}

attackDefs["fl_binding cry"] = {
	name = "Binding Cry",
	type = ATK_SUPPORT,
	power = 0,
	accuracy = 45,
	statuschance = 45,
	status = COND_SHOCK,
	costtype = CST_SP,
	luckbased = true,
	cost = 12,
	desc = "Low chance of inflicting \nShock on all enemies.",
	target = TGT_ALLENEMIES,
	norogue = true,
	norandom = true,
	anim = function(mo, targets, hittargets, timer)
			for i = 1, #hittargets
				local target = hittargets[i]
				local t = timer - (i-1)*6
				if t == 10
					playSound(mo.battlen, sfx_absorb)
				end
				if t <= 30
					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_GOLD
					thok.tics = P_RandomRange(10, 35)
					thok.scale = FRACUNIT*3/2
				end
				if t == 20
					damageObject(target)
				end
			end
			if timer == 42 + (#hittargets-1)*6
				return true
			end
	end,
}

attackDefs["fl_mirage dance"] = {
	name = "Mirage Dance",
	type = ATK_PASSIVE|ATK_SLASH|ATK_STRIKE|ATK_PIERCE,
	desc = "Boost Evasion rate \nagainst Physical attacks \nby 45%",
	power = 45,
	passive = PSV_DODGE,
	norogue = true,
	norandom = true,
}

attackDefs["fl_thunder kick"] = {
	name = "Thunder Kick",
	type = ATK_STRIKE,
	power = 1640,
	accuracy = 85,
	costtype = CST_HPPERCENT,
	technical = COND_FREEZE,
	cost = 20,
	critical = 5,
	desc = "Heavy Strike damage to \n2 random enemies.",
	target = TGT_ALLENEMIES,
	hits = 2,
	anim = function(mo, targets, hittargets, timer)
		local rand = P_RandomRange(1, #hittargets)
		if timer == 1
			mo.target_randhits = {}
			mo.critted = false
		end
		local target = hittargets[rand]
		for i = 1, mo.attack.hits do
			if timer == 10 + (i-1)*30
				local targetfound = false
				for z = 1, 9999
					rand = P_RandomRange(1, #hittargets)
					target = hittargets[rand]
					if target.hp > 0
					and not targetfound
						table.insert(mo.target_randhits, target)
						targetfound = true
					end
					if z == 9999
					and not targetfound
						server.P_BattleStatus[mo.battlen].atktimer = 35 + (mo.attack.hits)*30
					end
				end
			end
			if timer >= 20 + (i-1)*30 
			and timer <= 35 + (i-1)*30
				target = mo.target_randhits[i]
				if not target or not target.valid
					continue
				end
				if timer == 20 + (i-1)*30
					local downstate = target.down
					damageObject(target)
					if (target.damagestate == DMG_WEAK
					or target.damagestate == DMG_TECHNICAL
					or target.damagestate == DMG_CRITICAL)
					and target.down
					and not downstate
						mo.critted = true
					end
					playSound(mo.battlen, sfx_pstop)
					playSound(mo.battlen, sfx_zio3)
					lightningblast(target, SKINCOLOR_CYAN, FRACUNIT*3/2)
					if not target.plyr
						createSplat(mo)
						createSplat(mo)
						localquake(mo.battlen, 7*FRACUNIT, 5)
					end
					for i=1,16
						local b = P_SpawnMobj(target.x, target.y, target.z+2*FRACUNIT, MT_DUMMY)
						b.momx = P_RandomRange(-3, 3)*FRACUNIT
						b.momy = P_RandomRange(-3, 3)*FRACUNIT
						b.momz = P_RandomRange(4, 16)*FRACUNIT
						b.state = S_AOADUST1
						b.frame = A|FF_FULLBRIGHT
						b.scale = FRACUNIT*3
						b.destscale = FRACUNIT/12
					end
					for i=1,16
						local b = P_SpawnMobj(target.x, target.y, target.z+20*FRACUNIT, MT_DUMMY)
						b.momx = P_RandomRange(-8, 8)*FRACUNIT
						b.momy = P_RandomRange(-8, 8)*FRACUNIT
						b.momz = P_RandomRange(-8, 8)*FRACUNIT
						b.state = S_AOADUST1
						b.frame = A|FF_FULLBRIGHT
						b.scale = FRACUNIT*3
						b.destscale = FRACUNIT/12
					end
				end
			end
		end
		if timer < 10 + (mo.attack.hits)*30
			for i = 1, #hittargets
				if hittargets[i].damage_wait
				and hittargets[i].hp > 0
					hittargets[i].damage_wait = 1
				end
			end
		end
		if timer == 45 + (mo.attack.hits)*30
			mo.target_randhits = nil
			mo.setonemore = mo.critted
			mo.critted = nil
			return true
		end
	end,
}

-- Fusion Skills
local FLFusions_BTL_splitSkills = BTL_splitSkills
BTL_splitSkills = function(v)
	if server.gamemode ~= GM_PVP 
	and server.gamemode ~= GM_VOIDRUN
		if v.skin == "flchan" 
		and #v.allies_noupdate
			if v.level >= 42
				for i = 1, #v.allies_noupdate
					if not v.allies_noupdate[i] or not v.allies_noupdate[i].valid then continue end
					if v.allies_noupdate[i].skin == "metalsonic"
						table.insert(v.skills, "brain buster f")
					end
				end
			end
			if bionis and v.level >= 46
				for i = 1, #v.allies_noupdate
					if not v.allies_noupdate[i] or not v.allies_noupdate[i].valid then continue end
					if v.allies_noupdate[i].skin == "motobug"
						table.insert(v.skills, "banshee scream f")
					end
				end
			end
			if v.level >= 72
				for i = 1, #v.allies_noupdate
					if not v.allies_noupdate[i] or not v.allies_noupdate[i].valid then continue end
					if v.allies_noupdate[i].skin == "voidy"
						table.insert(v.skills, "antichthon f")
					end
				end
			end
		end
		if v.skin == "metalsonic" 
		and #v.allies_noupdate
			if v.level >= 42
				for i = 1, #v.allies_noupdate
					if not v.allies_noupdate[i] or not v.allies_noupdate[i].valid then continue end
					if v.allies_noupdate[i].skin == "flchan"
						table.insert(v.skills, "brain buster m1")
					end
				end
			end
		end
	end
	FLFusions_BTL_splitSkills(v)
end

attackDefs["brain buster f"] = {
	name = "Brain Buster",
	type = ATK_STRIKE,
	power = 320,
	accuracy = 80,
	critical = 5,
	statuschance = 33,
	status = COND_BRAINWASH,
	costtype = CST_HPPERCENT,
	cost = 22,
	desc = "Fusion (w/ Metal Sonic) - \nHeavy Strike dmg to all foes. \n33% Brainwash chance.",
	target = TGT_ALLENEMIES,
	norogue = true,
	norandom = true,
	nometronome = true,
	nocast = function(targets, n, mo)
		local tgt = targets[n]
		local battlen = tgt.battlen
		local skincheck = "metalsonic"
		local checkteam = tgt.enemies
		local found
		mo.fusionpartner = false
		local fusioncost = ATK_getSkillCost(mo, attackDefs["brain buster f"])
		local can_afford
		local incapacitated
		for i = 1, #checkteam do
			if checkteam[i].skin == skincheck
				found = true
				mo.fusionpartner = checkteam[i]
				if mo.fusionpartner.hp and mo.fusionpartner.hp >= fusioncost
					can_afford = true
				end
				if mo.fusionpartner.down 
				or mo.fusionpartner.status_condition == COND_SHOCK 
				or mo.fusionpartner.status_condition == COND_BRAINWASH 
				or mo.fusionpartner.status_condition == COND_SLEEP 
				or mo.fusionpartner.status_condition == COND_RAGE
					incapacitated = true
					break
				end
			end
		end
		if not found
			BTL_logMessage(battlen, "Metal Sonic is not alive.")
			playSound(battlen, sfx_not)
			return true
		elseif not can_afford
			BTL_logMessage(battlen, mo.fusionpartner.name.." has insufficient HP.")
			playSound(battlen, sfx_not)
			return true
		elseif incapacitated
			BTL_logMessage(battlen, mo.fusionpartner.name.." can't think for themselves right now.")
			playSound(battlen, sfx_not)
			return true
		end
	end,
	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)
					if not (target.boss)
						local fusioncost = ATK_getSkillCost(mo, attackDefs["brain buster f"])
						target.hp = $ - fusioncost
					end
				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*3 + (#hittargets-1)*6
			return true
		end
	end,
}

attackDefs["brain buster m1"] = {
	name = "Brain Buster",
	type = ATK_STRIKE,
	power = 320,
	accuracy = 80,
	critical = 5,
	statuschance = 33,
	status = COND_BRAINWASH,
	costtype = CST_HPPERCENT,
	cost = 22,
	desc = "Fusion (w/ FL Chan) - \nHeavy Strike dmg to all foes. \nCures Brainwash for x2 dmg.",
	target = TGT_ALLENEMIES,
	norogue = true,
	norandom = true,
	nometronome = true,
	condboost = 200,
	implicit = "brain buster m2",
	nocast = function(targets, n, mo)
		local tgt = targets[n]
		local battlen = tgt.battlen
		local skincheck = "flchan"
		local checkteam = tgt.enemies
		local found
		mo.fusionpartner = false
		local fusioncost = ATK_getSkillCost(mo, attackDefs["brain buster m1"])
		local can_afford
		local incapacitated
		for i = 1, #checkteam do
			if checkteam[i].skin == skincheck
				found = true
				mo.fusionpartner = checkteam[i]
				if mo.fusionpartner.hp and mo.fusionpartner.hp >= fusioncost
					can_afford = true
				end
				if mo.fusionpartner.down 
				or mo.fusionpartner.status_condition == COND_SHOCK 
				or mo.fusionpartner.status_condition == COND_BRAINWASH 
				or mo.fusionpartner.status_condition == COND_SLEEP 
				or mo.fusionpartner.status_condition == COND_RAGE
					incapacitated = true
					break
				end
			end
		end
		if not found
			BTL_logMessage(battlen, "FL Chan is not alive.")
			playSound(battlen, sfx_not)
			return true
		elseif not can_afford
			BTL_logMessage(battlen, mo.fusionpartner.name.." has insufficient HP.")
			playSound(battlen, sfx_not)
			return true
		elseif incapacitated
			BTL_logMessage(battlen, mo.fusionpartner.name.." can't think for themselves right now.")
			playSound(battlen, sfx_not)
			return true
		end
	end,
	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["flchan"] and charStats["flchan"].hudaoa or "metalsonic")
				if target.skin == "flchan"
					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 == "flchan"
					VFX_Play(target, VFX_AOADO)
					if not (target.boss)
						local fusioncost = ATK_getSkillCost(mo, attackDefs["brain buster m1"])
						target.hp = $ - fusioncost
					end
				end
			elseif timer >= 1
				if target.skin == "metalsonic"
					summonAura(target, SKINCOLOR_TEAL)
				end
				if target.skin == "flchan"
					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 == 1
				if (target.status_condition and target.status_condition == COND_BRAINWASH)
					target.alreadybrainwashed = true
				end
			elseif 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)
				if target.alreadybrainwashed 
				and target.damagestate ~= DMG_MISS 
				and target.damagestate ~= DMG_BLOCK 
				and target.damagestate ~= DMG_DRAIN
					cureStatus(target)
					BTL_logMessage(targets[1].battlen, "Status nullified!")
					playSound(mo.battlen, sfx_spkdth)
					target.alreadybrainwashed = false
				end
				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*3 + (#hittargets-1)*6
			return true
		end
	end,
}
attackDefs["brain buster m2"] = {
	name = "Brain Buster - Apply Condboost",
	type = ATK_PASSIVE,
	desc = "Who cares.",
	norandom = true,
	norogue = true,
	passive = PSV_TRIGGERDAMAGE,
	anim = 	function(mo, target, dmg, crit)
				if mo.attack and mo.attack.condboost
				and (target.status_condition and target.status_condition == COND_BRAINWASH)
					dmg = $ + dmg*mo.attack.condboost/100
				end
				return dmg
			end,
}

attackDefs["banshee scream f"] = {
	name = "Banshee's Scream",
	type = ATK_ALMIGHTY,
	power = 100,
	accuracy = 999,
	costtype = CST_SP,
	instakill = true,
	cost = 10,
	desc = "Fusion (w/ Motobug) - \nInstantly kills foes inflicted \nwith any ailment.",
	target = TGT_ALLENEMIES,
	norogue = true,
	norandom = true,
	nometronome = true,
	nocast = function(targets, n, mo)
		local tgt = targets[n]
		local battlen = tgt.battlen
		local skincheck = "motobug"
		local checkteam = tgt.enemies
		local found
		mo.fusionpartner = false
		local fusioncost = ATK_getSkillCost(mo, attackDefs["banshee scream f"])
		local can_afford
		local incapacitated
		for i = 1, #checkteam do
			if checkteam[i].skin == skincheck
				found = true
				mo.fusionpartner = checkteam[i]
				if mo.fusionpartner.sp and mo.fusionpartner.sp >= fusioncost
					can_afford = true
				end
				if mo.fusionpartner.down 
				or mo.fusionpartner.status_condition == COND_SHOCK 
				or mo.fusionpartner.status_condition == COND_BRAINWASH 
				or mo.fusionpartner.status_condition == COND_SLEEP 
				or mo.fusionpartner.status_condition == COND_RAGE
					incapacitated = true
					break
				end
			end
		end
		if not found
			BTL_logMessage(battlen, "Motobug is not alive.")
			playSound(battlen, sfx_not)
			return true
		elseif not can_afford
			BTL_logMessage(battlen, mo.fusionpartner.name.." has insufficient SP.")
			playSound(battlen, sfx_not)
			return true
		elseif incapacitated
			BTL_logMessage(battlen, mo.fusionpartner.name.." can't think for themselves right now.")
			playSound(battlen, sfx_not)
			return true
		end
	end,
	hudfunc = function(v, mo, timer)
				if timer > 5
				and timer < TICRATE*3/2 + 1
					v.fadeScreen(0xFF00, 10)
				end
				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["motobug"] and charStats["motobug"].hudaoa or "flchan")
						if target.skin == "motobug"
							if target.status_condition == COND_SUPER
							and charStats[target.skin] and charStats[target.skin].hudsaoa
								pp = v.cachePatch(charStats[target.skin].hudsaoa)
							end
							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)
		local avgx, avgy = 0, 0
		for i = 1, #targets
			avgx = $ + targets[i].x/FRACUNIT
			avgy = $ + targets[i].y/FRACUNIT
		end
		avgx = ($/#targets)	*FRACUNIT
		avgy = ($/#targets)	*FRACUNIT
		local cam = server.P_BattleStatus[mo.battlen].cam
		for i = 1, #mo.allies do
			local target = mo.allies[i]
			if timer == 1
				if target.skin == "motobug"
					VFX_Play(target, VFX_AOADO)
					local fusioncost = ATK_getSkillCost(mo, attackDefs["banshee scream f"])
					damageSP(target, fusioncost)
				end
			elseif timer >= 1
				if target.skin == "flchan"
					summonAura(target, SKINCOLOR_TEAL)
				end
				if target.skin == "motobug"
					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
		if timer == 1
			mo.oldangle = mo.angle
			mo.angle = R_PointToAngle2(mo.x, mo.y, avgx, avgy)
			local tgtx = mo.x + 256*cos(mo.angle)
			local tgty = mo.y + 256*sin(mo.angle)
			P_TeleportMove(cam, tgtx, tgty, mo.z + FRACUNIT*16)
			cam.angle = R_PointToAngle2(cam.x, cam.y, mo.x, mo.y)
			CAM_stop(cam)
		elseif timer == 5
			local thean = mo.angle
			local tgtx = avgx + 512*cos(thean)
			local tgty = avgy + 512*sin(thean)
			playSound(mo.battlen, sfx_howl1)
			localquake(mo.battlen, FRACUNIT*64, 10)
			CAM_goto(cam, tgtx, tgty, mo.z + FRACUNIT*128, FRACUNIT*20)
		elseif timer >= 5
		and timer <= TICRATE*3/2
			if leveltime%5 == 0
				local d = P_SpawnMobj(mo.x, mo.y, mo.z + FRACUNIT*64, MT_THOK)
				d.state = S_HOWL1
				d.color = SKINCOLOR_AETHER
				d.frame = $|FF_FULLBRIGHT
				d.angle = mo.angle + ANG1*90
				d.scale = mo.scale*2
				d.destscale = mo.scale*7
				d.scalespeed = FRACUNIT/4
			end
		elseif timer == TICRATE*3/2 + 1
			for i = 1, #hittargets
				if hittargets[i].status_condition and hittargets[i].status_condition < COND_HYPER
					damageObject(hittargets[i])
				end
			end
		elseif timer == TICRATE*3
			return true
		end
	end,
}

attackDefs["antichthon f"] = {
	name = "Antichthon",
	type = ATK_ALMIGHTY,
	power = 350,
	accuracy = 90,
	costtype = CST_SP,
	cost = 48,
	desc = "Fusion (w/ Voidy) - \nHeavy Almighty dmg to all enemies. \nLowers all stats by 1 stage.",
	target = TGT_ALLENEMIES,
	norogue = true,
	norandom = true,
	nometronome = true,
	nocast = function(targets, n, mo)
		local tgt = targets[n]
		local battlen = tgt.battlen
		local skincheck = "voidy"
		local checkteam = tgt.enemies
		local found
		mo.fusionpartner = false
		local fusioncost = ATK_getSkillCost(mo, attackDefs["antichthon f"])
		local can_afford
		local incapacitated
		for i = 1, #checkteam do
			if checkteam[i].skin == skincheck
				found = true
				mo.fusionpartner = checkteam[i]
				if mo.fusionpartner.sp and mo.fusionpartner.sp >= fusioncost
					can_afford = true
				end
				if mo.fusionpartner.down 
				or mo.fusionpartner.status_condition == COND_SHOCK 
				or mo.fusionpartner.status_condition == COND_BRAINWASH 
				or mo.fusionpartner.status_condition == COND_SLEEP 
				or mo.fusionpartner.status_condition == COND_RAGE
					incapacitated = true
					break
				end
			end
		end
		if not found
			BTL_logMessage(battlen, "Voidy is not alive.")
			playSound(battlen, sfx_not)
			return true
		elseif not can_afford
			BTL_logMessage(battlen, mo.fusionpartner.name.." has insufficient SP.")
			playSound(battlen, sfx_not)
			return true
		elseif incapacitated
			BTL_logMessage(battlen, mo.fusionpartner.name.." can't think for themselves right now.")
			playSound(battlen, sfx_not)
			return true
		end
	end,
	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["voidy"] and charStats["voidy"].hudaoa or "flchan")
				if target.skin == "voidy"
					if target.status_condition == COND_SUPER
					and charStats[target.skin] and charStats[target.skin].hudsaoa
						pp = v.cachePatch(charStats[target.skin].hudsaoa)
					end
					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 == "voidy"
					VFX_Play(target, VFX_AOADO)
					local fusioncost = ATK_getSkillCost(mo, attackDefs["antichthon f"])
					damageSP(target, fusioncost)
				end
			elseif timer >= 1
				if target.skin == "flchan"
					summonAura(target, SKINCOLOR_TEAL)
				end
				if target.skin == "voidy"
					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
		local avgx, avgy = 0, 0
		for i = 1, #hittargets
			avgx = $ + hittargets[i].x/FRACUNIT
			avgy = $ + hittargets[i].y/FRACUNIT
		end
		avgx = ($/#hittargets)*FRACUNIT
		avgy = ($/#hittargets)*FRACUNIT
		local zpos = mo.z + FRACUNIT*200	
		if timer == 20
			playSound(mo.battlen, sfx_absorb)
			local frei = P_SpawnMobj(avgx, avgy, zpos, MT_DUMMY)
			frei.state = S_PLAY_STND
			frei.tics = 30
			frei.fuse = 30
			frei.sprite = SPR_FREI
			frei.frame = G|TR_TRANS20|FF_FULLBRIGHT
			frei.scale = FRACUNIT*5
			frei.color = SKINCOLOR_BLACK
		elseif timer > 20 and timer <= 50
			if timer == 25 
			or timer == 35 
			or timer == 45
				local bx = avgx + P_RandomRange(-192, 192)*FRACUNIT
				local by = avgy + P_RandomRange(-129, 192)*FRACUNIT
				local bz = mo.z + P_RandomRange(0, 256)*FRACUNIT
				for i = 1, 32
					local boom = P_SpawnMobj(bx + P_RandomRange(-20, 20)*FRACUNIT, by + P_RandomRange(-20, 20)*FRACUNIT, bz + 10*FRACUNIT, MT_DUMMY)
					boom.state = S_CQUICKBOOM1
					boom.color = SKINCOLOR_ORANGE
					boom.momx = P_RandomRange(-20, 20)*FRACUNIT
					boom.momy = P_RandomRange(-20, 20)*FRACUNIT
					boom.momz = P_RandomRange(-20, 20)*FRACUNIT
					boom.scale = FRACUNIT*3/2
				end
				playSound(mo.battlen, sfx_megi6)
				localquake(mo.battlen, FRACUNIT*32, 10)
			end
			if not (timer%4)
				local ol = P_SpawnMobj(avgx, avgy, zpos + FRACUNIT*50, MT_DUMMY)
				ol.sprite = SPR_NTHK
				ol.scale = 1
				ol.destscale = FRACUNIT*8
				ol.scalespeed = FRACUNIT
				ol.frame = B|FF_FULLBRIGHT
				ol.color = SKINCOLOR_CRIMSON
				ol.tics = 8
			end
		elseif timer == 51
			for k,v in ipairs(hittargets)
				damageObject(v)
				if v.damagestate ~= DMG_MISS
					buffStat(v, "atk", -25)
					buffStat(v, "mag", -25)
					buffStat(v, "def", -25)
					buffStat(v, "agi", -25)
					BTL_logMessage(mo.battlen, "Weakened overall combat performance!")
				end
			end
			for i = 1, 16
				local boom = P_SpawnMobj(avgx + P_RandomRange(-20, 20)*FRACUNIT, avgy + P_RandomRange(-20, 20)*FRACUNIT, zpos, MT_DUMMY)
				boom.state = S_CQUICKBOOM1
				boom.color = SKINCOLOR_ORANGE
				boom.momx = P_RandomRange(-20, 20)*FRACUNIT
				boom.momy = P_RandomRange(-20, 20)*FRACUNIT
				boom.momz = P_RandomRange(-20, 20)*FRACUNIT
				boom.scale = FRACUNIT*3/2
			end
			playSound(mo.battlen, sfx_megi5)
			localquake(mo.battlen, FRACUNIT*16, 10)
		elseif timer == 90
			return true
		end
	end,
}

-- Trait
personaList["uzume"].trait = "companion spirit"

attackDefs["companion spirit"] = {
	name = "Companion Spirit",
	type = ATK_PASSIVE,
	passive = PSV_SKILLCOST,
	desc = "Lowers the costs of Healing \nand Support skills by 25%.",
	norandom = true,
	norogue = true,
	anim = function(mo, skill, cost)
		if skill.type == ATK_HEAL 
		or skill.type == ATK_SUPPORT
			cost = $*3/4
		end
		return cost
	end,
}