actor Hornetman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_9F"
dropitem "HornetChaserWep"
Weapon.AmmoUse 2
Weapon.AmmoGive 28
Obituary "$OB_HORNETCHASER"
Inventory.Pickupmessage "NOT THE BEES"
weapon.ammotype "NotTheHornetsAmmo"
weapon.ammotype2 "HornetHoverAmmo"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_09 F 1
loop

Deselect:
HORH A 0
goto DeselectSwap
Select:
HORH A 0 A_TakeInventory("BeeFlag1")
HORH A 0 A_TakeInventory("BeeFlag2")
goto SelectSwap

Ready:
HORH A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_HORNETMAN,0,CBM_TCLR_DEFAULT)
HORH A 0 A_GunFlash("Flash",1)
Goto Ready1
Ready1:
HORH A 0 A_JumpIfInventory("NotTheHornetsAmmo",6,"Ready2")
HORH A 8 A_WeaponReady(WRF_NOPRIMARY)
HORH A 0 A_GiveInventory("NotTheHornetsAmmo",1)
loop
Ready2:
HORH A 8 A_WeaponReady
HORH A 0 A_GiveInventory("NotTheHornetsAmmo",1)
loop

Fire:
HORH A 3 Offset(24,52)A_TakeInventory("BeeFlag1")
HORH A 3 Offset(46,75)
HORH A 0 A_PlaySoundEx("weapon/hornetchaser","Weapon")
HORH A 0 A_FireCustomMissile("HornetChaserB",24,1,0,0)
HORH A 3 Offset(46,75)
HORH A 0 A_FireCustomMissile("HornetChaserB",0,1,0,0)
HORH A 3 Offset(46,75)
HORH A 0 A_FireCustomMissile("HornetChaserB",-24,1,8,0)
HORH A 6 Offset(46,75)
goto FireHold+1

FireHold:
HORH A 0 Offset(46,75)A_GiveInventory("NotTheHornetsAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
HORH A 1 A_GiveInventory("CBM_TargetMarker")
HORH A 0 A_Refire(1)
goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker")
HORH A 0 A_Refire(1)
goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire(1)goto FireEnd
HORH A 1 A_GiveInventory("CBM_TargetMarker") HORH A 0 A_Refire("FireHold")goto FireEnd//18 tics


FireEnd:
HORH A 3 Offset(46,75)A_GiveInventory("BeeFlag1",1)
HORH A 3 Offset(24,52)
Goto Ready1
AltFire:
HORH A 0 A_JumpIfInventory("BeeFlag1",1,"AltfireBee")
HORH A 0 A_PlaySoundEx("item/ItemUseAA","Weapon")
HORH A 0 A_FireCustomMissile("HornetNectarHive",0,0,0,0)
HORH B 4 Offset(24,52)
HORH BB 4 Offset(46,75)
HORH A 4 Offset(24,52)A_GiveInventory("NotTheHornetsAmmo",1)
HORH A 4 A_WeaponReady(14)
HORH A 6
HORH A 4 A_GiveInventory("NotTheHornetsAmmo",1)
Goto Ready1
AltfireBee:
HORH A 0 A_GiveInventory("BeeFlag2",1)
HORH A 2 Offset(24,52)
HORH C 2 Offset(24,52)A_PlaySoundEx("weapon/hornetcommand","Weapon")
HORH C 2 Offset(22,50)
HORH C 2 Offset(24,52)
HORH C 2 Offset(22,50)
HORH C 2 Offset(24,52)
HORH C 2 Offset(22,50)
HORH C 2 Offset(24,52)
HORH A 2 A_WeaponReady(14)
HORH A 2 A_TakeInventory("BeeFlag1")
HORH A 0 A_TakeInventory("BeeFlag2")
Goto Ready1

Flash:
TNT1 A 1 A_GiveInventory("HornetmanFlashState_P")
TNT1 A 1 A_GiveInventory("HornetmanFlashState_P2")
loop
}
}

actor NotTheHornetsAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 28
+INVENTORY.IGNORESKILL
}

actor HornetHoverAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 336
+INVENTORY.IGNORESKILL
}

actor BeeFlag1 : Inventory{}
actor BeeFlag2 : Inventory{}

actor HornetHoverFlag : Inventory{}
actor HornetWasThrusted : Inventory{}

