actor DrillBombBoss : BaseMM8BDMWep_CBM
{
dropitem "DrillBombWepCDropped"
Weapon.AmmoUse 0
Weapon.AmmoGive 18
Weapon.SlotNumber 5
Obituary "$OB_DRILLBOMB"
Inventory.Pickupmessage "Power up! Drill Bomb"
weapon.ammotype "DrillBombClassAmmo"
weapon.ammotype2 "DrillBombClassAmmo"
States
{
Spawn:
C_04 C 1
loop
Ready:
DRIA A 0 ACS_ExecuteAlways(998,0,782)
DRIA A 0 A_TakeInventory("DrillingFlag",1)
DRIA B 0 A_JumpIfInventory("DrillBombClassAmmo",17,"Ready2")
DRIA B 0 A_JumpIfInventory("DigLimit",200,"Ready3a")
DRIA B 3 A_WeaponReady(12)
DRIA B 0 A_GiveInventory("DrillBombClassAmmo",1)
DRIA B 0 A_GiveInventory("DigLimit",6)
Goto Ready+2
Ready2:
DRIA C 0 A_JumpIfInventory("DigLimit",200,"Ready4")
DRIA C 3 A_WeaponReady(12)
DRIA C 0 A_GiveInventory("DrillBombClassAmmo",1)
DRIA C 0 A_GiveInventory("DigLimit",6)
Ready2a:
DRIA A 0 A_JumpIfInventory("DigLimit",200,"Ready4a")
DRIA A 3 A_WeaponReady(8)
DRIA A 0 A_GiveInventory("DigLimit",6)
loop
Ready3a:
DRIA B 0 A_JumpIfInventory("DrillBombClassAmmo",17,"Ready4")
DRIA B 3 A_WeaponReady(4)
DRIA B 0 A_GiveInventory("DrillBombClassAmmo",1)
goto Ready3a
Ready4:
DRIA C 3 A_WeaponReady(4)
DRIA C 0 A_GiveInventory("DrillBombClassAmmo",1)
Ready4a:
DRIA A 1 A_WeaponReady
loop

Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
DRIA A 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
DRIA A 1 A_Raise
Loop
Fire:
DRIA A 0 A_JumpIfInventory("DrillBombClassAmmo",1,"Fire2")
DRIA B 2
DRIA B 2 A_ClearRefire
DRIA B 4
goto Ready+2
Fire2:
DRIA A 0 //A_PlaySoundEx("weapon/mbuster","Weapon")
DRIA A 0 A_TakeInventory("DrillBombClassAmmo",2)
DRIA A 0 A_GiveInventory("DrillmanMain_CI",1)
DRIA BBBCCCAAA 2 A_GiveInventory("DigLimit",1)
DRIA A 0 A_Refire
DRIA B 3 A_GiveInventory("DigLimit",1)
DRIA B 0 A_ClearRefire
DRIA BB 3 A_GiveInventory("DigLimit",1)
Goto Ready+2

AltFire:
DRIA B 0 A_JumpIfInventory("DigLimitDelay",100,"AirE2")
DRIA B 1 A_JumpIfInventory("DigLimit",200,1)
Goto Ready+2
DRIA B 0 A_GiveInventory("JumpCanclerDisable",1)
DRIA B 0 A_GiveInventory("DrillingFlag",1)
DRIA B 0 ThrustThingZ(0,50,0,0)
DRIA B 0 A_TakeInventory("JumpCancler",2)
DRIA B 1 A_SpawnItemEx("DrillDigCrush",0,0,66,0,0,10)
DRIA B 0 A_JumpIf(momz<=0,1)
goto AltFire+5
DRIA B 0 A_SpawnItemEx("DrillDigCrush",0,0,-10,0,0,-10)
DRIA B 0 A_GiveInventory("DigLimitDelay",1)
DRIA B 0 A_JumpIfInventory("DigLimitDelay",100,"AirE")
DRIA B 2 A_JumpIf(z-floorz==0,"DigStart") //The Ground and Air check
Goto Altfire+8
AirE:
DRIA B 0 A_WeaponReady(6)
DRIA B 0 A_SpawnItemEx("DrillDigCrush",0,0,-10,0,0,-10)
DRIA B 1 A_JumpIf(z-floorz==0,"DigStart")
loop
AirE2:
DRIA B 0 A_TakeInventory("DrillingFlag",999)
DRIA B 0 A_TakeInventory("DigLimitDelay",999)
DRIA B 0 A_PlayWeaponSound("S3_K/MetalSpark")
DRIA BC 3
goto Ready+2
DigStart:
DRIA A 0 A_TakeInventory("DigLimit",20)
DRIA A 0 A_SpawnItemEx("DrillDigCrushFX",0,0,0,0,0,0,0,1)
DRIA AAAAAAAAAAAA 0 A_SpawnItemEx("DrillRocks",0,0,8,random(-30,30),0,random(3,14),random(0,359),1)
Goto Dig
Dig:
DRIA A 0 A_GiveInventory("IsInvunFlag",1)
DRIA A 0 A_GiveInventory("DrillingFlag2",1)
DRIA A 0 A_SpawnItemEx("DrillVisualHelper")
DRIA A 0 A_TakeInventory("UnSolid",1)
DRIA A 0 A_ChangeFlag("SOLID",0)
DRIA A 0 A_ChangeFlag("INVULNERABLE",1)
DRIA A 0 A_ChangeFlag("PICKUP",0)
DRIA A 0 A_ChangeFlag("FLOORHUGGER",1)
DRIA A 0 A_SetTranslucent(0.0,0)
DRIA A 0 A_Stop
DRIA A 0 ThrustThingZ(0,40,1,0)
DRIA A 0 ACS_ExecuteAlways(191,0,15)
DRIA A 0 ACS_ExecuteAlways(648,0,1)
DRIA A 0 A_Stop
DRIA A 0 A_TakeInventory("DrillingFlag",99)
DRIA A 0 A_TakeInventory("DigLimitDelay",999)
goto AltHold
AltHold:
TNT1 A 0 A_TakeInventory("DigLimit",5)
TNT1 A 2 A_PlayWeaponSound("classes/drilling")
TNT1 A 1 ThrustThingZ(0,0,1,0)//Fix running over fans/bubbles
TNT1 A 0 A_JumpIfInventory("DigLimit",100,"KeepDiggin")
TNT1 A 0 A_JumpIfInventory("DigLimit",1,"KeepDiggin2")
goto DigRelease
KeepDiggin2:
TNT1 AA 0 A_SpawnItemEx("DrillRocks",0,0,8,random(-10,10),0,random(2,12),random(0,359),1)
KeepDiggin:
TNT1 A 1 A_ReFire
goto DigRelease
DigRelease:
DRIA A 0 A_SpawnItemEx("DrillDigCrushFX",0,0,0,0,0,0,0,1)
DRIA AAAAAAAAAAAAAAAAAA 0 A_SpawnItemEx("DrillRocks",0,0,8,random(-20,20),0,random(10,30),random(0,359),1)
//DRIA A 0 A_TakeInventory("DrillingFlag",1)
DRIA A 0 A_TakeInventory("DrillingFlag2",99)
DRIA A 0 A_TakeInventory("DigLimit",100)//999
DRIA A 0 A_ClearRefire
DRIA A 0 //A_Stop
//DRIA A 0 SetPlayerProperty(0,1,0)
DRIA A 0 A_SetTranslucent(1.0,0)
DRIA A 0 A_FireCustomMissile("DrillDamager",0,0,0)
DRIA A 0 A_PlayWeaponSound("classes/drillout")
DRIA A 0 A_ChangeFlag("FLOORHUGGER",0)
DRIA A 0 A_ChangeFlag("PICKUP",1)
DRIA A 0 ACS_ExecuteAlways(648,0,3)
DRIA B 0 ThrustThingZ(0,70,0,0)//60
DRIA B 0 A_ChangeFlag("THRUACTORS",1)
DRIA BB 1 A_FireCustomMissile("DrillDamagerX",0,0,0)
DRIA BBBB 2 A_FireCustomMissile("DrillDamager",0,0,0)
//DRIA B 0 SetPlayerProperty(0,0,0)
DRIA B 0 A_ChangeFlag("INVULNERABLE",0)
DRIA B 0 A_ChangeFlag("THRUACTORS",0)
DRIA B 0 A_SpawnItemEx("ReSolidifier")
DRIA B 0 A_TakeInventory("IsInvunFlag",9)
DRIA B 0 A_TakeInventory("JumpCanclerDisable",1)
DRIA B 0 A_JumpIfInventory("DrillBombClassAmmo",17,"DigRelease2")
DRIA BC 6
Goto Ready+2
DigRelease2:
DRIA B 6
Goto Ready2
}
}

