/////////////////////////////////////
//      ADVANCED SNIPER JOE        //
///////////////////////////////////// 

Actor SniperJoeAdvanced
{
Tag "Advanced Sniper Joe"
Translation "192:192=4:4", "198:198=93:93"
MONSTER
Species "SniperJoeAdvanced"
+NOBLOOD
+FLOORCLIP
-NOINFIGHTING
+DOHARMSPECIES
Health 100
Radius 20
Height 56
Speed 1 // 8
PainChance 100
PainChance "WindStorm", 100
PainChance "GravityHold", 100
PainChance "ConcreteShot", 100
PainChance "TornadoBlow", 100
PainChance "BlackHoleBomb", 100
PainChance "TimeStopper", 256
DamageFactor "Dummy", 0.0
SeeSound "item/rushdetect"
PainSound "monster/mm2pain"
DeathSound "monster/death"
ActiveSound "misc/repairing"
Obituary "$OB_ZOMBIE"
Mass 9999
Scale 2.5
States
{
Spawn:
SNIP A 0 NoDelay A_Stop
SNIP A 0 A_TakeInventory("CutterFlag",1)
SNIP A 0 ACS_NamedExecuteAlways("Monster_PassivePain",0)
SNIP A 0 A_SpawnItemEx("MonsterHitbox20_56")
SNIP A 10 A_Look
Goto Spawn+4

FirstSee:
SNIP A 0 A_TakeInventory("CutterFlag",1)
SNIP A 0 ACS_NamedExecuteAlways("Monster_PassivePain",0)
SNIP A 0 Thing_SetTranslation(0,30501) //ALLRED
SNIP A 2 Bright
SNIP A 0 Thing_SetTranslation(0,1) //BUBBLELEAD
SNIP A 0 A_GiveInventory("CutterFlag",1)
Goto SeeCheck

See:
SNIP "#" 0 A_JumpIfInventory("CutterFlag",1,1)
Goto FirstSee
SeeCheck:
SNIP "#" 0 A_JumpIfInventory("IceWaveAmmo",3,"SeeE")
SNIP "#" 0 A_JumpIfInventory("IceWaveAmmo",2,"SeeD")
SNIP "#" 0 A_JumpIfInventory("IceWaveAmmo",1,"SeeC")
SeeB:
SNIP B 0 A_GiveInventory("IceWaveAmmo",1)
SNIP B 0 A_CheckFlag("FRIGHTENED","SeeLoopFrightened")
SNIP B 0 A_JumpIfInventory("CentaurFlashAmmo",1,"SeeLoopEnraged")
Goto SeeLoop
SeeC:
SNIP C 0 A_GiveInventory("IceWaveAmmo",1)
SNIP C 0 A_CheckFlag("FRIGHTENED","SeeLoopFrightened")
SNIP C 0 A_JumpIfInventory("CentaurFlashAmmo",1,"SeeLoopEnraged")
Goto SeeLoop
SeeD:
SNIP D 0 A_GiveInventory("IceWaveAmmo",1)
SNIP D 0 A_CheckFlag("FRIGHTENED","SeeLoopFrightened")
SNIP D 0 A_JumpIfInventory("CentaurFlashAmmo",1,"SeeLoopEnraged")
Goto SeeLoop
SeeE:
SNIP E 0 A_TakeInventory("IceWaveAmmo",99)
SNIP E 0 A_CheckFlag("FRIGHTENED","SeeLoopFrightened")
SNIP E 0 A_JumpIfInventory("CentaurFlashAmmo",1,"SeeLoopEnraged")
Goto SeeLoop

SeeLoopReset:
SNIP "#" 0 A_TakeInventory("IceWallAmmo",99)
SNIP "#" 0 A_TakeInventory("TopSpinAmmo",1)
Goto SeeCheck

SeeFrightenedActive:
SNIP "#" 0 A_ChangeFlag("FRIGHTENED",true)
SNIP "#" 0 Thing_SetTranslation(0,30503) //ALLWHITE
SNIP "#" 0 A_PlaySoundEx("misc/venusdrip","Weapon")
SNIP "#" 2
SNIP "#" 0 Thing_SetTranslation(0,41) //WINDSTORM
Goto See

SeeLoop:
SNIP "#" 0 A_JumpIfInventory("IceWallAmmo",6,"SeeLoopReset")
SNIP "#" 0 A_JumpIfInventory("CentaurFlashAmmo",1,2)
SNIP "#" 0 A_JumpIfHealthLower(51,"SeeFrightenedActive")
SNIP "#" 1 A_FaceTarget
SNIP "#" 0 A_ChangeVelocity(4,0,momz,3)
SNIP "#" 0 A_GiveInventory("IceWallAmmo",1)
SNIP "#" 0 A_JumpIfInTargetLOS("Dodge",10,JLOSF_DEADNOJUMP)
SNIP "#" 0 A_JumpIf(CallACS("IsTargetInGame")==0,"Spawn")
Goto SeeLoop

SeeLoopEnraged:
SNIP "#" 0 A_JumpIfInventory("IceWallAmmo",5,"SeeLoopReset")
SNIP "#" 1 A_FaceTarget
SNIP "#" 0 A_ChangeVelocity(8,0,momz,3)
SNIP "#" 0 A_GiveInventory("IceWallAmmo",1)
SNIP "#" 0 A_JumpIfInventory("BalladeCrackerAmmo",20,"ShootEnraged")
SNIP "#" 0 A_GiveInventory("BalladeCrackerAmmo",1)
SNIP "#" 0 A_JumpIf(CallACS("IsTargetInGame")==0,"Spawn")
Goto SeeLoopEnraged

Dodge:
SNIP "#" 0 A_JumpIfInventory("TopSpinAmmo",1,"SeeLoop")
SNIP "#" 0 A_GiveInventory("TopSpinAmmo",4)
SNIP "#" 0 Thing_SetTranslation(0,30504) //MISSILEFLASH
SNIP "#" 2
SNIP "#" 0 Thing_SetTranslation(0,1) //BUBBLELEAD
SNIP "#" 0 A_SetTranslucent(0.7,0)
SNIP "#" 0 A_ChangeFlag("SHOOTABLE",false)
SNIP "#" 0 A_ChangeFlag("INVULNERABLE",true)
SNIP "#" 0 A_PlaySoundEx("misc/darkleap","Weapon")
SNIP "#" 0 A_Jump(128,3)
SNIP "#" 0 A_ChangeVelocity(0,15,5,3)
SNIP "#" 0 A_Jump(256,2)
SNIP "#" 0 A_ChangeVelocity(0,-15,5,3)
SNIP F 4
SNIP F 0 A_FaceTarget
SNIP F 0 A_PlaySoundEx("misc/devilfire","Weapon")
SNIP F 0 A_CustomMissile("SniperJoeAdvancedShot",26,10,frandom(-5,5),0,0)
SNIP F 4
SNIP F 0 A_PlaySoundEx("misc/devilfire","Weapon")
SNIP F 0 A_CustomMissile("SniperJoeAdvancedShot",26,10,frandom(-5,5),0,0)
SNIP F 2
SNIP "#" 0 A_SetTranslucent(1.0,0)
SNIP "#" 0 A_ChangeFlag("SHOOTABLE",true)
SNIP "#" 0 A_ChangeFlag("INVULNERABLE",false)
Goto See

SeeLoopFrightened:
SNIP "#" 0 A_JumpIfInventory("IceWallAmmo",5,"SeeLoopReset")
SNIP "#" 1 A_Chase
SNIP "#" 0 A_ChangeVelocity(5,0,momz,3)
SNIP "#" 0 A_GiveInventory("IceWallAmmo",1)
SNIP "#" 0 A_JumpIfCloser(250,"EscapeFrightened")
SNIP "#" 0 A_JumpIfCloser(550,"SeeLoopFrightened")
SNIP "#" 0 A_JumpIfTargetInLOS("ShootFrightened")
Goto SeeLoopFrightened


ShootEnraged:
SNIP F 0 A_Stop
SNIP F 0 A_PlaySoundEx("misc/fakereloadshort","Weapon")
SNIP F 0 A_TakeInventory("BalladeCrackerAmmo",99)
SNIP F 7 A_FaceTarget
SNIP F 0 A_PlaySoundEx("weapon/megaarmmini","Weapon")
SNIP FFF 0 A_CustomMissile("SniperJoeAdvancedShot",26,10,frandom(-5,5),0,0)
SNIP F 0 Thing_SetTranslation(0,30504) //MISSILEFLASH
SNIP F 2 Bright
SNIP F 0 Thing_SetTranslation(0,41) //WINDSTORM
Goto SeeLoopEnraged

ShootFrightened:
SNIP "#" 0 A_JumpIfCloser(550,"SeeLoopFrightened")
SNIP "#" 0 A_JumpIfInTargetLOS("SeeLoopFrightened",10,JLOSF_DEADNOJUMP)
SNIP "#" 0 A_JumpIfTargetInLOS("Missile")
SNIP "#" 0 A_JumpIf(CallACS("IsTargetInGame")==0,"Spawn")
Missile:
SNIP F 0 A_Stop
SNIP F 0 A_JumpIfCloser(550,"SeeLoopFrightened")
SNIP F 0 A_PlaySoundEx("misc/fakereloadshort","Weapon")
SNIP F 0 A_JumpIfCloser(550,"SeeLoopFrightened")
SNIP F 0 A_JumpIfHealthLower(21,"EscapeFrightened")
SNIP F 10 A_FaceTarget
SNIP F 0 A_PlaySoundEx("misc/devilfire","Weapon")
SNIP F 0 A_CustomMissile("SniperJoeAdvancedShot",26,10,frandom(-5,5),0,0)
SNIP F 0 Thing_SetTranslation(0,30504) //MISSILEFLASH
SNIP F 2 Bright
SNIP F 0 Thing_SetTranslation(0,41) //WINDSTORM
SNIP F 0 A_MonsterRefire(0,"See")
Goto Missile+3

EscapeFrightened:
SNIP "#" 0 A_ChangeFlag("FRIGHTENED",false)
SNIP "#" 0 Thing_SetTranslation(0,30503) //ALLWHITE
SNIP "#" 2
SNIP "#" 0 A_PlaySoundEx("weapon/centaurflash","Weapon")
SNIP "##########" 0 A_SpawnItemEx("CentaurFlashFX",0,0,28,256/12,0,random2(256/12),random(0, 359))
SNIP "##########" 0 A_SpawnItemEx("CentaurFlashFX",0,0,28,256/12,0,random2(256/12),random(0, 359))
SNIP "#" 0 A_SetTranslucent(0.0,0)
SNIP "#" 0 A_ChangeFlag("SHOOTABLE",false)
SNIP "#" 0 A_ChangeFlag("THRUACTORS",true)
SNIP "#" 0 A_ChangeFlag("INVULNERABLE",true)
SNIP "#" 0 A_Explode(13,256,0)
SNIP "#" 0 A_ChangeVelocity(0,0,60,CVF_REPLACE)
SNIP "##################" 3 A_ChangeVelocity(random(-50,50),random(-50,50),momz,3)
SNIP "#" 0 HealThing(20)
SNIP "#" 0 A_GiveInventory("CentaurFlashAmmo",1)
SNIP "#" 0 Thing_SetTranslation(0,1) //BUBBLELEAD
SNIP "#" 0 A_PlaySoundEx("weapon/centauruncloak","Weapon")
SNIP A 0 A_Stop
SNIP A 0 A_FaceTarget
SNIP A 2 A_SetTranslucent(0.25,0)
SNIP A 2 A_SetTranslucent(0.5,0)
SNIP A 2 A_SetTranslucent(1,0)
SNIP "#" 0 A_ChangeFlag("SHOOTABLE",true)
SNIP "#" 0 A_ChangeFlag("THRUACTORS",false)
SNIP "#" 0 A_ChangeFlag("INVULNERABLE",false)
SNIP A 5
Goto See

Pain:
SNIP H 0 A_Stop
Pain.WindStorm:
Pain.GravityHold:
Pain.ConcreteShot:
Pain.TornadoBlow:
Pain.BlackHoleBomb:
SNIP H 0 Thing_SetTranslation(0,1) //BUBBLELEAD
SNIP H 6 A_Pain
SNIP H 0 A_CheckFlag("FRIGHTENED","See")
SNIP H 0 A_JumpIfInventory("CentaurFlashAmmo",1,"SeeLoopEnraged")
Goto Dodge

Pain.TimeStopper:
SNIP H 0 A_Stop
SNIP H 0 Thing_SetTranslation(0,1) //BUBBLELEAD
SNIP H 0 A_ChangeFlag("NOPAIN",true)
SNIP "##############################################################################################################################################################################################################################################################################################################################################################" 1 A_SpawnItemEx("TimeStopGFX",random(8,56),0,random(0,72),0,0,0,random(0,359),0,80)
SNIP H 0 A_ChangeFlag("NOPAIN",false)
Goto See

Death.WindStorm:
Death.GravityHold:
Death.TornadoBlow:
BlowDeath:
SNIP H 0 A_Stop
SNIP H 0 Thing_SetTranslation(0,1) //BUBBLELEAD
SNIP H 0 A_ChangeFlag("SHOOTABLE",false)
SNIP H 0 A_ChangeFlag("NODAMAGE",false)
SNIP H 0 A_ChangeFlag("SOLID",false)
SNIP H 1 ThrustThingZ(0,10,0,1)
SNIP H 0 A_JumpIf(ceilingz-z<64,"Death")
SNIP H 0 A_GiveInventory("BlowDeathTimer",1)
SNIP H 0 A_JumpIfInventory("BlowDeathTimer",35,"Death")
Goto BlowDeath+5

Death:
XDeath:
SNIP H 0 A_Stop
SNIP H 0 A_FaceTarget
SNIP H 0 Thing_SetTranslation(0,1) //BUBBLELEAD
SNIP H 2 A_NoBlocking
SNIP H 0 A_Scream
SNIP H 0 A_SpawnItemEx("ExplosionEffect1",0,0,32)
SNIP H 0 A_SpawnItemEx("MonsterFakeDeathFX",0,0,32,0,0,0,0,1)
SNIP H 0 A_SpawnItemEx("SniperJoeAdvanced_DeathMarker",0,0,32,0,0,8,0,1)
TNT1 A 18
TNT1 A -1
Stop

Raise:
TNT1 A 0 A_SpawnItemEx("MonsterReviveHelper")
TNT1 A 20 Thing_SetTranslation(0,1) //BUBBLELEAD
TNT1 A 0 A_GiveInventory("DrillFlag",1)
SNIP A 0 A_TakeInventory("DrillFlag",1)
Goto See
}
}

Actor SniperJoeAdvanced_DeathMarker : SniperJoePistol_DeathMarker {}

Actor SniperJoeAdvancedShot
{
Translation "0:40=4:4", "41:41=93:93", "42:255=4:4"
+BRIGHT
PROJECTILE
Radius 5
Height 5
Speed 85
FastSpeed 95
Damage (8)
DamageType "Buster"
Scale 2.5
States
{
Spawn:
YBIT G 1 NoDelay
wait
}
}