actor WaterWaveBoss : BaseMM8BDMWep_CBM
{
dropitem "WaterWaveWepCDropped"
Weapon.AmmoUse 4
Weapon.AmmoGive 28
Weapon.AmmoGive2 500
Weapon.SlotNumber 1
Obituary "$OB_WATERWAVE"
weapon.ammotype "WaterWaveClassAmmo"
weapon.ammotype2 "HookshotStamina"
+WEAPON.NOAUTOAIM
inventory.icon "HARPJ"
States
{
Spawn:
C_05 B 1
loop
Ready:
WAVA A 0 ACS_ExecuteAlways(998,0,801)
WAVA A 0 A_GunFlash
goto Ready2
Ready1:
WAVA A 0 A_JumpIfInventory("WaterWaveClassAmmo",4,"Ready1a")
WAVA A 14 A_WeaponReady(WRF_NOPRIMARY)
goto Ready2
Ready1a:
WAVA A 10 A_WeaponReady
goto Ready2a
Ready2:
WAVA A 0 A_JumpIfInventory("IsBot",1,"Ready2a")
WAVA A 0 A_JumpIfInventory("WaterWaveClassAmmo",4,"Ready2a")
WAVA A 4 A_WeaponReady(WRF_NOPRIMARY)
WAVA A 0 A_GiveInventory("WaterWaveClassAmmo",1)
goto Ready2+1
Ready2a:
WAVA A 4 A_WeaponReady
WAVA A 0 A_GiveInventory("WaterWaveClassAmmo",1)
loop
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
WAVA A 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
WAVA A 1 A_Raise
Loop
Fire:
WAVA A 0 A_JumpIfInventory("IsBot",1,"BotFire")
WAVA A 0 A_JumpIfNoAmmo("NoAmmo")
WAVA A 0 A_PlaySoundEx("weapon/waterwave","Weapon")
WAVA A 0 A_TakeInventory("WaterWaveClassAmmo",4)
WAVA DDDEEE 2 A_GiveInventory("WavemanMain_CI",1)
WAVA A 8
WAVA A 0 A_Refire
Goto Ready1



AltFire:
//WAVA B 0 A_JumpIfInventory("IsBot",1,"BotFire")
WAVA B 0 A_TakeInventory("HookshotTired",9)
WAVA B 0 A_JumpIfInventory("HookshotStamina",200,1)
goto Altfire2
WAVA B 0 A_PlaySoundEx("weapon/mbuster","Weapon")
WAVA B 0 A_GiveInventory("WavemanAltDelay",1)
WAVA B 0 A_GiveInventory("HookshotFiredFlag",1)
WAVA B 0 A_GunFlash
WAVA B 0 A_GiveInventory("WaterWaveClassAmmo",1)
WAVA B 0 A_SpawnItemEx("WaveHarpoonHook",-2,8,32,cos(-pitch)*1,0,sin(-pitch)*1,0,1)
Goto AltHold
AltHold:
WAVA B 0 A_JumpIfInventory("HookshotTired",1,"AltFireEnd")
WAVA B 1 //A_PlaySoundEx("weapon/WireAdp","weapon")
WAVA B 0 A_ReFire
goto AltFireEnd
AltFireEnd:
WAVA B 0 A_TakeInventory("HookshotFiredFlag",9)
WAVA B 0 A_GiveInventory("HookshotTired",1)
WAVA BC 3
WAVA A 0 A_ClearReFire
WAVA A 1 A_GunFlash
Goto AltFireWait
AltFireWait:
WAVA A 1 A_RailWait
WAVA A 0 A_JumpIfInventory("WavemanAltDelay",1,"AltFireWait")
goto Ready1


Altfire2:
WAVA A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
WAVA A 0 A_GiveInventory("WaterWaveClassAmmo",1)
WAVA A 0 A_GiveInventory("WavemanAlt_CI",1)
WAVA BC 3
WAVA A 10
Goto Ready2
NoAmmo:
WAVA A 0
Goto Ready1

BotFire:
WAVA A 0 A_JumpIfInventory("WaterWaveClassAmmo",28,"BotFire2")
WAVA A 0 A_Jump(128,"AltFire2")
WAVA A 0 A_JumpIfInventory("WaterWaveClassAmmo",4,"BotFire2")
WAVA A 0 A_Jump(32,"BotFire3")
goto Altfire2
BotFire2:
WAVA A 0
goto Fire+1
BotFire3:
WAVA A 0 A_GiveInventory("WaterWaveClassAmmo",12)
goto Altfire2





Flash:
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0 A_JumpIfInventory("HookshotFiredFlag",1,"FlashSlow")
TNT1 A 0 A_JumpIfInventory("HookshotStamina",500,"NoFlash")
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("HookshotLandFlag",1,"Flash")
TNT1 A 0 A_JumpIfInventory("HookshotTired",1,"FlashCheck")
TNT1 A 0 A_GiveInventory("HookshotStamina",1)
loop
FlashCheck:
TNT1 A 1 A_JumpIf(z-floorz==0,"FlashChecked")
TNT1 A 0 A_JumpIf(momz==0,"FlashCheckZ")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0
loop
FlashCheckZ:
TNT1 A 1 A_JumpIf(z-floorz==0,"FlashChecked")
TNT1 A 0 A_JumpIf(momz==0,"FlashChecked")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0
goto FlashCheck
FlashChecked:
TNT1 A 0 A_TakeInventory("HookshotTired",1)
goto Flash
FlashSlow:
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 AAAAAAAAAAAAAA 1 A_JumpIfInventory("HookshotTired",1,"NoFlash")
TNT1 A 0 A_GiveInventory("WaterWaveClassAmmo",1)
loop
}
}

