actor Frostman_W : BaseMM8BDMWep_CBM
{
tag "$TAGC_8F"
dropitem "IceWaveWep"
Weapon.AmmoUse 0
Weapon.AmmoGive 0
Obituary "$OB_FROSTPUNCH"//Obituary "$OB_ICEWAVE"//Attempt at making point blank kills better
Inventory.Pickupmessage "I'M FROSTMAN"
weapon.ammotype "PopsicleAmmo"
+WEAPON.NOAUTOAIM
States
{
Spawn:
C_08 F 1
loop

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

Ready:
ICWB A 0 ACS_NamedExecuteWithResult("core_weaponcolor",DYE_FROSTMAN)
goto Ready1
Ready1:
ICWB A 4 A_WeaponReady
wait

Flash:
TNT1 A 1 A_GiveInventory("FrostmanFlashCharge_P",1)
loop
Flash.End:
TNT1 A 1 A_GiveInventory("VivifyDelay6",1)
stop

BotFire:
ICWB B 0 A_JumpIfCloser(200,"BotFire2")
ICWB B 0 A_TakeInventory("BotHugFlag",999)
ICWB B 0 //A_Jump(4,1)
goto Fire+1
BotFire2:
ICWB B 0 A_GiveInventory("BotHugFlag",1)
goto Altfire

Fire:
ICWB B 0 A_JumpIfInventory("IsBot",1,"BotFire")
ICWB B 0 A_GunFlash("Flash",1)
ICWB B 1 Offset(0,24)A_TakeInventory("VivifyDelay6",1)
ICWB B 0 A_Refire("FireH0")
goto FireEnd0

FireH0:
ICWB B 0 A_JumpIfInventory("PopsicleAmmo",7,"FireH1_Start")
ICWB B 1 Offset(0,24)
ICWB B 0 A_Refire("FireH0")
goto FireEnd0

FireH1_Start:
ICWB C 0 A_SpawnItemEx("FrostmanChargeWarper",8,0,128,0,0,0,0,1)
ICWB C 0 A_Refire("FireH1")
FireH1:
ICWB C 0 A_JumpIfInventory("PopsicleAmmo",13,"FireH2")
ICWB C 1 Offset(0,-6)
ICWB C 0 A_Refire("FireH1")
goto FireEnd1

FireH2:
ICWB D 0 A_JumpIfInventory("PopsicleAmmo",22,"FireH3")
ICWB D 1 Offset(0,-36)
ICWB D 0 A_Refire("FireH2")
goto FireEnd2

FireH3:
ICWB E 0 A_JumpIfInventory("PopsicleAmmo",27,"FireH4")
ICWB E 1 Offset(0,-66)
ICWB E 0 A_Refire("FireH3")
goto FireEnd3

BotFireH4:
ICWB F 0 A_Jump(16,"FireIcePunch")
goto FireH4+1
FireH4:
ICWB F 0 A_JumpIfInventory("IsBot",1,"BotFireH4")
ICWB F 0 A_JumpIfInventory("PopsicleAmmo",45,"FireH5.a")
ICWB F 1 Offset(-1,-66)A_WeaponReady(7)
ICWB F 0 A_Refire("FireH4.a")
goto FireEnd4
FireH4.a:
ICWB F 0 A_JumpIfInventory("PopsicleAmmo",45,"FireH5.a")
ICWB F 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireH4.b")
ICWB F 1 Offset(-1,-66)A_WeaponReady(7)
ICWB F 0 A_Refire("FireH4.b")
goto FireEnd4
FireH4.b:
ICWB F 0 A_JumpIfInventory("PopsicleAmmo",45,"FireH5")
ICWB F 1 Offset(1,-66)A_WeaponReady(7)
ICWB F 0 A_Refire("FireH4.c")
goto FireEnd4
FireH4.c:
ICWB F 0 A_JumpIfInventory("PopsicleAmmo",45,"FireH5")
ICWB F 0 A_JumpIfInventory("PlayerPropertyRage",1,"FireH4")
ICWB F 1 Offset(1,-66)A_WeaponReady(7)
ICWB F 0 A_Refire("FireH4")
goto FireEnd4

BotFireH5:
ICWB F 0 A_Jump(4,"FireIcePunch")
ICWB F 0 A_Jump(32,"FireIceWave")
goto FireH5+1
FireH5:
ICWB F 0 A_JumpIfInventory("IsBot",1,"BotFireH5")
ICWB F 0 A_JumpIfInventory("IceWaveHoldFlag",35,"FireIceWave")
ICWB F 1 Offset(-2,-76)A_WeaponReady(7)
ICWB F 0 A_Refire("FireH5.a")
goto FireIceWave
FireH5.a:
ICWB F 0 A_JumpIfInventory("IceWaveHoldFlag",35,"FireIceWave")
ICWB F 1 Offset(2,-76)A_WeaponReady(7)
ICWB F 0 A_Refire("FireH5")
goto FireIceWave


FireEnd0:
ICWB B 0 A_GunFlash("Flash.End",1)
ICWB BB 2 Offset(0,24)A_TakeInventory("PopsicleAmmo",4)
Goto FireEnd
FireEnd1:
ICWB C 0 A_GunFlash("Flash.End",1)
ICWB C 2 Offset(0,-6)A_TakeInventory("PopsicleAmmo",4)
ICWB BB 2 Offset(0,24)A_TakeInventory("PopsicleAmmo",4)
Goto FireEnd
FireEnd2:
ICWB C 0 A_GunFlash("Flash.End",1)
ICWB D 2 Offset(0,-36)A_TakeInventory("PopsicleAmmo",5)
ICWB C 2 Offset(0,-6)A_TakeInventory("PopsicleAmmo",5)
ICWB BB 2 Offset(0,24)A_TakeInventory("PopsicleAmmo",4)
Goto FireEnd
FireEnd3:
ICWB E 0 A_GunFlash("Flash.End",1)
ICWB E 2 Offset(0,-66)A_TakeInventory("PopsicleAmmo",7)
ICWB D 2 Offset(0,-36)A_TakeInventory("PopsicleAmmo",7)
ICWB C 2 Offset(0,-6)A_TakeInventory("PopsicleAmmo",6)
ICWB B 2 Offset(0,24)A_TakeInventory("PopsicleAmmo",5)
Goto FireEnd
FireEnd4:
ICWB F 0 A_GunFlash("Flash.End",1)
ICWB E 2 Offset(0,-66)A_TakeInventory("PopsicleAmmo",9)
ICWB D 2 Offset(0,-36)A_TakeInventory("PopsicleAmmo",9)
ICWB C 2 Offset(0,-6)A_TakeInventory("PopsicleAmmo",9)
ICWB B 2 Offset(0,24)A_TakeInventory("PopsicleAmmo",9)
Goto FireEnd
FireEnd:
ICWB B 0 A_GiveInventory("FrostmanFlagReset_P",1)
Goto Ready1

FireIceWave:
ICWB G 0 A_Quake(9,9,0,48,"none")
ICWB G 0 A_FireCustomMissile("FrostIceWaveSpawner_H",0,0,0,0)
goto FireIceWaveEnd
FireIcePunch:
ICWB G 0 A_Quake(5,9,0,48,"none")
ICWB G 0 A_FireCustomMissile("FrostPunchShot",0,0,0,0)
goto FireIceWaveEnd
FireIceWaveEnd:
ICWB G 0 A_GunFlash("Flash.End",1)
ICWB G 0 A_GiveInventory("FrostmanFlagReset_P",1)
ICWB G 0 A_WeaponReady(14)
ICWB G 3 Offset(0,8)A_PlaySoundEx("weapon/BlizzStrike","Weapon")
ICWB H 3 Offset(0,28)
ICWB I 3 Offset(0,48)
ICWB I 9 Offset(0,48)
ICWB I 6 Offset(0,48)
ICWB J 3 Offset(0,44)
ICWB J 3 Offset(0,40)A_GiveInventory("FrostmanFlagReset_P",1)
ICWB A 3 Offset(0,36)
ICWB A 3 A_WeaponReady(14)
Goto Ready1

Altfire:
ICWB K 0 A_JumpIfInventory("PopsicleAmmo",27,"FireIcePunch")
ICWB K 0 A_FireCustomMissile("FrostPunch",0,0,0,0)
ICWB K 0 A_PlaySoundEx("Weapon/GutMelee","Weapon")

ICWB K 2 Offset(0,22)
ICWB L 2 Offset(0,10)A_GiveInventory("FrostmanFlagReset_P",1)
ICWB LL 2 Offset(0,2)
ICWB L 2 Offset(0,7)
ICWB M 2 Offset(0,12)
ICWB N 2 Offset(0,17)
ICWB O 2 Offset(0,22)
ICWB P 2 Offset(0,27)
ICWB A 2 A_WeaponReady(14)
Goto Ready1
}
}

