actor Enker_W : BaseMM8BDMWep_CBM 
{
tag "$TAGC_KA"
dropitem "MirrorBusterWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Obituary "$OB_MIRRORREFLECT"
weapon.ammotype "MirrorChargeAmmo"
States
{
Spawn:
C_0K A 1
loop

Deselect:
ENKA C 0
goto DeselectSwap
Select:
ENKA C 0
goto SelectSwap

Ready:
ENKA C 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_ENKER)
goto Ready2
Ready2:
ENKA C 4 A_WeaponReady(8)
ENKA C 14 A_WeaponReady(8)
ENKA C 2 A_WeaponReady(8)
Ready3:
ENKA C 1 A_WeaponReady
wait

Fire:
ENKA C 0 A_JumpIfInventory("IsBot",1,"BotFire")
ENKA C 0 A_JumpIfInventory("EnkerAltCombo_F",1,"Fire_AltReset")
ENKA C 2 offset(21,47)
ENKA C 2 offset(43,50)
ENKA D 2 offset(41,54)A_GiveInventory("Enker_Fire_P")
ENKA D 8 offset(55,40)
ENKA D 2 offset(44,41)
ENKA C 2 offset(47,21)
ENKA C 2 offset(29,25)
ENKA C 2 offset(15,28)
ENKA C 2 offset(6,30)
goto Ready3

Fire_AltReset:
ENKA C 0 A_GiveInventory("Enker_ArmorReset_P")
ENKA C 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
ENKA C 0 A_TakeInventory("CBM_DisableJumpPower")
ENKA C 0 A_GunFlash("NoFlash",1)
ENKA C 0
goto Fire+2

Flash:
TNT1 A 1 A_JumpIfInventory("VivifyDelay3",1,2)
TNT1 A 0 A_JumpIfInventory("EnkerAbsorbCount",1,"Flash")
stop
Flash.Hit:
ENKA G 1 A_TakeInventory("VivifyDelay3",1)
TNT1 A 0 A_JumpIfInventory("EnkerAbsorbCount",1,1)
stop
ENKA G 1 A_JumpIfInventory("VivifyDelay3",1,"Flash.Hit")
TNT1 A 0 A_JumpIfInventory("EnkerAbsorbCount",1,1)
stop
ENKA H 1 A_JumpIfInventory("VivifyDelay3",1,"Flash.Hit")
TNT1 A 0 A_JumpIfInventory("EnkerAbsorbCount",1,1)
stop
ENKA H 1 A_JumpIfInventory("VivifyDelay3",1,"Flash.Hit")
TNT1 A 0 A_JumpIfInventory("EnkerAbsorbCount",1,"Flash")
stop

AltFire:
ENKA C 0 A_JumpIfInventory("EnkerAltCombo_F",1,"Altfire_Swipe")
ENKA C 0 A_GiveInventory("EnkerAbsorbCount",1)
ENKA C 0 A_GiveInventory("Enker_BasicArmor_P",1)
ENKA C 0 A_GiveInventory("SetDynamicArmorDosage")
ENKA C 0 A_GiveInventory("LastArmorCount",CallACS("core_getarmorinfo",1))
ENKA C 0 ACS_NamedExecuteWithResult("cbm_NoHitStunplayer",0,true)
ENKA C 0 ACS_NamedExecuteWithResult("core_stopplayer",0,1)
ENKA C 0 A_GiveInventory("CBM_DisableJumpPowerGiver",1)
ENKA C 0 A_PlaySoundEx("weapon/mirrorabsorb","Weapon")
ENKA C 2 Offset(27,48)
ENKA D 2 Offset(-10,62)A_GiveInventory("MirrorChargeAmmo",1)
ENKA F 0 A_GunFlash("Flash",1)
ENKA F 2 Offset(-13,55)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX")
//6
//ENKA FFFFFFFFFFFFFFF 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,22)//Man...
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX1")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX2")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX3")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX4")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX5")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX6")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX7")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX8")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX9")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX10")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX11")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX12")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX13")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX14")
ENKA F 2 Offset(-2,27)A_JumpIfInventory("EnkerAltCombo_F",1,"AltFireX15")
//30
ENKA D 0 A_GunFlash("NoFlash",1)
ENKA D 0 A_GiveInventory("Enker_ArmorReset_P")
ENKA D 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
ENKA D 0 A_TakeInventory("CBM_DisableJumpPower")
ENKA D 2 Offset(8,32)
ENKA C 2 Offset(20,23)
ENKA C 2 Offset(8,28)
goto Ready2+1

