/* Extend the Doom bestiary in various ways.  "replaces" can't stack, so all
 * of this has to live in the same file, alas.
 *
 * Here's what we've got going on:
 *
 * 1. Drops are changed to be a little more interesting.  Some monsters have
 * rare better drops; some have drops that didn't before.
 *
 * DEPENDS ON:
 * realm667.Bullet Kit.wad
 * realm667.Shell Kit.wad
 * realm667.Rocket Pile.wad
 * realm667.Cell Kit.wad
 *
 * 2. Monsters with hitscan weaponry are changed to use a "hitscan" damage
 * type, for compatibility with the command armor.
 *
 * 3. Hell Knights and Barons of Hell get green blood.  Cacodemons get blue
 * blood, and also fall and splat to the floor.  Lost Souls lose their blood
 * entirely.  (Good idea, zpack, on that last one.)
 */

// Special fake drop items.  These immediately become one of a handful of
// different items (by spawning another item and then destroying themselves).
// You can have more than one "dropitem" per actor, but each of them is rolled
// independently; this is a minor hack to make sure exactly one item in a set
// always drops.
actor ZombieManDrop
{
    // 5%: bullet kit (+30)
    // 95%: clip (+10)
    states {
    Spawn:
        SOUL A 0 NODELAY A_Jump(12, "BecomeBulletKit")
        SOUL A 0 A_SpawnItemEx("Clip")
        stop
    BecomeBulletKit:
        SOUL A 0 A_SpawnItemEx("BulletKit")
        stop
    }
}

actor ShotgunGuyDrop
{
    // 30%: shells (+4)
    // 70%: shell kit (+12)
    states {
    Spawn:
        SOUL A 0 NODELAY A_Jump(76, "BecomeShell")
        SOUL A 0 A_SpawnItemEx("ShellKit")
        stop
    BecomeShell:
        SOUL A 0 A_SpawnItemEx("Shell")
        stop
    }
}

actor ChaingunGuyDrop
{
    // 5%: commando armor
    // 25%: box of bullets (+50)
    // 70%: bullet kit (+30)
    states {
    Spawn:
        SOUL A 0 NODELAY A_Jump(12, "BecomeCommandoArmor")
        SOUL A 0 A_Jump(76, "BecomeClipBox")
        SOUL A 0 A_SpawnItemEx("BulletKit")
        stop
    BecomeCommandoArmor:
        SOUL A 0 A_SpawnItemEx("CommandoArmor")
        stop
    BecomeClipBox:
        SOUL A 0 A_SpawnItemEx("ClipBox")
        stop
    }
}

// Just like the regular Cell, but using the beta sprite
actor ArachnotronCell : Cell
{
    inventory.pickupmessage "Picked up a curious energy cell."
    inventory.amount 30
    states {
    Spawn:
        CEL0 A -1
        stop
    }
}


// ----------------------------------------------------------------------------

actor Anachrony_ZombieMan : ZombieMan replaces ZombieMan
{
    dropitem "ZombieManDrop"
    damagetype "hitscan"
}
actor Anachrony_StealthZombieMan : StealthZombieMan replaces StealthZombieMan
{
    dropitem "ZombieManDrop"
    damagetype "hitscan"
}

actor Anachrony_ShotgunGuy : ShotgunGuy replaces ShotgunGuy
{
    dropitem "ShotgunGuyDrop", 64
    dropitem "Shotgun", 192
    damagetype "hitscan"
}
actor Anachrony_StealthShotgunGuy : StealthShotgunGuy replaces StealthShotgunGuy
{
    dropitem "ShotgunGuyDrop", 64
    dropitem "Shotgun", 192
    damagetype "hitscan"
}

actor Anachrony_ChaingunGuy : ChaingunGuy replaces ChaingunGuy
{
    dropitem "ChaingunGuyDrop", 64
    dropitem "Chaingun", 192
    damagetype "hitscan"
}
actor Anachrony_StealthChaingunGuy : StealthChaingunGuy replaces StealthChaingunGuy
{
    dropitem "ChaingunGuyDrop", 64
    dropitem "Chaingun", 192
    damagetype "hitscan"
}

actor GreenHellKnight : HellKnight replaces HellKnight
{
    bloodcolor darkgreen
}

actor GreenBaronOfHell : BaronOfHell replaces BaronOfHell
{
    bloodcolor darkgreen
}

// Cacodemon splat is from:
// http://zdoom.org/wiki/Improving_original_monsters_with_DECORATE
actor BlueCacodemon : Cacodemon replaces Cacodemon
{
    bloodcolor blue

    states {
    Death:
        HEAD G 4 A_SetSolid
        HEAD G 4 A_SetShootable
        HEAD H 8 A_Scream
        HEAD H -1
        stop
    Crash:
        HEAD I 4 A_PlaySound("*fist")
        HEAD J 4
        HEAD K 2 A_NoBlocking
        HEAD K 1 A_UnsetSolid
        HEAD K 1 A_UnSetShootable
        HEAD L -1 A_SetFloorClip
        stop
    Raise:
        HEAD L 8 A_UnSetFloorClip
        HEAD KJIHG 8
        goto See
    }
}

actor Anachrony_LostSoul : LostSoul replaces LostSoul
{
    +NOBLOOD
    dropitem "ArmorBonus", 24

}

actor Anachrony_Arachnotron : Arachnotron replaces Arachnotron
{
    dropitem "ArachnotronCell", 32
}

actor Anachrony_SpiderMastermind : SpiderMastermind replaces SpiderMastermind
{
    dropitem "Clip", 64
    dropitem "Clip", 64
    dropitem "Clip", 64
    dropitem "Clip", 64
    dropitem "BulletKit", 32
    dropitem "BulletKit", 32
    dropitem "ClipBox", 16
    damagetype "hitscan"
}

actor Anachrony_Cyberdemon : Cyberdemon replaces Cyberdemon
{
    dropitem "Rocket", 64
    dropitem "Rocket", 64
    dropitem "Rocket", 64
    dropitem "Rocket", 64
    dropitem "RocketKit", 32
    dropitem "RocketKit", 32
    dropitem "RocketKit", 32
    dropitem "RocketKit", 32
}

actor Anachrony_MarinePistol : MarinePistol replaces MarinePistol
{
    damagetype "hitscan"
}
actor Anachrony_MarineShotgun : MarineShotgun replaces MarineShotgun
{
    damagetype "hitscan"
}
actor Anachrony_MarineSSG : MarineSSG replaces MarineSSG
{
    damagetype "hitscan"
}
actor Anachrony_MarineChaingun : MarineChaingun replaces MarineChaingun
{
    damagetype "hitscan"
}
