actor CapsuleDamage 10627
{
//$Category MM8BDM-Bosses
//$Sprite AMMOA0
+SHOOTABLE
+NOBLOOD
Health 1000
States
{
Spawn:
TNT1 A 1
loop
Death:
TNT1 A 1 ACS_Execute(37,0)
stop
}
}

actor WilyCapsuleBoss
{
+NOGRAVITY
-SHOOTABLE
+NOBLOOD
+LOOKALLAROUND
scale 2.5
Height 32
radius 40
Obituary "%o was blasted by Dr. Wily."
States
{
Spawn:
TNT1 A 1 A_Look
loop
See:
WCAP ABCDE 3
WCAP F 30
WCAP G 0 A_PlaySoundEx("misc/terraclick","Weapon",0,1)
WCAP GHIKIKIKHLMNOP 2
WCAP H 1
wait
Teleport:
TNT1 A 0 A_GiveToTarget("ScreenFlash",1)
TNT1 A 140 Thing_Remove(1133)
TNT1 A 1 Teleport_NoFog(random(101,132),0,0)
TNT1 A 0 A_SpawnItemEx("WilyCapsuleSpawn")
WCAP ABXYZH 3
WCAP H 6
WCAP IKIKIK 2
WCAP H 6
Goto Attack
Attack:
TNT1 A 0 A_FaceTarget
TNT1 A 0 A_SpawnItemEx("RandomCapsuleProjectile1")
TNT1 A 0 A_SpawnItemEx("RandomCapsuleProjectile2")
TNT1 A 0 A_SpawnItemEx("RandomCapsuleProjectile3")
TNT1 A 0 A_SpawnItemEx("RandomCapsuleProjectile4")
WCAP Q 12
WCAP Q 6 A_Jump(64, "Teleport")
WCP2 ABABABABABAB 1
WCP2 A 0 A_FaceTarget
WCP2 A 0 A_SpawnItemEx("WilyCapsuleLitFX",0,67,0)
WCP2 A 0 A_SpawnItemEx("WilyCapsuleLitFX",0,-67,0)
WCP2 A 0 A_PlaySoundEx("weapon/thunderbolt","Weapon",0,1)
WCP2 ABABAB 1 
WCAP RSTUVUVHWW 2
WCAP Q 0 A_PlaySoundEx("weapon/junkshield","Voice",0,1)
WCAP Q 0 A_SpawnItemEx("WilyCapsuleGroundSplit",0,0,0,0,0,-50)
WCAP Q 24
Goto Teleport
}
}

actor WilyCapsuleDead 
{
	states
	{
	Spawn:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEx("FakeDeathFX")
	TNT1 A 0 A_SpawnItemEx("WilyGrovel3")
	stop
	}
}

actor WilyGrovel3
{
scale 2.5
States
{
Spawn:
WILG A 1 A_JumpIf(floorz-z==0,"Beg")
loop
Beg:
WILG BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC 7
WILG B 50
DecoyReveal:
WILG OPOQ 5
loop
}
}


actor WilyCapsuleGroundSplit
{
PROJECTILE
Speed 50
scale 2.5
States
{
Spawn:
WCPJ J 2
SpawnLoop:
WCPJ KLP 2
loop
Death:
WCPJ KLP 2
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,215)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,270)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,225)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,180)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,135)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,90)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,45)
WCPJ J 1 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,0)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,338)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,293)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,248)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,203)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,158)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,113)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,68)
WCPJ K 1 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,20,0,0,23)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,215)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,270)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,225)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,180)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,135)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,90)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,45)
WCPJ L 1 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,0)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,338)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,293)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,248)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,203)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,158)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,113)
WCPJ J 0 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,68)
WCPJ J 1 A_SpawnItemEx("WilyCapsuleGroundLit",0,0,0,50,0,0,23)
WCPJ J 0
stop
}
}

actor WilyCapsuleGroundLit
{
PROJECTILE
Height 32
scale 2.5
Radius 32
+FLOORHUGGER
+RIPPER
damagetype "WilyGroundLightning"
Damage (6)
Speed 50
States
{
Spawn:
WCPJ MNON 2
loop
}
}

actor WilyCapsuleLitFX
{
PROJECTILE
+NOINTERACTION
scale 2.5
States
{
Spawn:
WCPJ QRSTPP 1
stop
}
}