actor PopsicleAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 45
+INVENTORY.IGNORESKILL
}

actor IceWaveHoldFlag : Inventory
{
inventory.amount 1
inventory.maxamount 35
}

actor FrostmanFlagReset_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_TakeInventory("PopsicleAmmo")
TNT1 A 0 A_TakeInventory("IceWaveHoldFlag")
stop
}
}

actor FrostmanFlashCharge_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("PopsicleAmmo",45,2)
TNT1 A 0 A_GiveInventory("PopsicleAmmo",1+CallACS("core_checkrune",RUNE_RAGE))
stop
TNT1 A 0 A_GiveInventory("IceWaveHoldFlag",1)
stop
}
}


actor FrostmanChargeWarper : ProjSpawnFuncActor
{
+MISSILE
+NOINTERACTION
+NOTIMEFREEZE
-SOLID
+THRUACTORS
+NOGRAVITY
+DONTBLAST
+DONTREFLECT
Height 2
Radius 2
Scale 2.5
States
{
Spawn:
ICWB R 0
ICWB R 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
ICWB R 0 A_JumpIfInTargetInventory("VivifyDelay6",1,"ShieldEnd")
ICWB R 0 A_JumpIfInTargetInventory("PopsicleAmmo",27,"Shield2")
ICWB R 1 A_Warp(2,8,0,128,0,24)
loop
Shield2:
ICWB S 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
ICWB S 0 A_JumpIfInTargetInventory("VivifyDelay6",1,"ShieldEnd")
ICWB S 0 A_JumpIfInTargetInventory("PopsicleAmmo",45,"Shield3")
ICWB S 1 A_Warp(2,8,0,128,0,24)
loop
Shield3:
ICWB T 0 A_JumpIf(!CallACS("cbm_PointerExists",AAPTR_TARGET),"Death")
ICWB T 0 A_JumpIfInTargetInventory("VivifyDelay6",1,"ShieldEnd")
ICWB T 1 A_Warp(2,8,0,128,0,24)
loop
ShieldEnd:
TNT1 A 1
stop
Death:
TNT1 A 1
stop
}
}

