actor Protoman : ClassBase
{
Player.ScoreIcon "C_00A0X"
player.displayname "Protoman"
player.soundclass "protomanc"

player.maxhealth 850
health 850
player.jumpz 10
player.forwardmove 0.83, 0.83
player.sidemove 0.81, 0.81

player.startitem "CBM_BaseFlagPack"
player.startitem "ModeWeps"

player.startitem "IsProtoman_F"
player.startitem "Protoman_W"
player.startitem "NuclearSkidAmmo", 500

player.startitem "CopyNerfGiver_P"

States
{
Spawn:
PROM A 0
PROM B 1
PROM A 1
PROM AY 5
Goto Spawn+2
See:
PROM BCDE 5
Goto Spawn
Missile:
PROM F 0 A_JumpIfInventory("SlideVivifyFlag",1,"Slide")
PROM F 5
PROM G 4
goto Spawn+2
Slide:
PROM WWWWWWWWWWWWWWWWWWWW 1 A_JumpIfInventory("VivifyDelay7",1,"SlideJump")
goto Spawn
SlideJump:
PROM N 2
PROM NNNNNNNNNNNNNNNNNN 1 A_JumpIf(z-floorz==0,"Spawn")
goto Spawn

ClassPain:
PROM H 0
goto MegamanPain
ClassDeath:
PROM H 0
goto MegamanDeath
}
}

//Proto Item zone

actor ProtoCoilTeleport : RushTeleport
{
states
{
Spawn:
PJET F 0
PJET F 6
PJET F 0 A_ChangeFlag("NOINTERACTION",0)
PJET FFFFFFFFFF 1 A_CheckFloor("Next")
Next:
PJET F 0 //A_ChangeFlag("NOGRAVITY",0)
Goto Death
Death:
TNT1 A 0 A_SpawnItemEx("ProtoCoil",0,0,3,0,0,momz,0,32)
stop
}
}

actor ProtoCoil : Rush
{
states
{
Spawn:
PJET F 0 
PJET F 0 A_JumpIfInventory("Once",1,"Death")
PJET F 0 A_GiveInventory("Once",1)
PJET F 0 A_ChangeFlag("MISSILE",0)
PJET F 0 A_ChangeVelocity(0,0,-32,CVF_REPLACE)
PJET F 1 A_JumpIf(z-floorz<=0,"Look")
Goto Spawn+2

Look:
PJET G 0 A_ChangeFlag("NOCLIP",0)
PJET GFHH 1
LookLoop:
PJET I 0 //A_Chase("")
PJET III 1 A_JumpIf(CallACS("core_getPlayersInRadius",80) > 0,"Melee")
PJET I 0 //A_Chase("")
PJET III 1 A_JumpIf(CallACS("core_getPlayersInRadius",80) > 0,"Melee")
PJET I 0 A_CountDown
loop

Melee:
PJET J 0 A_JumpIfInTargetInventory("StrongSpring",1,"Melee2")
PJET J 18 A_RadiusGive("SpringActivate",80+16,RGF_PLAYERS|RGF_NOSIGHT,1)
PJET J 0 A_Die
Goto Death
Melee2:
PJET J 18 A_RadiusGive("SpringActivate2",80+16,RGF_PLAYERS|RGF_NOSIGHT,1)
PJET J 0 A_Die
Goto Death
Death:
PJET J 0 A_SpawnItemEx("ProtoAssistDeathFX",0,0,16,0,0,0,0,1+32)
stop
}
}

actor ProtoAssistDeathFX : BasicGraphicEffect
{
+FORCEXYBILLBOARD
+BRIGHT
States
{
SpawnFrame:
NMFX OBCE 2
stop
}
}

actor ProtoMarineTeleport : RushMarineTeleport
{
states
{
Spawn:
PJET F 0
PJET F 7 
PJET F 0 A_SpawnItemEx("ProtoMarineGiver",0,0,0,0,0,0,0,32)
stop
}
}

