ACTOR KaguyaHouraisan
{
//Enemy Name: Kaguya Houraisan
//Monster Tier: Hell Knight
//Enemy Tier: Normal (Touhou)
//Difficulty: Normal (4/10)
  Speed 0
  MONSTER
  Health 2500
  Radius 20
  Height 62
  Scale 0.55
  MinMissileChance 3000
  Mass 0x7FFFFFFF
  MeleeThreshold 35
  MeleeRange 65
  Species "Touhou"
  damagefactor "Touhou", 0.0
  +LOOKALLAROUND
  +FLOORCLIP
  +BOSS
  +Neverfast
  +Missilemore
  +Missileevenmore
  +Dontmorph
  +NORADIUSDMG
  +DONTHURTSPECIES
  +NOTIMEFREEZE
  +NOICEDEATH
  -COUNTKILL
  Painchance 64
  Seesound ""
  painsound "touhou/pain"
  deathsound "touhou/rekt"
  DamageFactor "Legendary", 0.0
  DamageFactor "LegendaryGuru", 0.0
  DamageFactor "LegendaryGuruPlayer", 0.0
  DamageFactor "LegendaryPlayer", 0.0
  DamageFactor "Legendary", 0.0
  DamageFactor "LegendaryGuru", 0.0
  DamageFactor "LACGrenade", 0.0
  DamageFactor "LSSGGrenade", 0.0
  damagefactor 0.5
  Obituary "%o couldn't withstand Kaguya Houraisan's unrivaled beauty."
  tag "$NEKaguya"
  var int user_delay;
  var int user_lowlag;
  var int user_script;
  States
  {
  Spawn:
	KAGI A 1
	TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("GetCVar",11) == 1, "BegoneThot")
  SpawnLoop:
	KAGI A 0
	TNT1 A 0 ACS_NamedExecuteAlways("WimpyMode",0,2)
	TNT1 A 0 ACS_NamedExecuteAlways("ModifyMonster",0,2)
	TNT1 A 0 A_SetInvulnerable
	TNT1 A 0 A_ChangeFlag("NODAMAGE",1)
	TNT1 A 0 A_ChangeFlag("NOPAIN",1)
 	KAGI AAABCDDDDDDDDCBEFG 5 A_LookEX(LOF_FULLVOLSEESOUND,0,0,0,360,"See")
  IdleMore:
	KAGI H 10 A_LookEX(LOF_FULLVOLSEESOUND,0,0,0,360,"See")
	Loop
  BegoneThot:
	TNT1 A 0 A_SpawnItemEx("explosivebarrel",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
	TNT1 A 0 A_ChangeFlag("COUNTKILL", FALSE)
	TNT1 A 0
	Stop
  See:
	TNT1 A 0 A_PlaySound("touhou/sight",7,1.0,0,ATTN_NONE)
	TNT1 A 0 A_UnSetInvulnerable
	TNT1 A 0 A_ChangeFlag("NODAMAGE",0)
	TNT1 A 0 A_ChangeFlag("NOPAIN",0)
  See2:
	TNT1 A 0 A_JumpIf(user_lowlag == 1,"MoreSee")
	TNT1 A 0 A_JumpIfTargetInLOS("MoreSee",0,0,0,0)
	KAGI ABCD 2 A_Chase
	Loop
  MoreSee:
	TNT1 A 0 A_SetUserVar("user_lowlag",1)
	TNT1 A 0 A_SetUserVar("user_delay",0)
  SeeAnim1:
	TNT1 A 0 A_JumpIf(user_delay >= 15,"SeeAnim2")
  	KAGI A 0 A_Jump(2,"BOUNCEPAD")
    KAGI A 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim2:
 	TNT1 A 0 A_JumpIf(user_delay >= 20,"SeeAnim3")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KAGI B 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim3:
 	TNT1 A 0 A_JumpIf(user_delay >= 25,"SeeAnim4")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KAGI C 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim4:
 	TNT1 A 0 A_JumpIf(user_delay >= 65,"SeeAnim5")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KAGI D 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim5:
 	TNT1 A 0 A_JumpIf(user_delay >= 70,"SeeAnim6")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KAGI C 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim6:
 	TNT1 A 0 A_JumpIf(user_delay >= 75,"See")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KAGI B 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  BOUNCEPAD:
	TNT1 A 0 A_SetUserVar("user_delay",0)
	KAGJ ABC 5
	KAGJ D 5 A_GiveInventory("KaguyaJump",1)
	KAGJ EF 5
  CheckForFloor:
	TNT1 A 0 A_JumpIf(user_delay >= 100,"Land")
    TNT1 A 0 A_SetUserVar("user_delay",user_delay+10)
	KAGJ GGGGGHHHHH 1 A_CheckFloor("Land")
    Loop
  Land:	
  	TNT1 A 0 A_SetUserVar("user_delay",0)
	KAGJ IJ 3 A_Stop
	Goto MoreSee
  Pain:
	TNT1 A 0 A_StopSound(7)
	KAGP A 4
    KAGP A 10 A_Pain
    Goto MoreSee
  Melee:
    KAGM ABC 3 A_FaceTarget
	KAGM D 5 A_CustomMeleeAttack(random(40,60),"touhou/kaguya/melee","touhou/kaguya/meleemiss","Touhou")
	KAGM EFG 4 A_FaceTarget
    MYST A 0 A_Jump(256,"Missile")
	Goto MoreSee
  Missile:
    MYST A 0 A_facetarget
	MYST A 0 A_Jump(256,"Attack1", "Attack2","Attack3")
    Goto MoreSee
  Attack1:
	KAG1 A 5 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku6",30,0,-50)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku5",30,0,-40)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku4",30,0,-30)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku3",30,0,-20)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku2",30,0,-10)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku1",30,0,0)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku2",30,0,10)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku3",30,0,20)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku4",30,0,30)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku5",30,0,40)
	KAG1 B 0 A_CustomMissile("KaguyaDanmaku6",30,0,50)
	KAG1 CDE 5 A_FaceTarget
	Goto MoreSee
  Attack2:
	KAGJ A 5 A_FaceTarget
	KAG2 ABABABABAB 5 A_FaceTarget
	KAGJ A 3 A_FaceTarget
	TNT1 A 0 Bright A_Explode(128,512,0,0)
	TNT1 A 0 Bright A_PlaySound("touhou/rekt")
	TNT1 A 0 Bright A_SpawnItemEx("PurpleDevastatorShockWave2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION|SXF_CLIENTSIDE)
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,18,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,36,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,54,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,72,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,90,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,108,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,126,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,144,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,144,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,162,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,180,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,196,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,216,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,234,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,252,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,270,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,288,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,306,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,324,CMF_AIMDIRECTION,random(-90,90))
	TNT1 A 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,342,CMF_AIMDIRECTION,random(-90,90))
	KAG2 CDE 5 A_FaceTarget
	Goto MoreSee
  Attack3:
	KAG3 AB 5 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku1",30,0,0)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku2",30,0,10)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku3",30,0,20)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku4",30,0,30)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku5",30,0,40)
	KAG3 C 5 A_CustomMissile("KaguyaDanmaku6",30,0,50)
	KAG3 DEEED 5 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku1",30,0,0)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku2",30,0,-10)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku3",30,0,-20)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku4",30,0,-30)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku5",30,0,-40)
	KAG3 C 5 A_CustomMissile("KaguyaDanmaku6",30,0,-50)
	KAG3 BBB 5 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku1",30,0,0)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku2",30,0,10)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku3",30,0,20)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku4",30,0,30)
	KAG3 C 0 A_CustomMissile("KaguyaDanmaku5",30,0,40)
	KAG3 C 5 A_CustomMissile("KaguyaDanmaku6",30,0,50)
	KAG3 DEFG 5 A_FaceTarget
	Goto MoreSee
  Death:
	TNT1 A 0 A_Pain
	KAGP C 70
	KAGP BA 5
	KAGJ A 5
	KAG2 ABABABAB 5
	KAGJ A 5
	TNT1 A 0 A_SpawnItem("BlueLightning")
	KAL2 CDE 5
	TNT1 A 0 A_SpawnItemEx("LegendaryKaguya",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION|SXF_TELEFRAG)
	TNT1 A 15
	stop
  }
}

