actor DrWily_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_2I"
dropitem "WaveBusterWep"
weapon.preferredskin "Base-Wily"
Weapon.AmmoUse 1
Weapon.AmmoGive 0
Obituary "$OB_WILYPAN"
weapon.ammotype "WahweeAmmo"
weapon.ammotype2 "WiltCapuleAmmo"
States
{
Spawn:
C_02 I 1
loop

Deselect:
WICH A 0
goto DeselectSwap
Select:
WICH A 0
goto SelectSwap

Ready:
WICH A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_DRWILYC,0,CBM_TCLR_DEFAULT)
WICH A 1 A_GunFlash("Flash",1)
goto Ready1
Ready1:
WICH A 0 A_JumpIfInventory("WahweeAmmo",2,"Ready2")
WICH A 5 A_WeaponReady(WRF_NOPRIMARY)
WICH A 0 A_GiveInventory("WiltCapuleAmmo",1)
WICH A 0 A_GiveInventory("WahweeAmmo",1)
loop
Ready2:
WICH A 5 A_WeaponReady
WICH A 0 A_GiveInventory("WiltCapuleAmmo",1)
WICH A 0 A_GiveInventory("WahweeAmmo",1)
loop

Fire:
WICH A 0 A_JumpIfInventory("DrWily_PanFlag",1,"FireReady")
WICH A 0 A_JumpIfInventory("WahweeAmmo",2,"Fire2")
goto NoAmmo
Fire2:
WICH B 3 A_GiveInventory("DrWily_Fire0_P")
WICH C 3
WICH A 3 OffSet(6,38)
WICH A 3 A_WeaponReady(14)
goto Ready1
FireReady:
WICH A 1 OffSet(18,92)A_TakeInventory("DrWily_PanFlag")
WICH A 1 OffSet(9,62)A_TakeInventory("DrWily_PanFlag")
goto Ready1

Altfire:
WICH A 0 A_JumpIfInventory("DrWily_PanFlag",1,"Altfire2")
WICH A 0 A_PlaySoundEx("B_Toad/Swipe","Weapon")
WICH F 1 OffSet(20,34)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH F 1 OffSet(35,46)A_GiveInventory("DrWily_Alt1_P")
WICH F 1 OffSet(51,57)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH F 1 OffSet(67,68)
WICH F 1 OffSet(83,79)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH G 1 OffSet(75,85)
WICH G 1 OffSet(91,98)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH G 1 OffSet(106,113)
WICH G 1 OffSet(120,130)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH G 1 OffSet(133,149)
WICH G 1 OffSet(145,170)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH G 1 OffSet(156,193)
TNT1 A 12 A_GiveInventory("DrWily_PanFlag",1)
TNT1 A 14 A_WeaponReady
goto FireReady
Altfire2:
WICH D 0 A_PlaySoundEx("B_Toad/Swipe","Weapon")
WICH D 1 OffSet(-50,60)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH D 1 OffSet(-72,45)A_GiveInventory("DrWily_Alt2_P")
WICH D 1 OffSet(-95,33)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH D 1 OffSet(-119,24)
WICH D 1 OffSet(-144,18)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH D 1 OffSet(-170,24)
WICH E 1 OffSet(-130,28)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH E 1 OffSet(-157,47)
WICH E 1 OffSet(-183,67)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH E 1 OffSet(-208,89)
WICH E 1 OffSet(-232,114)A_JumpIfInventory("PlayerPropertyRage",1,1)
WICH E 1 OffSet(-255,143)

TNT1 A 12 A_TakeInventory("DrWily_PanFlag")
TNT1 A 14 A_WeaponReady
goto FireReady

NoAmmo:
WICH A 0
Goto Ready1
Transform:
WICH A 0 A_GiveInventory("WilySkullSuit_Pickup",1)
WICH A 1
Loop
Flash:
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAA 2//50
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAA 2
TNT1 AAAAAAAAAAAAAAAAAAAAAAAAA 2
TNT1 AAAAAAAAAAAAA 2//26
TNT1 A 0 A_TakeInventory("WilyNoSuitWeakness",9)
TNT1 A 0 A_TakeInventory("GuardDownFlag",9)
TNT1 A 1
stop
}
}

actor WahweeAmmo : Ammo
{
Inventory.Amount 1
Inventory.MaxAmount 28
+INVENTORY.IGNORESKILL
}

actor WiltCapuleAmmo : Ammo
{
Inventory.Amount 1
Inventory.MaxAmount 28
+INVENTORY.IGNORESKILL
}

actor DrWily_PanFlag : Inventory
{
inventory.amount 1
inventory.maxamount 2
}
actor WilyNoFiredFlag : OnceC {}

