/*
================================================================================
	Snowball
	
	Class: Outer Sphere Angel
	
"A chilly flier who can freeze dry her foes in seconds. While powerful for a 
smol angel, she is exceedingly frail and will fall with just a few shots." 

-Snowballs tend to be easier than chaingunners in most situations.
This is mainly due to their ice attack being a projectile and not a hitscanner.
She is 60 health as opposed to the chaingunner's 70 health, moves slower and it 
takes her a few seconds to begin attacking compaired to the chaingunner who can
instantly turn the player into swiss cheese. What makes Snowballs a pain is 
their ability to fly and get into nooks and crannies that chaingunners could 
only dream of. A wise player can use the Snowballs added mobility to their 
advantange to score an early chaingun.
-Snowball takes 2X damage from fire attacks and 1/2 damage from ice attacks. 
Snowballs are the only non-rare bird to have elemental resistance/weakness.
  
================================================================================
*/

Actor SnowballSpawner replaces ChaingunGuy
{
  +NOBLOCKMAP
  +NOSECTOR
  +THRUACTORS
  States
  {
  Spawn:
  	TNT1 A 0
// 	TNT1 A 0 A_JumpIf(Getcvar("AA_SnowballShutUp") == 2, "SummonQuietSnowball")
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEX("Snowball",0,0,0, 0, 0,0,0, SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG )
	Stop
	SummonQuietSnowball:
	TNT1 A 0
	TNT1 A 0 A_SpawnItemEX("QuietSnowball",0,0,0, 0, 0,0,0, SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG )
	Stop
	}
}

