actor SmallHealthC : CustomInventory replaces SmallHealth
{
inventory.pickupmessage "$PU_SMALLHEALTH"
+COUNTITEM
Scale 2.0
States
{
Spawn:
HBAL AB 6
loop
Pickup:
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(C_HEALTHACS,1),"HealMe")
TNT1 A 0 A_JumpIfInventory("IsAPirate",1,"Pirate")
fail
Pirate:
TNT1 A 0 A_GiveInventory("PirateTreasureStack",1)
TNT1 A 0 A_Jump(96,2)
TNT1 A 0 A_PlaySound("classes/Stolen4",3,1.0)
stop
TNT1 A 0 A_PlaySound("classes/Stolen5",3,1.0)
stop
HealMe:
TNT1 A 0 A_PlaySound("item/energyup",3,1.0)
TNT1 A 0 ACS_ExecuteAlways(C_HEALTHACS,0,3,15)
stop
}
}

actor BigHealthC : CustomInventory replaces BigHealth
{
inventory.pickupmessage "$PU_LARGEHEALTH"
+COUNTITEM
Scale 2.0
States
{
Spawn:
HBAL CD 6
loop
Pickup:
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(C_HEALTHACS,1),"HealMe")
TNT1 A 0 A_JumpIfInventory("IsAPirate",1,"Pirate")
fail
Pirate:
TNT1 A 0 A_GiveInventory("PirateTreasureStack",2)
TNT1 A 0 A_Jump(128,2)
TNT1 A 0 A_PlaySound("classes/Stolen2",3,1.0)
stop
TNT1 A 0 A_PlaySound("classes/Stolen3",3,1.0)
stop
HealMe:
TNT1 A 0 A_PlaySound("item/energyup",3,1.0)
TNT1 A 0 ACS_ExecuteAlways(C_HEALTHACS,0,3,40)
stop
}
}

actor WeaponEnergyC : CustomInventory replaces WeaponEnergy
{
inventory.pickupmessage "$PU_SMALLENERGY"
+COUNTITEM
Scale 2.0
States
{
Spawn:
EBAL A 0
EBAL A 0 Thing_ChangeTID(0,999)
EBAL AB 6
Goto Spawn+2
Pickup:
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(984,0),"Success")
TNT1 A 0 A_JumpIfInventory("IsAPirate",1,"Pirate")
fail
Pirate:
TNT1 A 0 A_GiveInventory("PirateTreasureStack",1)
TNT1 A 0 A_Jump(96,2)
TNT1 A 0 A_PlaySound("classes/Stolen4",3,1.0)
stop
TNT1 A 0 A_PlaySound("classes/Stolen5",3,1.0)
stop
Success:
TNT1 A 0 A_PlaySound("item/energyup",3,1.0)
TNT1 A 0 A_JumpIfInventory("RollFlag",1,"Success_R")
TNT1 A 0 A_JumpIfInventory("MegamanUpgradeFlag",1,"Success2")
TNT1 A 0 ACS_ExecuteAlways(992,0,30)
stop
Success2:
TNT1 A 0 ACS_ExecuteAlways(992,0,35)
stop
Success_R:
TNT1 A 0 A_GiveInventory("RollHealAmmo",4)
stop
}
}

actor BigWeaponEnergyC : CustomInventory replaces BigWeaponEnergy
{
inventory.pickupmessage "$PU_LARGEENERGY"
+COUNTITEM
Scale 2.0
States
{
Spawn:
EBAL C 0
EBAL C 0 Thing_ChangeTID(0,999)
EBAL CD 6 
Goto Spawn+2
Pickup:
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(984,0),"Success")
TNT1 A 0 A_JumpIfInventory("IsAPirate",1,"Pirate")
fail
Pirate:
TNT1 A 0 A_GiveInventory("PirateTreasureStack",2)
TNT1 A 0 A_Jump(128,2)
TNT1 A 0 A_PlaySound("classes/Stolen2",3,1.0)
stop
TNT1 A 0 A_PlaySound("classes/Stolen3",3,1.0)
stop
Success:
TNT1 A 0 A_PlaySound("item/energyup",3,1.0)
TNT1 A 0 A_JumpIfInventory("RollFlag",1,"Success_R")
TNT1 A 0 A_JumpIfInventory("MegamanUpgradeFlag",1,"Success2")
TNT1 A 0 ACS_ExecuteAlways(992,0,72)
stop
Success2:
TNT1 A 0 ACS_ExecuteAlways(992,0,86)
stop
Success_R:
TNT1 A 0 A_GiveInventory("RollHealAmmo",10)
stop
}
}