actor WaterHookBoss : BaseMM8BDMWep_CBM
{
dropitem "WaterWaveWepCDropped"
Weapon.AmmoUse 4
Weapon.AmmoGive 28
Weapon.AmmoGive2 500
Weapon.SlotNumber 2
Obituary "$OB_WATERWAVE"
weapon.ammotype "WaterWaveClassAmmo"
weapon.ammotype2 "HookshotStamina"
+WEAPON.NOAUTOAIM
inventory.icon "HARPK"
States
{
Spawn:
C_05 B 1
loop
Ready:
WAVA F 0 ACS_ExecuteAlways(998,0,801)
WAVA F 0 A_GunFlash
goto Ready2
Ready1:
WAVA F 0 A_JumpIfInventory("WaterWaveClassAmmo",4,"Ready1a")
WAVA F 14 A_WeaponReady(WRF_NOPRIMARY)
goto Ready2
Ready1a:
WAVA F 10 A_WeaponReady
goto Ready2a
Ready2:
WAVA F 0 A_JumpIfInventory("IsBot",1,"Ready2a")
WAVA F 0 A_JumpIfInventory("WaterWaveClassAmmo",4,"Ready2a")
WAVA F 4 A_WeaponReady(WRF_NOPRIMARY)
WAVA F 0 A_GiveInventory("WaterWaveClassAmmo",1)
goto Ready2+1
Ready2a:
WAVA F 4 A_WeaponReady
WAVA F 0 A_GiveInventory("WaterWaveClassAmmo",1)
loop
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
WAVA A 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
WAVA A 1 A_Raise
Loop
Fire:
WAVA F 0 A_JumpIfInventory("IsBot",1,"BotFire")
WAVA F 0 A_JumpIfNoAmmo("NoAmmo")
WAVA F 0 A_PlaySoundEx("weapon/waterwave","Weapon")
WAVA F 0 A_TakeInventory("WaterWaveClassAmmo",4)
WAVA IIIJJJ 2 A_GiveInventory("WavemanMain_CI",1)
WAVA F 8
WAVA F 0 A_Refire
Goto Ready1

AltFire:
WAVA F 0 A_PlaySoundEx("weapon/mbuster","Weapon")
WAVA F 0 A_GiveInventory("WaterWaveClassAmmo",1)
WAVA F 0 A_GiveInventory("WavemanAlt_CI",1)
WAVA GH 3
WAVA F 3
WAVA F 7 A_GiveInventory("WaterWaveClassAmmo",1)
Goto Ready2
NoAmmo:
WAVA F 0
Goto Ready1

BotFire:
WAVA F 0 A_JumpIfInventory("WaterWaveClassAmmo",28,"BotFire2")
WAVA F 0 A_Jump(128,"AltFire")
WAVA F 0 A_JumpIfInventory("WaterWaveClassAmmo",4,"BotFire2")
WAVA F 0 A_Jump(32,"BotFire3")
goto Altfire2
BotFire2:
WAVA F 0
goto Fire+1
BotFire3:
WAVA F 0 A_GiveInventory("WaterWaveClassAmmo",12)
goto Altfire2

Flash:
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0 A_JumpIfInventory("HookshotFiredFlag",1,"FlashSlow")
TNT1 A 0 A_JumpIfInventory("HookshotStamina",500,"NoFlash")
TNT1 A 1
TNT1 A 0 A_JumpIfInventory("HookshotLandFlag",1,"Flash")
TNT1 A 0 A_JumpIfInventory("HookshotTired",1,"FlashCheck")
TNT1 A 0 A_GiveInventory("HookshotStamina",1)
loop
FlashCheck:
TNT1 A 1 A_JumpIf(z-floorz==0,"FlashChecked")
TNT1 A 0 A_JumpIf(momz==0,"FlashCheckZ")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0
loop
FlashCheckZ:
TNT1 A 1 A_JumpIf(z-floorz==0,"FlashChecked")
TNT1 A 0 A_JumpIf(momz==0,"FlashChecked")
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 A 0
goto FlashCheck
FlashChecked:
TNT1 A 0 A_TakeInventory("HookshotTired",1)
goto Flash
FlashSlow:
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
TNT1 AAAAAAAAAAAAAA 1 A_JumpIfInventory("HookshotTired",1,"NoFlash")
TNT1 A 0 A_GiveInventory("WaterWaveClassAmmo",1)
loop
}
}

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