actor LegendaryKaguya : KaguyaHouraisan
{
//Enemy Name: Legendary Kaguya Houraisan
//Monster Tier: Pinky Demon
//Enemy Tier: Legendary (Touhou)
//Difficulty: Insane (SURPRISE! 8/10)
 Health 3000
 Painchance 16
 Obituary "%o died when %g saw Legendary Kaguya's beautiful barrage of danmaku."
 tag "\c[z3]Legendary Kaguya"
 DamageFactor "SuperWeapon", 0.0
 DamageFactor "Extreme", 0.0
 DamageFactor "SatanGuard", 0.1
 DamageFactor "AbyssalSatyr", 0.1
 DamageFactor "Moloch", 0.1
 DamageFactor "Exos", 0.2
 DamageFactor "ZombieDev", 0.1
 DamageFactor "Terminator", 0.1
 DamageFactor "AdvancedImp", 0.1
 DamageFactor "Legendary1", 0.1
 DamageFactor "LegendaryGuru", 0.1
 DamageFactor "UltimateLegendary", 0.0
 DamageFactor "Nobles", 0.1
 DamageFactor "VileFires", 0.1
 DamageFactor "Shadow", 0.1
 DamageFactor "DarkBruiserBFG10K", 0.1
 DamageFactor "Cybers", 0.1
 DamageFactor "Hell", 0.1
 DamageFactor "Commander", 0.1
 DamageFactor "Baby15K", 0.1
 DamageFactor "Cyber10K", 0.1
 DamageFactor "DemolisherEx", 0.1
 DamageFactor "DarkDemoEx", 0.1
 DamageFactor "CerChainguns", 0.1
 DamageFactor "CerEnergyBall", 0.1
 DamageFactor "LegMind", 0.1
 DamageFactor "BeheComet", 0.1
 DamageFactor "UBDTR", 0.1
 DamageFactor "NobleComet", 0.1
 DamageFactor "CacoComet", 0.1
 DamageFactor "SoulToxic", 0.1
 DamageFactor "Cacolich", 0.1
 DamageFactor "CadaverRocket", 0.1
 DamageFactor "HellComet", 0.1
 DamageFactor "HFCyber", 0.1
 DamageFactor "DBFG2", 0.1
 DamageFactor "DBFG10K2", 0.1
 DamageFactor "DBFGSplash2", 0.1
 damagefactor "Terminator", 0.01
 damagefactor "T3rm", 0.01
 damagefactor "Term", 0.1
 dropitem "LegendaryRune", 128
 DropItem "LDemonAmmoBox" 200 
 DropItem "LDemonAmmoBox" 200 
 DropItem "LDemonAmmo" 250 
 DropItem "LDemonAmmo" 250 
 dropitem "LegendaryRevolver", 48
 dropitem "LegendaryAssaultShotgun", 48
 dropitem "LegendaryCoachgun", 48
 dropitem "LegendaryLightMachineGun", 48
 dropitem "LegendaryPlasmaticCannon", 48
 dropitem "LegendaryPlasmaticRifle", 48
 dropitem "LegendaryBFG10K", 48
 dropitem "LegendaryBFG", 24
 dropitem "LegendaryBossLifeEssence", 256
 dropitem "LegendaryLifeEssence", 256
 dropitem "LegendaryBossArmorBonusMax", 256
 dropitem "LegendaryArmorBonusMax", 256
 var int user_music;
 var int user_loopnuke;
 seesound ""
 States
 {
  Spawn:
	KALI A 0
	TNT1 A 0 A_JumpIf(user_script == 1,4)
	TNT1 A 0 ACS_NamedExecuteAlways("SpawnFireOnActor",0,19)
	TNT1 A 0 A_SetUserVar("user_script",1)
	TNT1 A 0 A_SetUserVar("user_script_type",19)
	TNT1 A 0 ACS_NamedExecuteAlways("WimpyMode",0,2)
	TNT1 A 0 ACS_NamedExecuteAlways("ModifyMonster",0,2)
	TNT1 A 0 A_SetInvulnerable
	TNT1 A 0 A_ChangeFlag("NODAMAGE",1)
	TNT1 A 0 A_ChangeFlag("NOPAIN",1)
	KALI AABCDDDDDDDDCBAAAAAAEFG 5 A_LookEX(LOF_FULLVOLSEESOUND,0,0,0,360,"See")
  IdleMore:
	KALI H 10 A_LookEX(LOF_FULLVOLSEESOUND,0,0,0,360,"See")
	Loop
  Remove:
	TNT1 A 0 A_SpawnItemEx("Demon",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION)
	TNT1 A 0 A_ChangeFlag("COUNTKILL", FALSE)
	TNT1 A 0
	Stop
  See:
	TNT1 A 0 A_PlaySound("touhou/sight",7,1.0,0,ATTN_NONE)
	TNT1 A 0 A_UnSetInvulnerable
	TNT1 A 0 A_ChangeFlag("NODAMAGE",0)
	TNT1 A 0 A_ChangeFlag("NOPAIN",0)
  See2:
  	TNT1 A 0 A_JumpIf(user_music == 1,3)
	TNT1 A 0 ACS_NamedExecuteAlways("CFMusic",0,814)
	TNT1 A 0 A_SetUserVar("user_music",1)
    TNT1 A 0 A_SetUserVar("user_delay",0)
  SeeAnim1:
	TNT1 A 0 A_JumpIf(user_delay >= 15,"SeeAnim2")
  	KAGI A 0 A_Jump(2,"BOUNCEPAD")
    KALI A 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim2:
 	TNT1 A 0 A_JumpIf(user_delay >= 20,"SeeAnim3")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KALI B 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim3:
 	TNT1 A 0 A_JumpIf(user_delay >= 25,"SeeAnim4")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KALI C 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim4:
 	TNT1 A 0 A_JumpIf(user_delay >= 65,"SeeAnim5")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KALI D 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim5:
 	TNT1 A 0 A_JumpIf(user_delay >= 70,"SeeAnim6")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KALI C 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  SeeAnim6:
 	TNT1 A 0 A_JumpIf(user_delay >= 75,"See")
 	KAGI B 0 A_Jump(2,"BOUNCEPAD")
    KALI B 1 A_Chase
	TNT1 A 0 A_SetUserVar("user_delay",user_delay+1)
	loop
  BOUNCEPAD:
	TNT1 A 0 A_SetUserVar("user_delay",0)
	KALJ ABC 3
	KALJ D 3 A_GiveInventory("KaguyaJump",1)
	KALJ EF 3
  CheckForFloor:
	TNT1 A 0 A_JumpIf(user_delay >= 60,"Land")
    TNT1 A 0 A_SetUserVar("user_delay",user_delay+6)
	KALJ GGGHHH 1 A_CheckFloor("Land")
    Loop
  Land:	
	KALJ IJ 2 A_Stop
	Goto See2
  Pain:
    KALP A 5 A_Pain
    Goto See2
  Melee:
    KALM ABC 2 A_FaceTarget
	KALM D 3 A_CustomMeleeAttack(random(150,200),"touhou/kaguya/melee","touhou/kaguya/meleemiss","Touhou")
	KALM EFG 2 A_FaceTarget
    MYST A 0 A_Jump(256,"Missile")
	Goto See2
  Missile:
	TNT1 A 0 A_Jump(4,"OhShit")
    MYST A 0 A_facetarget
	MYST A 0 A_Jump(256,"Attack1", "Attack2","Attack3","Attack4","Attack5")
    Goto See2
  Attack1:
	KAL1 A 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku6",30,0,-50)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku5",30,0,-40)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku4",30,0,-30)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku3",30,0,-20)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku2",30,0,-10)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku1",30,0,0)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku2",30,0,10)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku3",30,0,20)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku4",30,0,30)
	KAL1 B 0 A_CustomMissile("KaguyaDanmaku5",30,0,40)
	KAL1 B 3 A_CustomMissile("KaguyaDanmaku6",30,0,50)
	KAL1 CDE 3 A_FaceTarget
	TNT1 A 0 A_Jump(192,"Attack1")
	Goto See2
  Attack2:
	KALJ A 5 A_FaceTarget
	KAL2 ABABABABABABABABAB 3 A_FaceTarget
	KALJ A 3 A_FaceTarget
	TNT1 A 0 Bright A_Explode(768,768,0,0)
	TNT1 A 0 Bright A_PlaySound("touhou/rekt")
	TNT1 A 0 Bright A_SpawnItemEx("PurpleDevastatorShockWave2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION|SXF_CLIENTSIDE)
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,18,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,36,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,54,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,72,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,90,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,108,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,126,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,144,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,144,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,162,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,180,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,196,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,216,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,234,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,252,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,270,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,288,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,306,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,324,CMF_AIMDIRECTION,random(-90,90))
	TNT1 AAA 0 Bright A_CustomMissile("ZombieCommanderDevastatorBall2",30,0,342,CMF_AIMDIRECTION,random(-90,90))
	KAL2 CDE 5 A_FaceTarget
	Goto See2
  Attack3:
	KAL3 AB 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,10)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,20)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,30)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,40)
	KAL3 C 3 A_CustomMissile("LegendaryProjectile",30,0,50)
	KAL3 DED 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,-10)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,-20)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,-30)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,-40)
	KAL3 C 3 A_CustomMissile("LegendaryProjectile",30,0,-50)
	KAL3 B 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,10)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,20)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,30)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,40)
	KAL3 C 3 A_CustomMissile("LegendaryProjectile",30,0,50)
	KAL3 DED 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,-10)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,-20)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,-30)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,-40)
	KAL3 C 3 A_CustomMissile("LegendaryProjectile",30,0,-50)
	KAL3 B 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,0)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,10)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,20)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,30)
	KAL3 C 0 A_CustomMissile("LegendaryProjectile",30,0,40)
	KAL3 C 3 A_CustomMissile("LegendaryProjectile",30,0,50)
	KAL3 DEFG 3 A_FaceTarget
	Goto See2
  Attack4:
	KAL1 A 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-50)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-40)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,40)
	KAL1 B 3 A_CustomMissile("LegRevSmallBall3",30,0,50)
	KAL1 CDEA 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-50)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-40)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,40)
	KAL1 B 3 A_CustomMissile("LegRevSmallBall3",30,0,50)
	KAL1 CDEA 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-50)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-40)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,40)
	KAL1 B 3 A_CustomMissile("LegRevSmallBall3",30,0,50)
	KAL1 CDEA 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-50)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-40)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,40)
	KAL1 B 3 A_CustomMissile("LegRevSmallBall3",30,0,50)
	KAL1 CDEA 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-50)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-40)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,-10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,0)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,10)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,20)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,30)
	KAL1 B 0 A_CustomMissile("LegRevSmallBall3",30,0,40)
	KAL1 B 3 A_CustomMissile("LegRevSmallBall3",30,0,50)
	KAL1 CDE 3 A_FaceTarget
	Goto See2
  Attack5:
  	KAL3 AB 3 A_FaceTarget
	MYS2 O 0 A_Playsound("remishot",0)
	KAL3 C 3 A_CustomMissile("LegendaryProjectile",30,0,0)
	KAL3 DEFG 3 A_FaceTarget
	Goto See2
  OhShit:
	KALJ A 5 A_FaceTarget
	TNT1 A 0 A_PrintBold("\cgTAKE COVER!!!!!")
  OhShitLoop:
	TNT1 A 0 A_JumpIf(user_loopnuke == 10,"OhShitNuke")
	KAG2 CCC 0 A_SpawnItemEX("FakeLegCardinalThunder",10,0,0,0,0,0,random(0,360))
	KAL2 ABABABABABABABABABAB 1 A_FaceTarget
	TNT1 A 0 A_SetUserVar("user_loopnuke",user_loopnuke+1)
	loop
  OhShitNuke:
	KALJ A 3 A_FaceTarget
    TNT1 A 0 A_SpawnItem("LegendaryCardinalNuke")
    TNT1 A 0 A_Explode(8000,1642,0,1)
    TNT1 A 0 A_BFGSpray("ArcSpray",15,20)
    KAL2 C 3 
	TNT1 A 0 DamageThing(1000000)
	Goto See2
  Death:
	KALP C 70 A_PlaySound("uroboros/death",5,1.0,0,ATTN_NONE)
    MYST K 0 A_Scream
	TNT1 A 0 A_NoBlocking
	TNT1 AAA 0 A_SpawnItemEx("Red2huBossDeathFlame",0,0,20,random(-4,4),random(-4,4),random(0,3))
	TNT1 AAA 0 A_SpawnItemEx("Red2huBossDeathFlame3",0,0,20,random(-20,20),random(-20,20),random(0,20))
	TNT1 A 0 A_Explode(256,256,0)
	TNT1 AAA 0 A_CustomMissile("BigRedBloodCloud", random(10,80), 0, random(0,360), 2, random(0,360))
	TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("2huBossDeathFlame", Random(-8,8), Random(-8,8), Random(12,80), Random(8,38), 0, Random(3,43), Random(-180,180))
	TNT1 A 15
	stop
  }
}