actor WilyBarrel1C : WilyBarrel1 replaces WilyBarrel1
{
Species "DumbBarrel"
+THRUSPECIES
}
actor WilyBarrel2C : WilyBarrel2 replaces WilyBarrel2
{
Species "DumbBarrel"
+THRUSPECIES
}

actor FirePillarC : FirePillar replaces FirePillar
{
states
{
Pain.MegaIceBall:
Pain.IceSlashSlow:
Pain.FreezeCrackerB:
Pain.IceWaveB:
Pain.IceWallB:Pain.IceWallS:
FIRP A 0
goto Pain.IceSlasher
}
}

actor JunkLavaPillarC : JunkLavaPillar replaces JunkLavaPillar
{
states
{
Pain.MegaIceBall:
Pain.IceSlashSlow:
Pain.FreezeCrackerB:
Pain.IceWaveB:
Pain.IceWallB:Pain.IceWallS:
TNT1 A 0
goto Pain.IceSlasher
}
}

actor PirateMineC : PirateMine replaces PirateMine
{
damagefactor "RockKick", 1.0
damagefactor "RollSwing", 1.0
damagefactor "RollSwing2", 1.0
damagefactor "PiratePush", 1.0
States
{
Pain.RockKick:
Pain.RollSwing:Pain.RollSwing2:
Pain.PiratePush:
PMIN A 0
goto Pain.WaveBurnerUW
}
}

actor OilCanisterC : OilCanister replaces OilCanister
{
states
{
Pain.AtomicfireB:
Pain.MegaFireBall:
Pain.Coal:
Pain.FlameBlastB:
Pain.ScorchWheelB:
Pain.FlameSwordB:Pain.FlameSwordSpark2:Pain.FlameSwordSpark3:
Pain.FlameBlastStage:
Pain.HSHFire:
OILP A 0
goto Pain.FireStorm
}
}

Actor OilBlobC : OilBlob replaces OilBlob
{
states
{
Pain.AtomicfireB:
Pain.MegaFireBall:
Pain.Coal:
Pain.FlameBlastB:
Pain.ScorchWheelB:
Pain.FlameSwordB:Pain.FlameSwordSpark2:Pain.FlameSwordSpark3:
Pain.FlameBlastStage:
Pain.HSHFire:
OILL E 0
goto Pain.FireStorm
}
}

actor MirrorBuster1C : MirrorBuster1 replaces MirrorBuster1
{
Species "MirrorBuster"
+THRUSPECIES
States
{
Pain.Plant:
Pain.MagPush:
Pain.MirrorBuster:
Pain.MirrorBuster1:
Pain.MirrorBuster2:
Pain.TopSpinB:
Pain.YamatoSpin:
Pain.BusterRodG:Pain.BusterRodGW:
Pain.ShadeDrain:
goto "MirrorBuster1::Pain.PharaohHold"
}
}

actor MirrorBuster2C : MirrorBuster2 replaces MirrorBuster2
{
Species "MirrorBuster"
+THRUSPECIES
States
{
Pain.Plant:
Pain.MagPush:
Pain.MirrorBuster:
Pain.MirrorBuster1:
Pain.MirrorBuster2:
Pain.YamatoSpin:
Pain.BusterRodG:Pain.BusterRodGW:
Pain.ShadeDrain:
goto "MirrorBuster1::Pain.PharaohHold"
}
}

actor OilFlameC : OilFlame replaces OilFlame
{
damagetype "FlameBlastStage"
}

