actor Shadowman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_3H"
dropitem "ShadowBladeWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Obituary "$OB_SHADOWBLADE"
weapon.ammotype "CloakAmmo"
weapon.ammotype2 "CaltropAmmo"
States
{
Spawn:
C_03 H 1
loop

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

Ready:
SHAH A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_SHADOWMAN)
SHAH A 0 A_GunFlash("Flash",1)
SHAH A 0 A_JumpIfInventory("CloakFlag",1,"ReadyCloak")
goto Ready2
ReadyCloak:
SHAH A 1 A_WeaponReady
SHAH A 0 A_JumpIfInventory("CloakAmmo",1,"ReadyCloak")
SHAH A 0 A_GiveInventory("ShadowmanFlashInvisOff_P",1)
goto Ready2
Ready2:
SHAH A 0 A_JumpIfInventory("CloakFlag",1,"ReadyCloak")
SHAH A 0 A_JumpIfInventory("CloakAmmo",56,"Ready3")
SHAH A 5 A_WeaponReady(8)
SHAH A 0 A_GiveInventory("CloakAmmo",2)
SHAH A 0 A_GiveInventory("CaltropAmmo",2)
loop
Ready3:
SHAH A 5 A_WeaponReady
SHAH A 0 A_GiveInventory("CloakAmmo",2)
SHAH A 0 A_GiveInventory("CaltropAmmo",2)
loop

Fire:
SHAH A 0 A_TakeInventory("ShadowSlide",1)
SHAH A 0 A_GiveInventory("ShadowmanFlashInvisOff_P",1)
SHAH A 0 A_GiveInventory("Shadowman_Fire_P")
SHAH A 0 A_Refire(1)

SHAH B 2
SHAH B 2 OffSet(-70,72)A_GiveInventory("ShadowmanFlashInvisOff_P",1)
SHAH B 2 OffSet(-121,112)
SHAH C 2 OffSet(1,33)A_GiveInventory("CloakAmmo",2)
SHAH C 2 OffSet(-21,56)A_GiveInventory("CaltropAmmo",2)
SHAH C 2 OffSet(-35,84)
TNT1 A 4
SHAH A 2 OffSet(-2,69)A_GiveInventory("CloakAmmo",2)
SHAH A 2 OffSet(-1,48)A_GiveInventory("CaltropAmmo",2)
SHAH A 2 A_WeaponReady(14)
goto Ready2

Flash:
TNT1 A 0 A_JumpIfInventory("VivifyDelay5",1,"Flash.Caltrop")
TNT1 A 1 A_GiveInventory("ShadowmanFlashState_P",1)
loop
Flash.Caltrop:
TNT1 A 0 A_TakeInventory("VivifyDelay5")
TNT1 A 0 A_GunFlash("Flash",0)
stop

Altfire:
SHAH A 0 A_JumpIfInventory("CloakAmmo",56,"Altfire2")
goto AltfireSlide
AltfireSlide:
SHAH G 0 A_GiveInventory("ShadowmanSliding_P",1)
SHAH G 0 A_Refire(1)
SHAH G 1
SHAH G 1 A_GiveInventory("ShadowmanFlashInvisOff_P",1)
SHAH GGGGGGGGGGGGGGGGGGGGGGG 1 A_WeaponReady(10)
goto Ready2
Altfire2:
SHAH A 0 A_TakeInventory("CloakAmmo",2)
SHAH A 0 A_SpawnItemEx("ShadowCloakSmokeStartFX",0,0,28,0,0,0,0,1)
SHAH A 0 A_SpawnItemEx("ShadowCloakSmoke_H",0,0,28,0,0,0,0,1)
SHAH A 10 A_GiveInventory("ShadowmanFlashInvisOn_P",1)
goto ReadyCloak
}
}

actor CloakAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 56
+INVENTORY.IGNORESKILL
}
actor CaltropAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 140
+INVENTORY.IGNORESKILL
}

actor ShadowmanFiredFlag : OnceC{}
actor CloakFlag : OnceC{}

actor CloakFlagDelay : Inventory
{
inventory.amount 1
inventory.maxamount 8
}

actor PowerShadowmanInvis : PowerInvisibility
{
+DONTSPLASH
Powerup.Strength 100
Powerup.Duration -25
Powerup.Mode "Translucent"
+INVENTORY.ALWAYSPICKUP
}