actor DrWily_Fire0_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
TNT1 A 0 A_TakeInventory("WahweeAmmo",1,1)
TNT1 A 0 A_JumpIfInventory("WilyNoFiredFlag",1,3)
TNT1 A 0 A_GiveInventory("WilyNoFiredFlag",1)
TNT1 A 0 A_FireCustomMissile("WilyNoShot",0,0,8,0)
stop
TNT1 A 0 A_TakeInventory("WilyNoFiredFlag",1)
TNT1 A 0 A_FireCustomMissile("WilyNoShot2",0,0,8,0)
stop
}
}

actor DrWily_Alt1_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("WilyShotX",0,0,-8,0)
End:
TNT1 A 0 A_SpawnItemEx("WilyFryingPanBlock",cos(-pitch)*36,0,11+sin(-pitch)*36,0,0,0,0,32+512)
stop
}
}
actor DrWily_Alt2_P : DrWily_Alt1_P
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("WilyShotX",0,0,8,0)
goto End
}
}

actor WilySkullSuit_Pickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("DrWily_W2",1)

TNT1 A 0 A_TakeInventory("DrWily_W",1)
TNT1 A 0 A_TakeInventory("WiltCapuleAmmo",28)
TNT1 A 0 A_TakeInventory("WilySkullSuitItem",1)
TNT1 A 0 A_GiveInventory("WilyCapsuleItem",1)

TNT1 A 0 A_TakeInventory("GuardDownFlag",99)
TNT1 A 0 A_TakeInventory("WilyNoSuitWeakness",99)
stop
}
}

actor WilyCapsule_Pickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 //A_JumpIf(CallACS("core_checkmode",0)==2,"Death")
TNT1 A 0 ACS_NamedExecuteWithResult("core_flyplayer",0,2)
TNT1 A 0 A_GiveInventory("DrWily_W3",1)
TNT1 A 0 A_GiveInventory("DrWily_W4",1)

TNT1 A 0 A_TakeInventory("DrWily_W",1)
TNT1 A 0 A_TakeInventory("DrWily_W2",1)
TNT1 A 0 A_TakeInventory("WilyCapsuleItem",1)

TNT1 A 0 A_GiveInventory("WilySandalsItem",1)
TNT1 A 0 A_TakeInventory("WilyNoSuitWeakness",99)
stop
}
}

actor WilySandals_Pickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 ACS_NamedExecuteWithResult("core_flyplayer",0,0)
TNT1 A 0 A_GiveInventory("DrWily_W",1)

TNT1 A 0 A_TakeInventory("DrWily_W2",1)
TNT1 A 0 A_TakeInventory("DrWily_W3",1)
TNT1 A 0 A_TakeInventory("DrWily_W4",1)
TNT1 A 0 A_TakeInventory("WilySandalsItem",1)
TNT1 A 0 A_TakeInventory("WahweeAmmo",28)
TNT1 A 0 A_TakeInventory("WiltCapuleAmmo",28)
TNT1 A 0 A_TakeInventory("WilyCapsuleFlagDelay")
TNT1 A 0 A_GiveInventory("WilySkullSuitItem",1)

TNT1 A 0 A_GiveInventory("GuardDownFlag",1)
TNT1 A 0 A_GiveInventory("WilyNoSuitWeakness",1)
stop
}
}


actor WilySandalsItem : BasicClassItem
{
inventory.icon "WilyIcon"
inventory.pickupmessage "Picked up Ninja Wily Item."
Tag "Wily Capsule Escape"
states
{
Spawn:
WICH X 1
loop
UseCBM:
TNT1 A 0 A_TakeInventory("WilyCapsuleFlagDelay")
TNT1 A 1 A_GiveInventory("WilySandals_Pickup",1)
stop
}
}

actor WilyCapsuleItem : BasicClassItem
{
inventory.icon "CapIcon"
inventory.pickupmessage "Wily Capsule, only 7 payments of $19.95."
Tag "Wily Capsule Equip"
states
{
Spawn:
WICH Y 1
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("WiltCapuleAmmo",28,"Use2")
fail
Use2:
TNT1 A 1 A_GiveInventory("WilyCapsule_Pickup",1)
stop
}
}

actor WilySkullSuitItem : BasicClassItem
{
inventory.icon "SSIcon"
inventory.pickupmessage "Picked up Amazing Wily Armor!"
Tag "Wily Suit Equip"
states
{
Spawn:
WICH Z 1
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("WiltCapuleAmmo",28,"Use2")
fail
Use2:
TNT1 A 1 A_GiveInventory("WilySkullSuit_Pickup",1)
stop
}
}


