actor IceCircleWep : BaseMM8BDMWep
{
//$Category RNC-Weapons
//$Title Ice Circle
Weapon.AmmoGive 28
weapon.ammouse 7
Weapon.SlotNumber 7
Tag "$TAG_ICECIRCLE"
Obituary "$OB_ICECIRCLE"
Inventory.Pickupmessage "$PU_ICECIRCLE"
weapon.ammotype "IceCircleAmmo"
inventory.icon "RNCWP2"
States
{
SpawnLoop:
RNCW B -1
loop
Ready:
NCH1 G 0 ACS_ExecuteAlways(998,0,20)
NCH1 G 0 A_ClearRefire
NCH1 G 1 A_WeaponReady
Goto Ready+2
Deselect:
NCH1 G 0 A_TakeInventory("ShieldCheck",1)
NCH1 G 0 A_TakeInventory("IceCircleCharge",99)
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Lower
NCH1 G 1 A_Lower
Goto Deselect+1
Select:
TNT1 AAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
NCH1 G 1 A_Raise
Loop
Fire:
AltFire:
NCH1 G 0 A_JumpIfInventory("ShieldCheck",1,"ShieldThrow")
NCH1 G 0 A_JumpIfNoAmmo("NoAmmo")
NCH1 G 0 A_TakeInventory("BasicArmor",9999)
NCH1 G 0 A_PlaySoundEx("misc/freeze","Weapon")
NCH1 G 0 A_TakeInventory("IceCircleAmmo",7)
NCH1 GHIJKL 1
NCH1 L 0 A_GiveInventory("ShieldCheck",1)
NCH1 L 0 A_GiveInventory("IceCircleCharge",24)
NCH1 L 0 A_SpawnItemEx("IceCircleWarper")
TNT1 A 0 A_SpawnItemEx("IceCircleMover")
goto ShieldActive
Hold:
NCH1 G 1
goto Ready+1
ShieldActive:
NCH1 MN 2
NCH1 N 0 A_SpawnItemEx("IceRadius",0,0,0)
Goto Shield
Shield:
NCH1 G 4 A_WeaponReady
NCH1 G 0 A_SpawnItemEx("IceRadius",0,0,0)
NCH1 G 0 A_TakeInventory("IceCircleCharge",1)
NCH1 G 0 A_JumpIfInventory("IceCircleCharge",1,"Shield")
ShieldThrow:
NCH1 G 0 A_TakeInventory("IceCircleCharge",99)
NCH1 OP 2
NCH1 G 0 A_TakeInventory("ShieldCheck",1)
NCH1 P 0 A_FireCustomMissile("IceCircleShot",0,0,0,0)
NCH1 Q 15
NCH1 PO 3
goto Ready+1
NoAmmo:
NCH1 G 1 ACS_Execute(979,0)
goto Ready+1
}
}
actor IceCircleWepSH : IceCircleWep replaces IceCircleWep
{+INVENTORY.RESTRICTABSOLUTELY Inventory.RestrictedTo megamans}

actor IceCircleAmmo : Ammo {inventory.amount 1 inventory.maxamount 28}

actor IceCircleCharge : WeaponCharge
{
	inventory.maxamount 24
}

actor IceCircleWarper : BaseShieldWarper
{
States
{
Shield:
RNCP CCDDEEFF 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
loop
}
}

actor IceRadius
{
PROJECTILE
+DONTSPLASH
Damagetype "IceCircle"
Obituary "$OB_ICECIRCLE"
Damage 0
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(17,130,0,0,90)
stop
}
}

actor IceCircleBounce
{
BounceSound "weapon/freezecrackerhit"
PROJECTILE
Bouncetype Doom
-BOUNCEONFLOORS
+MOVEWITHSECTOR
+CANBOUNCEWATER
+DONTSPLASH
+NOEXPLODEFLOOR
+STEPMISSILE
//Maxstepheight 7
Maxstepheight 24
+BOUNCEONACTORS
+SKYEXPLODE
Bouncefactor 1.0
Wallbouncefactor 1.0
}

const int ICECIRCLE_GROUND_NUM = 6;
const int ICECIRCLE_GROUND_DIV = 5;
const int ICECIRCLE_AIR_NUM = 2;
const int ICECIRCLE_AIR_DIV = 5;

actor IceCircleSpeed : PowerSpeed
{
+POWERSPEED.NOTRAIL
Speed 0.75
Powerup.Duration 5
}

