/* Lightly tweaks some of the Doom weapons.  Or not so lightly.
 */

// Give the shotgun slightly more power -- 9 pellets, up from 7.
// Also spawn the OG shell casings.
actor AnachronyShellCasingSpawner
{
    speed 20
    PROJECTILE
    +NOCLIP

    states {
    Spawn:
	SCAS A 0 NODELAY A_CustomMissile("AnachronyShellCasing", 0, 0, random(85, 95), 2, random(-10, 10))
	stop
    }
}
actor AnachronyShellCasing
{
    scale 0.1666
    radius 3
    height 3
    speed 6
    mass 1
    bouncefactor 0.5
    PROJECTILE
    -NOGRAVITY
    -NOBLOCKMAP
    +DOOMBOUNCE
    seesound "weapons/casing"

    states {
    Spawn:
	SCAS A -1
	stop
    Death:
	SCAS A 350
	stop
    }
}
actor AnachronyShotgun : Shotgun replaces Shotgun
{
    // This stuff is not inherited, whoops
    weapon.slotnumber 3
    weapon.slotpriority 0
    decal BulletChip

    states {
    Fire:
	SHTG A 3
	SHTG A 0 A_FireBullets(5.6, 0, 9, 5, "BulletPuff")
        SHTG A 0 A_PlaySound("weapons/shotgf", CHAN_WEAPON)
	SHTG A 7 A_GunFlash
	SHTG A 0 A_FireCustomMissile("AnachronyShellCasingSpawner", 0, 0, 0, 1)
	goto super::Fire +2
    }
}



// this isn't actually a replacement but i'm still figuring weapons out so

actor PowerAnachronyMinigunSlowdown : PowerSpeed
{
    powerup.duration 0x7FFFFFFD
    speed 0.4
    +POWERSPEED.NOTRAIL
}

actor AnachronyMinigunSlowdown : PowerupGiver
{
    powerup.type PowerAnachronyMinigunSlowdown
}

actor AnachronyMinigun : Weapon 13399
{
    weapon.slotnumber 4
    weapon.ammotype "Clip"
    weapon.ammogive 20
    weapon.ammouse 1
    inventory.pickupsound "misc/w_pkup"
    inventory.pickupmessage "Picked up a minigun!"
    obituary "%o was shredded by %k's minigun."
    attacksound "weapons/minigunfire"
    states {
    Spawn:
	MNGN A -1
	loop
    Ready:
	MNGG A 1 A_WeaponReady
	loop
    Deselect:
	MNGG A 1 A_TakeInventory("PowerAnachronyMinigunSlowdown", 255)
	MNGG A 1 A_Lower
	loop
    Select:
	MNGG A 1 A_Raise
	loop
    Fire:
	MNGG A 0 A_JumpIfInventory("PowerAnachronyMinigunSlowdown", 1, "Hold")
	MNGG A 0 A_GiveInventory("PowerAnachronyMinigunSlowdown")
	MNGG B 14
	MNGG A 11
	MNGG B 8
	MNGG A 5
	MNGG B 2
    Hold:
	MNGG A 0 A_GunFlash
	MNGG A 2 A_FireBullets(5, 1, 1, 5)
	MNGG B 2 A_FireBullets(5, 1, 1, 5)
	MNGG B 0 A_ReFire
	MNGG B 2 A_WeaponReady(WRF_NOBOB|WRF_NOSWITCH|WRF_NOPRIMARY)
	MNGG A 5
	MNGG B 8
	MNGG A 11
	MNGG B 14
	MNGG A 17
	MNGG A 0 A_TakeInventory("PowerAnachronyMinigunSlowdown", 255)
	goto Ready
    AltFire:
	MNGG A 0 A_JumpIfInventory("PowerAnachronyMinigunSlowdown", 1, "AltHold")
	MNGG A 0 A_GiveInventory("PowerAnachronyMinigunSlowdown")
	MNGG B 14
	MNGG A 11
	MNGG B 8
	MNGG A 5
	MNGG B 2
    AltHold:
	MNGG AABB 1 A_WeaponReady(WRF_NOBOB|WRF_NOSWITCH|WRF_NOSECONDARY)
	MNGG B 0 A_ReFire
	MNGG B 2
	MNGG A 5
	MNGG B 8
	MNGG A 11
	MNGG B 14
	MNGG A 17
	MNGG A 0 A_TakeInventory("PowerAnachronyMinigunSlowdown", 255)
	goto Ready
    Flash:
	MNGF A 3 BRIGHT A_Light1
	MNGF B 3 BRIGHT A_Light0
	stop
    }
}

