actor SharkAttackWep : BaseMM8BDMWep
{
//$Category MM8BDM-Weapons
//$Title Shark Attack
//$Sprite DOSWG0
Weapon.AmmoUse 4
Weapon.AmmoGive 28
Weapon.SlotNumber 2
Inventory.Pickupmessage "$PU_SHARKATTACK"
Obituary "$OB_SHARKATTACK"
Tag "$TAG_SHARKATTACK"
weapon.ammotype "SharkAttackAmmo"
inventory.icon "SHRKAT"
States
{
SpawnLoop:
DOSW G -1
loop
Ready:
SHRK A 0 ACS_ExecuteAlways(998,0,DOSREBORN_COLOR_SHARK)
SHRK A 1 A_WeaponReady
Goto Ready+1
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
SHRK A 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
SHRK I 1 A_Raise
Loop
Fire:
SHRK A 0 A_JumpIfNoAmmo("NoAmmo")
SHRK A 0 A_PlaySoundEx("weapon/mbuster","Weapon")
SHRK A 0 A_FireCustomMissile("SharkAttackStart", 0, 1, 8, 0)
SHRK BC 5
SHRK A 22
SHRK A 0 A_Refire
Goto Ready+1
NoAmmo:
SHRK A 1 ACS_Execute(979,0)
Goto Ready+1
}
}
actor SharkAttackWepSH : SharkAttackWep replaces SharkAttackWep {+INVENTORY.RESTRICTABSOLUTELY Inventory.RestrictedTo megamans}

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

const int SHARKSPEED = 7;

actor SharkAttackStart
{
PROJECTILE
-NOGRAVITY
Damage (15)
Speed 15
damagetype "SharkSearch"
Obituary "$OB_SHARKATTACK"
Height 5
Radius 6
Scale 2.5
States
{
Spawn:
SHAT A 4
wait
Death:
TNT1 A 0 A_JumpIf(ceilingz-z < 48, "XDeath")
TNT1 A 0 A_JumpIf(z-floorz!=0,"Air")
TNT1 A 0 A_SpawnItemEx("SharkSearch",0,0,0,SHARKSPEED)
SHAT B 0 A_SpawnItemEx("MMSplash")
stop
Air:
TNT1 A 0 A_SpawnItemEx("UpShark0",-1,0,16,0,0,1)
stop
XDeath:
Crash:
TNT1 A 0
stop
}
}

actor SharkSearch
{
PROJECTILE
+SEEKERMISSILE
+STEPMISSILE
maxstepheight 15 // MAKE SURE THIS DOESN'T DESYNC
damagetype "SharkSearch"
Obituary "$OB_SHARKATTACK"
Height 5
Radius 6
Scale 2.5
Speed 15
var int user_DAMAGE;
Damage (15)
States
{
Spawn:
SHAT A 0
SHAT B 2
SHAT A 0 A_JumpIfTargetInLOS("SpawnChase", 0, JLOSF_PROJECTILE)
SHAT A 0 A_SeekerMissile(4, 10, SMF_LOOK, 256, 4)
SHAT C 1 A_JumpIf(z-floorz>8, "Down")
SHAT A 0 A_JumpIfTargetInLOS("SpawnChase", 0, JLOSF_PROJECTILE)
SHAT A 0 A_SeekerMissile(4, 10, SMF_LOOK, 256, 4)
SHAT C 1 A_JumpIf(z-floorz>8, "Down")
SHAT A 0 A_JumpIfTargetInLOS("SpawnChase", 0, JLOSF_PROJECTILE)
SHAT A 0 A_SeekerMissile(4, 10, SMF_LOOK, 256, 4)
SHAT B 1 A_JumpIf(z-floorz>8, "Down")
SHAT A 0 A_JumpIfTargetInLOS("SpawnChase", 0, JLOSF_PROJECTILE)
SHAT A 0 A_SeekerMissile(4, 10, SMF_LOOK, 256, 4)
SHAT B 1 A_JumpIf(z-floorz>8, "Down")
SHAT A 0 A_ChangeVelocity(SHARKSPEED,0,0, CVF_REPLACE | CVF_RELATIVE)
goto Spawn+1
SpawnChase:
SHAT A 0 A_SetUserVar(user_DAMAGE, 1)
SHAT A 0 A_Stop
SHAT A 0 A_SpawnItemEx("SharkAttack", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERPOINTERS)
stop
ChaseLoop:
SHAT LMLN 2
loop
Down:
TNT1 A 0 A_SpawnItemEx("DownShark",0,0,0,0,0, -SHARKSPEED)
stop
XDeath:
Crash:
TNT1 A 0
stop
Death:
TNT1 A 0 A_JumpIf(user_DAMAGE > 0, "Crash")
TNT1 A 0 A_SpawnItemEx("UpShark0",-1, 0, SHARKSPEED, 0, 0, 1)
stop
}
}