Actor KaguyaJump : LegZombieStrafing
{
  +NOTIMEFREEZE
  States
  {
  Pickup:
    NULL A 0
    NULL A 0 A_CheckFloor(1)
    Stop
	NULL A 0 ThrustThing(random(0,360),random(2,15),3,0)
	NULL A 1 ThrustThingZ(0,80,0,1)
    Stop
  }
}

ACTOR KaguyaDanmaku1
{
	PROJECTILE
	Height 5
	Radius 5
	Speed 20
	Scale 1.5
	RenderStyle stencil
	stencilcolor "red"
	Decal "DoomImpScorch"
	Damage 15
	+FORCERADIUSDMG
	+NOTIMEFREEZE
	+THRUSPECIES
	+SEEKERMISSILE
	DamageType "Touhou"
	DeathSound "weapons/demontechex"
	Obituary "%o couldn't withstand Kaguya Houraisan's unrivaled beauty."
	var int user_looptime;
	States
	{
	Spawn:
		TNT1 A 0 A_SetUserVar("user_looptime",0)
	TakeFlight:
		TNT1 A 0 A_JumpIf(user_looptime == 360,"Death")
		BAL1 A 1 bright A_SpawnItemEX("KaguyaDanmaku1Tracer",0,0,0,0,0,0,0,SXF_CLIENTSIDE)
		TNT1 A 0 A_SetUserVar("user_looptime",user_looptime+1)
		loop
	Death:
		TNT1 A 0 A_SpawnItem("RedProjExplodeLarge")
		TNT1 AAAAAAAAA 0 A_SpawnItemEx("RedProjParticleSuperLarge",0,0,0,frandom(-4,4),frandom(-4,4),frandom(-4,4),random(0,359))
		MISL B 8 bright A_Explode(5,100,1)
		MISL C 6 bright
		MISL D 4 bright
		Stop
	}
}