actor DrillBombClassAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 18
+INVENTORY.IGNORESKILL
}

actor DrillingFlag : OnceC{}
actor DrillingFlag2 : OnceC{}

actor DigLimit : Inventory
{
inventory.amount 1
inventory.maxamount 200
}

actor DigLimitDelay : Inventory
{
inventory.amount 1
inventory.maxamount 100
}

actor DMDrillBomb : DrillBomb
{
Translation "192:192=4:4", "198:198=227:227", "202:202=210:210"
States
{
Spawn:
DRIA R 0
DRIA R 0 A_PlaySoundEx("weapon/drillfly","Weapon")
DRIA RST 2 //A_SpawnItemEx("DMDrillBombFX2",0,0,0,0,0,0,0,1)
loop
Death:
TNT1 A 0 A_Stop
TNT1 A 0 A_PlaySoundEx("classes/drillexplode", "Weapon")
TNT1 A 0 A_Explode(30,96,0,0,8)
TN_B EFGHIJKLMNOPQRS 2
stop
}
}

actor DMDrillBombFX : BasicClientSide
{
Scale 3.0
States
{
Spawn:
DRIA MNOPQ 5
stop
}
}

actor DMDrillBombFX2 : BasicClientSide
{
Scale 2.0
States
{
Spawn:
TNT1 A 1
DRIA MNOPQ 2
stop
}
}