actor IceCircleMover : IceCircleBounce
{
+SERVERSIDEONLY

+NOBOUNCESOUND
+USEBOUNCESTATE

+DONTBLAST
+DONTREFLECT
+THRUGHOST
Species "Survivors" +MTHRUSPECIES
//+THRUACTORS

//Radius 16
//Height 56
Radius 15
Height 54
damage (0)

var int user_owner;
var int user_ground;
var int user_air;
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SetUserVar("user_owner", ACS_ExecuteWithResult(257,0))
TNT1 A 0 A_TakeFromTarget("IceCircleStoppedFlag",999)
Spawn2:
TNT1 A 0 A_JumpIfInTargetInventory("ShieldCheck",1,"Spawn3")
goto TheEnd
Spawn3:
TNT1 A 0 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION|WARPF_USECALLERANGLE)
TNT1 A 0 A_ChangeVelocity(25,0,0,CVF_RELATIVE|CVF_REPLACE)
//TNT1 A 0 A_LogInt(angle)
TNT1 A 0 A_SpawnItemEx("IceCircleMoveCheck")
TNT1 A 0 A_JumpIfInTargetInventory("IceCircleStoppedFlag",6,"TurnAround")
goto Spawn4
TurnAround:
//TNT1 A 0 A_Log("turn around")
TNT1 A 0 A_PlaySound("weapon/freezecrackerhit")
TNT1 A 0 A_TakeFromTarget("IceCircleStoppedFlag",999)
TNT1 A 0 A_SetAngle(angle+180)
goto Spawn4
Spawn4:
TNT1 A 0 A_GiveToTarget("IceCircleSpeed",1)
TNT1 A 0 A_CheckFloor("Spawn4B")
//TNT1 A 0 A_Log(air)
//TNT1 A 0 A_LogInt((user_air+ICECIRCLE_AIR_NUM)/ICECIRCLE_AIR_DIV)
TNT1 A 0 ThrustThing(angle*256/360,(user_air+ICECIRCLE_AIR_NUM)/ICECIRCLE_AIR_DIV,1,user_owner)
TNT1 A 0 A_SetUserVar("user_air",(user_air+ICECIRCLE_AIR_NUM)%ICECIRCLE_AIR_DIV)
goto SpawnEnd
Spawn4B:
//TNT1 A 0 A_Log(ground)
//TNT1 A 0 A_LogInt(user_ground+ICECIRCLE_GROUND_NUM)/ICECIRCLE_GROUND_DIV)
TNT1 A 0 ThrustThing(angle*256/360,(user_ground+ICECIRCLE_GROUND_NUM)/ICECIRCLE_GROUND_DIV,1,user_owner)
TNT1 A 0 A_SetUserVar("user_ground",(user_ground+ICECIRCLE_GROUND_NUM)%ICECIRCLE_GROUND_DIV)
goto SpawnEnd
SpawnEnd:
TNT1 A 1
//PLAY A 1
TNT1 A 0 A_ChangeFlag("USEBOUNCESTATE",1)
goto Spawn2
Bounce:
TNT1 A 0 A_ChangeFlag("USEBOUNCESTATE",0)
TNT1 A 0 A_PlaySound("weapon/freezecrackerhit")
goto Spawn2
Death:
TheEnd:
TNT1 A 0
stop
}
}

actor IceCircleStoppedFlag : Inventory
{
inventory.amount 1
inventory.maxamount 6
}

actor IceCircleMoveCheck
{
+SERVERSIDEONLY

PROJECTILE
+NOINTERACTION
+NOCLIP
+DONTBLAST
damage 0
radius 1
height 1
speed 0
States
{
Spawn:
TNT1 A 0
TNT1 A 1
TNT1 A 0 A_JumpIfCloser(2,"Stopped")
//TNT1 A 0 A_JumpIfCloser(3,"Stopped")
//TNT1 A 0 A_JumpIfCloser(5,"Stopped")
//TNT1 A 0 A_Log("Going")
TNT1 A 0 A_TakeFromTarget("IceCircleStoppedFlag",1)
stop
Stopped:
//TNT1 A 0 A_Log("Stopped")
TNT1 A 1 A_GiveToTarget("IceCircleStoppedFlag",1)
stop
}
}

actor IceCircleShot : IceCircleBounce
{
scale 2.5
//Damage (20)
//Speed 25
Radius 12
Height 12

Damagetype "IceCircle"
Obituary "$OB_ICECIRCLE"

Speed 20
-NOGRAVITY
Gravity 0.8
Damage (0)
+RIPPER
reactiontime 24
States
{
Spawn:
RNCP C 0
Spawn2:
TNT1 A 0 A_CountDown
TNT1 A 0 A_Explode(8,90,0)
RNCP CD 2
TNT1 A 0 A_CountDown
TNT1 A 0 A_Explode(8,90,0)
RNCP EF 2
loop
}
}