actor HookshotStamina : Ammo
{
inventory.amount 1
inventory.maxamount 500
+INVENTORY.IGNORESKILL
}

actor HookshotFiredFlag : OnceC {}
actor HookshotLandFlag : OnceC {}
actor HookshotTired : OnceC {}

actor WavemanAltDelay : Powerup
{
Powerup.Duration 16
}


actor WaveHarpoonHook
{
Translation "199:199=193:193"
var int user_PTID;
PROJECTILE
damagetype "ClassPainSemi"
Obituary "$OB_WAVEHARPOON"
//+RIPPER
+DONTBLAST
+DONTREFLECT
//+SKYEXPLODE
Damage (15)
Radius 7
Height 7
Speed 40
scale 2.5
states
{
Spawn:
HARP A 0
HARP A 0 A_SetUserVar("user_PTID", ACS_ExecuteWithResult(257,0))
HARP A 0 Thing_ChangeTID(0,user_PTID+1700)
HARP A 0 A_GiveInventory("WeaponCharge",1)
HARP A 0 A_ScaleVelocity(40)
Spawn2:
HARP A 0 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"SuperDeath")
HARP A 0 A_JumpIfInTargetInventory("HookshotTired",1,"SpawnX")
HARP A 1 A_SpawnItemEx("WaveHarpoonHookFX",0,0,0,0,0,0,0,1)
loop
SpawnX:
HARP A 0 A_GiveInventory("CutterFlag",1)
HARP A 0 Thing_ChangeTID(0,0)
HARP A 0 A_GiveInventory("ResyncPickup",1)
HARP A 5
goto SpawnX+2
Death:
HARP A 0 A_JumpIfInventory("CutterFlag",1,"SuperDeath")
HARP A 0 A_JumpIfInTargetInventory("FlightDisableFlag",1,"SuperDeath")
HARP A 0 A_PlaySoundEx("weapon/crashland","Weapon")
HARP A 0 A_JumpIfInventory("WeaponCharge",1,1)
goto SuperDeathPoof
HARP A 0 A_JumpIfInTargetInventory("HookshotFiredFlag",1,1)
goto SuperDeathPoof
HARP A 0 A_JumpIfInTargetInventory("HookshotTired",1,"SuperDeathPoof")
HARP A 0 A_GiveToTarget("HookshotGravityPickup",1)
//6P17 A 0 A_GiveToTarget("HookshotLandFlag",1)
HARP A 0 ACS_ExecuteAlways(C_CEL_HOOKSHOT,0,user_PTID,2,2)
HARP A 1// A_SpawnItemEx("BasicAstro_CFX10",0,0,0,0,0,0,0,1)
DeathLoop:
HARP A 0 A_JumpIfInTargetInventory("HookshotTired",1,"SuperDeath")
HARP A 1 A_JumpIf(ACS_ExecuteWithResult(C_CHECK_TARGET_OOC)==0,"SuperDeath")
loop
SuperDeathPoof:
TMFX B 0 A_ChangeFlag("NOINTERACTION",1)
TMFX B 2 A_Stop
TMFX BCDE 2 
stop
SuperDeath:
HARP A 1
stop
}
}