actor ShadowmanInvisAlphaGiver : PowerApropGiver {}
actor ShadowmanInvisAlpha : Base_CBM_PropertyPower {}

actor ShadowSlide : PowerSpeed
{
Speed 2.5
Powerup.Duration 25
}

actor ShadowmanItem : BasicClassItem
{
inventory.icon "Sha2Icon"
inventory.pickupmessage "Poison not included."
Tag "Toss Shadow Caltrops"
states
{
Spawn:
SHAH "]" 1
loop
UseCBM:
TNT1 A 0 A_JumpIfInventory("CaltropAmmo",70,"Use2")
fail
Use2:
TNT1 A 0 A_TakeInventory("CaltropAmmo",20)
TNT1 A 0 A_TakeInventory("CaltropAmmo",50,1)
TNT1 A 0 A_GiveInventory("VivifyDelay5",1)
TNT1 A 0 A_FireCustomMissile("ShadowCaltropToss_H",0,1,8,0)
TNT1 A 0 A_FireCustomMissile("ShadowCaltropToss_H",10,0,8,0)
TNT1 A 0 A_FireCustomMissile("ShadowCaltropToss_H",-10,0,8,0)
TNT1 A 0 A_JumpIfInventory("ShadowmanInvisAlpha",1,"Use3")//PowerShadowmanInvis
TNT1 A 0 A_PlaySound("weapon/Shad_Kunai",4,0.75)
fail
Use3:
TNT1 A 0 A_SpawnItemEx("ShadowCaltropCloakToss_H")
fail
}
}

actor ShadowmanFlashState_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("CloakFlag",1,"Pickup2")
stop
Pickup2:
//TNT1 A 0 A_SpawnItemEx("CloakVisualSpawner",0,0,0,momx,momy,momz,0,9,0)
TNT1 A 0 A_GiveInventory("CloakFlagDelay",1)
TNT1 A 0 A_JumpIfInventory("CloakFlagDelay",8,"Pickup3")
stop
Pickup3:
TNT1 A 0 A_GiveInventory("CaltropAmmo",2)
TNT1 A 0 A_TakeInventory("CloakAmmo",1)
TNT1 A 0 A_TakeInventory("CloakAmmo",1,1)
TNT1 A 0 A_TakeInventory("CloakFlagDelay",999)
stop
}
}

actor ShadowmanSliding_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("ShadowSlide",1)
TNT1 A 0 A_TakeInventory("CloakAmmo",6)
TNT1 A 0 A_TakeInventory("CloakAmmo",6,1)
//TNT1 A 0 A_TakeInventory("CloakFlag",99)
TNT1 A 0 A_PlaySoundEx("weapon/tengudash","Weapon")
TNT1 A 0 A_GiveInventory("ShadowmanFlashInvisOff_P",1)
stop
}
}

actor ShadowmanFlashInvisOn_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("CloakFlag",1)
//TNT1 A 0 A_GiveInventory("PowerShadowmanInvis",1)
TNT1 A 0 A_GiveInventory("ShadowmanInvisAlphaGiver",1)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_cloakplayer",0,true)//mmrf maps
TNT1 A 0 ACS_NamedExecuteWithResult("core_cantseekplayer",0,true)
TNT1 A 0 ACS_NamedExecuteWithResult("core_dontidentifytargetplayer",0,true)
stop
}
}

actor ShadowmanFlashInvisOff_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("CloakFlag",1,1)
stop
TNT1 A 0 A_TakeInventory("CloakFlag")
TNT1 A 0 A_TakeInventory("CloakFlagDelay")
//TNT1 A 0 A_TakeInventory("PowerShadowmanInvis")
TNT1 A 0 A_TakeInventory("ShadowmanInvisAlpha")
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_cloakplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_cantseekplayer",0,false)
TNT1 A 0 ACS_NamedExecuteWithResult("core_dontidentifytargetplayer",0,false)
stop
}
}

actor Shadowman_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_PlaySoundEx("weapon/shadow","Weapon")
TNT1 A 0 A_JumpIfInventory("ShadowmanFiredFlag",1,3)
TNT1 A 0 A_GiveInventory("ShadowmanFiredFlag",1)
TNT1 A 0 A_FireCustomMissile("ShadowBlade_CBM1",0,1,0,0)
stop
TNT1 A 0 A_TakeInventory("ShadowmanFiredFlag")
TNT1 A 0 A_FireCustomMissile("ShadowBlade_CBM2",0,1,0,0)
stop
}
}