actor ProtoMarineGiver : RushMarineGiver
{
states
{
Spawn:
PJET F 0
PJET F 0 A_JumpIfInventory("Once",1,"Death")
PJET F 0 A_GiveInventory("Once",1)
PJET F 0 A_ChangeFlag("MISSILE",0)
PJET F 0 A_ChangeVelocity(0,0,-32,CVF_REPLACE)
PJET F 1 A_JumpIf(z-floorz<=0,"Look")
Goto Spawn+2
Look:
PJET G 0 A_ChangeFlag("NOCLIP",0)
PJET GFHH 1
LookLoop:
PJET L 0 //A_Chase("")
PJET LLL 1 A_JumpIf(CallACS("core_getPlayersInRadius",80,PRF_CLOSESTPOINTER,AAPTR_TRACER) > 0,"Melee")
PJET L 0 //A_Chase("")
PJET LLL 1 A_JumpIf(CallACS("core_getPlayersInRadius",80,PRF_CLOSESTPOINTER,AAPTR_TRACER) > 0,"Melee")
PJET L 0 A_CountDown
loop
Melee:
PJET L 0 A_GiveInventory("ProtoMarineActivate",1,AAPTR_TRACER)
stop
Death:
PJET L 0 A_SpawnItemEx("ProtoAssistDeathFX",0,0,16,0,0,0,0,1+32)
stop
}
}

actor ProtoMarineActivate : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEX("ProtoMarineActivater")
stop
}
}

actor ProtoMarineActivater : BasicWatcher
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("RushMarineCounter",1,"Reset")
TNT1 A 0 A_GiveToTarget("RushMarineCounter",20)
TNT1 A 0 A_GiveToTarget("ProtoMarineVisual",1)
stop
Reset:
TNT1 A 0 A_GiveToTarget("RushMarineCounter",20)
stop
}
}

actor ProtoMarineVisual : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("ProtoMarineWarper")
TNT1 A 0 ACS_NamedExecuteAlways("core_rushmarineflight",0)
stop
}
}

actor ProtoMarineWarper : BasicGraphicEffect
{
States
{
SpawnFrame:
PJET M 1 A_JumpIFInTargetInventory("IsUnderwater",1,"Marine")
NotUnderwater:
TNT1 A 1 A_JumpIFInTargetInventory("IsUnderwater",1,"MarineStart")
TNT1 A 1 A_JumpIFInTargetInventory("RushMarineCounter",1,"NotUnderwater")
stop
MarineStart:
TNT1 A 1 A_Warp(AAPTR_TARGET,0,0,0,0,WARPF_NOCHECKPOSITION|WARPF_INTERPOLATE)//8+16
Marine:
PJET NNNMMM 1 A_Warp(2,0,0,0,0,8+16)
PJET M 1 A_JumpIFInTargetInventory("RushMarineCounter",1,"SpawnLoop")
PJET M 0 A_SpawnItemEx("ProtoAssistDeathFX",0,0,0,0,0,0,0,SXF_WEPFXCOLOR)
stop
SpawnLoop:
PJET M 0
goto SpawnFrame
}
}


actor ProtoJetTeleport : RushJetTeleport
{
states
{
Spawn:
PJET F 0
PJET F 6
PJET F 0 A_ChangeFlag("NOINTERACTION",0)
PJET FFFFFFFFFF 1 A_CheckFloor("Next")
Goto Next
Next:
PJET F 0 //A_ChangeFlag("NOGRAVITY",0)
Goto Death
Death:
TNT1 A 0 A_SpawnItemEx("ProtoJetGiver",0,0,3,0,0,momz,0,32)
stop
}
}