actor SharkAttack
{
PROJECTILE
+NOEXPLODEFLOOR
+STEPMISSILE
maxstepheight 48
damagetype "SharkSearch"
Obituary "$OB_SHARKATTACK"
Height 5
Radius 6
Scale 2.5
Damage (45)
Speed 45
States
{
Spawn:
SHAT A 0
SHRK A 0 A_PlaySoundEx("weapon/sharkalert","Voice")
TNT1 A 0 A_SpawnItemEx("MMSplash")
SHAT HIJK 5
SHAT LLLLLLLLLLLL 0 A_SeekerMissile(1, 360, SMF_PRECISE, 256, 2)
SHAT L 0 A_ScaleVelocity(0.01)
SHAT L 2 A_FaceTracer
SHAT L 0 A_ScaleVelocity(100.0)
SpawnLoop:
SHAT LLMMLLNN 1 A_JumpIf(z-floorz > 1, "SpawnFloor")
loop
SpawnFloor:
SHAT L 0 A_ChangeFlag(FLOORHUGGER, true)
SHAT L 1
SHAT L 0 A_ChangeFlag(FLOORHUGGER, false)
goto SpawnLoop
}
}

actor UpShark0 : SharkSearch
{
+NOGRAVITY
+STEPMISSILE
maxstepheight 17
States
{
Spawn:
SHAT D 0
SHAT D 0 A_ChangeVelocity(SHARKSPEED,0,0, CVF_REPLACE | CVF_RELATIVE) //A_Recoil(-SHARKSPEED)
SHAT D 1
TNT1 D 0 A_JumpIf(z-floorz < 48, "SpawnFloor")
TNT1 D 0 A_SpawnItemEx("SharkSearch",0,0,0,SHARKSPEED)
stop
SpawnFloor:
SHAT C 0 A_SpawnItemEx("SharkSearch",0,0,-(z-floorz),SHARKSPEED)
stop
XDeath:
Crash:
TNT1 A 0
stop
Death:
TNT1 A 0 A_JumpIf(ceilingz-z > 48, "Continue")
TNT1 A 0
stop
Continue:
TNT1 A 0 A_SpawnItemEx("UpShark1",0,0,4,0,0,SHARKSPEED)
stop
}
}

actor UpShark1 : UpShark0
{
States
{
Spawn:
SHAT D 1
SHAT D 0 A_Stop
SHAT D 0 A_ChangeVelocity(SHARKSPEED, 0, 0, CVF_REPLACE | CVF_RELATIVE) //A_Recoil(-SHARKSPEED)
SHAT D 1
SHAT D 0 A_JumpIf(z-floorz < 48, "SpawnFloor")
SHAT D 0 A_SpawnItemEx("SharkSearch",0,0,0,SHARKSPEED)
stop
SpawnFloor:
TNT1 A 0 A_SpawnItemEx("SharkSearch",0,0,-(z-floorz),SHARKSPEED)
stop
XDeath:
Crash:
TNT1 A 0
stop
Death:
TNT1 A 0 A_JumpIf(ceilingz-z > 48, "Continue")
TNT1 A 0
stop
Continue:
TNT1 A 0 A_SpawnItemEx("UpShark2",0,0,4,0,0,SHARKSPEED)
stop
}
}

actor UpShark2 : UpShark1
{
States
{
Death:
TNT1 A 0 A_JumpIf(ceilingz-z > 48, "Continue")
TNT1 A 0
stop
Continue:
TNT1 A 0 A_SpawnItemEx("UpShark3",0,0,4,0,0,SHARKSPEED)
stop
}
}

actor UpShark3 : UpShark1
{
States
{
Spawn:
SHAT E 1
SHAT E 0 A_Stop
SHAT E 0 A_ChangeVelocity(SHARKSPEED,0,0, CVF_REPLACE | CVF_RELATIVE) //A_Recoil(-SHARKSPEED)
SHAT E 1
SHAT E 0 A_JumpIf(z-floorz < 48, "SpawnFloor")
SHAT E 0 A_SpawnItemEx("SharkSearch",0,0,0,SHARKSPEED)
stop
SpawnFloor:
TNT1 A 0 A_SpawnItemEx("SharkSearch",0,0,-(z-floorz),SHARKSPEED)
stop
Death:
TNT1 A 0 A_JumpIf(ceilingz-z > 48, "Continue")
TNT1 A 0
stop
Continue:
TNT1 A 0 A_SpawnItemEx("UpShark4",0,0,4,0,0,SHARKSPEED)
stop
}
}

actor UpShark4 : UpShark3
{
States
{
Death:
TNT1 A 0 A_JumpIf(ceilingz-z > 48, "Continue")
TNT1 A 0
stop
Continue:
TNT1 A 0 A_SpawnItemEx("UpShark1",0,0,4,0,0,SHARKSPEED)
stop
}
}

actor DownShark : SharkSearch
{
+NOGRAVITY
-NOEXPLODEFLOOR
States
{
Spawn:
SHAT FG 4
loop
Crash:
XDeath:
TNT1 A 0
stop
Death:
TNT1 A 0 A_SpawnItemEx("SharkSearch",0,0,0,SHARKSPEED)
TNT1 A 0 A_SpawnItemEx("MMSplash")
stop
}
}