actor ShadowM_Blade1Protect : PowerProtection
{
Powerup.Duration 12
DamageFactor "ShadowM_Blade1", 0.15
}
actor ShadowM_Blade2Protect : PowerProtection
{
Powerup.Duration 12
DamageFactor "ShadowM_Blade2", 0.15
}

actor ShadowBlade_CBM1 : ProjSpawnFuncActor
{
var int user_TranslateWhiteColors;
PROJECTILE
damagetype "ShadowM_Blade1"
Obituary "$OB_SHADOWBLADE"
+RIPPER
Damage (250)//150
Radius 14//7
Height 14
Speed 40//32
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Jump(256,"Spawn1","Spawn2")
Spawn1:
SHAH KLKL 3
SHAH K 0 A_ScaleVelocity(-1)
SHAH KLKL 3
stop
Spawn2:
SHAH LKLK 3
SHAH L 0 A_ScaleVelocity(-1)
SHAH LKLK 3
stop
Death:
TNT1 A 1
stop
}
}

actor ShadowBlade_CBM2 : ShadowBlade_CBM1
{
damagetype "ShadowM_Blade2"
}

actor ShadowCaltropToss_H : BasicHelper
{
Speed 1
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("ShadowCaltropToss",0,0,0,momx*frandom(23,27),momy*frandom(23,27),momz*frandom(23,27),0,8)
stop
}
}

actor ShadowCaltropToss : ProjSpawnFuncActor
{
PROJECTILE
damagetype "ShadowM_Caltrop"
Obituary "$OB_SHADOWCALTROPX"
-NOGRAVITY
+SKYEXPLODE
//+THRUACTORS
//+THRUGHOST
+DONTREFLECT
+DONTSPLASH
+BOUNCEONWALLS
+BOUNCEONFLOORS
+BOUNCEONCEILINGS
bouncefactor 0.40
wallbouncefactor 0.55
BounceCount 4
gravity 0.90
Damage (30)
Radius 16
Height 16
Speed 26
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_ChangeVelocity(0,0,0.25*random(15,21))
TNT1 A 0 ThrustThing(angle*256/360,0,1,0)
TNT1 A 0 A_Jump(256,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
Spawn1:
SHAH MNOPQRST 2
loop
Spawn2:
SHAH TSRQPONM 2
loop
XDeath:
Crash:
TNT1 A 0
TNT1 A 1
stop
Death:
TNT1 A 0 A_SpawnItemEx("ShadowCaltropSet",0,0,0,0,0,0,0,1)
TNT1 A 1
stop
}
}

actor ShadowCaltropSet : ProjSpawnFuncActor
{
PROJECTILE
damagetype "ShadowM_Caltrop"
Obituary "$OB_SHADOWCALTROP"
-NOGRAVITY
+THRUGHOST
+DONTBLAST
+BOUNCEONCEILINGS
+DONTSPLASH
+HITTRACER
+NOEXPLODEFLOOR
+STEPMISSILE
maxstepheight 24
BounceCount 3
BounceFactor 1.0
WallBounceFactor 0.15
gravity 1.0
ReactionTime 61
Damage (100)
Radius 16
Height 16
speed 20
Scale 2.5
States
{
Spawn:
SHAH M 0
SHAH M 0 A_PlaySound("DuckHunt/Flap",1,0.85)
Spawn2:
SHAH M 0 A_JumpIf(ReactionTime<=Pitch,"Death")
SHAH M 6 A_CountDown
loop
Respawn:
TNT1 A 0 A_SetPitch(61-ReactionTime+Pitch+1)
TNT1 A 1 A_SpawnItemEx("ShadowCaltropRespawn",0,0,0,0,0,0,0,513)
stop
XDeath:
TNT1 A 1 A_PlaySound("S3_K/Spikes",1,0.65)
stop
Crash:
TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("cbm_istracerally")==1,"Respawn")
goto XDeath
Death:
TNT1 A 1
stop
}
}

actor ShadowCaltropRespawn : ShadowCaltropSet
{
+THRUACTORS
RenderStyle Translucent
Alpha 0.5
states
{
Spawn:
SHAH M 0
SHAH M 5 A_JumpIf(ReactionTime<=pitch,"Death")
SHAH M 1 A_ChangeFlag("THRUACTORS",0)
SHAH M 0 A_SetTranslucent(1.0)
goto Spawn2
}
}

