actor Yamatoman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_6H"
dropitem "YamatoSpearWep"
Weapon.AmmoUse 3
Weapon.AmmoGive 0
Obituary "$OB_YAMATOSPEAR"
weapon.ammotype "TheLastSamuraiAmmo"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_06 H 1
loop

Deselect:
YAMB A 0
goto DeselectSwap
Select:
YAMB A 0
goto SelectSwap

Ready:
YAMB A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_YAMATOMAN)
YAMB A 0 A_GunFlash("Flash",1)
YAMB A 0 A_JumpIfInventory("TheLastSamuraiAmmo",3,"Ready2")
YAMB A 2 A_WeaponReady(4)
YAMB A 0 A_GiveInventory("YamatoStock",2)
goto Ready+2
Ready2:
YAMB A 2 A_WeaponReady
YAMB A 0 A_GiveInventory("YamatoStock",2)
loop

Fire:
TNT1 A 0 A_JumpIfInventory("IsBot",1,"BotFire")
YAMB B 3
Hold:
YAMB A 0 A_JumpIfNoAmmo("No")
YAMB C 0 A_GiveInventory("Yamatoman_Fire_P")
YAMB CDCDCD 2
YAMB A 0 A_Refire
YAMB A 0
No:
YAMB B 3 A_ClearRefire
Goto Ready+2
AltFire:
YAMB C 0 A_GiveInventory("CBM_YamatomanJumpPowerGiver",1)//Slow
YAMB C 0 A_GiveInventory("YamatoStock",1)
YAMB C 0 A_GiveInventory("YamatoSpinFlag",4)
goto AltfireLoop
AltfireLoop:
YAMB C 0 A_JumpIfInventory("PlayerPropertyRage",1,"AltfireLoopR")
YAMB C 1 A_PlaySoundEx("weapon/BRGSpin","Weapon")
YAMB D 0 A_PlaySoundEx("weapon/BRGSpin","Weapon")
YAMB D 0 A_SpawnItemEx("YamatoAlt",0,8,33)
YAMB D 1 A_GiveInventory("YamatoStock",1)
YAMB D 0 A_Refire("AltfireLoop")
goto AltfireEnd
AltfireLoopR:
YAMB C 0 A_GiveInventory("YamatoStock",1)
YAMB C 0 A_SpawnItemEx("YamatoAlt",0,8,33)
goto AltfireLoop+1

AltfireEnd:
YAMB D 0 A_PlaySoundEx("weapon/topspin","Weapon")
YAMB CD 2 A_GiveInventory("YamatoStock",1)
YAMB C 0 A_TakeInventory("YamatomanSpinSlow")
YAMB C 2 A_GiveInventory("YamatoStock",1)
YAMB C 0 A_GiveInventory("YamatoStock",1)
YAMB C 0 A_JumpIfInventory("PlayerPropertyRage",1,2)
YAMB CD 1
YAMB B 2 A_GiveInventory("YamatoStock",1)
YAMB B 1 A_GiveInventory("YamatoStock",1)
YAMB B 0 A_TakeInventory("YamatoSpinFlag",20)
Goto Ready+2

Flash:
TNT1 A 0
TNT1 A 0 A_JumpIfInventory("TheLastSamuraiAmmo",28,5)
TNT1 A 1 //A_GiveInventory ("YamatoStock",1)
TNT1 A 0 A_JumpIfInventory("YamatoStock",24,1)
loop
TNT1 A 0 A_TakeInventory("YamatoStock",19)
TNT1 A 0 A_GiveInventory("TheLastSamuraiAmmo",1)
goto Flash+2
TNT1 A 1 A_TakeInventory("YamatoStock",999)
goto Flash

BotFire:
TNT1 A 0 A_JumpIfCloser(250,"BotAltFire")
goto Fire+1
BotAltFire:
TNT1 A 0 A_GiveInventory("BotHugFlag",1)
TNT1 A 0 A_GiveInventory("YamatoSpinFlag",4)
BotAltFire2:
YAMB C 0 A_PlaySoundEx("weapon/topspin","Weapon")
YAMB C 1
YAMB D 0 A_PlaySoundEx("weapon/topspin","Weapon")
YAMB D 0 A_SpawnItemEx("YamatoAlt",0,8,33)
YAMB D 1 A_GiveInventory("YamatoStock",1)
YAMB C 0 A_Refire(2)
YAMB C 0 A_TakeInventory("BotHugFlag",999)
Goto AltfireEnd
YAMB C 0 A_JumpIfCloser(250,"BotAltFire")
YAMB C 0 A_TakeInventory("YamatoSpinFlag",1)
YAMB C 0 A_JumpIfInventory("YamatoSpinFlag",1,"BotAltFire2")
YAMB C 0 A_TakeInventory("BotHugFlag",999)
YAMB C 0 A_ClearRefire
Goto AltfireEnd
}
}

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

