//I don't care if it's just Nail Shield 2 it's not my fault the source weapon is so similar.
actor MistletoeBarrierWep_NormalBar : NormalBar {args 110, 227}

actor MistletoeBarrierWep : BaseMM8BDMWep
{
Weapon.AmmoUse 1
Weapon.AmmoGive 36
Weapon.SlotNumber 7
Inventory.Pickupmessage "$PU_MISTLETOEBARRIER"
Obituary "$OB_MISTLETOEBARRIER"
Tag "$TAG_MISTLETOEBARRIER"
weapon.ammotype "MistletoeBarrierAmmo"
inventory.icon "MSTBICON"
States
{
SpawnLoop:
MSTB Z 1
loop
Ready:
MSTB F 0 ACS_NamedExecuteWithResult("core_weaponcolor",COLOR_MISTLETOEBARRIER)
MSTB F 1 A_WeaponReady
Goto Ready+1
ReadyC: Goto Ready+1
Deselect:
MSTB F 0 A_TakeInventory("ShieldCheck", 1)
MSTB A 0 A_TakeInventory("MistletoeBoost",1)
goto DeselectSwap
Select:
MSTB F 0
MSTB A 0 A_TakeInventory("MistletoeBoost",1)
goto SelectSwap
Fire:
MSTB A 0 A_JumpIfInventory("ShieldCheck",1,"ShieldThrow")
MSTB A 0 A_JumpIfNoAmmo("NoAmmo")
MSTB A 0 A_PlaySoundEx("misc/gravityup","Weapon")
MSTB A 0 A_GiveInventory("ShieldCheck",1)
MSTB B 0 A_SpawnItemEx("MistletoeBarrierWarper")
MSTB A 0 A_TakeInventory("MistletoeBarrierAmmo",4)
MSTB GHIJK 2 A_GiveInventory("MistletoeBoostGiver",1)
TNT1 A 2 A_GiveInventory("MistletoeBoostGiver",1)
MSTB LM 2 A_GiveInventory("MistletoeBoostGiver",1)
goto Shield
Shield:
MSTB A 0 A_GiveInventory("MistletoeBoostGiver",1)
PLAA A 0 A_JumpIfNoAmmo("ShieldThrow")
MSTB D 0 A_PlaySoundEx("weapon/joegrenade","Weapon")
MSTB E 0 ACS_NamedExecute("vile_statechange",0,2)
MSTB B 0 A_FireCustomMissile("MistletoeBarrierShot1",0,1,8,0)
MSTB NNOOOPPP 1 A_WeaponReady
loop
Altfire:
MSTB A 0 A_JumpIfInventory("ShieldCheck",1,"ShieldThrow")
goto Super::Altfire

ShieldThrow:
STAA A 0 A_TakeInventory("ShieldCheck",999)
BLIZ D 0 A_PlaySoundEx("misc/gravityup","Weapon")
MSTB B 0 A_FireCustomMissile("MistletoeBarrierShot1",0,1,8,0)
MSTB B 0 A_FireCustomMissile("MistletoeBarrierShot2",0,0,8,0)
MSTB B 0 A_FireCustomMissile("MistletoeBarrierShot3",0,0,8,0)
MSTB B 0 A_FireCustomMissile("MistletoeBarrierShot4",0,0,8,0)
MSTB A 0 A_TakeInventory("MistletoeBoost",1)
MSTB QR 2
MSTB S 22
MSTB RQ 5
BLIZ D 0 A_Refire
Goto Ready+1
AltFire:
MSTB A 0 A_JumpIfInventory("ShieldCheck",1,3)
MSTB F 0 A_JumpIfInventory("Vile_ClassAltfire", 1, "ClassAltfire")
MSTB F 0 A_JumpIf(CallACS("Vile_class_altfire"), "ClassAltfire")
MSTB F 1 A_JumpIfInventory("MM8BDMPlayer", 1, "Fire")
wait
ClassAltfire:
MSTB F 0 
goto Super::Altfire
NoAmmo:
MSTB F 1 ACS_NamedExecuteAlways("core_noammo",0)
Goto Ready+1
}
}

Actor MistletoeBoostGiver : PowerApropGiver {}

actor MistletoeBoost : Powerup
{
powerup.duration 10
+INVENTORY.ALWAYSPICKUP
}

actor MistletoeBarrierShot1 : BasicProjectile
{
PROJECTILE
Damage (CallACS("vile_cbm_damage",14))
Height 8
Radius 8
damagetype "MistletoeBarrier"
Obituary "$OB_MISTLETOEBARRIER"
+DONTBLAST
-NOGRAVITY
gravity 1.5
Scale 2.5
speed 25
States
{
Spawn:
MSTM D 0 
MSTM D 0 ThrustThingZ(0, 10, 0, 1)
Spawn2:
MSTM DDEEFFGGHHII 1 A_CheckFloor("Floor")
loop
Death:
MSTM D 0 A_CheckFloor("Floor")
MSTM D 0 A_SpawnItemEx("FallingMistletoe")
stop
Floor:
MSTM D 0 A_SpawnItemEx("FloorMistletoe",0,0,0,8)
stop
XDeath:
MSTM D 0
stop
}
}

actor MistletoeBarrierShot2 : MistletoeBarrierShot1{speed 28}
actor MistletoeBarrierShot3 : MistletoeBarrierShot1{speed 31}
actor MistletoeBarrierShot4 : MistletoeBarrierShot1{speed 34}



actor FallingMistletoe : MistletoeBarrierShot1
{
Damage (CallACS("vile_cbm_damage",12))
states
{
Spawn:
MSTM D 0
Spawn2:
MSTM D 1 A_CheckFloor("Floor")
loop
Death:
MSTM D 0 A_CheckFloor("Floor")
stop
}
}

actor FloorMistletoe : FallingMistletoe
{
-NOGRAVITY
+STEPMISSILE
maxstepheight 24
+NOEXPLODEFLOOR
gravity 100.0
reactiontime 90
states
{
Spawn:
MSTM D 0
Spawn2:
MSTM DDEEFFGGHHII 1 A_CountDown
loop
Death:
MSTM D 0 A_SpawnItemEx("ExplosionEffect1")
stop
}
}


actor MistletoeBarrierWarper : BaseShieldWarper
{
States
{
Shield:
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX1",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)

TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)

TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX3",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)

TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch)	 *40.0,(-sin(pitch)    *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+90) *40.0,(-sin(pitch+90) *40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+180)*40.0,(-sin(pitch+180)*40)+32,0,0,0,0)
TNT1 A 0 A_SpawnItemEx("MistletoeBarrierFX2",-4,cos(pitch+270)*40.0,(-sin(pitch+270)*40)+32,0,0,0,0)
TNT1 A 1 A_Warp(AAPTR_TARGET, 0, 0, 0, 0, WARPF_INTERPOLATE|WARPF_NOCHECKPOSITION)
TNT1 E 0 A_SetPitch(pitch%360+10)
loop
}
}

actor MistletoeBarrierFX1 : BasicGraphicEffect
{
scale 2.0
States
{
SpawnFrame:
MSTM J 1 
stop
}
}

actor MistletoeBarrierFX2 : MistletoeBarrierFX1
{
States
{
SpawnFrame:
MSTM K 1 
stop
}
}

actor MistletoeBarrierFX3 : MistletoeBarrierFX1
{
States
{
SpawnFrame:
MSTM L 1 
stop
}
}

actor MistletoeBarrierAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 36
+INVENTORY.IGNORESKILL
}