actor ShadowCloakSmokeStartFX : BasicExplosion
{
+FORCEXYBILLBOARD
RenderStyle Translucent
Alpha 0.75
ReactionTime 8
Scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_PlaySound("weapon/Shad_Poof",1,1.0)
TNT1 A 0 A_Jump(256,"Spawn1","Spawn2")
Spawn1:
SHAH W 2
TNT1 A random(1,2)
SHAH W 2
TNT1 A random(1,2)
SHAH W 2
TNT1 A random(1,2)
SHAH V 2
TNT1 A random(1,2)
SHAH U 2
stop
Spawn2:
SHAH Z 2
TNT1 A random(1,2)
SHAH Z 2
TNT1 A random(1,2)
SHAH Z 2
TNT1 A random(1,2)
SHAH Y 2
TNT1 A random(1,2)
SHAH X 2
stop
}
}

actor ShadowCloakSmoke_H : BasicExplosion
{
ReactionTime 35
RenderStyle None
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Warp(2,0,0,28,0,8)
TNT1 A 1 A_SpawnItemEx("ShadowCloakSmokeFX",random(-15,15),random(-20,20),random(-28,42),0,0,0,0,1)
TNT1 A 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
TNT1 A 0 A_CountDown
loop
Death:
TNT1 A 1
stop
}
}

actor ShadowCaltropCloakToss_H : BasicExplosion
{
RenderStyle None
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("ShadowCaltropCloakTossFX")
TNT1 A 0 A_SpawnItemEx("ShadowCaltropCloakTossFX2")
TNT1 A 1
stop
}
}

actor ShadowCaltropCloakTossFX : BasicGraphicEffect
{
var int user_translateLikePlayer;
Translation "192:192=4:4","198:198=198:198"
RenderStyle Translucent
Alpha 0.50
States
{
Spawn:
TNT1 A 0
TNT1 A 0 //ACS_NamedExecuteWithResult("core_copytranslation")
SHAM R 0
SHAM R 3
SHAM S 5
stop
}
}
actor ShadowCaltropCloakTossFX2 : BasicGraphicEffect
{
RenderStyle None
ReactionTime 2
States
{
SpawnFrame:
TNT1 A 0
TNT1 AAA 0 A_SpawnItemEx("ShadowCloakSmokeFX2",random(-15,15),random(-20,20),28+random(19,40),0,0,0,0,1)
TNT1 AAA 0 A_SpawnItemEx("ShadowCloakSmokeFX2",random(-15,15),random(-20,20),28+random(-4,17),0,0,0,0,1)
TNT1 AAA 0 A_SpawnItemEx("ShadowCloakSmokeFX2",random(-15,15),random(-20,20),28+random(-27,-6),0,0,0,0,1)
TNT1 A 8 A_CountDown
loop
}
}

actor ShadowCloakSmokeFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
RenderStyle Translucent
Alpha 0.75
ReactionTime 8
States
{
SpawnFrame:
TNT1 A 0
TNT1 A 0 A_SetScale(ScaleX+frandom(-1,1))
TNT1 A 0 A_Jump(256,"Spawn0","Spawn2")
Spawn0:
TNT1 A 0
TNT1 A 0 A_CountDown
TNT1 A 0 A_Jump(256,"S1.U","S1.V","S1.W")
S1.U:
SHAH U 2
goto Spawn0
S1.V:
SHAH V 2
goto Spawn0
S1.W:
TNT1 A 2
goto Spawn1
Spawn1:
TNT1 A 0
TNT1 A 0 A_CountDown
TNT1 A 0 A_Jump(256,"S1.U","S1.V")
goto S1.U

Spawn2:
TNT1 A 0
TNT1 A 0 A_CountDown
TNT1 A 0 A_Jump(256,"S1.X","S1.Y","S1.Z")
S1.X:
SHAH X 2
goto Spawn2
S1.Y:
SHAH Y 2
goto Spawn2
S1.Z:
TNT1 A 2
goto Spawn3
Spawn3:
TNT1 A 0
TNT1 A 0 A_CountDown
TNT1 A 0 A_Jump(256,"S1.X","S1.Y")
goto S1.X
}
}
actor ShadowCloakSmokeFX2 : ShadowCloakSmokeFX
{
ReactionTime 3
Scale 1.0
}


actor Shadowman_W_NormalBar : NormalBar {Args 34,239}
actor Shadowman_W_SecondBar : SecondBar {Args 4,94}