
//CBM Pain


actor Basic_PainTID_H : BasicWatcher
{
//+SERVERSIDEONLY
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_RearrangePointers(0,0,2)//Shift Target to Tracer [Player hurt is now Tracer]
TNT1 A 0 A_TransferPointer(2,0,2,2)//Set Target's Target to Target [Damager is now Target]
TNT1 A 0 A_Jump(256,"Check")
stop
Check:
//TNT1 A 0 A_JumpIf(CallACS("cbm_PoisonControl_acs",28,PSN_SET_TO,8)>0,"PoisonTime")
TNT1 A 0 A_Log("You forgot to define the \"Check\" state!")
stop
}
}

actor Basic_PainFling_H : BasicWatcher
{
+NOTIMEFREEZE
Args 777,77,2//KNK_ADDZTHRUST
states
{
Spawn:
TNT1 A 0
SpawnCheck:
TNT1 A 0 A_JumpIfInventory("NoPushFlag",1,"No",AAPTR_TARGET)
//TempPit
TNT1 A 0 A_JumpIfInventory("HalfPushFlag",1,"Half",AAPTR_TARGET)
Fling:
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_knockback", Args[0]/(1.0+Args[3]), Args[1]/(1.0+Args[3]), Args[2], AAPTR_TARGET)
stop
Half:
TNT1 A 0 A_SetArg(3,1)
goto Fling
No:
TNT1 A 0
stop
}
}
actor Basic_DeathFling_H : Basic_PainFling_H
{
states
{
Spawn:
TNT1 A 0
goto Fling
}
}


actor CollideFlag : Inventory{}
//*20 Gravity
actor GravSlammerPowerGiver : PowerApropGiver {}
actor GravSlammerPower : PowerUp
{
	+INVENTORY.ALWAYSPICKUP
	Powerup.Duration -10
}

actor BasicPain_SlamHit : BasicHelper//Gravityman
{
var int user_HIT;
var int user_GravStack;
+NOCLIP
//+NOTARGETSWITCH
Mass 250
states
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetUserVar("user_HIT",CallACS("core_gettarget"))
TNT1 A 0 A_RearrangePointers(0,0,2)
TNT1 A 0 A_TransferPointer(2,0,2,2)
TNT1 A 0 ACS_NamedExecuteWithResult("cbm_GravitySlam",user_HIT)
goto CollideWait
CollideWait:
TNT1 A 1 A_JumpIfInventory("CollideFlag",1,"CollideCheck")
loop

CollideCheck:
TNT1 A 0 //A_LogInt(user_GravStack)
TNT1 A 0 A_SetArg(0,user_GravStack)
TNT1 A 0 Thing_Move(0,user_HIT,1)
TNT1 A 0 A_JumpIf(user_GravStack>=Mass,"CollideX")
TNT1 A 0 A_JumpIf(user_GravStack>=1,"Collide")
TNT1 A 2 //A_Log("Gravity Slam = 0")
stop
Collide:
TNT1 A 2 //A_SpawnItemEX("SlamCollide",0,0,28,0,0,0,0,SXF_TRANSFERSPECIAL)
stop
CollideX:
TNT1 A 2 //A_SpawnItemEX("SlamCollideX",0,0,28,0,0,0,0,SXF_TRANSFERSPECIAL)
stop
}
}

actor BasicCollideSlam : BasicExplosion
{
damagetype "GravityM_Dunked"
Obituary "$OB_GRAVITYBALL"
Mass 1
Meleerange 30
renderstyle none
states
{
Spawn:
TNT1 A 0
TNT1 A 0 //A_LOG("Args[0]")
TNT1 A 0 //A_LOGINT(Args[0])
TNT1 A 0 //A_LOG("Meleerange")
TNT1 A 0 //A_LOGINT(Meleerange)
TNT1 A 0 //A_LOG("Args AND Dam Calc")
TNT1 A 0 //A_LOGINT(ScaleX)
TNT1 A 0 //A_LOG("Total")
TNT1 A 0 //A_LOGINT(Mass*(Meleerange*0.1)*Args[0])
TNT1 A 0 A_Explode(Mass*(Meleerange*0.1)*Args[0]+1,15,0,0,15)
TNT1 A 3
stop
}
}



actor GravitySmackDown_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_CheckFloor("Grounded")
TNT1 A 0 A_JumpIfInventory("NoPushFlag",1,"Grounded")
TNT1 A 0 ThrustThingZ(0,70,1,0)
Grounded:
TNT1 A 0 ACS_NamedExecuteWithResult("core_groundplayer",0,1)
TNT1 A 0 A_SpawnItemEx("GravitySmackDown_H")
stop
}
}
actor GravitySmackDown_P1 : GravitySmackDown_P
{
States
{
Pickup:
TNT1 A 0 A_CheckFloor("Grounded")
TNT1 A 0 A_JumpIfInventory("NoPushFlag",1,"Grounded")
TNT1 A 0 ThrustThingZ(0,70,1,1)
goto Grounded
}
}

actor GravitySmackDownEnd_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 ACS_NamedExecuteWithResult("core_groundplayer",0,0)
stop
}
}

actor GravitySmackDown_H : BasicHelper
{
+SERVERSIDEONLY
States
{
Spawn:
TNT1 A 0
TNT1 AAAA 4 A_JumpIf(ACS_NamedExecuteWithResult("core_targetexists")==0,"Death")
TNT1 A 1 A_GiveToTarget("GravitySmackDownEnd_P",1)
stop
}
}