AltFireX1:goto AltFireX+1
AltFireX2:goto AltFireX+2
AltFireX3:goto AltFireX+3
AltFireX4:goto AltFireX+4
AltFireX5:goto AltFireX+5
AltFireX6:goto AltFireX+6
AltFireX7:goto AltFireX+7
AltFireX8:goto AltFireX+8
AltFireX9:goto AltFireX+9
AltFireX10:goto AltFireX+10
AltFireX11:goto AltFireX+11
AltFireX12:goto AltFireX+12
AltFireX13:goto AltFireX+13
AltFireX14:goto AltFireX+14
AltFireX15:goto AltFireX+15
AltFireX:
ENKA F 2 Offset(-13,55)A_WeaponReady(3)
ENKA FFFFFFFFFFFFFFF 2 offset(-2,27)A_WeaponReady(3)

ENKA D 0 A_GunFlash("NoFlash",1)
ENKA D 0 A_GiveInventory("Enker_ArmorReset_P")
ENKA D 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
ENKA D 0 A_TakeInventory("CBM_DisableJumpPower")
ENKA D 2 Offset(8,32)A_WeaponReady(11)
ENKA C 2 Offset(20,23)A_WeaponReady(11)
ENKA C 2 Offset(8,28)A_WeaponReady(11)
goto Ready2+1

Altfire_Swipe:
ENKA C 0 A_GiveInventory("Enker_ArmorReset_P")
ENKA C 0 ACS_NamedExecuteWithResult("core_stopplayer",0,0)
ENKA C 0 A_TakeInventory("CBM_DisableJumpPower")
ENKA C 0 A_GiveInventory("VivifyDelay6",1)
ENKA C 0 A_GunFlash("NoFlash",1)
ENKA C 0 A_Refire(1)
ENKA C 2 Offset(12,14)
ENKA C 2 Offset(-36,26)
ENKA D 0 A_PlaySoundEx("misc/enkerswing","Weapon")
ENKA D 2 Offset(-53,39)A_FireCustomMissile("EnkerMeleeCust",0,0,0,0)
ENKA D 2 Offset(15,32)
ENKA D 6 Offset(66,27)
ENKA C 2 Offset(85,15)
ENKA C 2 Offset(41,24)
ENKA C 2 Offset(13,29)
goto Ready2+2//Ready3

BotFire:
ENKA C 0 A_JumpIfInventory("EnkerAltCombo_F",1,"BotFire2")
ENKA C 0 A_JumpIfInventory("MirrorChargeAmmo",44,3)
ENKA C 0 //A_JumpIfCloser(256,"AltFire")
ENKA C 0 A_Jump(64,"AltFire")
ENKA C 0
goto Fire+1
BotFire2:
ENKA C 0 A_FaceTarget
ENKA C 0 A_JumpIfCloser(120,"Altfire_Swipe")
goto Fire+1
}
}

actor MirrorChargeAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 55
+INVENTORY.IGNORESKILL
}

actor EnkerAltCombo_F : Powerup
{
powerup.duration 41
}

actor LastArmorCount : Inventory
{
inventory.amount 1
inventory.maxamount 30000
}

actor EnkerAbsorbCount : OnceC {}

actor EnkerDashCooldown : Inventory 
{
inventory.amount 1
inventory.maxamount 112
}

actor EnkerDashSpeedTrail : PowerSpeed
{
powerup.duration 10
speed 1.0
}