actor FrostPunchShot : ProjSpawnFuncActor
{
PROJECTILE
Damagetype "FrostM_Shot"
Obituary "$OB_ICEWAVE"
+DONTREFLECT
+SKYEXPLODE
+DONTSPLASH
+THRUGHOST
+THRUACTORS
+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
+ALLOWBOUNCEONACTORS
+CANBOUNCEWATER
BounceFactor 1.0
WallBounceFactor 1.0
BounceCount 5
Reactiontime 24//13
damage (0)
Radius 15
Height 15
speed 28
scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_CountDown
Spawn2:
TNT1 A 2 A_SpawnItemEx("FrostPunchIcicle",0,0,0,0,0,0,0,1)
Goto Spawn
Death:
TNT1 A 1
stop
}
}

actor FrostPunchIcicle : ProjSpawnFuncActor
{
PROJECTILE
Damagetype "FrostM_Shot"
Obituary "$OB_ICEWAVE"
+DONTBLAST
Damage (150)
Radius 15
Height 15
Scale 2.5
States
{
Spawn:
ICWB R 0
ICWB R 0 A_SpawnItemEX("IcePitFreeze")
ICWB R 0 A_PlaySoundEx("weapon/icewavespawn","weapon")
ICWB RSTTT 3
Goto Death
Death:
TNT1 A 0 A_PlaySound("weapon/icewavebreak",1,1.0)
TNT1 AAAAA 0 A_SpawnItemEx("FrostPunchIcicleFX",Random(-16,16),Random(-16,16),Random(-16,16),Random(-4,4),Random(-4,4),Random(2,8),0,1)
TNT1 A 1
stop
}
}