actor HornetHoverSoundDelay : Powerup
{
Powerup.Duration 11
}

actor HornetHoverItem : BasicClassItem
{
inventory.pickupmessage "AGH, I'M FULL OF BEES!"
inventory.icon "HornIcon"
Tag "Hornet Hover Toggle"
states
{
Spawn:
HORH I 1
loop
UseCBM:
TNT1 A 0 A_PlaySoundEx("item/ItemUseMM9","SoundSlot7")
TNT1 A 0 A_JumpIfInventory("HornetHoverFlag",1,"Take")
TNT1 A 0 A_GiveInventory("HornetHoverFlag",1)
fail
Take:
TNT1 A 0 A_TakeInventory("HornetHoverFlag")
fail
}
}

actor HornetmanFlashState_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("HornetWasThrusted",1,"PickupAir")
TNT1 A 0 A_JumpIfInventory("PlayerPropertyGrounded",1,"GiveAmmo")
TNT1 A 0 A_JumpIfInventory("HornetHoverAmmo",1,"HoverCheck")
goto GiveAmmo
HoverCheck:
TNT1 A 0 A_JumpIfInventory("HornetHoverFlag",1,"HoverCheckFalling")
goto GiveAmmo
HoverCheckFalling:
TNT1 A 0 A_JumpIf(momz<0 && CallACS("cbm_GetPointerButtonInput",0,true) & BT_JUMP,"Hover")
goto GiveAmmo

GiveAmmo:
TNT1 A 0 A_GiveInventory("HornetHoverAmmo",2+CallACS("core_checkrune",RUNE_RAGE)*2)
goto ResetSpeed

ResetSpeed:
TNT1 A 0 A_TakeInventory("CBM_185_SpeedPower")
stop

Hover:
TNT1 A 0 A_TakeInventory("HornetHoverAmmo",1)
TNT1 A 0 A_GiveInventory("CBM_IsHovering",1)
TNT1 A 0 A_GiveInventory("HornetWasThrusted",1)
TNT1 A 0 ThrustThingZ(0,0,1,0)//3

TNT1 A 0 A_JumpIfInventory("HornetHoverSoundDelay",1,3)
TNT1 A 0 A_PlaySoundEx("weapon/hornetfly","Body")
TNT1 A 0 A_GiveInventory("HornetHoverSoundDelay",1)
TNT1 A 0 A_GiveInventory("CBM_185_SpeedPowerGiver",1)
stop

FoundGround:
TNT1 A 0 A_TakeInventory("HornetWasThrusted",1)
goto Pickup+2

PickupAir:
TNT1 A 0 A_JumpIf(z-floorz<=0,"FoundGround")
TNT1 A 0 A_JumpIfInventory("PlayerPropertyGrounded",1,"TakeHover")
TNT1 A 0 A_JumpIfInventory("HornetHoverAmmo",1,"HoverCheck2")
goto TakeHover
HoverCheck2:
TNT1 A 0 A_JumpIfInventory("HornetHoverFlag",1,"HoverCheckFalling2")
goto TakeHover
HoverCheckFalling2:
TNT1 A 0 A_JumpIf(momz<0 && CallACS("cbm_GetPointerButtonInput",0,true) & BT_JUMP,"Hover")
goto TakeHover

TakeHover:
TNT1 A 0 A_TakeInventory("CBM_IsHovering",1)
goto ResetSpeed
}
}
actor HornetmanFlashState_P2 : HornetmanFlashState_P
{
States
{
Hover:
TNT1 A 0 A_TakeInventory("HornetHoverAmmo",1,1)
goto HornetmanFlashState_P::Hover+1
}
}