actor FSSParkSpawnerC : FSSParkSpawner replaces FSSParkSpawner
{
states
{
Spawn:
TNT1 A 1 A_SpawnItemEx("FlameSwordSpark",Random(0,16),Random(-16, -8),8,random(50,55),random(-15,15),random(0,15),0, 1, 0)
TNT1 A 0 A_SpawnItemEx("FlameSwordSpark",Random(0,16),0,8,random(45,55),random(-15,15),random(-15,15),0, 1, 0)
TNT1 A 0 A_SpawnItemEx("FlameSwordSpark",Random(0,16),Random(8, 16),8,random(40,55),random(-15,15),random(0,15),0, 1, 0)
TNT1 A 0 A_CountDown
TNT1 A 1 A_SpawnItemEx("FlameSwordSpark2",Random(0,16),Random(-16, -8),8,random(50,55),random(-15,15),random(0,15),0, 1, 0)
TNT1 A 0 A_SpawnItemEx("FlameSwordSpark2",Random(0,16),0,8,random(45,55),random(-15,15),random(-15,15),0, 1, 0)
TNT1 A 0 A_SpawnItemEx("FlameSwordSpark2",Random(0,16),Random(8, 16),8,random(40,55),random(-15,15),random(0,15),0, 1, 0)
TNT1 A 0 A_CountDown
TNT1 A 1 A_SpawnItemEx("FlameSwordSpark3",Random(0,16),Random(-16, -8),8,random(50,55),random(-15,15),random(0,15),0, 1, 0)
TNT1 A 0 A_SpawnItemEx("FlameSwordSpark3",Random(0,16),0,8,random(45,55),random(-15,15),random(-15,15),0, 1, 0)
TNT1 A 0 A_SpawnItemEx("FlameSwordSpark3",Random(0,16),Random(8, 16),8,random(40,55),random(-15,15),random(0,15),0, 1, 0)
TNT1 A 0 A_CountDown
loop
}
}

actor FlameSwordSpark2 : FlameSwordSpark
{
damagetype "FlameSwordSpark2"
}

actor FlameSwordSpark3 : FlameSwordSpark
{
damagetype "FlameSwordSpark3"
}

actor MegaBallC : MegaBall replaces MegaBall
{
states
{
KickOrSpring:
MBAL C 0
MBAL C 1 A_GiveToTarget("BallActionC",1)
Goto Death
}
}

actor BallActionC : BallAction
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("MegaSlide",1,"KickTheBallSlide")
TNT1 A 0 A_JumpIfInventory("ProtoSlide",1,"KickTheBallSlide")
TNT1 A 0 A_JumpIfInventory("BassDash",1,"KickTheBallSlide")
TNT1 A 0 A_JumpIfInventory("DuoBash",1,"KickTheBallSlide")
goto "Super::Pickup"
KickTheBallSlide:
MBAL Q 0 A_FireCustomMissile("MegaBallKicked",0,0,0,0)
MBAL Q 0 A_TakeInventory("BallFlag",999)
stop
}
}

actor ThunderBeamC : ThunderBeam replaces ThunderBeam
{
-PIERCEARMOR
}

actor SparkShockC : SparkShock replaces SparkShock
{
-PIERCEARMOR
}

actor ThunderBoltC : ThunderBolt replaces ThunderBolt
{
-PIERCEARMOR
}

actor ThunderBoltSplitC : ThunderBoltSplit replaces ThunderBoltSplit
{
-PIERCEARMOR
}

actor ThunderClawC : ThunderClaw replaces ThunderClaw
{
-PIERCEARMOR
}

actor LightningBoltC : LightningBolt replaces LightningBolt
{
-PIERCEARMOR
}

actor LaserTridentC : LaserTrident replaces LaserTrident
{
-PIERCEARMOR
}

actor PlugBallC : PlugBall replaces PlugBall
{
-PIERCEARMOR
}


actor ThunderClawDamagerC : ThunderClawDamager replaces ThunderClawDamager
{
damagetype "ThunderClawT"
}

actor JunkProjectileC : JunkProjectile replaces JunkProjectile
{
damagetype "JunkShot"
}


actor MirrorShotSmallC : MirrorShotSmall replaces MirrorShotSmall
{
Species "MirrorBuster"
+THRUSPECIES
-THRUGHOST
}

actor MirrorShotMediumC : MirrorShotMedium replaces MirrorShotMedium
{
Species "MirrorBuster"
+THRUSPECIES
-THRUGHOST
}

actor MirrorShotLargeC : MirrorShotLarge replaces MirrorShotLarge
{
Species "MirrorBuster"
+THRUSPECIES
-THRUGHOST
}


