Esempio n. 1
0
void mdeath::normal(monster *z)
{
    if ((g->u.sees(*z)) && (!z->no_corpse_quiet)) {
        add_msg(m_good, _("The %s dies!"),
                z->name().c_str()); //Currently it is possible to get multiple messages that a monster died.
    }
    if ( z->type->in_species( ZOMBIE )) {
            sfx::play_variant_sound( "mon_death", "zombie_death", sfx::get_heard_volume(z->pos()));
        }
    m_size monSize = (z->type->size);
    bool leaveCorpse = !((z->type->has_flag(MF_VERMIN)) || (z->no_corpse_quiet));

    // leave some blood if we have to
    if (!z->has_flag(MF_VERMIN)) {
        field_id type_blood = z->bloodType();
        if (type_blood != fd_null) {
            g->m.add_field( z->pos(), type_blood, 1, 0 );
        }
    }

    int maxHP = z->get_hp_max();
    if (!maxHP) {
        maxHP = 1;
    }

    float overflowDamage = std::max( -z->get_hp(), 0 );
    float corpseDamage = 5 * (overflowDamage / (maxHP * 2));

    if (leaveCorpse) {
        int gibAmount = int(floor(corpseDamage)) - 1;
        // allow one extra gib per 5 HP
        int gibLimit = 1 + (maxHP / 5.0);
        if (gibAmount > gibLimit) {
            gibAmount = gibLimit;
        }
        bool pulverized = (corpseDamage > 5 && overflowDamage > 150);
        if (!pulverized) {
            make_mon_corpse(z, int(floor(corpseDamage)));
        } else if (monSize >= MS_MEDIUM) {
            gibAmount += rng(1, 6);
            sfx::play_variant_sound( "mon_death", "zombie_gibbed", sfx::get_heard_volume(z->pos()));
        }
        // Limit chunking to flesh, veggy and insect creatures until other kinds are supported.
        bool leaveGibs = (z->made_of("flesh") || z->made_of("hflesh") || z->made_of("veggy") ||
                          z->made_of("iflesh"));
        if (leaveGibs) {
            make_gibs( z, gibAmount );
        }
    }
}
Esempio n. 2
0
void mdeath::normal(monster *z) {
    if (g->u_see(z)) {
        g->add_msg(_("The %s dies!"), z->name().c_str());
    }
    if(z->type->difficulty >= 30) {
        // TODO: might not be killed by the player (g->u)!
        g->u.add_memorial_log(pgettext("memorial_male","Killed a %s."),
            pgettext("memorial_female", "Killed a %s."),
            z->name().c_str());
    }

    m_size monSize = (z->type->size);
    bool isFleshy = (z->made_of("flesh") || z->made_of("hflesh"));
    bool leaveCorpse = !(z->type->has_flag(MF_VERMIN));

    // leave some blood if we have to
    if (isFleshy && z->has_flag(MF_WARM) && !z->has_flag(MF_VERMIN)) {
        g->m.add_field(z->posx(), z->posy(), fd_blood, 1);
    }

    int maxHP = z->type->hp;
    if (!maxHP) {
        maxHP = 1;
    }

    float overflowDamage = -(z->hp);
    float corpseDamage = 5 * (overflowDamage / (maxHP * 2));

    if (leaveCorpse) {
        int gibAmount = int(floor(corpseDamage)) - 1;
        // allow one extra gib per 5 HP
        int gibLimit = 1 + (maxHP / 5.0);
        if (gibAmount > gibLimit) {
            gibAmount = gibLimit;
        }
        bool pulverized = (corpseDamage > 5 && overflowDamage > 150);
        if (!pulverized) {
            make_mon_corpse(z, int(floor(corpseDamage)));
        } else if (monSize >= MS_MEDIUM) {
            gibAmount += rng(1,6);
        }
        // Limit chunking to flesh and veggy creatures until other kinds are supported.
        bool leaveGibs = (isFleshy || z->made_of("veggy"));
        if (leaveGibs) {
            make_gibs( z, gibAmount);
        }
    }
}
Esempio n. 3
0
void mdeath::normal(monster *z)
{
    if (g->u_see(z)) {
        add_msg(m_good, _("The %s dies!"),
                z->name().c_str()); //Currently it is possible to get multiple messages that a monster died.
    }

    m_size monSize = (z->type->size);
    bool leaveCorpse = !(z->type->has_flag(MF_VERMIN));

    // leave some blood if we have to
    if (!z->has_flag(MF_VERMIN)) {
        field_id type_blood = z->bloodType();
        if (type_blood != fd_null) {
            g->m.add_field(z->posx(), z->posy(), type_blood, 1);
        }
    }

    int maxHP = z->type->hp;
    if (!maxHP) {
        maxHP = 1;
    }

    float overflowDamage = -(z->hp);
    float corpseDamage = 5 * (overflowDamage / (maxHP * 2));

    if (leaveCorpse) {
        int gibAmount = int(floor(corpseDamage)) - 1;
        // allow one extra gib per 5 HP
        int gibLimit = 1 + (maxHP / 5.0);
        if (gibAmount > gibLimit) {
            gibAmount = gibLimit;
        }
        bool pulverized = (corpseDamage > 5 && overflowDamage > 150);
        if (!pulverized) {
            make_mon_corpse(z, int(floor(corpseDamage)));
        } else if (monSize >= MS_MEDIUM) {
            gibAmount += rng(1, 6);
        }
        // Limit chunking to flesh, veggy and insect creatures until other kinds are supported.
        bool leaveGibs = (z->made_of("flesh") || z->made_of("hflesh") || z->made_of("veggy") ||
                          z->made_of("iflesh"));
        if (leaveGibs) {
            make_gibs( z, gibAmount );
        }
    }
}