actor RandomCapsuleProjectile1
{
PROJECTILE
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(85,"Lightning")
TNT1 A 0 A_Jump(85,"Ice")
Goto Fire
Lightning:
TNT1 A 0 A_SpawnItemEx("CapsuleLightning",0,0,0,0,20,20)
stop
Fire:
TNT1 A 0 A_SpawnItemEx("CapsuleFire",0,0,0,0,20,20)
stop
Ice:
TNT1 A 0 A_SpawnItemEx("CapsuleIce",0,0,0,0,20,20)
stop
}
}

actor RandomCapsuleProjectile2
{
PROJECTILE
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(85,"Lightning")
TNT1 A 0 A_Jump(85,"Ice")
Goto Fire
Lightning:
TNT1 A 0 A_SpawnItemEx("CapsuleLightning",0,0,0,0,20,-20)
stop
Fire:
TNT1 A 0 A_SpawnItemEx("CapsuleFire",0,0,0,0,20,-20)
stop
Ice:
TNT1 A 0 A_SpawnItemEx("CapsuleIce",0,0,0,0,20,-20)
stop
}
}

actor RandomCapsuleProjectile3
{
PROJECTILE
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(85,"Lightning")
TNT1 A 0 A_Jump(85,"Ice")
Goto Fire
Lightning:
TNT1 A 0 A_SpawnItemEx("CapsuleLightning",0,0,0,0,-20,20)
stop
Fire:
TNT1 A 0 A_SpawnItemEx("CapsuleFire",0,0,0,0,-20,20)
stop
Ice:
TNT1 A 0 A_SpawnItemEx("CapsuleIce",0,0,0,0,-20,20)
stop
}
}


actor RandomCapsuleProjectile4
{
PROJECTILE
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(85,"Lightning")
TNT1 A 0 A_Jump(85,"Ice")
Goto Fire
Lightning:
TNT1 A 0 A_SpawnItemEx("CapsuleLightning",0,0,0,0,-20,-20)
stop
Fire:
TNT1 A 0 A_SpawnItemEx("CapsuleFire",0,0,0,0,-20,-20)
stop
Ice:
TNT1 A 0 A_SpawnItemEx("CapsuleIce",0,0,0,0,-20,-20)
stop
}
}

actor CapsuleLightning
{
PROJECTILE
+HEXENBOUNCE
+RIPPER
Height 16
Radius 16
Scale 2.5
Speed 30
damagetype "WilyLightning"
+LOOKALLAROUND
Damage (12)
States
{
Spawn:
TNT1 A 0 
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
TNT1 A 0 A_ClearTarget
WCPJ DEF 3
WCPJ A 0 A_Stop
WCPJ DEF 3
WCPJ DEF 1 A_Look
See:
TNT1 A 0 A_FaceTarget
TNT1 A 0 //A_ClearTarget
TNT1 A 0 A_CustomMissile("CapsuleLightning2",0,0,0)
stop
}
}

actor CapsuleLightning2
{
PROJECTILE
+HEXENBOUNCE
Height 16
Radius 16
Scale 2.5
damagetype "WilyLightning"
Damage (12)
Speed 30
+LOOKALLAROUND
States
{
Spawn:
TNT1 A 0 
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
TNT1 A 0 A_ClearTarget
WCPJ DEF 3
WCPJ A 0 A_Stop
WCPJ DEF 3
WCPJ DEF 1 A_Look
See:
TNT1 A 0 A_FaceTarget
TNT1 A 0 //A_ClearTarget
TNT1 A 0 A_CustomMissile("CapsuleLightning3",0,0,random(-12,12),0,0)
stop
}
}

actor CapsuleLightning3
{
PROJECTILE
Height 16
Radius 16
Scale 2.5
damagetype "WilyLightning"
Damage (12)
Speed 35
States
{
Spawn:
TNT1 A 0 
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
TNT1 A 0 A_ClearTarget
WCPJ DEF 3
loop
}
}

actor CapsuleFire
{
PROJECTILE
+HEXENBOUNCE
+RIPPER
Height 16
Radius 16
Scale 2.5
Speed 30
+LOOKALLAROUND
Damage (8)
DamageType "WilyFire"
States
{
Spawn:
TNT1 A 0 
TNT1 A 0 A_ClearTarget
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
WCPJ ABC 3
WCPJ A 0 A_Stop
WCPJ ABC 3
WCPJ ABC 1 A_Look
See:
TNT1 A 0 A_FaceTarget
TNT1 A 0 //A_ClearTarget
TNT1 A 0 A_CustomMissile("CapsuleFire2",0,0,0)
stop
}
}

