actor TenguBladeWep : BaseMM8BDMWep 10012
{
//$Category MM8BDM-Weapons
//$Title Tengu Blade
//$Sprite TBLAX0
Weapon.AmmoUse 2
Weapon.AmmoGive 28
Weapon.SlotNumber 4
Inventory.Pickupmessage "$PU_TENGUBLADE"
Obituary "$OB_TENGUBLADE"
Tag "$TAG_TENGUBLADE"
weapon.ammotype "TenguBladeAmmo"
inventory.icon "TENBLI"
States
{
SpawnLoop:
TBLA X -1
loop
Ready:
TENA A 0 ACS_ExecuteAlways(998,0,170)
TENA A 1 A_WeaponReady
Goto Ready+1
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
TENA A 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
TENA A 1 A_Raise
Loop
Fire:
Hold:
TENA A 0 A_JumpIfNoAmmo("NoAmmo")
TENA A 0 A_JumpIfInventory("WeaponCharge", 25, "Charge2")
TENA A 0 A_JumpIfInventory("WeaponCharge", 15, "Charge")
TENA A 1 A_GiveInventory("WeaponCharge", 1)
TENA A 0 A_Refire
Goto Fire1
Charge:
TENA B 0 A_JumpIfInventory("WeaponCharge", 25, "Charge2")
TENA B 1 A_GiveInventory("WeaponCharge", 1)
TENA B 0 A_Refire
Goto Fire1
Charge2:
TENA C 1 A_JumpIfInventory("IsBot", 1, "BotCharge")
TENA C 0 A_Refire
TENA C 0 A_CheckFloor("DashStart")
Goto Fire1
BotCharge:
TENA C 1 A_Jump(64, "Fire1")
TENA C 0 A_Jump(32, 2)
TENA C 0 A_Refire
Goto Charge2+2
DashStart:
TENA E 0 A_GiveInventory("CutterFlag", 10)
TENA E 0 A_TakeInventory("TenguBladeAmmo", 2,TIF_NOTAKEINFINITE)
TENA E 0 A_Recoil(-50)
TENA E 0 A_PlaySoundEx("weapon/tengudash","Weapon")
TENA E 0 ACS_NamedExecuteAlways("core_freezeplayer",0,0,1)
TENA E 0 A_ChangeFlag("THRUSPECIES", 1)
Goto DashAttack
DashExtend:
TENA E 0 A_GiveInventory("CutterFlag", 2)
TENA E 0 A_Stop
TENA E 0 A_SpawnItemEx("TenguDash")
TENA E 0 A_Recoil(-40)
TENA E 0 ThrustThingZ(0, 35, 0, 0)
Goto DashAttack
DashAttack:
TENA E 0 A_Recoil(-1)
TENA E 1 A_SpawnItemEx("TenguDash", 48, 0, 32, momx, momy, momz, 0, SXF_ABSOLUTEMOMENTUM) //A_FireCustomMissile("TenguDash",0,0,11,-8)
TENA E 0 A_TakeInventory("CutterFlag", 1)
TENA E 0 A_JumpIfInventory("CutterFlag", 1, "DashAttack")
DashFinish:
TENA E 1 A_JumpIf(ACS_ExecuteWithResult(261, 64) == 1, "DashExtend")
TENA E 0 ACS_NamedExecuteAlways("core_freezeplayer",0,0,0)
TENA E 0 A_ChangeFlag("THRUSPECIES", 0)
TENA E 0 A_ScaleVelocity(0.25)
TENA FG 2
TNT1 A 8 A_TakeInventory("WeaponCharge", 999)
TENA CBA 2
TENA A 0 A_Refire
Goto Ready+1
Altfire:
Fire1:
TENA A 0 A_JumpIfNoAmmo("NoAmmo")
TENA A 0 A_PlaySoundEx("weapon/tengushot","Weapon")
TENA B 1 A_GiveInventory("FireTenguSlash1", 1) // SpreadRune
TENA C 1
TENA D 2 
TENA E 2 A_GiveInventory("FireTenguSlash2", 1) // SpreadRune
TENA F 2
TENA G 2 A_FireCustomMissile("TenguBlade",0,1,8,0)
TNT1 A 8 A_TakeInventory("WeaponCharge", 999)
TENA CBA 2
TENA A 1 A_Refire
Goto Ready+1
NoAmmo:
TENA A 1 ACS_Execute(979,0)
Goto Ready+1
}
}


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