actor HornetChaserB : ProjSpawnFuncActor
{
var int user_translateLikePlayer;
var int user_H;
Translation "192:192=248:248","198:198=220:220"
species "BeeStuff"
PROJECTILE
damagetype "HornetM_Shot"
Obituary "$OB_HORNETCHASER"
+DONTSEEKINVISIBLE//
+SEEKERMISSILE
+THRUSPECIES
//+SCREENSEEKER
+DONTREFLECT
reactiontime 10
damage (90-user_H)
Radius 16
Height 16
speed 20//25
scale 2.5
Args 20
States
{
Spawn:
HORH S 0
HORH S 0 A_JumpIfInTargetInventory("PlayerPropertyRage",1,3)
HORH STST 1
HORH S 0 A_Stop
HORH S 0 A_GiveInventory("ReSyncPickup",1)
Check:
HORH S 0 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET)
HORH ST 1 A_JumpIfInTargetInventory("BeeFlag1",1,"Cont")
HORH S 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
loop
Cont:

HORH S 0 ACS_NamedExecuteWithResult("core_aimattargetcursor",CallACS("core_gettarget")+PLN_TARGETPOINT_OFFSET)
HORH S 0 //ACS_NamedExecuteWithResult("cbm_CopyPointerAnglePitch",2,1)
HORH S 1 A_ChangeVelocity(Cos(pitch)*25,0,-sin(pitch)*25,CVF_RELATIVE)
HORH S 0 A_GiveInventory("ReSyncPickup",1)
Spawn3:

HORH TS 1 A_JumpIfInTargetInventory("BeeFlag2",1,"Home")
loop
Home:
HORH Q 0 A_RearrangePointers(0,0,1)
HORH Q 0 A_GiveInventory("ReSyncPickup",1)
HORH QRST 1 A_Stop
HORH Q 0 A_GiveInventory("ReSyncPickup",1)
HORH QRST 1 A_Stop
HORH QQQQQ 0 A_SeekerMissile(2,10,3,128,8)
HORH Q 1
HORH Q 0 A_JumpIfInventory("MM8BDMPlayer",1,"Spawn3",AAPTR_TRACER)
HORH Q 0 A_ChangeVelocity(Cos(pitch)*9, 0, -sin(pitch)*9,CVF_RELATIVE)
HORH Q 0 A_GiveInventory("ReSyncPickup",1)
HORH Q 0
goto Spawn2
Spawn2:
HORH QR 1
loop
Spawn3:
HORH Q 0 A_SetUserVar("user_H",20)
HORH QRQRQRQRQRQRQRQRQR 1 A_SeekerMissile(3,15,SMF_PRECISE)
//   QRQRQRQRQRQRQRQRQRQRQR 1 A_SeekerMissile(3,15,SMF_PRECISE)
HORH Q 0
goto Spawn2
Death:
TNT1 A 1 A_SpawnItemEx("HornetM_ChaserFX")
stop
}
}

actor HornetM_ChaserFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
States
{
SpawnFrame:
NMFX ABCD 1
stop
}
}



actor HornetM_Slow_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("CoolestIceSlow",1,2)
TNT1 A 0 A_SpawnItemEx("HornetM_Slow_H")
TNT1 A 0 A_GiveInventory("CoolestIceSlowGiver",1)
stop
}
}

actor HornetM_Slow_H : BasicWatcher
{
States
{
Spawn:
TNT1 A 0 
TNT1 A 3 A_GiveToTarget("HornetM_SlowFX_P",1)
TNT1 A 0 A_JumpIfInTargetInventory("CoolestIceSlow",1,"Spawn")
stop
}
}

actor HornetM_SlowFX_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("HornetM_SlowFX",random(18,56),0,Random(18,56),0,0,0,random(0,71)*5,0)
stop
}
}

actor HornetM_SlowFX : CoolestIceSlowFX
{
Translation "197:197=215:215"//248
}