actor CapsuleFire2
{
PROJECTILE
+HEXENBOUNCE
Height 16
Radius 16
Scale 2.5
Damage (8)
Speed 30
+LOOKALLAROUND
DamageType "WilyFire"
States
{
Spawn:
TNT1 A 0 
TNT1 A 0 A_ClearTarget
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
WCPJ ABC 3
WCPJ A 0 A_Stop
WCPJ ABC 3
WCPJ ABC 1 A_Look
See:
TNT1 A 0 A_FaceTarget
TNT1 A 0// A_ClearTarget
TNT1 A 0 A_CustomMissile("CapsuleFire3",0,0,random(-12,12),0,0)
stop
}
}

actor CapsuleFire3
{
PROJECTILE
Height 16
Radius 16
Scale 2.5
Damage (8)
DamageType "WilyFire"
Speed 35
States
{
Spawn:
TNT1 A 0 
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
TNT1 A 0 A_ClearTarget
WCPJ ABC 3
loop
}
}


actor TestProjectiles
{
MONSTER
States
{
Spawn:
TNT1 A 32 A_SpawnItemEx("CapsuleFire3",0,0,20,20,0,0,180)
TNT1 A 32 A_SpawnItemEx("CapsuleIce3",0,0,20,20)
loop
}
}

actor CapsuleIce
{
PROJECTILE
+HEXENBOUNCE
+RIPPER
Height 16
Radius 16
Scale 2.5
Speed 30
+LOOKALLAROUND
Damage (6)
DamageType "WilyIce"
States
{
Spawn:
TNT1 A 0 
TNT1 A 0 A_ClearTarget
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
WCPJ GHI 3
WCPJ A 0 A_Stop
WCPJ GHI 3
WCPJ GHI 1 A_Look
See:
TNT1 A 0 A_FaceTarget
TNT1 A 0 //A_ClearTarget
TNT1 A 0 A_CustomMissile("CapsuleIce2",0,0,0)
stop
}
}

actor CapsuleIce2
{
PROJECTILE
+HEXENBOUNCE
Height 16
Radius 16
Scale 2.5
Damage (6)
Speed 30
+LOOKALLAROUND
DamageType "WilyIce"
States
{
Spawn:
TNT1 A 0 
TNT1 A 0 A_ClearTarget
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
WCPJ GHI 3
WCPJ A 0 A_Stop
WCPJ GHI 3
WCPJ GHI 1 A_Look
See:
TNT1 A 0 A_FaceTarget
TNT1 A 0// A_ClearTarget
TNT1 A 0 A_CustomMissile("CapsuleIce3",0,0,random(-12,12),0,0)
stop
}
}

actor CapsuleIce3
{
PROJECTILE
Height 16
Radius 16
Scale 2.5
Damage (6)
DamageType "WilyIce"
Speed 35
States
{
Spawn:
TNT1 A 0 
TNT1 A 0 A_ClearTarget
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
WCPJ GHI 3
loop
}
}

actor WilyCapsuleSpawn
{
+NOGRAVITY
scale 2.5
-SOLID
mass 99999999
damagefactor "WilyLightning", 0.0
damagefactor "WilyGroundLightning", 0.0
damagefactor "WilyFire", 0.0
damagefactor "WilyIce", 0.0
damagefactor "FreezeCrackerBit", 0.0
Health 999999
painchance 256
Height 30
radius 30
States
{
Spawn:
TNT1 A 0
TNT1 A 0 Thing_ChangeTID(0,1133)
TNT1 AAAA 2
TNT1 A 0 A_ChangeFlag("SHOOTABLE",1)
SpawnWait:
TNT1 A 1
wait
Pain:
TNT1 A 0 A_SpawnItemEx("PainFX", 0, 0, 35)
TNT1 A 1 ACS_ExecuteAlways(36,0)
Goto SpawnWait
Pain.WildCoil2:
TNT1 A 0 A_SpawnItemEx("PainFX", 0, 0, 35)
TNT1 A 0 A_ChangeFlag("SHOOTABLE",0)
TNT1 A 1
TNT1 A 9 ACS_ExecuteAlways(36,0,2)
TNT1 A 0 A_ChangeFlag("SHOOTABLE",1)
Goto SpawnWait
Pain.FreezeCracker:
TNT1 A 0 A_SpawnItemEx("PainFX", 0, 0, 35)
TNT1 A 1 ACS_ExecuteAlways(36,0,1)
Goto SpawnWait
Pain.ThunderBolt:
TNT1 A 0 A_SpawnItemEx("PainFX", 0, 0, 35)
TNT1 A 1 ACS_ExecuteAlways(36,0,1)
Goto SpawnWait
}
}