actor KaguyaDanmaku2 : KaguyaDanmaku1
{
	stencilcolor "orange"
	States
	{
	Spawn:
		TNT1 A 0 A_SetUserVar("user_looptime",0)
	TakeFlight:
		TNT1 A 0 A_JumpIf(user_looptime == 360,"Death")
		BAL1 A 1 bright A_SpawnItemEX("KaguyaDanmaku2Tracer",0,0,0,0,0,0,0,SXF_CLIENTSIDE)
		TNT1 A 0 A_SetUserVar("user_looptime",user_looptime+1)
		loop
	Death:
		TNT1 A 0 A_SpawnItem("OrangeProjExplodeLarge")
		TNT1 AAAAAAAAA 0 A_SpawnItemEx("OrangeProjParticleSuperLarge",0,0,0,frandom(-4,4),frandom(-4,4),frandom(-4,4),random(0,359))
		MISL B 8 bright A_Explode(5,100,1)
		MISL C 6 bright
		MISL D 4 bright
		Stop
	}
}

actor KaguyaDanmaku3 : KaguyaDanmaku1
{
	stencilcolor "yellow"
	States
	{
	Spawn:
		TNT1 A 0 A_SetUserVar("user_looptime",0)
	TakeFlight:
		TNT1 A 0 A_JumpIf(user_looptime == 360,"Death")
		BAL1 A 1 bright A_SpawnItemEX("KaguyaDanmaku3Tracer",0,0,0,0,0,0,0,SXF_CLIENTSIDE)
		TNT1 A 0 A_SetUserVar("user_looptime",user_looptime+1)
		loop
	Death:
		TNT1 A 0 A_SpawnItem("YellowProjExplodeLarge")
		TNT1 AAAAAAAAA 0 A_SpawnItemEx("YellowProjParticleSuperLarge",0,0,0,frandom(-4,4),frandom(-4,4),frandom(-4,4),random(0,359))
		MISL B 8 bright A_Explode(5,100,1)
		MISL C 6 bright
		MISL D 4 bright
		Stop
	}
}