actor DrWily_W2 : BaseMM8BDMWep_CBM
{
tag "$TAGC_2I2"
dropitem "WaveBusterWep"
weapon.preferredskin "SkullSuit-Wily"
Weapon.AmmoUse 1
Weapon.AmmoGive 0
Obituary "$OB_WILYSKULL"
weapon.ammotype "WahweeAmmo"
weapon.ammotype2 "WiltCapuleAmmo"
//+WEAPON.Alt_AMMO_OPTIONAL
States
{
Spawn:
C_02 I 1
loop

Deselect:
WICH H 0
goto DeselectSwap
Select:
WICH H 0
goto SelectSwap

Ready:
WICH H 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_DRWILYCSUIT,0,CBM_TCLR_DEFAULT)
WICH H 0 A_GunFlash("Flash",1)
Goto Ready2
Ready2:
WICH H 8 A_WeaponReady
WICH H 0 A_GiveInventory("WahweeAmmo",2)
loop

Fire:
WICH H 0 A_JumpIfInventory("WahweeAmmo",26,"Fire1")
WICH H 0 A_JumpIfInventory("WahweeAmmo",14,"Fire2")
WICH H 0 A_JumpIfInventory("WahweeAmmo",1,"Fire3")
WICH H 0 A_PlaySoundEx("weapon/mbuster","Weapon")
WICH H 0 A_FireCustomMissile("WilyShot4",0,0,8,0)
WICH JI 3
WICH H 2
WICH H 0 A_Refire
goto Ready2
Fire1:
WICH H 0 A_PlaySoundEx("weapon/wilyshot4","Weapon")
WICH H 0 A_FireCustomMissile("WilyShot1",0,0,8,0)
WICH H 0 A_TakeInventory("WahweeAmmo",2)
WICH H 0 A_TakeInventory("WahweeAmmo",2,1)
WICH JI 3
WICH H 6
WICH H 0 A_Refire
goto Ready2
Fire2:
WICH H 0 A_PlaySoundEx("weapon/wilyshot3","Weapon")
WICH H 0 A_FireCustomMissile("WilyShot2",0,0,8,0)
WICH H 0 A_TakeInventory("WahweeAmmo",1)
WICH H 0 A_TakeInventory("WahweeAmmo",1,1)
WICH JI 3
WICH H 4
WICH H 0 A_Refire
goto Ready2
Fire3:
WICH H 0 A_PlaySoundEx("weapon/wilyshot2","Weapon")
WICH H 0 A_FireCustomMissile("WilyShot3",0,0,8,0)
WICH H 0 A_TakeInventory("WahweeAmmo",1,1)
WICH JI 3
WICH H 2
WICH H 0 A_Refire
goto Ready2
AltFire:
WICH J 3 A_GiveInventory("DrWily_Fire0_P")
WICH I 3
WICH H 6
goto Ready2

/*Altfire:
WICH H 1 A_JumpIfInventory("WahweeAmmo", 1, "Fly")
Goto Ready
Fly:
WICH H 0 SetPlayerProperty(0,1,3)
WICH H 0 A_Recoil(-3)
WICH H 0 ThrustThingZ(0,1,0,1)
WICH H 0 A_PlaySoundEX("weapon/superboost","Weapon")
WICH H 0 A_SpawnItemEX("BoosterFX",0,-10,0,0,0,0,0,0)
WICH H 1 A_SpawnItemEX("BoosterFX",0,10,0,0,0,0,0,0))
WICH H 0 ThrustThingZ(0,1,0,1)
WICH H 0 A_PlaySoundEX("weapon/superboost","Weapon")
WICH H 0 A_SpawnItemEX("BoosterFX",0,-10,0,0,0,0,0,0)
WICH H 1 A_SpawnItemEX("BoosterFX",0,10,0,0,0,0,0,0))
WICH H 0 ThrustThingZ(0,1,0,1)
WICH H 0 A_PlaySoundEX("weapon/superboost","Weapon")
WICH H 0 A_SpawnItemEX("BoosterFX",0,-10,0,0,0,0,0,0)
WICH H 1 A_SpawnItemEX("BoosterFX",0,10,0,0,0,0,0,0))
WICH H 0 ThrustThingZ(0,1,0,1)
WICH H 0 A_PlaySoundEX("weapon/superboost","Weapon")
WICH H 0 A_SpawnItemEX("BoosterFX",0,-10,0,0,0,0,0,0)
WICH H 1 A_SpawnItemEX("BoosterFX",0,10,0,0,0,0,0,0))
WICH H 0 ThrustThingZ(0,1,0,1)
WICH H 0 A_PlaySoundEX("weapon/superboost","Weapon")
WICH H 0 A_SpawnItemEX("BoosterFX",0,-10,0,0,0,0,0,0)
WICH H 1 A_SpawnItemEX("BoosterFX",0,10,0,0,0,0,0,0))
WICH H 0 A_TakeInventory("WahweeAmmo", 1)
WICH H 0 A_Refire
Goto Ready*/

Flash:
TNT1 AAAAAAA 1
TNT1 A 1 A_RailWait
TNT1 AAAAAAA 1
TNT1 A 0 A_GiveInventory("WiltCapuleAmmo",1)
loop

NoAmmo:
WICH H 0
Goto Ready2
}
}


