//Copy of v6b 'megaman-gibs.txt'

//Adds a blank voice sound to stop taunts
//Increases "CriticalFlag" max from 999 to 30000


// This file contains damage and death effect stuff

// Basic Death effects
actor FrozenDeathFX
{
-SOLID
+NOGRAVITY
+NOINTERACTION
radius 16
height 56
var int user_height;
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_GiveInventory("CutterFlag",random(28,35))
SpawnLoop:
TNT1 A 0 A_SetUserVar("user_height",random(0,56))
TNT1 A 0 A_SpawnItemEX("IceChunk",random(-16,16),random(-16,16),user_height,frandom(0,2),0,user_height/14,random(0,359),SXF_TRANSFERTRANSLATION)
TNT1 A 0 A_TakeInventory("CutterFlag",1)
TNT1 A 0 A_JumpIfInventory("CutterFlag",1,"SpawnLoop")
TNT1 A 5
stop
}
}

actor PainFX : BasicGraphicEffect
{
Speed 80
height 0
radius 0
States
{
Spawn:
MMFX AA 1
stop
}
}

actor DeathFX1 : ExplosionEffect1
{
PROJECTILE
Speed 15
reactiontime 10
States
{
SpawnFrame:
MXP1 ABCDE 2
MXP1 A 0 A_CountDown
loop
}
}

actor DeathFX2 : DeathFX1
{
speed 5
}