actor WaveHarpoonHookFX : BasicClientSide
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_FadeOut(0.15)
HARP A 1 A_FadeOut(0.15)
wait
}
}

Actor HookshotFX-1 : BasicClientSide
{
Translation "199:199=193:193"
States
{
Spawn:
HARP F 0
HARP F 1
stop
}
}

actor HookshotFX0 : HookshotFX-1{translation "199:199=74:74"}
actor HookshotFX1 : HookshotFX-1{translation "199:199=41:41"}
actor HookshotFX2 : HookshotFX-1{translation "199:199=128:128"}
actor HookshotFX3 : HookshotFX-1{translation "199:199=232:232"}

actor HookshotGravityPickup : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_Stop
TNT1 A 0 A_TakeInventory("HookshotStamina",25)
TNT1 A 0 A_GiveInventory("HookshotLandFlag",1)
TNT1 A 0 A_JumpIfInventory("FlightDisableFlag",1,2)
TNT1 A 0 A_ChangeFlag("NOGRAVITY",1)
TNT1 A 0 SetPlayerProperty(0,1,0)
stop
}
}

actor WaveHarpoon 
{
Translation "199:199=193:193"
PROJECTILE 
Damagetype "ClassPainSemi"
Obituary "$OB_WAVEHARPOON" 
+FORCEXYBILLBOARD
damage (15)
Radius 8
Height 8
speed 40
scale 3.0
States
{
Spawn:
HARP A 1
loop
}
}

actor WaveHarpoonB : WaveHarpoon{translation "199:199=74:74"}
actor WaveHarpoonR : WaveHarpoon{translation "199:199=41:41"}
actor WaveHarpoonO : WaveHarpoon{translation "199:199=128:128"}
actor WaveHarpoonP : WaveHarpoon{translation "199:199=232:232"}

actor PinpointWaterWaveSpawner : FastProjectile
{
Translation "199:199=193:193"
Height 40
Radius 6
speed 1000
//+RIPPER
//+THRUGHOST
+DONTBLAST
+SKYEXPLODE
+THRUACTORS
damage (0)
reactiontime 5
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_CountDown
loop
Death:
TNT1 A 0 A_CheckFloor("Forward")
TNT1 A 0 A_SpawnItemEx("WaterWaveSpawnerB",0,0,0,0,0,0,180,1)
stop
Forward:
TNT1 A 0 A_SpawnItemEx("WaterWaveSpawnerB2",0,0,0,0,0,0,0,1)
stop
}
}

actor PinpointWaterWaveSpawnerB : PinpointWaterWaveSpawner{translation "199:199=74:74"}
actor PinpointWaterWaveSpawnerR : PinpointWaterWaveSpawner{translation "199:199=41:41"}
actor PinpointWaterWaveSpawnerO : PinpointWaterWaveSpawner{translation "199:199=128:128"}
actor PinpointWaterWaveSpawnerP : PinpointWaterWaveSpawner{translation "199:199=232:232"}


actor WaterWaveSpawnerB
{
PROJECTILE
+DONTBLAST
Height 40
Radius 6
scale 2.5
damage (0)
//+RIPPER
//+THRUGHOST
+THRUACTORS
+FLOORHUGGER

reactiontime 30
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundEx("weapon/WaveSummon","Weapon")
Spawn2:
TNT1 AA 1 A_CountDown
HARP BBBBCCBBBB 1 A_CountDown
loop
Death:
TNT1 A 0 A_JumpIfCloser(64,"Launch")
Wave:
TNT1 A 0 A_SpawnItemEx("WaterWaveB",0,0,0,20,0,0,0,1)//A_CustomMissile("WaterWaveB",0,0,0,2,0)
TNT1 A 1 //A_PlaySoundEx("weapon/WaveSummonGo","Weapon")
stop
Launch:
TNT1 A 0 A_JumpIf(z!=floorz,"Wave")
TNT1 A 0 A_GiveToTarget("WaterWaveLaunch",1)
goto Wave
}
}