actor HornetNectarHive : ProjSpawnFuncActor
{
species "BeeStuff"
PROJECTILE
damagetype "HornetM_Slow"
Obituary "$OB_HORNETHONEY"
-NOGRAVITY
+SKYEXPLODE
+EXPLODEONWATER
Damage (50)
Radius 12
Height 10
speed 25
Scale 2.5
States
{
Spawn:
HORH K 0
HORH K 0 A_ChangeVelocity(0,0,3)
HORH K 1
wait
Death:
TNT1 A 0 A_JumpIf(ceilingz-z<=10, "Ceiling")
TNT1 A 0 A_SpawnItemEx("NectarTrapShot",0,0,8,random(6,12),0,random(4,10),random(10,80))
TNT1 A 0 A_SpawnItemEx("NectarTrapShot",0,0,8,random(6,12),0,random(4,10),random(100,170))
TNT1 A 0 A_SpawnItemEx("NectarTrapShot",0,0,8,random(6,12),0,random(4,10),random(190,260))
TNT1 A 0 A_SpawnItemEx("NectarTrapShot",0,0,8,random(6,12),0,random(4,10),random(280,350))
Goto RealDeath
Ceiling:
TNT1 A 0 A_SpawnItemEx("NectarTrapShot",0,0,-8,random(6,12),0,random(-1,-7),random(10,80))
TNT1 A 0 A_SpawnItemEx("NectarTrapShot",0,0,-8,random(6,12),0,random(-1,-7),random(100,170))
TNT1 A 0 A_SpawnItemEx("NectarTrapShot",0,0,-8,random(6,12),0,random(-1,-7),random(190,260))
TNT1 A 0 A_SpawnItemEx("NectarTrapShot",0,0,-8,random(6,12),0,random(-1,-7),random(280,350))
Goto RealDeath
RealDeath:
XDeath:
TNT1 A 0 A_SetGravity(0.0)
TNT1 A 0 A_PlaySoundEx("weapon/hornetcomb","Weapon")
TNT1 A 0 A_SetDamageType("HornetM_Shot")
TNT1 A 0 A_Explode(100,80,0,0,16)
TNT1 A 0 A_SpawnItemEx("HornetNectarHiveFX1",0,-3,10,0,-5,6,0,1)
TNT1 A 0 A_SpawnItemEx("HornetNectarHiveFX2",0,3,10,0,5,6,0,1)
TNT1 A 0 A_SpawnItemEx("HornetNectarHiveFX1",0,3,4,0,5,-6,0,1)
TNT1 A 0 A_SpawnItemEx("HornetNectarHiveFX2",0,-3,4,0,-5,-6,0,1)
TNT1 A 0 A_SetScale(2.75)
HORH L 2
HORH MN 3
stop
}
}

actor HornetNectarHiveFX1 : BasicGraphicEffectM
{
-NOGRAVITY
+THRUACTORS
ReactionTime 1
States
{
SpawnFrame:
HORH O 18
HORH O 1 A_CountDown
wait
}
}
actor HornetNectarHiveFX2 : HornetNectarHiveFX1
{
States
{
SpawnFrame:
HORH P 18
HORH P 1 A_CountDown
wait
}
}


actor NectarTrapShot : ProjSpawnFuncActor
{
species "BeeStuff"
PROJECTILE
damagetype "HornetM_Slow"
Obituary "$OB_HORNETHONEY"
-NOGRAVITY
+SKYEXPLODE
+EXPLODEONWATER
Gravity 0.75
Damage (50)
Radius 12
Height 10
speed 25
Scale 2.0
States
{
Spawn:
TNT1 A 0
HORH U 1
wait
Crash:
XDeath:
HORH U 1
stop
Death:
HORH U 0 
HORH U 0 A_JumpIf(z-floorz<=0,"Death2")
HORH U 1 A_GiveInventory("CutterFlag",1)
HORH U 0 A_JumpIfInventory("CutterFlag",175,"Xdeath")
loop
Death2:
HORH U 1 A_SpawnItemEx("NectarTrapBlob")
stop
}
}

Actor NectarTrapBlob : ProjSpawnFuncActor
{
species "BeeStuff"
damagetype "HornetM_Slow"
Obituary "$OB_HORNETHONEY"
+MISSILE
+DONTSPLASH
+NOEXPLODEFLOOR
reactiontime 100
Damage (50)
Radius 12
Height 10
scale 2.5
states
{
Spawn:
TNT1 A 0
HORH W 1
HORH W 1 A_Stop
goto SpawnW
SpawnW:
HORH V 1
HORH V 0 A_JumpIf(abs(z*100000-floorz*100000)>50,"NewShot")
HORH V 0 A_CountDown
loop
NewShot:
//HORH V 0 A_CheckFlag("BLASTED","NewShotX")
HORH V 0 A_SpawnItemEx("NectarTrapBlob",0,0,0,momx,momy,momz,0,8)
Goto Death
Death:
TNT1 A 0
stop
}
}


actor Hornetman_W_NormalBar : NormalBar {Args 4,228}
actor Hornetman_W_SecondBar : SecondBar {Args 160,220}
actor Hornetman_W_ScriptBar : ScriptBar {}