actor FakeDeathFX : BasicExplosion
{
States
{
Spawn:
TNT1 A 1
PLY1 Z 0 A_SpawnItemEx("DeathFX1", 0, 0, 0, 0,  1.0,  0.0, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX1", 0, 0, 0, 0,  0.7,  0.7, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX1", 0, 0, 0, 0,  0.0,  1.0, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX1", 0, 0, 0, 0, -0.7,  0.7, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX1", 0, 0, 0, 0, -1.0,  0.0, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX1", 0, 0, 0, 0, -0.7, -0.7, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX1", 0, 0, 0, 0,  0.0, -1.0, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX1", 0, 0, 0, 0,  0.7, -0.7, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX2", 0, 0, 0, 0,  1.0,  0.0, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX2", 0, 0, 0, 0,  0.7,  0.7, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX2", 0, 0, 0, 0,  0.0,  1.0, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX2", 0, 0, 0, 0, -0.7,  0.7, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX2", 0, 0, 0, 0, -1.0,  0.0, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX2", 0, 0, 0, 0, -0.7, -0.7, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX2", 0, 0, 0, 0,  0.0, -1.0, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
PLY1 Z 0 A_SpawnItemEx("DeathFX2", 0, 0, 0, 0,  0.7, -0.7, 0, SXF_MULTIPLYSPEED|SXF_WEPFXCOLOR)
TNT1 A 1
stop
}
}

// Decisive Blow effects
// Decisive blows are damaging hits that deal >=50% of the target's maximum HP.
// When someone is killed by a decisive blow, they explode more violently.
actor DecisiveScriptWait : PowerUp { powerup.duration 7 }
actor RecentlyCrit : PowerUp { powerup.duration 7 }
actor CriticalDeath : Once {}

actor CriticalHitGiver : CustomInventory
{
+INVENTORY.AUTOACTIVATE
-INVBAR
States
{
Use:
TNT1 H 0 A_PlaySoundEx("misc/criticalhit","SoundSlot6")
TNT1 H 0 A_PlaySoundEx("*critpain","SoundSlot6")
TNT1 A 0 A_SpawnItemEX("CriticalHitSpawner")
stop
}
}

actor CriticalHitSpawner
{
reactiontime 4
Height 0
Radius 0
+NOINTERACTION
-SOLID
+NOGRAVITY
+MISSILE
+CLIENTSIDEONLY
+DONTBLAST
States
{
Spawn:
TNT1 A 1
Spawn2:
TNT1 AA 0 A_SpawnItemEx("CriticalPainFX", -5, 0, Random(3,48), 0, random(-7,7), random(5,7), 0)
TNT1 A 2
TNT1 A 0 A_CountDown
loop
}
}

actor CriticalPainFX : PainFX
{
scale 2.0 // 0.15
States
{
Spawn:
TNT1 A 2
MMDX AA 2 //A_SetScale(scalex + 0.25, scaley + 0.25)
TNT1 A 0 A_Stop
MMDX BBCCD 1 //A_SetScale(scalex + 0.25, scaley + 0.25)
MMDX D 1 
stop
}
}

actor CriticalDeathGiver : CriticalHitGiver
{
States
{
Use:
TNT1 A 0 A_StopSoundEx("Voice")//A_StopSound(2)
TNT1 A 0 A_PlaySoundEX("misc/gib", "SoundSlot6")
TNT1 A 0 A_PlaySoundEX("*critdeth", "SoundSlot6")
TNT1 A 0 A_SpawnItemEX("CriticalDeathSpawner",0,0,0,0,0,0,0,SXF_TRANSFERTRANSLATION)
stop
}
}

actor CriticalDeathSpawner : CriticalHitSpawner
{
var int user_InFloor;
States
{
Spawn:
TNT1 A 1
TNT1 A 0 A_JumpIf(!CallACS("core_checkclientcvar", CLCVAR_GIBS), "End")
TNT1 A 0 A_SetUserVar(user_InFloor, (z-floorz < 32))
Spawn2:
TNT1 A 0 A_SpawnItemEx("CriticalDeathGibA", 0, 0, (!user_InFloor + 3 + user_InFloor * -(z-floorz)), random(-9,9), random(-9,9), random(15,20), random(0,359),SXF_TRANSFERTRANSLATION)
TNT1 A 2 A_SpawnItemEx("CriticalDeathGibB", 0, 0, (!user_InFloor + 3 + user_InFloor * -(z-floorz)), random(-9,9), random(-9,9), random(15,20), random(0,359),SXF_TRANSFERTRANSLATION)
TNT1 A 0 A_SpawnItemEx("CriticalDeathGibC", 0, 0, (!user_InFloor + 3 + user_InFloor * -(z-floorz)), random(-9,9), random(-9,9), random(15,20), random(0,359),SXF_TRANSFERTRANSLATION)
TNT1 A 2 A_SpawnItemEx("CriticalDeathGibD", 0, 0, (!user_InFloor + 3 + user_InFloor * -(z-floorz)), random(-9,9), random(-9,9), random(15,20), random(0,359),SXF_TRANSFERTRANSLATION)
TNT1 A 0 A_SpawnItemEx("CriticalDeathGibE", 0, 0, (!user_InFloor + 3 + user_InFloor * -(z-floorz)), random(-9,9), random(-9,9), random(15,20), random(0,359),SXF_TRANSFERTRANSLATION)
TNT1 A 2 A_SpawnItemEx("CriticalDeathGibF", 0, 0, (!user_InFloor + 3 + user_InFloor * -(z-floorz)), random(-9,9), random(-9,9), random(15,20), random(0,359),SXF_TRANSFERTRANSLATION)
TNT1 A 0 A_SpawnItemEx("CriticalDeathGibG", 0, 0, (!user_InFloor + 3 + user_InFloor * -(z-floorz)), random(-9,9), random(-9,9), random(15,20), random(0,359),SXF_TRANSFERTRANSLATION)
TNT1 A 2 A_SpawnItemEx("CriticalDeathGibH", 0, 0, (!user_InFloor + 3 + user_InFloor * -(z-floorz)), random(-9,9), random(-9,9), random(15,20), random(0,359),SXF_TRANSFERTRANSLATION)
stop
End:
TNT1 A 0
stop
}
}

actor CriticalDeathGib : DeathFX1
{
-NOINTERACTION
-NOGRAVITY
+NOBLOOD
+DONTSPLASH
+FORCEXYBILLBOARD
+DONTREFLECT
+NOEXPLODEFLOOR
+BOUNCEONFLOORS
+BOUNCEONWALLS
+BOUNCEONCEILINGS
+USEBOUNCESTATE
+THRUACTORS
-BRIGHT
scale 2.5
damage(0)
bouncefactor 0.5
WallBounceFactor 0.5
bouncecount 30
reactiontime 175
States
{
Spawn:
TNT1 A 0
TNT1 A 0 //ACS_NamedExecuteWithResult("core_copytranslation")
TNT1 A 0 A_Jump(256,"A","B","C","D","E","F","G","H")
wait
A:
MGIB AA 1 A_SpawnItemEX("CriticalDeathFX2",0,0,3)
loop
B:
MGIB BB 1 A_SpawnItemEX("CriticalDeathFX2",0,0,3)
loop
C:
MGIB CC 1 A_SpawnItemEX("CriticalDeathFX2",0,0,3)
loop
D:
MGIB DD 1 A_SpawnItemEX("CriticalDeathFX2",0,0,3)
loop
E:
MGIB EE 1 A_SpawnItemEX("CriticalDeathFX2",0,0,3)
loop
F:
MGIB FF 1 A_SpawnItemEX("CriticalDeathFX2",0,0,3)
loop
G:
MGIB GG 1 A_SpawnItemEX("CriticalDeathFX2",0,0,3)
loop
H:
MGIB HH 1 A_SpawnItemEX("CriticalDeathFX2",0,0,3)
loop
SpawnLoop:
MGIB "##" 1 A_SpawnItemEX("CriticalDeathFX2",0,0,3)
loop
Bounce.Floor:
MGIB "#" 0 A_JumpIf(sqrt(momx*momx+momy*momy+momz*momz)<=1,"Spawn2Start")
goto SpawnLoop
Spawn2Start:
MGIB "#" 0 A_ChangeFlag("USEBOUNCESTATE",0)
MGIB "#" 0 A_ChangeFlag("BOUNCEONFLOORS",0)
MGIB "#" 0 A_ChangeVelocity(0,0,0,2)
MGIB "#" 0 ThrustThing(angle*256/360,0)//Sync
MGIB "#" 0 ThrustThingZ(0,0,0,1)
MGIB "##" 1
MGIB "#" 0 A_ChangeFlag("BOUNCEONFLOORS",1)
Spawn2:
MGIB "#" 0
MGIB "##" 1
MGIB "#" 0
MGIB "##" 1
MGIB "#" 1 A_CountDown
wait
}
}

actor CriticalDeathGibA : CriticalDeathGib
{
    States
    {
    Spawn:
        TNT1 A 0
        goto Super::A
    }
}

actor CriticalDeathGibB : CriticalDeathGib
{
    States
    {
    Spawn:
        TNT1 A 0
        goto Super::B
    }
}

actor CriticalDeathGibC : CriticalDeathGib
{
    States
    {
    Spawn:
        TNT1 A 0
        goto Super::C
    }
}

actor CriticalDeathGibD : CriticalDeathGib
{
    States
    {
    Spawn:
        TNT1 A 0
        goto Super::D
    }
}

actor CriticalDeathGibE : CriticalDeathGib
{
    States
    {
    Spawn:
        TNT1 A 0
        goto Super::E
    }
}

actor CriticalDeathGibF : CriticalDeathGib
{
    States
    {
    Spawn:
        TNT1 A 0
        goto Super::F
    }
}

actor CriticalDeathGibG : CriticalDeathGib
{
    States
    {
    Spawn:
        TNT1 A 0
        goto Super::G
    }
}

actor CriticalDeathGibH : CriticalDeathGib
{
    States
    {
    Spawn:
        TNT1 A 0
        goto Super::H
    }
}

actor CriticalDeathFX2 : DeathFX1
{
Scale 1.5
States
{
SpawnFrame:
TNT1 A 2
MMFX CDE 2
stop
}
}


actor CriticalFlag : Inventory
{
inventory.amount 1
inventory.maxamount 30000//9999
}

actor CritCheckTime : Powerup { powerup.duration 30 }