actor FireTenguSlash1 : CustomInventory
{
    States
    {
    Pickup:
        TNT1 A 0 A_SpawnItemEx ("TenguSlash1",cos(-pitch)*56,8,32+(sin(-pitch)*48), momx, momy, 0,0,SXF_ABSOLUTEMOMENTUM,0)
        TNT1 A 0 A_JumpIfInventory("RuneSpread", 1, "PickupSpread")
        stop
    PickupSpread:
        TNT1 A 0 A_SpawnItemEx ("TenguSlash1",cos(-pitch)*56,8,32+(sin(-pitch)*48), momx, momy, 0,20,SXF_ABSOLUTEMOMENTUM,0)
        TNT1 A 0 A_SpawnItemEx ("TenguSlash1",cos(-pitch)*56,8,32+(sin(-pitch)*48), momx, momy, 0,-20,SXF_ABSOLUTEMOMENTUM,0)
        stop
    }
}

actor FireTenguSlash2 : CustomInventory
{
    States
    {
    Pickup:
        TNT1 A 0 A_SpawnItemEx ("TenguSlash2",cos(-pitch)*56,8,32+(sin(-pitch)*48), momx, momy, 0,0,SXF_ABSOLUTEMOMENTUM,0)
        TNT1 A 0 A_JumpIfInventory("RuneSpread", 1, "PickupSpread")
        stop
    PickupSpread:
        TNT1 A 0 A_SpawnItemEx ("TenguSlash2",cos(-pitch)*56,8,32+(sin(-pitch)*48), momx, momy, 0,20,SXF_ABSOLUTEMOMENTUM,0)
        TNT1 A 0 A_SpawnItemEx ("TenguSlash2",cos(-pitch)*56,8,32+(sin(-pitch)*48), momx, momy, 0,-20,SXF_ABSOLUTEMOMENTUM,0)
        stop
    }
}

actor TenguDash
{
PROJECTILE
Radius 16
Height 5
scale 2.5
damage (0)
+RIPPER
+DONTBLAST
damagetype "TenguSlash"
Obituary "$OB_TENGUBLADE"
speed 15
States
{
Spawn:
TNT1 A 0
SCLA HI 1 A_Explode(7,64,0)
SCLA J 0 A_Explode(7,64,0)
SCLA J 1 A_ScaleVelocity(0.5)
SCLA J 1 A_FadeOut(0.5)
stop
Death:
TNT1 A 0
stop
}
}

actor TenguSlash1
{
PROJECTILE
Radius 12
Height 8
scale 2.5
damage (0)
+RIPPER
+DONTBLAST
damagetype "TenguSlash"
Obituary "$OB_TENGUBLADE"
speed 0
States
{
Spawn:
TBLA E 0
TBLA EF 2 A_Explode(11,80,0)
stop
}
}

actor TenguSlash2 : TenguSlash1
{
States
{
Spawn:
TBLA G 0
TBLA GF 2 A_Explode(11,80,0)
stop
}
}


actor TenguBlade
{
PROJECTILE
Radius 12
Height 8
scale 2.5
damage (35)
Bouncetype Classic
+BOUNCEONWALLS
+CANBOUNCEWATER
WALLBOUNCEFACTOR 0.91
BOUNCEFACTOR 0.91
BOUNCECOUNT 6
damagetype "TenguBlade"
Obituary "$OB_TENGUBLADE"
speed 30
States
{
Spawn:
TNT1 A 3
TBLA HI 2
TBLA BCD 3 
Goto Spawn+3
Death:
TNT1 A 0 
stop
}
}