actor WilyBurnTimer : Inventory
{
inventory.amount 1
inventory.maxamount 60
}



actor WilyNoShot : ProjSpawnFuncActor
{
PROJECTILE
damagetype "DrWily_Wave"
Obituary "$OB_WILYSHOT"
//+DONTSEEKINVISIBLE//
//+SEEKERMISSILE
//+SCREENSEEKER
+BRIGHT
//ReactionTime 30
damage (120)
Radius 10
Height 10
speed 35
scale 3.0
States
{
Spawn://WaveBuster CopyWep sprites
TNT1 A 1
XH0C VV 1 A_Changevelocity(0,-3,0,1)
XH0C W 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C X 0 A_Changevelocity(0,18,0,1)
goto Spawn1
Spawn1:
XH0C XVW 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C XX 1 A_Changevelocity(0,-6,0,1)
XH0C V 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C VV 1 A_Changevelocity(0,-6,0,1)
XH0C WXV 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C WW 1 A_Changevelocity(0,6,0,1)
XH0C X 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C XX 1 A_Changevelocity(0,6,0,1)

XH0C VWX 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C VV 1 A_Changevelocity(0,-6,0,1)
XH0C W 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C WW 1 A_Changevelocity(0,-6,0,1)
XH0C XVW 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C XX 1 A_Changevelocity(0,6,0,1)
XH0C V 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C VV 1 A_Changevelocity(0,6,0,1)

XH0C WXV 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C WW 1 A_Changevelocity(0,-6,0,1)
XH0C X 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C XX 1 A_Changevelocity(0,-6,0,1)
XH0C VWX 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C VV 1 A_Changevelocity(0,6,0,1)
XH0C W 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C WW 1 A_Changevelocity(0,6,0,1)
loop
/*
Spawn2:
TNT1 A 1
XH0C V 2 A_SeekerMissile(2,10,3,50,6)
XH0C V 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C W 2 A_SeekerMissile(2,10,3,50,6)
XH0C W 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C X 2 A_SeekerMissile(2,10,3,50,6)
XH0C X 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C X 0 A_CountDown
Goto Spawn2+1
*/
Death:
TNT1 A 1
stop
}
}

actor WilyNoShot2 : WilyNoShot
{
States
{
Spawn:
TNT1 A 1
XH0C VV 1 A_Changevelocity(0,3,0,1)
XH0C W 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C X 0 A_Changevelocity(0,-18,0,1)
goto Spawn1
Spawn1:
XH0C XVW 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C XX 1 A_Changevelocity(0,6,0,1)
XH0C V 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C VV 1 A_Changevelocity(0,6,0,1)
XH0C WXV 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C WW 1 A_Changevelocity(0,-6,0,1)
XH0C X 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C XX 1 A_Changevelocity(0,-6,0,1)

XH0C VWX 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C VV 1 A_Changevelocity(0,6,0,1)
XH0C W 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C WW 1 A_Changevelocity(0,6,0,1)
XH0C XVW 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C XX 1 A_Changevelocity(0,-6,0,1)
XH0C V 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C VV 1 A_Changevelocity(0,-6,0,1)

XH0C WXV 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C WW 1 A_Changevelocity(0,6,0,1)
XH0C X 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C XX 1 A_Changevelocity(0,6,0,1)
XH0C VWX 2 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C VV 1 A_Changevelocity(0,-6,0,1)
XH0C W 0 A_SpawnItemEx("WilyNoShotFX",0,0,0,0,0,0,0,1)
XH0C WW 1 A_Changevelocity(0,-6,0,1)
loop
}
}

actor WilyNoShotFX : BasicGraphicEffect
{
+BRIGHT
scale 2.0
States
{
SpawnFrame:
TNT1 A 1
XH0C VWX 2
stop
}
}

actor WilyShot1 : ProjSpawnFuncActor
{
PROJECTILE
damagetype "DrWily_Suit"
Obituary "$OB_WILYSKULL"
+BRIGHT
Damage (240)
radius 28//40
height 28
Speed 26
scale 2.5//5
States
{
Spawn:
TNT1 A 0
TNT1 A 1
WISS ST 3
goto Spawn+2
}
}

actor WilyShot2 : WilyShot1
{
Damage (200)
radius 22
height 22
States
{
Spawn:
TNT1 A 0
TNT1 A 1
WISS UV 3
goto Spawn+2
}
}

actor WilyShot3 : WilyShot1
{
Damage (150)
radius 16
height 16
States
{
Spawn:
TNT1 A 0
TNT1 A 1
WISS WX 3
goto Spawn+2
}
}

actor WilyShot4 : WilyShot1
{
Damage (100)
radius 10
height 10
States
{
Spawn:
TNT1 A 0
TNT1 A 1
WISS YZ 3
goto Spawn+2
}
}