actor CopyVisionBuffSpawner : CopyVisionSpawner
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("CopyVisionBuff",48,0,-32,0,0,0,0,0,0)
stop
}
}

actor CopyVisionBuff : CopyVision
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("RuneSpread",1,"SpawnSpread")
TNT1 A 0 A_PlaySoundEx("weapon/copyvision","weapon")
TNT1 A 0 ACS_ExecuteAlways(259,0,0)
COPY FGHI 2
Goto Shooting
SpawnSpread:
TNT1 A 0 A_GiveInventory("Once",1)
goto Spawn+2
Shooting:
COPY L 0 A_JumpIfInTargetInventory("CopyVisionRedirect",1,"Redirect")
COPY L 0 A_JumpIfInventory("Once",1,"ShootingSpread")
COPY L 0 A_CustomMissile("CopyShot",32,0,0,2,-pitch)
COPY LLLLLL 1 A_JumpIfInTargetInventory("CopyVisionRedirect",1,"Redirect")
COPY L 0 A_JumpIfInTargetInventory("IsDead",1,"Death")
COPY L 0 A_Countdown
Loop
ShootingSpread:
COPY L 0 A_CustomMissile("CopyShotSpread",32,0,0,2,-pitch)
goto Shooting+2
Redirect:
COPY LL 1 A_GiveToTarget("TargetMarker",1)
COPY L 0 ACS_ExecuteAlways(989,0,ACS_ExecuteWithResult(257)+100,32)
COPY L 0 A_TakeFromTarget("CopyVisionRedirect",9)
goto Shooting
}
}

actor ProtoMachineThingC : ProtoMachineThing replaces ProtoMachineThing
{
Health 6666
damagefactor "normal", 1.25
damagefactor "DynaTag", 100.0
damagefactor "MagicCardBF", 100.0
damagefactor "HomingSniper", 20.0
damagefactor "ProtoBuster", 25.0
states
{
Spawn:
GESP DEFG 4
loop
Pain.ProtoBuster:
GESP D 0
GESP D 0 A_PlaySoundEx("misc/devilpain","Voice",0,-1)
GESP DEFG 4
Goto Spawn
Death:
GESP D 0
GESP D 1 A_Stop
GESP GGGGGG 8 A_SpawnItemEx("FlashBombFX2",Random(-16, 16),Random(-40, 40), Random(90, 120),0,0,0,0)
GESP GGGGGGGGGGGG 4 A_SpawnItemEx("FlashBombFX2",Random(-16, 16),Random(-40, 40), Random(90, 120),0,0,0,0)
GESP GGGGGGGGGGGGGGGGGGGGGGGG 2 A_SpawnItemEx("FlashBombFX2",Random(-16, 16),Random(-40, 40), Random(90, 120),0,0,0,0)
TNT1 A 0 A_PlaySoundEx("misc/SearchSecret","Voice",0,1)
TNT1 A 0 ACS_ExecuteAlways(804,0,1)
TNT1 A 0 A_SpawnItemEx("TimeStopperWepCDropped",0,0,24,0,0,15)
TNT1 A 58 A_SpawnItemEx("SearchmanisEverywhere",0,0,70,5,5,20)
TNT1 A 0 ACS_ExecuteAlways(804,0,0)
TNT1 A 0 
stop
}
}

actor SearchmanisEverywhere 
{
-SOLID
height 16
radius 16
States
{
Spawn:
CSEA A 90
CSEA A 0 //A_Stop
CSEA A 1 A_ChangeFlag("NOINTERACTION",1)
Spawn2:
CSEA A 2 ThrustThingZ(0,1,0,1)//A_FadeOut(0.05)
CSEA A 0 A_GiveInventory("WeaponCharge",1)
CSEA A 0 A_JumpIfInventory("WeaponCharge",100,"Spawn3")//250
loop
Spawn3:
CSEA A 2 A_SpawnItemEx("SecretObituaryThomas",0,0,17777,0,0,-10)
CSEA A 20 A_FadeOut(0.05)
goto Spawn3+1
}
}


actor BonerManCreditsX
{
height 16
radius 16
Scale 4.0
States
{
Spawn:
CBON Y 1
loop
}
}

