Opened 6 years ago

Closed 6 years ago

#1799 closed bug (fixed (in master))

Some monster messages don't take into account uniqueness of monster

Reported by: PowerWyrm Owned by:
Milestone: 3.5.0 Keywords:
Cc:

Description

Killing a monster normally triggers a different message flavor (color + sound) in mon_take_hit() depending on the uniqueness of the monster: MSG_KILL for normal monsters, MSG_KILL_UNIQUE for uniques, MSG_KILL_KING for Morgoth.

Killing a monster with spells doesn't trigger the same behavior (see project_m):

  • message is delayed by calling add_monster_message() with a different parameter (MON_MSG_DIE, MON_MSG_DESTROYED, MON_MSG_DISSOLVE...)
  • message is flushed when flush_monster_messages() is called
  • all death causes are changed to MSG_KILL
  • the message is displayed

Fix: change cause of death to MSG_KILL_UNIQUE for uniques and MSG_KILL_KING for Morgoth in flush_monster_messages().

case MON_MSG_MORIA_DEATH:
case MON_MSG_DESTROYED:
case MON_MSG_DIE:
case MON_MSG_SHRIVEL_LIGHT:
case MON_MSG_DISENTEGRATES:
case MON_MSG_FREEZE_SHATTER:
case MON_MSG_DISSOLVE:
{
    /* Assume normal death sound */
    type = MSG_KILL;

    /* Play a special sound if the monster was unique */
    if (rf_has(r_ptr->flags, RF_UNIQUE))
    {
        if (r_ptr->base == lookup_monster_base("Morgoth"))
            type = MSG_KILL_KING;
        else
            type = MSG_KILL_UNIQUE;
    }
}

Change History (3)

comment:1 Changed 6 years ago by takkaria

  • Milestone changed from Triage to 3.5.0

comment:2 Changed 6 years ago by PowerWyrm

I just found out that the previous code crashes when the monster is invisible or out of LOS because, in that case, r_ptr is reset to NULL. So it should be changed to:

if (r_ptr && rf_has(r_ptr->flags, RF_UNIQUE))

comment:3 Changed 6 years ago by takkaria

  • Resolution set to fixed (in master)
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.