actor WilyFryingPanBlock : ProjSpawnFuncActor
{
-SOLID
+MISSILE
+DONTSPLASH
+DONTBLAST
+DONTDRAIN
+DONTREFLECT
+DONTRIP
+NOBLOOD
+NOCLIP
+NORADIUSDMG
//+GHOST
+SHOOTABLE
+NOTIMEFREEZE
+NOGRAVITY
+NOTARGETSWITCH
+NODAMAGE

Species "DumbWilyPan"

//PainSound "item/protoreflect"
RenderStyle "None"
bloodtype ""
damagefactor "Telefrag",0.0
painchance 256
health 99999

Damage 0
Height 42
Radius 25
Speed 0
scale 1.0

States
{
Spawn:
TNT1 A 0
TNT1 AAAAA 1 A_Warp(2,cos(-pitch)*36,0,11+sin(-pitch)*36,angle,2)
stop
Pain:
TNT1 A 0 //ACS_NamedExecuteWithResult("cbm_setpointer_clientside",AAPTR_TARGET,CallACS("core_gettarget"))
TNT1 A 0 A_ChangeFlag("NOPAIN",1)
TNT1 A 1 A_PlaySound("weapon/PanWall")//A_Pain
TNT1 A 1 A_SpawnItemEx("WilyFryingPanBlockFX",0,0,24,0,0,0,0,1)
stop
Death:
TNT1 A 0 //A_PlaySound("")
TNT1 A 1
stop
}
}

actor WilyFryingPanBlockFX : BasicGraphicEffect
{
+BRIGHT
Scale 1.0
States
{
SpawnFrame:
Q_2W QRSRQ 1
stop
}
}

actor WilyShotX : ProjSpawnFuncActorFast
{
Damagetype "DrWily_Pan"
Obituary "$OB_WILYPAN"
Species "DumbWilyPan"
+THRUSPECIES
+DONTSPLASH
+DONTBLAST
+BRIGHT
damage (330)
ReactionTime 1
Radius 14
Height 14
speed 125
scale 2.0
States
{
Spawn:
TNT1 A 1
//TNT1 A 0
//TNT1 A 0 A_CountDown
stop
Crash:
XDeath:
//TNT1 A 0 A_Stop
TNT1 A 0 A_Jump(256,1,3)
TNT1 A 0 A_PlaySound("weapon/PanHit1",2,0.81)
TNT1 A 1 A_PlaySound("weapon/PanHit1",1,0.81)
goto Death+3
TNT1 A 0 A_PlaySound("weapon/PanHit2",2,0.81)
TNT1 A 1 A_PlaySound("weapon/PanHit2",1,0.81)
goto Death+3
Death:
//TNT1 A 0 A_Stop
TNT1 A 0 A_PlaySound("weapon/PanWall",2,0.81)
TNT1 A 1 A_PlaySound("weapon/PanWall",1,0.81)
Q_2W UVWXWVU 1
stop
}
}


actor DrWily_W3 : BaseMM8BDMWep_CBM
{
tag "$TAGC_2I3"
dropitem "WaveBusterWep"
weapon.preferredskin "Capsule-Wily"
Weapon.AmmoUse 7
Weapon.AmmoGive 28
Obituary "$OB_WILYICE"
weapon.ammotype "WahweeAmmo"
weapon.ammotype2 "WiltCapuleAmmo"
inventory.icon "WilyICap"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_02 I 1
loop

Deselect:
WICH O 0
goto DeselectSwap
Select:
WICH O 0
goto SelectSwap

Ready:
WICH O 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_DRWILYCAPSULEI,0,CBM_TCLR_DEFAULT)
WICH O 0 A_GunFlash("Flash",1)
goto Ready1
Ready1:
WICH O 0 A_JumpIfInventory("WahweeAmmo",7,"Ready2")
WICH O 4 A_WeaponReady(WRF_NOFIRE)
WICH O 0 A_GiveInventory("WahweeAmmo",2)
loop
Ready2:
WICH O 0 A_JumpIfInventory("WahweeAmmo",14,"Ready3")
WICH O 4 A_WeaponReady(WRF_NOSECONDARY)
WICH O 0 A_GiveInventory("WahweeAmmo",2)
loop
Ready3:
WICH O 4 A_WeaponReady
WICH O 0 A_GiveInventory("WahweeAmmo",2)
loop