actor ProtoJetGiver : RushJetGiver
{
states
{
Spawn:
PJET F 0
PJET F 0 A_JumpIfInventory("Once",1,"Death")
PJET F 0 A_GiveInventory("Once",1)
PJET F 0 A_ChangeFlag("MISSILE",0)
PJET F 0 A_ChangeVelocity(0,0,-32,CVF_REPLACE)
PJET F 1 A_JumpIf(z-floorz<=0,"Look")
Goto Spawn+2
Look:
PJET G 0 A_ChangeFlag("NOCLIP",0)
PJET GFHH 1
LookLoop:
PJET A 0 //A_Chase("")
PJET AAA 1 A_JumpIf(CallACS("core_getPlayersInRadius",80,PRF_CLOSESTPOINTER,AAPTR_TRACER) > 0,"Melee")
PJET A 0 //A_Chase("")
PJET AAA 1 A_JumpIf(CallACS("core_getPlayersInRadius",80,PRF_CLOSESTPOINTER,AAPTR_TRACER) > 0,"Melee")
PJET A 0 A_CountDown
loop
Melee:
PJET A 0 A_GiveInventory("ProtoJetActivate",1,AAPTR_TRACER)
stop
Death:
PJET A 0 A_SpawnItemEx("ProtoAssistDeathFX",0,0,16,0,0,0,0,1+32)
stop
}
}

actor ProtoJetActivate : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEX("ProtoJetActivater")
stop
}
}

actor ProtoJetActivater : BasicWatcher
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_JumpIfInTargetInventory("RushJetCounter",1,"Reset")
TNT1 A 0 A_GiveToTarget("RushJetCounter",8)
TNT1 A 0 A_GiveToTarget("ProtoJetVisual",1)
stop
Reset:
TNT1 A 0 A_GiveToTarget("RushJetCounter",8)
stop
}
}

actor ProtoJetVisual : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_SpawnItemEx("ProtoJetWarper")
TNT1 A 0 ACS_NamedExecuteAlways("core_rushjetflight",0)
stop
}
}

actor ProtoJetWarper : BasicGraphicEffect
{
States
{
SpawnFrame:
TNT1 A 0
PJET BBBBCCCC 1 A_Warp(2,0,0,0,0,8+16)
PJET B 1 A_JumpIFInTargetInventory("RushJetCounter",1,"SpawnLoop")
PJET B 0 A_SpawnItemEx("ProtoAssistDeathFX",0,0,0,0,0,0,0,SXF_WEPFXCOLOR)
stop
SpawnLoop:
PJET B 0
goto SpawnFrame
}
}


//Leftover items


actor ProtoCoilItem : BasicItemPickup
{
inventory.pickupmessage "$PU_PROTOCOIL"
Tag "$TAG_PROTOCOIL"
inventory.icon "PCUP"
states
{
Spawn:
PJET K 1
loop
Use:
TNT1 A 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_SpawnItemEx("ProtoCoilTeleport",81,0,256,0,0,-32,0,32)
stop
}
}

actor ProtoMarineItem : BasicItemPickup
{
inventory.pickupmessage "$PU_PROTOMARINE"
Tag "$TAG_PROTOMARINE"
inventory.icon "PMUP"
states
{
Spawn:
PJET O 1
loop
Use:
TNT1 A 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_JumpIfInventory("RushmarineCounter",1,2)
TNT1 A 0 A_SpawnItemEx("ProtoMarineTeleport",40,0,256,0,0,-32,0,32)
stop
TNT1 A 0 A_GiveInventory("RushmarineCounter",20)
stop
}
}

actor ProtoJetItem : BasicItemPickup
{
inventory.pickupmessage "$PU_PROTOJET"
Tag "$TAG_PROTOJET"
inventory.icon "PJUP"
states
{
Spawn:
PJET D 1
loop
Use:
TNT1 A 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_JumpIfInventory("RushJetCounter",1,2)
TNT1 A 0 A_SpawnItemEx("ProtoJetTeleport",40,0,256,0,0,-32,0,32)
stop
TNT1 A 0 A_GiveInventory("RushJetCounter",8)
stop
}
}