actor WaterWaveSpawnerB2 : WaterWaveSpawnerB
{
ReactionTime 1
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySoundEx("weapon/WaveSummon","Weapon")
TNT1 A 0 A_JumpIfCloser(250,"Spawn7")
TNT1 A 0 //A_LOG("Too far 250")
TNT1 A 0 A_JumpIfCloser(400,"Spawn6")
TNT1 A 0 //A_LOG("Too far 400")
TNT1 A 0 A_JumpIfCloser(550,"Spawn5")
TNT1 A 0 //A_LOG("Too far 550")
TNT1 A 0 A_JumpIfCloser(700,"Spawn4")
TNT1 A 0 //A_LOG("Too far 700")
TNT1 A 0 A_JumpIfCloser(850,"Spawn3")
TNT1 A 0 //A_LOG("Too far 850")
Spawn2:
HARP ZZBBB 1
Spawn3:
HARP BCCBB 1
Spawn4:
HARP BBZZB 1
Spawn5:
HARP BBBCC 1
Spawn6:
HARP BBBBZ 1
Spawn7:
HARP ZBBBB 1
SpawnW:
HARP B 1 A_CountDown
loop
}
}

actor WaterWaveLaunch : CustomInventory
{
states
{
pickup2:
TNT1 A 0 ThrustThingZ(0,60,0,0)
stop
Pickup:
TNT1 A 0 A_JumpIf(z-floorz==0||momz>=0,"Ground")
goto Air
Air:
TNT1 A 0 ThrustThingZ(0,10,0,1)
stop
Ground:
TNT1 A 0 ThrustThingZ(0,60,0,0)
stop
}
}

/*actor WaterWaveSpawnerB : WaterWaveSpawner
{
Translation "196:200=192:192"
States
{
Death:
TNT1 A 0 A_CustomMissile("WaterWaveB",0,0,0,2,0)
stop
}
}*/


actor WaterWaveB
{
PROJECTILE
-NOGRAVITY
//+NOEXPLODEFLOOR
//+STEPMISSILE//Not yet
//maxstepheight 7
Damage (8)
damagetype "WaterWave"
Obituary "$OB_WATERWAVE"
Height 40
Radius 6
Scale 2.5
gravity 900.0
speed 20
States
{
Spawn:
HARP B 1
HARP B 3 A_GiveInventory("Clip",1)
HARP CDEDCB 4// ThrustThingZ(0,0,0,0)
Goto Spawn+2
Crash:
XDeath:
TNT1 A 0
stop
Death:
TNT1 A 0 A_JumpIfInventory("Clip",1,"Continue")
TNT1 A 1
stop
Continue:
TNT1 A 0 A_SpawnItemEx("WaterWaveB",0,0,0,20,0,0,0,1)//A_CustomMissile("WaterWaveB",0,0,0,2,0)
TNT1 A 1
stop
}
}


actor WavemanMain_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("PinpointWaterWaveSpawner",0,0,-8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("PinpointWaterWaveSpawnerB",0,0,-8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("PinpointWaterWaveSpawnerR",0,0,-8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("PinpointWaterWaveSpawnerO",0,0,-8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("PinpointWaterWaveSpawnerP",0,0,-8,0)
goto Done
}
}

actor WavemanAlt_CI : TeamColor_CI
{
states
{
FireX:
TNT1 A 0 A_FireCustomMissile("WaveHarpoon",0,0,8,0)
goto Done
FireB:
TNT1 A 0 A_FireCustomMissile("WaveHarpoonB",0,0,8,0)
goto Done
FireR:
TNT1 A 0 A_FireCustomMissile("WaveHarpoonR",0,0,8,0)
goto Done
FireO:
TNT1 A 0 A_FireCustomMissile("WaveHarpoonO",0,0,8,0)
goto Done
FireP:
TNT1 A 0 A_FireCustomMissile("WaveHarpoonP",0,0,8,0)
goto Done
}
}