Fire:
WICH O 0 A_JumpIfNoAmmo("NoAmmo")
WICH P 8 A_GiveInventory("DrWilyIce_Fire1_P")
WICH O 27 A_GiveInventory("DrWilyIce_Fire2_P")
WICH O 0 A_Refire
goto Ready1
Altfire:
WICH O 0 A_JumpIfInventory("WahweeAmmo",14,"GroundSplit")
Goto Ready1
GroundSplit:
WICH Q 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
WICH Q 0 A_FireCustomMissile("WilyCapsuleGroundSplitX",0,1,0,1)
WICH Q 0 A_TakeInventory("WahweeAmmo",14,1)
WICH Q 1 A_SpawnItemEx("WilyCapsuleElecFX",0,50,30,0,0,0,0,1)
WICH Q 1 A_SpawnItemEx("WilyCapsuleElecFX",0,-50,30,0,0,0,0,1)
WICH Q 3
WICH O 25
WICH O 0 A_Refire
NoAmmo:
WICH O 0
Goto Ready1

Flash:
TNT1 A 0 A_JumpIfInventory("WiltCapuleAmmo",1,2)
TNT1 A 1 A_GiveInventory("WilySandals_Pickup",1)
stop
TNT1 A 1 A_GiveInventory("WilyCapsuleFlagDelay",1)
TNT1 A 0 A_JumpIfInventory("WilyCapsuleFlagDelay",16,5)
TNT1 A 0 A_JumpIfInventory("WilyCapsuleFlagDelay",9,"Flash")
TNT1 A 0 A_JumpIfInventory("WilyCapsuleFlagDelay",8,1)
loop
TNT1 A 0 A_TakeInventory("WiltCapuleAmmo",1,1)
TNT1 A 0 //A_TakeInventory("WilyCapsuleFlagDelay")
loop
TNT1 A 0 A_TakeInventory("WiltCapuleAmmo",1)
TNT1 A 0 A_TakeInventory("WilyCapsuleFlagDelay")
loop
}
}

actor WilyCapsuleFlagDelay : Inventory
{
Inventory.Amount 1
Inventory.MaxAmount 16
}

actor DrWilyIce_Fire1_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Weapon")
TNT1 A 0 A_FireCustomMissile("CapsuleIceX",20,1,70,0)
TNT1 A 0 A_FireCustomMissile("CapsuleIceX",-20,0,-70,0)
stop
}
}
actor DrWilyIce_Fire2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_FireCustomMissile("CapsuleIceX",0,0,40,0)
TNT1 A 0 A_FireCustomMissile("CapsuleIceX",0,0,-40,0)
stop
}
}

actor DrWily_W4 : DrWily_W3
{
tag "$TAGC_2I4"
dropitem "WaveBusterWep"
weapon.preferredskin "Capsule-Wily"
Weapon.AmmoUse 2
inventory.icon "WilyFCap"
States
{
Deselect:
WICH K 0
goto DeselectSwap
Select:
WICH K 0
goto SelectSwap

Ready:
WICH K 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_DRWILYCAPSULEF,0,CBM_TCLR_DEFAULT)
WICH K 0 A_GunFlash("Flash",1)
goto Ready1
Ready1:
WICH K 0 A_JumpIfInventory("WahweeAmmo",2,"Ready2")
WICH K 4 A_WeaponReady(WRF_NOFIRE)
WICH K 0 A_GiveInventory("WahweeAmmo",2)
loop
Ready2:
WICH K 0 A_JumpIfInventory("WahweeAmmo",14,"Ready3")
WICH K 4 A_WeaponReady(WRF_NOSECONDARY)
WICH K 0 A_GiveInventory("WahweeAmmo",2)
loop
Ready3:
WICH K 4 A_WeaponReady
WICH K 0 A_GiveInventory("WahweeAmmo",2)
loop

Fire:
WICH K 0 A_JumpIfNoAmmo("NoAmmo")
WICH K 0 A_PlaySoundEx("weapon/atomicfire","Weapon")
WICH K 0 A_FireCustomMissile("CapsuleFireB",random(-15,15),1,0,0)
WICH L 4
WICH K 0 A_Refire
goto Ready1
Altfire:
WICH K 0 A_JumpIfInventory("WahweeAmmo",14,"GroundSplit")
Goto Ready1
GroundSplit:
WICH K 0 A_PlaySoundEx("weapon/thunderbolt","Weapon")
WICH K 0 A_FireCustomMissile("WilyCapsuleGroundSplitX",0,1,0,1)
WICH K 0 A_TakeInventory("WahweeAmmo",14,1)
WICH M 1 A_SpawnItemEx("WilyCapsuleElecFX",0,50,30,0,0,0,0,1)
WICH M 1 A_SpawnItemEx("WilyCapsuleElecFX",0,-50,30,0,0,0,0,1)
WICH M 3
WICH K 25
WICH K 0 A_Refire
NoAmmo:
WICH K 0
Goto Ready1
}
}