actor CBM_YamatomanJumpPowerGiver : PowerApropGiver {}
actor YamatomanSpinSlow : PowerSpeed
{
Powerup.Duration 0x7FFFFFFC
Speed 0.9
+POWERSPEED.NOTRAIL
+INVENTORY.ALWAYSPICKUP
}

actor YamatoSpinFlag : Inventory
{
inventory.amount 1
inventory.maxamount 4
}

actor YamatoStock : Inventory
{
inventory.amount 1
inventory.maxamount 999
}

actor Yamatoman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/6buster","Weapon")
TNT1 A 0 A_FireCustomMissile("YamatoM_Spear_H",random(7,3),1,8,random(5,10))
TNT1 A 0 A_FireCustomMissile("YamatoM_Spear_H",0,0,8,0)
TNT1 A 0 A_FireCustomMissile("YamatoM_Spear_H",random(-3,-7),0,8,random(5,10))
stop
}
}

actor YamatoM_Spear_H : BasicHelper
{
speed 1
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEX("YamatoM_Spear",0,0,0,momx,momy,momz,0,8+SXF_MULTIPLYSPEED)//8192
TNT1 A 0 A_JumpIfInTargetInventory("TheLastSamuraiAmmo",0,2)
TNT1 A 0 A_SpawnItemEX("YamatoM_Spear2",0,0,0,momx,momy,momz,0,8+8192)
TNT1 A 0
stop
}
}

actor YamatoM_Spear : ProjSpawnFuncActor
{
PROJECTILE
damagetype "YamatoM_Shot"
Obituary "$OB_YAMATOSPEAR"
+RIPPER
damage (60)
Radius 8
Height 8
speed 40
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 1
YAMB S 1
wait
}
}

actor YamatoM_Spear2 : YamatoM_Spear
{
damage (0)
-RIPPER
+DONTREFLECT
+SKYEXPLODE
+EXPLODEONWATER
states
{
Death:
YAMB S 0 A_SpawnItemEX("YamatoM_Spear3",0,0,0,0,0,0,0,1)
stop
}
}

actor YamatoM_Spear3 : ProjSpawnFuncActor
{
//-MISSILE
//-NOGRAVITY
+NOTELEPORT
+DROPOFF
+DONTBLAST
+SEEKERMISSILE
+THRUACTORS
//Renderstyle Translucent
//Alpha 0.95
reactiontime 300
damage (0)
Radius 5
Height 5
speed 40//20
scale 2.5
states
{
Spawn:
YAMB R 0
YAMB R 0 A_FaceTarget
YAMB R 1 A_RearrangePointers(0,0,AAPTR_TARGET)
goto SpawnWait
SpawnWait:
YAMB R 0 A_JumpIfCloser(92,"Return")
YAMB R 0 A_JumpIfInTargetInventory("YamatoSpinFlag",1,"SpawnWaitChance")
YAMB R 1 A_CountDown
loop
SpawnWaitChance:
YAMB RRR 2 A_JumpIfCloser(322,"SpawnDash")
YAMB RRRRRR 0 A_CountDown
goto SpawnWait

SpawnDash:
YAMB T 0 //A_SpawnItemEx("FX",0,0,0,0,0,0,0,1)
YAMB T 0 A_FaceTarget(90,90)
YAMB T 0 //A_ChangeVelocity(Cos(pitch)*12,0,Sin(pitch)*12,3)
YAMB T 0 A_SeekerMissile(90,90,2)
YAMB TTTTTTTTTTTTTTT 1 A_JumpIfCloser(92,"Return")
YAMB TTTTTTTTTTTTTTTT 0 A_CountDown
YAMB T 1 A_JumpIfCloser(92,"Return")
goto SpawnWait

Return:
TNT1 A 0 A_GiveToTarget("YamatoPickup",1)
stop
Death:
TNT1 A 1
stop
}
}
/*
actor YamatoM_Spear3_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_SpawnItemEx("YamatoM_Spear3_FX",0,0,0,0,0,0,0,1)
stop
}
}

actor YamatoM_Spear3_FX : BasicClientSide
{
States
{
Spawn:
YAMB RT 1
loop
}
}
*/
actor YamatoAlt : BasicImplosion
{
Damagetype "YamatoM_Spin"
Obituary "$OB_YAMATOSPIN"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(50+CallACS("core_checkrune",RUNE_SPREAD,2)*100,150,0,0,16)
stop
}
}

actor YamatoPickup : CustomInventory
{
inventory.pickupmessage "Picked up a spear tip."
inventory.pickupsound ""
States
{
Pickup:
TNT1 A 0 A_GiveInventory("YamatoStock",12)
TNT1 A 0 A_PlaySound("item/energyup",3,0.75)
stop
}
}



actor Yamatoman_W_NormalBar : NormalBar {Args 4,236}