actor NinjaSpyBossWeapon : MegaBuster
{
tag "Shahanshah"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Weapon.SlotNumber 2
Obituary "$OB_SHAHANSHAH"
+INVENTORY.UNDROPPABLE
weapon.ammotype "BossJumpCharge"
weapon.ammotype2 "BossRageCharge"
+WEAPON.AMMO_OPTIONAL
Scale 2.0
States
{
Spawn:
TNT1 A 0
stop
Ready:
SXH2 N 0 ACS_NamedExecuteAlways("GiveExecution",0)
SXH2 S 0 ACS_ExecuteAlways(991,0,535)
SXH2 N 1 A_WeaponReady
Goto Ready+1
Deselect:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
SXH2 N 1 A_Lower
Loop
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
SXH2 N 1 A_Raise
Loop
Fire:
SXH2 N 0 A_JumpIfInventory("NinjaCloak",1,"CloakCancelX")
SXH2 N 0 A_FireCustomMissile("NinjaShahanshah",0,0,0,0)
SXH2 OPPP 1
SXH2 P 0 A_PlaySoundEx("weapon/slashclaw","Weapon")
SXH2 P 0 A_FireCustomMissile("NinjaStarToss",0,0,0,0)
SXH2 P 0 A_FireCustomMissile("NinjaStarToss",7,0,0,0)
SXH2 P 0 A_FireCustomMissile("NinjaStarToss",-7,0,0,0)
SXH2 QR 1
TNT1 A 40
SXH2 STN 1
SXH2 N 0 A_Refire
Goto Ready+1
AltFire:
SXH2 N 0 A_JumpIfInventory("NinjaCloak"    ,1  ,"CloakCancel")
SXH2 N 0 A_JumpIfInventory("BossRageCharge",500,"Rage")
SXH2 N 0 A_JumpIfInventory("BossJumpCharge",50,"Cloak")
SXH2 N 1
Goto Ready+1
Cloak:
SXH2 N 2
SXH2 N 0 A_PlaySoundEx("weapon/centaurflashNS","Item",0,0)
SXH2 N 0 A_GiveInventory("NinjaCloak",1)
SXH2 N 0 A_GiveInventory("JumpChargeStop",1)
SXH2 N 10 ACS_ExecuteAlways(191,0,APROP_Speed,125,100)
goto ReadyCloak
ReadyCloak:
SXH2 S 0 ACS_ExecuteAlways(991,0,535)
SXH2 N 1 A_WeaponReady
SXH2 N 0 A_TakeInventory("BossJumpCharge",1)
SXH2 N 0 A_JumpIfInventory("BossJumpCharge",1,"ReadyCloak")
Goto CloakCancel
CloakCancel:
SXH2 N 4 
SXH2 N 0 A_PlaySoundEx("weapon/centaurflashNS","Item",0,0)
SXH2 N 0 A_TakeInventory("BossJumpCharge",50)
SXH2 N 0 A_TakeInventory("NinjaCloak",35)
SXH2 N 0 A_TakeInventory("JumpChargeStop",1)
SXH2 N 3 ACS_ExecuteAlways(191,0,APROP_Speed,100,100)
SXH2 NNNNNNNNNNNN 1 A_WeaponReady(WRF_NOSECONDARY)
goto Ready+1
CloakCancelX: 
SXH2 N 0 A_PlaySoundEx("weapon/centaurflashNS","Item",0,0)
SXH2 N 0 A_TakeInventory("BossJumpCharge",50)
SXH2 N 0 A_TakeInventory("NinjaCloak",35)
SXH2 N 0 A_TakeInventory("JumpChargeStop",1)
SXH2 N 0 ACS_ExecuteAlways(191,0,APROP_Speed,100,100)
goto Fire+1
Rage:
SXH2 N 0 A_PlaySoundEx("NinjaSpy/Rage","Item")
SXH2 N 0 A_TakeInventory("BossRageCharge",500)
SXH2 N 0 SetPlayerProperty(0,1,0)
SXH2 TS 5
SXH2 N 0 A_FireCustomMissile("BlindingFlash",0,0,8,0)
SXH2 N 0 A_TakeInventory("BlurryRage",1)
TNT1 A 10 A_GiveInventory("BlurryRage",1)
SXH2 STN 5
SXH2 N 0 SetPlayerProperty(0,0,0)
goto Ready+1
NoAmmo:
SXH2 N 1 ACS_Execute(979,0)
SXH2 N 0 A_Refire
Goto Ready+1
}
}

actor NinjaShahanshah : SaxtonFist
{
speed 90
damagetype "SpyStabTry"
Obituary "$OB_SHAHANSHAH"
translation "192:192=3:3", "198:198=5:5"
damage (5)
States
{
Death:
F_PR B 0 A_Explode(5,20,0,0,20)
goto XDeath
XDeath:
F_PR B 0 A_Stop
F_PR B 2
F_PR A 2
F_PR BC 2
stop
}
}