actor EnkerDashItem : BasicClassItem
{
inventory.icon "ENK_ITEM"
inventory.pickupmessage "Castlevania speedruns hate it!"
Tag "Perform Enker Dash"
states
{
Spawn:
ENKA Z 1
wait
UseCBM:
TNT1 A 0 A_JumpIfInventory("EnkerDashCooldown",1,"No")
TNT1 A 0 A_JumpIf(z-floorz==0,"Activate")
fail
Activate:
TNT1 A 0 A_SpawnItemEX("EnkerDashCooldown_H",0,0,0)
TNT1 A 0 A_GiveInventory("Enker_ItemBoostCheck_P")
TNT1 A 0 A_GiveInventory("EnkerDashSpeedTrail")
fail
}
}

actor Enker_Fire_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("MirrorChargeAmmo",11,"Pickup2")
TNT1 A 0 A_PlaySoundEx("weapon/mirrordeflect","Weapon")
TNT1 A 0 A_FireCustomMissile("MirrorShotSmallCust",0,0,8,0)
stop
Pickup2:
TNT1 A 0 A_PlaySoundEx("weapon/mirrordeflect2","Weapon")
TNT1 A 0 A_TakeInventory("MirrorChargeAmmo",3)
TNT1 A 0 A_TakeInventory("MirrorChargeAmmo",8,1)
TNT1 A 0 A_FireCustomMissile("MirrorShotLargeCust",0,0,8,0)
stop
}
}

actor Enker_ArmorReset_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("EnkerAbsorbCount")
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_NoHitStunplayer",0,false)
TNT1 A 0 A_TakeInventory("DynamicArmorDosage")
TNT1 A 0 A_TakeInventory("BasicArmor")
TNT1 A 0 A_TakeInventory("LastArmorCount")
TNT1 A 0 A_TakeInventory("EnkerAltCombo_F")
stop
}
}

actor EnkerDashCooldown_H : BasicHelper
{
+SERVERSIDEONLY
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveToTarget("EnkerDashCooldown",112)
SpawnL:
TNT1 A 0 A_JumpIf(CallACS("core_targetexists")==0,"Death")
TNT1 A 1 A_TakeFromTarget("EnkerDashCooldown",1+CallACS("core_checkrune",RUNE_RAGE,2))
TNT1 A 0 A_JumpIfInTargetInventory("EnkerDashCooldown",1,"SpawnL")
stop
}
}

actor Enker_ItemBoostCheck_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_GiveInventory("BasicSlideDashFX_P")
TNT1 A 0 A_PlaySoundEx("weapon/fakedash","SoundSlot7")

TNT1 A 0 A_JumpIf(CallACS("cbm_IsInputingMovement"),"Booster")
goto NoBoost
Booster:
TNT1 A 0 A_ChangeVelocity(sin(CallACS("cbm_FetchInputDir",0))*40,sin(CallACS("cbm_FetchInputDir",1))*-40,0,3)
stop
NoBoost:
TNT1 A 0 A_ChangeVelocity(40,0,0,3)
stop
}
}

actor MirrorShotSmallCust : ProjSpawnFuncActor
{
PROJECTILE
damagetype "Enker_Shot"
Obituary "$OB_MIRRORREFLECT"
+BRIGHT
damage (160)
Radius 10
Height 8
speed 50
scale 2.5
States
{
Spawn:
MIRR CD 2
loop
}
}

actor MirrorShotLargeCust : MirrorShotSmallCust
{
damagetype "Enker_Shot2"
Obituary "$OB_MIRRORREFLECT"
Radius 16
Height 18
damage (350)
States
{
Spawn:
MIRR DE 2
loop
}
}

actor PainEnker_PushHit : Basic_PainFling_H{Args 22,0,2}
actor DeathEnker_PushHit : Basic_DeathFling_H{Args 44,44,0}

actor EnkerMeleeCust
{
PROJECTILE
damagetype "Enker_Push"
Obituary "$OB_MIRRORSPEAR"
+THRUACTORS
+DONTBLAST
+DONTSPLASH
+DONTREFLECT
ReactionTime 1
damage (0)
Radius 4
Height 4
speed 60
scale 2.5
States
{
Spawn:
TNT1 A 1
TNT1 A 1 A_CountDown
wait
Death:
TNT1 A 2 A_Explode(180,100,0,0,20)
stop
}
}

actor Enker_W_NormalBar : NormalBar {Args 229,76}
actor Enker_W_ScriptBar : ScriptBar {}