actor DMDrillBombB : DMDrillBomb{translation "192:192=205:205", "198:198=74:74", "202:202=205:205"}
actor DMDrillBombR : DMDrillBomb{translation "192:192=171:171", "198:198=41:41", "202:202=171:171"}
actor DMDrillBombO : DMDrillBomb{translation "192:192=104:104", "198:198=128:128", "202:202=104:104"}
actor DMDrillBombP : DMDrillBomb{translation "192:192=229:229", "198:198=232:232", "202:202=229:229"}

actor DrillDigCrush
{
PROJECTILE
+DONTBLAST
damage (4)
Radius 15
Height 2
Obituary "$OB_DRILLDIG"
damagetype "ClassPainLess2"
renderstyle none
States
{
Spawn:
TNT1 A 1
stop
}
}

actor DrillDigCrushFX : BasicHelper
{
ReactionTime 4
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,1,3,5)
TNT1 A 0 A_SpawnItemEx("DMDrillBombFX",random(0,36),0,random(0,16),0,0,0,random(0,359),1)
TNT1 A 3 A_CountDown
TNT1 A 0 A_SpawnItemEx("DMDrillBombFX",random(0,30),0,random(20,36),0,0,0,random(0,359),1)
TNT1 A 3 A_CountDown
TNT1 A 0 A_SpawnItemEx("DMDrillBombFX",random(0,24),0,random(40,56),0,0,0,random(0,359),1)
TNT1 A 3 A_CountDown
goto Spawn+2
}
}


actor DrillDamager : BasicExplosion
{
Damagetype "ClassPainSemi"
Obituary "$OB_DRILLDIG"
States
{
Spawn:
TNT1 A 0
TNT1 A 11 A_Explode(6,72,0,0,72)
stop
}
}

actor DrillDamagerX : DrillDamager
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(3,72,0,0,72)
stop
}
}

actor DrillRocks
{
+DONTBLAST
+MISSILE
-NOGRAVITY
+RIPPER
+THRUACTORS
+CLIENTSIDEONLY
+FLOORCLIP
//+NOCLIP
Damage (0)
Height 5
Radius 5
Speed 30
Scale 2.5
States
{
Spawn:
DRIA U 0
DRIA U 30
stop
}
}

actor DrillVisualHelper : BasicHelper
{
ReactionTime 200 //Backup
States
{
Spawn:
TNT1 A 0
TNT1 A 1
goto Spawn2
Spawn2:
TNT1 A 1 A_JumpIfInTargetInventory("DrillingFlag2",1,1)
goto Death
TNT1 A 1 A_GiveToTarget("DrillVisualSpawner",1)
TNT1 A 0
TNT1 A 0 A_CountDown
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"Death")
loop
}
}

actor DrillVisualSpawner : CustomInventory
{
States
{
Pickup:
TNT1 A 0
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(143,0)==-1,"Spawn2")
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(143,0)==0,"Blue")
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(143,0)==1,"Red")
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(143,0)==2,"Orange")
TNT1 A 0 A_JumpIf(ACS_ExecuteWithResult(143,0)==3,"Purple")
Spawn2:
TNT1 A 1
stop
Blue://60
TNT1 A 0 A_SpawnItemEx("DrillVisualB",0,0,48,momx,momy,momz,0,9,0)
stop
Red:
TNT1 A 0 A_SpawnItemEx("DrillVisualR",0,0,48,momx,momy,momz,0,9,0)
stop
Orange:
TNT1 A 0 A_SpawnItemEx("DrillVisualO",0,0,48,momx,momy,momz,0,9,0)
stop
Purple:
TNT1 A 0 A_SpawnItemEx("DrillVisualP",0,0,48,momx,momy,momz,0,9,0)
stop
}
}

actor DrillVisualB : CloakVisualB
{
states
{
Spawn:
DRIM N 0
DRIM N 1
stop
}
}

actor DrillVisualR : CloakVisualR{states{Spawn:DRIM N 0
DRIM N 1
stop}}
actor DrillVisualO : CloakVisualO{states{Spawn:DRIM N 0
DRIM N 1
stop}}
actor DrillVisualP : CloakVisualP{states{Spawn:DRIM N 0
DRIM N 1
stop}}


actor DrillmanMain_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("DMDrillBomb",0,1,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("DMDrillBombB",0,1,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("DMDrillBombR",0,1,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("DMDrillBombO",0,1,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("DMDrillBombP",0,1,8,0)
goto Done
}
}