actor SpyStabFront : BasicExplosion
{
translation "192:192=3:3", "198:198=5:5"
damagetype "BossInstagib"
Obituary "$OB_SHAHANSHAH"
Scale 2.5
states
{
Spawn:
TNT1 A 0
//TNT1 A 0 A_PlaySound("Pokemon/FireSpin",2,0.75)
TNT1 A 0 A_Explode(34,20,0,0,20)
//F_PR B 2
//F_PR A 2
//F_PR BC 2
stop
}
}

actor SpyStabBack : BasicExplosion
{
translation "192:192=3:3", "198:198=5:5"
damagetype "BossInstagib"
Obituary "$OB_BACKSTAB"
Scale 2.5
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySound("weapon/icewavebreak",2,1.0)
TNT1 A 0 A_Explode(140,15,0,0,15)
//6P53 LKJ 3
stop
}
}

actor NinjaStarToss
{
PROJECTILE
damagetype "BossInstagib"
Obituary "$OB_NINJASTAR"
-NOGRAVITY
//+THRUACTORS
//+THRUGHOST
+DONTREFLECT
+HEXENBOUNCE
+DONTSPLASH
+BOUNCEONWALLS
+BOUNCEONFLOORS
+BOUNCEONCEILINGS
bouncefactor 0.40
wallbouncefactor 0.55
BounceCount 4
gravity 0.90
-NOBOUNCESOUND
SeeSound "misc/scorebounce"
Damage (5)
Radius 16
Height 16
Speed 20
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 ThrustThingZ(0,17,0,1)
//TNT1 A 0 ThrustThing(angle*256/360,0,1,0)
TNT1 A 0 A_Jump(256,1,2)
Spawn1:
NSPS BC 2
loop
XDeath:
Crash:
TNT1 A 0
TNT1 A 1
stop
Death:
TNT1 A 0 A_SpawnItemEx("NinjaStarSet",0,0,0,0,0,0,0,1)
TNT1 A 1
stop
}
}

actor NinjaStarSet
{
PROJECTILE
damagetype "BossInstagib"
Obituary "$OB_NINJASTARTRAP"
-NOGRAVITY
+THRUGHOST
+DONTBLAST
+BOUNCEONCEILINGS
+DONTSPLASH
+HITTRACER
+NOEXPLODEFLOOR
+STEPMISSILE
maxstepheight 24
BounceCount 3
BounceFactor 1.0
WallBounceFactor 0.15
gravity 1.0
ReactionTime 61
Damage (7)
Radius 16
Height 16
speed 20
Scale 2.5
States
{
Spawn:
NSPS A 0
NSPS A 0 A_PlaySound("misc/scorebounce",1,0.85)
Spawn2:
NSPS A 0 A_JumpIf(ReactionTime<=Pitch,"Death")
NSPS A 6 A_CountDown
loop
XDeath:
TNT1 A 1 A_PlaySound("S3_K/Spikes",1,0.65)
stop
Crash:
TNT1 A 0 
goto XDeath
Death:
NSPS AAAAAAAAAA 1 A_FadeOut(0.1)
stop
}
}

actor PainSpyBackstabHit : BasicHitBaseF
{
var int user_A;
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetUserVar("user_HIT", ACS_ExecuteWithResult(257))
TNT1 A 0 A_TransferPointer(2,0,2,2)
TNT1 A 0 A_SetUserVar("user_A",angle)
TNT1 A 0 A_FaceTarget
TNT1 A 0 A_SetUserVar("user_A",angle-user_A)
TNT1 A 0 A_JumpIf((user_A>90&&user_A<270)||(user_A<-90&&user_A>-270),"DoBackstab")
TNT1 A 0 Thing_Move(0,user_HIT,1)
TNT1 A 3 A_SpawnItemEx("SpyStabFront",0,0,28)
stop
DoBackstab:
TNT1 A 0 Thing_Move(0,user_HIT,1)
TNT1 A 3 A_SpawnItemEx("SpyStabBack",0,0,28)
stop
}
}

// Rage //

actor BlindingFlash
{
-SOLID
+NOGRAVITY
PROJECTILE
damage 0
radius 1
height 1
damagetype "FlashStopperSH"
Obituary "$OB_BLINDINGFLASH"
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Explode(15,1000,0)
stop
}
}

actor BlurryRage : PowerupGiver
{
+INVENTORY.AUTOACTIVATE
+INVENTORY.ALWAYSPICKUP
Inventory.MaxAmount 0
Powerup.Type "PowerFake"
//Powerup.Mode "Translucent"
Powerup.duration -35
States
{
Spawn:
TNT1 A 0
Loop
}
}