actor FrostPunchIcicleFX : BasicGraphicEffect
{
Gravity 0.75
States
{
SpawnFrame:
TNT1 A 0 A_Jump(256,"U","V","W","X")
U:
ICWB U 0 ThrustThingZ(0,4,1,1)
ICWB U 1 A_FadeOut
loop
V:
ICWB V 0 ThrustThingZ(0,4,1,1)
ICWB V 1 A_FadeOut
loop
W:
ICWB W 0 ThrustThingZ(0,4,1,1)
ICWB W 1 A_FadeOut
loop
X:
ICWB X 0 ThrustThingZ(0,4,1,1)
ICWB X 1 A_FadeOut
loop
}
}

actor FrostIceWaveSpawner_H : BasicHelper
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("FrostIceWaveSpawner",32,0,0,0,0,-12.5)
TNT1 A 0 A_SpawnItemEx("FrostIceWaveSpawner",32,50,0,0,0,-12.5)
TNT1 A 0 A_SpawnItemEx("FrostIceWaveSpawner",32,-50,0,0,0,-12.5)
TNT1 A 1
stop
}
}

actor FrostIceWaveSpawner : ProjSpawnFuncActor
{
PROJECTILE
Damagetype "FrostM_Iced"
Obituary "$OB_ICEWAVEDROP"
+DONTBLAST
+DONTREFLECT
-NOGRAVITY
ReactionTime 35
Damage(150)
Radius 10
Height 10
Scale 3.0
States
{
Spawn:
ICWB R 0
ICWB R 1 //ThrustThingZ(0,50,1,0)
ICWB R 2 A_CountDown
wait
Crash:
Death:
TNT1 A 0 A_SpawnItemEX("IcePitFreeze")
TNT1 A 0 A_SpawnItemEx("FrostIceWave",0,0,0,20)
stop
}
}

actor FrostIceWave : ProjSpawnFuncActor
{
PROJECTILE
Damagetype "FrostM_Iced"
Obituary "$OB_ICEWAVE"
+RIPPER
+DONTREFLECT
Damage (30)
Radius 10
Height 48
Speed 20
Scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_SpawnItemEx("FrostIceWaveIcicleF")
TNT1 A 0 A_CheckFloor("MakeIcicle")
TNT1 AA 1 A_JumpIf(z-floorz!=0,"Down")
Loop
MakeIcicle:
TNT1 A 0 A_SpawnItemEx("FrostIceWaveIcicleF")
Goto Spawn+3
Down: 
TNT1 A 0 A_SpawnItemEx("FrostIceWaveDown",0,0,0,0,0,-20)
stop
Death:
TNT1 A 0 A_SpawnItemEx("FrostIceWaveUp",0,0,0,0,0,20)
stop
}
}

actor FrostIceWaveDown : FrostIceWave
{
+DONTBLAST
States
{
Spawn:
TNT1 A 0
TNT1 A 2 A_SpawnItemEx("FrostIceWaveIcicleW")
wait
Death:
TNT1 A 0 A_SpawnItemEx("FrostIceWave",0,0,0,20)
stop
}
}

actor FrostIceWaveUp : FrostIceWave
{
+DONTBLAST
States
{
Spawn:
TNT1 A 2
TNT1 A 0 A_Stop
TNT1 A 0 A_SpawnItemEx("FrostIceWaveIcicleW",0,0,0,0,0,0,180)
TNT1 A 0 A_ChangeVelocity(20,0,0,3) 
TNT1 A 1
TNT1 A 0 A_SpawnItemEx("FrostIceWave",0,0,0,20)
stop
Death:
TNT1 A 0 A_JumpIf(ceilingz-z>48,"Continue")
TNT1 A 0 
stop
Continue:
TNT1 A 0 A_SpawnItemEx("FrostIceWaveUp",0,0,4,0,0,20)
stop
}
}