actor KaguyaDanmaku4 : KaguyaDanmaku1
{
	stencilcolor "green"
	States
	{
	Spawn:
		TNT1 A 0 A_SetUserVar("user_looptime",0)
	TakeFlight:
		TNT1 A 0 A_JumpIf(user_looptime == 360,"Death")
		BAL1 A 1 bright A_SpawnItemEX("KaguyaDanmaku4Tracer",0,0,0,0,0,0,0,SXF_CLIENTSIDE)
		TNT1 A 0 A_SetUserVar("user_looptime",user_looptime+1)
		loop
	Death:
		TNT1 A 0 A_SpawnItem("GreenProjExplodeLarge")
		TNT1 AAAAAAAAA 0 A_SpawnItemEx("GreenProjParticleSuperLarge",0,0,0,frandom(-4,4),frandom(-4,4),frandom(-4,4),random(0,359))
		MISL B 8 bright A_Explode(5,100,1)
		MISL C 6 bright
		MISL D 4 bright
		Stop
	}
}

actor KaguyaDanmaku5 : KaguyaDanmaku1
{
	stencilcolor "blue"
	States
	{
	Spawn:
		TNT1 A 0 A_SetUserVar("user_looptime",0)
	TakeFlight:
		TNT1 A 0 A_JumpIf(user_looptime == 360,"Death")
		BAL1 A 1 bright A_SpawnItemEX("KaguyaDanmaku5Tracer",0,0,0,0,0,0,0,SXF_CLIENTSIDE)
		TNT1 A 0 A_SetUserVar("user_looptime",user_looptime+1)
		loop
	Death:
		TNT1 A 0 A_SpawnItem("BlueProjExplodeLarge")
		TNT1 AAAAAAAAA 0 A_SpawnItemEx("BlueProjParticleSuperLarge",0,0,0,frandom(-4,4),frandom(-4,4),frandom(-4,4),random(0,359))
		MISL B 8 bright A_Explode(5,100,1)
		MISL C 6 bright
		MISL D 4 bright
		Stop
	}
}