actor RandomCapsuleProjectileX
{
PROJECTILE
Speed 50
States
{
Spawn:
TNT1 A 4
TNT1 A 0 A_Jump(85,"Lightning")
TNT1 A 0 A_Jump(85,"Ice")
Goto Fire
Lightning:
TNT1 A 0 A_CustomMissile("CapsuleLightningX")
stop
Fire:
TNT1 A 0 A_CustomMissile("CapsuleFireX")
stop
Ice:
TNT1 A 0 A_CustomMissile("CapsuleIceX")
stop
}
}

actor WilyCapsuleElecFX : BasicExplosion
{
States
{
Spawn:
TNT1 A 0
WISS PQR random(1,2)
stop
}
}

actor CapsuleLightningX : ProjSpawnFuncActor
{
damagetype "DrWily_Elec"
Obituary "$OB_WILYELEC"
PROJECTILE
+RIPPER
+SKYEXPLODE
+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
+CANBOUNCEWATER
+BRIGHT
BounceCount 8
BounceFactor 1.0
WallBounceFactor 1.0
Damage (120)
Height 16
Radius 16
Speed 30
Scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
TNT1 A 0 //A_ClearTarget
WISS DEF 3
goto Spawn+2
Death:
TNT1 A 0 A_SpawnItemEX("ElectrifyEffect")
stop
}
}

actor CapsuleLightningXX : CapsuleLightningX{BounceCount 5 Damage (8) Obituary "$OB_WILYELECX"}

actor CapsuleFireX : CapsuleLightningX
{
Obituary "$OB_WILYFIRE"
damagetype "DrWily_Fire"
-RIPPER
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundEx("weapon/wrapfire","Voice")
WISS ABC 3
goto Spawn+2
}
}

actor CapsuleFireB : ProjSpawnFuncActor
{
Obituary "$OB_WILYFIRE"
damagetype "DrWily_Fire"
PROJECTILE
+RIPPER
+BRIGHT
Damage (40)
radius 6
height 6
Speed 30
scale 2.5
states
{
Spawn:
WISS ABCABC 3
stop
Death:
TNT1 A 0
TNT1 A 1 A_SpawnItemEx("OilPitIgnite",0,0,8)
stop
}
}

actor PainDrWily_FireHit : Basic_PainTID_H
{
States
{
Check:
TNT1 A 0 A_JumpIf(CallACS("cbm_PoisonControl_acs",28,PSN_SET_TO,8)>0,"WilyBurn")
stop
WilyBurn:
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TRACER),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX1_P",1,AAPTR_TRACER)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX1_P",1,8)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX1_P",1,8)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX1_P",1,8)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX2_P",1,8)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX2_P",1,8)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX2_P",1,8)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX2_P",1,8)
TNT1 A 0 A_Warp(AAPTR_TRACER,0,0,28,0,WARPF_NOCHECKPOSITION)
TNT1 A 0 A_SpawnItemEX("WilyFireCollide")
TNT1 A 0 A_JumpIf(CallACS("cbm_PoisonControl_acs",28,PSN_ADJUST,-1)<=0,1)
loop
//Extra FX at end to match old style
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX1_P",1,8)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX1_P",1,8)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX1_P",1,8)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",8),"Death")
TNT1 A 1 A_GiveInventory("DrWily_FireFX1_P",1,8)
stop
}
}

actor WilyFireCollide : BasicImplosion
{
damagetype "DrWily_FireBurn"
Obituary "$OB_WILYFIRE"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(30+CallACS("core_checkrune",RUNE_SPREAD,2)*30,15,0,0,15)
stop
}
}


actor DrWily_FireFX1_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEX("WilyTackleFireFX1",0,0,12)
stop
}
}

actor DrWily_FireFX2_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEX("WilyTackleFireFX2",0,0,12)
stop
}
}

actor WilyTackleFireFX1 : BasicGraphicEffect
{
Translation "192:192=218:218","198:198=221:221"
+BRIGHT
RenderStyle "Translucent"
Alpha 0.5
scale 5.0
States
{
Spawn:
HOTH X 0
HOTH X 1
stop
}
}

actor WilyTackleFireFX2 : WilyTackleFireFX1
{
States
{
Spawn:
HOTH Y 0
HOTH Y 1
stop
}
}

actor CapsuleIceX : CapsuleLightningX
{
Obituary "$OB_WILYICE"
damagetype "DrWily_Ice"
-RIPPER
BounceCount 4
Damage (100)
states
{
Spawn:
TNT1 A 0
WISS GHI 3
goto Spawn+1
Death:
TNT1 A 0 A_SpawnItemEX("IcePitFreeze")
stop
}
}