actor FrostIceWaveIcicle : FrostIceWave
{
Damagetype "FrostM_Iced2"
-RIPPER
+DONTBLAST
Damage (80)
States
{
Spawn:
Q_8F B 0
Q_8F B 0 A_PlaySoundEx("weapon/icewavespawn","weapon")
Q_8F B 0 A_Jump(80,"Icicle2")
Q_8F B 0 A_Jump(64,"Icicle4")
Q_8F BCDEE 3
Goto Death
Icicle2:
Q_8F L 0
Q_8F L 0 A_Jump(80,"Icicle3")
Q_8F LMMNN 3
Goto Death
Icicle3:
Q_8F LMNOO 3
Goto Death
Icicle4:
Q_8F BCCDD 3
Goto Death
Death:
TNT1 A 0 A_SpawnItemEx("FrostIceWaveIcicleFX",0,0,0,0,0,0,0,1)
stop
}
}

actor FrostIceWaveIcicleFX : BasicGraphicEffect
{
States
{
SpawnFrame:
Q_8F FGH random(1,2)
stop
}
}

actor FrostIceWaveIcicleF : FrostIceWaveIcicle
{
+FLOORHUGGER
}

actor FrostIceWaveIcicleW : FrostIceWaveIcicle
{
States
{
Spawn:
Q_8F P 0
Q_8F P 0 A_PlaySoundEx("weapon/icewavespawn","weapon")
Q_8F P 0 A_JumpIf(z-floorz <= 8,"SpawnFloor")
Q_8F P 0 A_Jump(80,"Icicle2")
Q_8F P 0 A_Jump(64,"Icicle4")
Q_8F PQRSS 3
Goto Death
Icicle2:
Q_8F T 0
Q_8F T 0 A_Jump(80,"Icicle3")
Q_8F TUUVV 3
Goto Death
Icicle3:
Q_8F TUVWW 3
Goto Death
Icicle4:
Q_8F PQQRR 3
Goto Death
SpawnFloor:
TNT1 A 0 A_SpawnItemEx("FrostIceWaveIcicleF",0,0,0,0,0,0,0,1)
stop
Death:
TNT1 A 0 A_SpawnItemEx("FrostIceWaveIcicleFX",0,0,0,0,0,0,0,1)
stop
}
}

actor FrostPunch : ProjSpawnFuncActor
{
PROJECTILE
DamageType "FrostM_Punch"
Obituary "$OB_FROSTPUNCH"
+DONTBLAST
reactiontime 1
damage (400)
Radius 20
Height 20
Speed 80
scale 2.5
States
{
Spawn:
XMFX B 0
XMFX B 1 A_CountDown
wait
Death:
XMFX B 0 A_Explode(400,52,0,0,4)
goto XDeath
XDeath:
XMFX B 0 A_Stop
XMFX B 0 A_SpawnItemEX("IcePitFreeze")
XMFX BABC 2
stop
}
}


actor PainFrostM_Iced_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("GroundIce_FrostmanF",1,3)
TNT1 A 0 A_SpawnItemEx("GroundIce_Frost")
TNT1 A 0 ACS_NamedExecuteWithResult("core_groundplayer",0,1)
TNT1 A 0 A_GiveInventory("GroundIce_FrostmanF",1)
stop
}
}

actor GroundIce_FrostmanF : Powerup
{
+INVENTORY.ALWAYSPICKUP
Powerup.Duration 30
}

actor GroundIce_Frost : BasicPain_GroundedHit
{
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_GiveToTarget("GroundIce_Frost_P",1)
TNT1 A 0 A_JumpIfInTargetInventory("GroundIce_FrostmanF",1,"Spawn")
Death:
TNT1 A 0
goto DeathEnd
}
}

actor GroundIce_Frost_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_Stop
TNT1 A 0 A_GiveInventory("DashingStraitjacket_F",1)
TNT1 A 0 A_SpawnItemEx("GroundIce_FrostFX")
stop
}
}

actor GroundIce_FrostFX : BasicGraphicEffect
{
Translation "192:192=4:4","198:198=70:70"
States
{
Spawn:
MRFA F 0
MRFA F 1
stop
}
}


actor Frostman_W_NormalBar : NormalBar {Args 229,205}
actor Frostman_W_ScriptBar : ScriptBar {}