ACTOR Snowball 
{
  Health 60
  Radius 20
  Height 56
  Mass 60
  Speed 8
  PainChance 200
  Tag "Snowball"
  Monster
  +FLOAT
  +NOGRAVITY
  +SPAWNFLOAT
  +NOICEDEATH
  +NODROPOFF
  DamageFactor "Ice", 0.5
  DamageFactor "Fire", 2
  DamageFactor "UndeadGoHomeImpact", 0
  DamageFactor "Judgement", 0
  DamageFactor "Holy", 0
  DamageFactor "PlayerVoid", 0.5
  DamageFactor "KissMagic", 2
  SeeSound "snow/sight"
  PainSound "snow/pain"
  DeathSound "snow/death"
  ActiveSound "snow/active"
  AttackSound "snow/attack"
  Obituary "%o felt the chill of a Snowball."
  Dropitem "Chaingun"
  DropItem "AngelHealthSpawner" 128
  DropItem "AngelHealthSpawner" 128
  DropItem "AngelHealthSpawner" 8
  DropItem "Clipbox" 1
			
		var int user_haloactive;
			
  States
  {
  Spawn:
  	SZOW A 0 NoDelay A_SpawnItemEx ("SnowBallHalo", 0,0,40, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER)
// 	TNT1 A 0 A_JumpIf (user_haloactive == 1, "SpawnLoop")
// 	TNT1 A 0 A_SetUserVar (user_haloactive, 1)
//     TNT1 A 0 A_SpawnItemEx ("SnowBallHalo", 0,0,40, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER)
// 	TNT1 A 0 A_JumpIf(Getcvar("AA_Dropoff") == 2, "Aggressive")
	TNT1 A 0 A_Changeflag("NODROPOFF",FALSE)
	TNT1 A 0 A_Jump(256, "SpawnLoop")
	Goto SpawnLoop
//   Aggressive:
// 	TNT1 A 0
// 	TNT1 A 0 A_Changeflag("NODROPOFF",FALSE)
// 	Goto SpawnLoop
  Idle:
  SpawnLoop:
    SZOW ABCDABCDA 10 A_Look
	SZ2W ABC 8 A_Look
    Loop
  See:
    SZOW AABBCC 3 A_Chase
	TNT1 A 0 a_playsound("bird/flap")
	SZOW DD 3 A_Chase
	TNT1 A 0 A_Jump (96, 2)
    Loop
	SZOW AA 3 A_Chase
	SZ2W AA 3 A_Chase 
	SZ2W B 2 A_Chase 
	SZ2W CC 3 A_Chase
	TNT1 A 0 a_playsound("bird/flap")
	Loop
  Missile:
    SZOW E 20 A_FaceTarget
    SZOW FG 4 Bright A_CustomMissile ("Flake" ,20,0,1 ) 
    SZOW F 1 A_CPosRefire
    Goto Missile+1
  Pain:
    SZOW H 5
    SZOW H 5 A_Pain
    Goto See
  Death:
	TNT1 A 0 A_SetUserVar (user_haloactive, 0)
    SZOW I 15 A_Scream
    SZOW J 7 A_NoBlocking
    SZOW KLM 5
    SZOW N -1
    Stop
  XDeath:
	TNT1 A 0 A_SetUserVar (user_haloactive, 0)
	TNT1 A 0 A_Playsound ("egg/death",6,1)
    SZOW O 5
    SZOW P 3 A_playsound ("snow/gib")
    SZOW Q 5 A_NoBlocking
	SZOW RSTUVWXYZ 2
    SZOW [ 5
    SZOW ] -1
    Stop
  Death.PlayerVoid:
// 	TNT1 A 0 A_JumpIf(Getcvar("AA_Petrify") == 1, "Death")
//     TNT1 A 0 A_JumpIf(Getcvar("AA_Fanservice") == 2, "Death")
	TNT1 A 0 A_Changeflag("DONTCORPSE",TRUE)
	TNT1 A 0 A_playsound("stonemaiden/pain",6,1, FALSE)
	SZ2W D 1 Bright A_NoBlocking
	TNT1 AAA 0 a_spawnitemex ("Rrock06",random(-16,16),random(-16,16),42,random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0)
	TNT1 A 0 a_spawnitemex("Rrock02",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 A 0 a_spawnitemex("Rrock03",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 A 0 a_spawnitemex ("Rrock04",random(-20,20),random(-16,16),42,random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0)
	TNT1 A 0 a_spawnitemex("Rrock05",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 A 0 a_spawnitemex("Rrock01",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 A 0 a_spawnitemex ("Rrock04",random(-16,16),random(-16,16),42,random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0)
	TNT1 AA 0 a_spawnitemex("Rrock05",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 A 0 a_spawnitemex("Rrock06",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 AAA 0 a_spawnitemex ("Rrock01",random(-20,20),random(-16,16),42,random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0)
	TNT1 A 0 a_spawnitemex("Rrock02",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 A 0 a_spawnitemex("Rrock03",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 A 0 A_playsound ("stonemaiden/free")
	TNT1 A 0 A_Jump (128, "Altstone")
	TNT1 A 0 A_SpawnItemEx ("StoneSnowball", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER)
    Stop
  AltStone:
	TNT1 A 0 A_SpawnItemEx ("StoneSnowball2", 0,0,0, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER)
    Stop
  Raise:
	TNT1 A 0 //A_SetUserVar (user_haloactive, 0)
    SZOW N 5
    SZOW MLKJIH 5
	TNT1 H 0 A_SpawnItemEx ("SnowballHalo", 0,0,40, 0,0,0, 0, SXF_NOCHECKPOSITION | SXF_SETMASTER)
    Goto See
  }
}

ACTOR QuietSnowball : Snowball
{
  Tag "Snowball"
  SeeSound "snow/altsight"
  PainSound "virgin/pain"
  DeathSound "body/altgore"
  ActiveSound "bird/flap"
  States
  {
  XDeath:
	TNT1 A 0 A_SetUserVar (user_haloactive, 0)
    SZOW O 5
    SZOW P 3 A_playsound ("egg/death")
    SZOW Q 5 A_NoBlocking
	SZOW RSTUVWXYZ 2
    SZOW [ 5
    SZOW ] -1
    Stop
  }
}

Actor StoneSnowball
{
  Health 300
  Radius 20
  Height 56
  Mass 500
  +SOLID
  +SHOOTABLE
  +PUSHABLE
  +DONTBLAST
  +DONTMORPH
  +DONTRIP
  +NOICEDEATH
  +FULLVOLACTIVE
  +NOBLOOD
  +NEVERTARGET
  -COUNTKILL
	DamageFactor "PlayerVoid", 0
	DamageFactor "Poison", 0
	DamageFactor "Melee", 2.0
	DamageFactor "Ice", 0
	DamageFactor "Fire", 0
	DamageFactor "Electric", 0
	DamageFactor "Magic", 0
  States
  {
  Spawn:
	SZ2W D 3 Bright A_playsound("angel/stonebeam")
	SZ2W EF 3 Bright
	SZ2W D 3 Bright A_playsound("angel/stonebeam")
	SZ2W EF 3 Bright
	SZ2W D 3 Bright A_playsound("angel/stonebeam")
	SZ2W EF 3 Bright
	SZ2W D 3 Bright A_playsound("angel/stonebeam")
	SZ2W EF 3 Bright
	SZ2W D 3 Bright A_playsound("angel/stonebeam")
	SZ2W EF 3 Bright
	SZ2W D 2 Bright A_playsound("angel/stonebeam")
	SZ2W EF 2 Bright
	SZ2W D 2 Bright A_playsound("angel/stonebeam")
	SZ2W EF 2 Bright
	SZ2W D 2 Bright A_playsound("angel/stonebeam")
	SZ2W EF 2 Bright
	SZ2W D 2 Bright A_playsound("angel/stonebeam")
	SZ2W EF 2 Bright
	SZ2W D 1 Bright A_playsound("angel/stonebeam")
	SZ2W EF 1 Bright
	SZ2W D 1 Bright A_playsound("angel/stonebeam")
	SZ2W EF 1 Bright
	SZ2W D 1 Bright A_playsound("angel/stonebeam")
	SZ2W EF 1 Bright
	SZ2W D 1 Bright A_playsound("angel/stonebeam")
	SZ2W EF 1 Bright
	SZ2W G 25 Bright
	SZ2W HI 50 Bright A_playsound("stonemaiden/pain")
	SZ2W JKL 50 A_playsound("stonemaiden/pain")
	TNT1 A 0 A_playsound("stonemaiden/pain4")
	SZ2W M -1
	Stop
  Death:
	TNT1 A 0 A_playsound("stonemaiden/pain",6,1, FALSE)
	SZ2W M 1  A_NoBlocking
	TNT1 AAAAAAAAA 0 a_spawnitemex ("Rrock06",random(-16,16),random(-16,16),42,random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0)
	TNT1 AA 0 a_spawnitemex("Rrock02",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 AAAAAA 0 a_spawnitemex("Rrock03",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 AAA 0 a_spawnitemex ("Rrock04",random(-20,20),random(-16,16),42,random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0)
	TNT1 AAAA 0 a_spawnitemex("Rrock05",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 AAAAAAAAAAAAA 0 a_spawnitemex("Rrock01",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 AAAA 0 a_spawnitemex ("Rrock04",random(-16,16),random(-16,16),42,random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0)
	TNT1 AAAAAAA 0 a_spawnitemex("Rrock05",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 AAA 0 a_spawnitemex("Rrock06",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 AAAAAAAAAA 0 a_spawnitemex ("Rrock01",random(-20,20),random(-16,16),42,random(-100,100)/20.0,random(-100,100)/20.0,random(-100,100)/20.0,0)
	TNT1 AA 0 a_spawnitemex("Rrock02",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 AA 0 a_spawnitemex("Rrock03",0,0,32,random(-10,10),random(-10,10),random(5,10))
	TNT1 A 0 A_playsound ("stonemaiden/free")
    Stop
  }
}

Actor StoneSnowball2 : StoneSnowball
{
//   +SPRITEFLIP
}