actor BasicPain_GroundedHit : BasicHelper
{//Freeze/Frost/Cold/RaThor
+SERVERSIDEONLY
States
{
DeathEnd:
TNT1 A 1 A_GiveToTarget("PlayerPropertyGroundedOff")
stop
}
}





actor PainRecoilDelay_F : Powerup
{
Powerup.Duration 1
}

actor PainRecoil_P : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("PainRecoilDelay_F",1,"No")
TNT1 A 0 A_JumpIfInventory("NoHitStunFlag",1,"No")
TNT1 A 0 A_JumpIfInventory("HalfHitStunFlag",1,"No")
TNT1 A 0 A_Recoil(1)
TNT1 A 0 A_GiveInventory("PainRecoilDelay_F",1)
stop
No:
TNT1 A 0
stop
}
}

actor PainHitstun_75_P : PainRecoil_P
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("NoHitStunFlag",1,"No")
TNT1 A 0 A_JumpIfInventory("HalfHitStunFlag",1,"Half")
TNT1 A 0 A_ScaleVelocity(0.75)
stop
Half:
TNT1 A 0 A_ScaleVelocity(0.875)
stop
No:
TNT1 A 0
stop
}
}

actor PainHitstun_80_P : PainRecoil_P 
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("NoHitStunFlag",1,"No")
TNT1 A 0 A_JumpIfInventory("HalfHitStunFlag",1,"Half")
TNT1 A 0 A_ScaleVelocity(0.80)
stop
Half:
TNT1 A 0 A_ScaleVelocity(0.90)
stop
}
}

actor PainHitstun_85_P : PainRecoil_P 
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("NoHitStunFlag",1,"No")
TNT1 A 0 A_JumpIfInventory("HalfHitStunFlag",1,"Half")
TNT1 A 0 A_ScaleVelocity(0.85)
stop
Half:
TNT1 A 0 A_ScaleVelocity(0.925)
stop
}
}

actor PainHitstun_90_P : PainRecoil_P 
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("NoHitStunFlag",1,"No")
TNT1 A 0 A_JumpIfInventory("HalfHitStunFlag",1,"Half")
TNT1 A 0 A_ScaleVelocity(0.90)
stop
Half:
TNT1 A 0 A_ScaleVelocity(0.95)
stop
}
}

actor PainHitstun_0_P : PainRecoil_P 
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("NoHitStunFlag",1,"No")
TNT1 A 0 A_JumpIfInventory("HalfHitStunFlag",1,"Half")
TNT1 A 0 A_Stop
stop
Half:
TNT1 A 0 A_ScaleVelocity(0.5)
stop
}
}





actor PainPush_Fling : CustomInventory
{
States
{
Pickup:
TNT1 A 0 A_JumpIfInventory("NoPushFlag",1,"No")
TNT1 A 0 A_JumpIfInventory("HalfPushFlag",1,"Half")
TNT1 A 0 A_Jump(256,"Full")
stop
Full:
TNT1 A 0 ThrustThing(random(0,255),1,1,0)
stop
Half:
TNT1 A 0 ThrustThing(random(0,255),0.5,1,0)
stop
No:
TNT1 A 0
stop
}
}

actor PainPush_F_500 : PainPush_Fling
{
States
{
Full:
TNT1 A 0 ThrustThing(random(0,255),500,1,0)
stop
Half:
TNT1 A 0 ThrustThing(random(0,255),250,1,0)
stop
}
}

actor PainPush_F_15 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThing(random(0,255),15,1,0)stop
Half:TNT1 A 0 ThrustThing(random(0,255),7.5,1,0)stop}}

actor PainPush_F_4d5 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThing(random(0,255),4.5,1,0)stop
Half:TNT1 A 0 ThrustThing(random(0,255),2.25,1,0)stop}}


actor PainPush_Z_70_Rand_80 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,random(70,80),0,0)stop
Half:TNT1 A 0 ThrustThingZ(0,random(35,40),0,0)stop}}

actor PainPush_Z_200 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,200,0,0)stop
Half:TNT1 A 0 ThrustThingZ(0,100,0,0)stop}}

actor PainPush_Z_80 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,80,0,0)stop
Half:TNT1 A 0 ThrustThingZ(0,40,0,0)stop}}

actor PainPush_Z_70 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,70,0,0)stop
Half:TNT1 A 0 ThrustThingZ(0,35,0,0)stop}}

actor PainPush_Z_60 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,60,0,0)stop
Half:TNT1 A 0 ThrustThingZ(0,30,0,0)stop}}

actor PainPush_Z_56 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,56,0,0)stop
Half:TNT1 A 0 ThrustThingZ(0,28,0,0)stop}}

actor PainPush_Z_50 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,50,0,0)stop
Half:TNT1 A 0 ThrustThingZ(0,25,0,0)stop}}


actor PainPush_Z1_20 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,20,0,1)stop
Half:TNT1 A 0 ThrustThingZ(0,10,0,1)stop}}

actor PainPush_Z1_32 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,32,0,1)stop
Half:TNT1 A 0 ThrustThingZ(0,16,0,1)stop}}

actor PainPush_Z1_65 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,65,0,1)stop
Half:TNT1 A 0 ThrustThingZ(0,32.5,0,1)stop}}

actor PainPush_Z1_52 : PainPush_Fling{States{
Full:TNT1 A 0 ThrustThingZ(0,52,0,1)stop
Half:TNT1 A 0 ThrustThingZ(0,26,0,1)stop}}