actor SecretObituaryThomas
{
+NOINTERACTION
Damagetype "Thomas"
Obituary "%o learned Thomas is everywhere!"
States
{
Spawn:
TNT1 A 0
TNT1 A 1000 A_SpawnItemEx("ThomasisEverywhere",0,0,0,0,0,-25)
TNT1 A 50
stop
}
}

actor ThomasisEverywhere
{
PROJECTILE
Translation "192:192=69:69", "198:198=74:74"
+RIPPER
+NOINTERACTION
+DONTBLAST
+THRUGHOST
+THRUACTORS
-NOGRAVITY
Damagetype "Thomas"
Obituary "%o suffered a heart attack from \cnThomas the Tank Engine\c-'s stare."
damage (1000)
height 64
radius 52
Scale 10//7.5
//Reactiontime 10
States
{
Spawn:
CHRM B 0
CHRM B 0 ThrustThingZ(0,10,1,1)
CHRM BBBCCCDDDEEE 1 A_JumpIf(ceilingz-z>64, "Spawn2")
CHRM B 0 A_JumpIf(momz==0,"Death")
CHRM B 0 A_SetAngle(angle+15)
Goto Spawn+1
Spawn2:
CHRM B 0 //A_ChangeFlag("RIPPER",0)
CHRM B 0 A_ChangeFlag("NOINTERACTION",0)
CHRM BBBCCCDDDEEE 1 A_SpawnItemEx("ThomasisEverywhereDamager")
CHRM B 0 A_JumpIf(momz==0,"Death")
CHRM B 0 A_SetAngle(angle+15)
Goto Spawn2+2
Death:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("SearchManCredits",1800,2856,0,0,0,0,0,2)//Penguin island
TNT1 A 0 A_SpawnItemEx("BonerManCreditsX",1750,2526,0,0,0,0,0,2)//Penguin island
TNT1 A 0 A_SpawnItemEx("ThomasisEverywhereScare",-300,-100,56,0,0,0,0,2)//Bubble lead by Search
TNT1 A 0 A_SpawnItemEx("ThomasisEverywhereScare",-900,-156,128,0,0,0,0,2)//Cliff south of west hole
TNT1 A 0 A_SpawnItemEx("ThomasisEverywhereScare",-450,1000,-128,0,0,0,0,2)//Underwater center
TNT1 A 0 A_SpawnItemEx("ThomasisEverywhereScare",450,950,64,0,0,0,0,2)//Penguin big window
TNT1 A 0 A_SpawnItemEx("ThomasisEverywhereScare",264,800,-64,0,0,0,0,2)//underwater big window
TNT1 A 0 A_SpawnItemEx("ThomasisEverywhereScare",50,1626,32,0,0,0,0,2)//Penguin small window
TNT1 A 0 A_SpawnItemEx("ThomasisEverywhereScare",-1111,1000,128,0,0,0,0,2)//West hole above
TNT1 A 0 A_SpawnItemEx("ThomasisEverywhereScare",-450,1000,128,0,0,0,0,2)//Center hole above
TNT1 A 0 A_SpawnItemEx("ThomasisEverywhereScare",-940,1050,-256,0,0,0,0,2)//West hole under
TNT1 A 0 A_Explode(25,320,0,0,320)
TNT1 AAA 8 A_PlaySoundEx("misc/mm3explosion","Weapon",0,1)
stop
}
}

actor ThomasisEverywhereDamager : ThomasisEverywhere
{
-NOINTERACTION
-THRUACTORS
+NOGRAVITY
States
{
Spawn:
TNT1 A 1
stop
}
}

actor ThomasisEverywhereScare// : BasicExplosion
{
+DONTBLAST
+NOGRAVITY
+MISSILE
+RIPPER
+THRUGHOST
+THRUACTORS
+SKYEXPLODE
+DONTSPLASH
+DONTREFLECT
height 1
radius 1
-SOLID
Damage 0
+NOCLIP
Damagetype "Thomas"
Obituary "%o learned Thomas is everywhere!"
Scale 8.0
States
{
Spawn:
TNT1 A 0
ASEX A 0 A_Explode(8,9000,0,0,9000)
ASEX ABCDEF 2
stop
}
}