actor WilyCapsuleGroundSplitX : ProjSpawnFuncActor
{
PROJECTILE
damagetype "DrWily_Elec"
Obituary "$OB_WILYELEC"
+RIPPER
-NOGRAVITY
+BRIGHT
Damage (50)
Radius 16
Height 16
Speed 0
scale 2.5
States
{
Spawn:
WISS J 0
WISS J 0 ThrustThingZ(0,1,0,1)
WISS JKL 1
goto Spawn+2
Death:
WISS J 0 A_SpawnItemEX("ElectrifyEffect")
WISS JKL 1
WISS J 0 A_SpawnItemEx("WilyCapsuleGroundLitX",0,0,0,20,0,0,0)
WISS J 0 A_SpawnItemEx("WilyCapsuleGroundLitX",0,0,0,20,0,0,90)
WISS J 0 A_SpawnItemEx("WilyCapsuleGroundLitX",0,0,0,20,0,0,180)
WISS J 0 A_SpawnItemEx("WilyCapsuleGroundLitX",0,0,0,20,0,0,270)
stop
}
}

actor WilyCapsuleGroundLitX : ProjSpawnFuncActor
{
PROJECTILE
damagetype "DrWily_Elec"
Obituary "$OB_WILYELEC"
+FLOORHUGGER
+RIPPER
+BRIGHT
Damage (60)
Radius 32
Height 32
Speed 50
scale 2.5
States
{
Spawn:
WISS MNON 2
loop
Death:
TNT1 A 0 A_SpawnItemEX("ElectrifyEffect")
stop
}
}

actor WilyNoSuitWeakness : BasePowerWeak
{
DamageFactor "Normal", 1.25
}


actor PowerDrWily_IceUnfreezeProtect : PowerProtection
{
Powerup.Duration 20
damagefactor "Normal", 0.5
}

actor DrWily_IceCamera_F : Inventory {}
actor IsFrozenByWily_F : Inventory {}
actor DrWily_IceDuration : Powerup
{
Powerup.Duration 60
}

actor DrWily_IceStart_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("EternalPainFlag",1)
TNT1 A 0 A_TakeInventory("SuperEffective",1)
TNT1 A 0 A_JumpIfInventory("DrWily_IceDuration",1,"Reset")
TNT1 A 0 A_SpawnItemEx("DrWily_IceWatcher_H")
TNT1 A 0 ACS_NamedExecuteWithResult("core_freezeplayer",0,1)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_DrWily_IceCameraLook")

Reset:
TNT1 A 0 A_GiveInventory("IceVision",1)//Core actor, blue tint and invun for 1200 duration
TNT1 A 0 A_GiveInventory("IsFrozenByWily_F",1)
TNT1 A 0 A_GiveInventory("DrWily_IceDuration",1)
stop
}
}

actor DrWily_IceWatcher_H : BasicWatcher
{//This watcher is to assist in instances when a class breaks out of the pain state
+SERVERSIDEONLY//Such as the Melee state happening
States
{
Spawn:
TNT1 A 0
//TNT1 A 1 A_GiveToTarget("WasFrozenTodayFX_P",1)
//TNT1 A 0 A_TakeFromTarget("EternalPainFlag",1)
Spawn1:
TNT1 A 0 A_GiveToTarget("WasFrozenTodayFX_P",1)
TNT1 A 1 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
TNT1 A 0 //A_JumpIfInTargetInventory("EternalPainFlag",1,"Spawn2")
TNT1 A 0 A_JumpIfInTargetInventory("DrWily_IceDuration",1,"Spawn")
goto Spawn2
Spawn2:
TNT1 A 0
TNT1 A 2 A_GiveToTarget("DrWily_IceEnd_P",1)
stop
}
}

actor DrWily_IceEnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("PowerDrWily_IceUnfreezeProtect",1)
TNT1 A 0 A_TakeInventory("IceVision")
TNT1 A 0 A_TakeInventory("DrWily_IceDuration")
TNT1 A 0 A_JumpIfInventory("IsFrozenByWily_F",1,2)
TNT1 A 0 A_TakeInventory("IsFrozenByWily_F")
stop
TNT1 A 0 A_TakeInventory("IsFrozenByWily_F")
TNT1 A 0 ACS_NamedExecuteWithResult("core_freezeplayer",0,0)
stop
}
}

actor WasFrozenTodayFX_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("WasFrozenTodayFX",0,0,36,0,0,0,0,32)
stop
}
}

actor WasFrozenTodayFX : BasicGraphicEffect
{
Translation "192:192=4:4", "198:198=69:69"
Alpha 0.5
scale 5.0
States
{
Spawn:
MRFA N 0
MRFA N 1
stop
}
}





actor DrWily_W_SecondBar : SecondBar {Args 4,91}//94
actor DrWily_W_ScriptBar : ScriptBar {}
actor DrWily_W2_SecondBar : SecondBar {Args 4,91}
actor DrWily_W2_ScriptBar : ScriptBar {}
actor DrWily_W3_SecondBar : SecondBar {Args 4,91}
actor DrWily_W3_ScriptBar : ScriptBar {}
actor DrWily_W4_SecondBar : SecondBar {Args 4,91}
actor DrWily_W4_ScriptBar : ScriptBar {}