actor KaguyaDanmaku6 : KaguyaDanmaku1
{
	stencilcolor "purple"
	States
	{
	Spawn:
		TNT1 A 0 A_SetUserVar("user_looptime",0)
	TakeFlight:
		TNT1 A 0 A_JumpIf(user_looptime == 360,"Death")
		BAL1 A 1 bright A_SpawnItemEX("KaguyaDanmaku6Tracer",0,0,0,0,0,0,0,SXF_CLIENTSIDE)
		TNT1 A 0 A_SetUserVar("user_looptime",user_looptime+1)
		loop
	Death:
		TNT1 A 0 A_SpawnItem("PurpleProjExplodeLarge")
		TNT1 AAAAAAAAA 0 A_SpawnItemEx("PurpleProjParticleSuperLarge",0,0,0,frandom(-4,4),frandom(-4,4),frandom(-4,4),random(0,359))
		MISL B 8 bright A_Explode(5,100,1)
		MISL C 6 bright
		MISL D 4 bright
		Stop
	}
}

ACTOR KaguyaDanmaku1Tracer : BFG9500Trail
{
	Scale 1.5
	RenderStyle stencil
	stencilcolor "red"
	+NOTIMEFREEZE
	States
	{
	Spawn:
		BAL1 AAAAAAAAAA 1 Bright A_Fadeout(0.1,0)
		stop
	}
}

ACTOR KaguyaDanmaku2Tracer : KaguyaDanmaku1Tracer {	stencilcolor "orange" }
ACTOR KaguyaDanmaku3Tracer : KaguyaDanmaku1Tracer {	stencilcolor "yellow" }
ACTOR KaguyaDanmaku4Tracer : KaguyaDanmaku1Tracer {	stencilcolor "green" }
ACTOR KaguyaDanmaku5Tracer : KaguyaDanmaku1Tracer {	stencilcolor "blue" }
ACTOR KaguyaDanmaku6Tracer : KaguyaDanmaku1Tracer {	stencilcolor "purple" }
