when a mon has died, maybe record an achievement or issue livelog message; moved into separate routine to unclutter mondead() */
| 2994 | /* when a mon has died, maybe record an achievement or issue livelog message; |
| 2995 | moved into separate routine to unclutter mondead() */ |
| 2996 | staticfn void |
| 2997 | logdeadmon(struct monst *mtmp, int mndx) |
| 2998 | { |
| 2999 | int howmany = svm.mvitals[mndx].died; |
| 3000 | |
| 3001 | if (mndx == PM_MEDUSA && howmany == 1) { |
| 3002 | record_achievement(ACH_MEDU); /* also generates a livelog event */ |
| 3003 | } else if ((unique_corpstat(mtmp->data) |
| 3004 | && (mndx != PM_HIGH_CLERIC || !mtmp->mrevived)) |
| 3005 | || (mtmp->isshk && !mtmp->mrevived)) { |
| 3006 | char shkdetail[QBUFSZ]; |
| 3007 | const char *mkilled; |
| 3008 | boolean herodidit = !svc.context.mon_moving; |
| 3009 | |
| 3010 | /* |
| 3011 | * livelog event; unique_corpstat() includes the Wizard and |
| 3012 | * any High Priest even though they aren't actually unique. |
| 3013 | * |
| 3014 | * Shopkeeper kills are logged, but only the first time per |
| 3015 | * shopkeeper, since their shared kill counter wouldn't work |
| 3016 | * for this purpose (and it wouldn't account for polymorphed |
| 3017 | * shopkeepers either). |
| 3018 | */ |
| 3019 | shkdetail[0] = '\0'; |
| 3020 | if (mtmp->isshk) { |
| 3021 | howmany = 1; |
| 3022 | /* ", the <shoptype> proprietor" needs a trailing comma for |
| 3023 | the alternate phrasing "<shk>, shkdetails, has been killed" |
| 3024 | when hero isn't directly responsible */ |
| 3025 | Snprintf(shkdetail, sizeof shkdetail, ", the %s %s%s", |
| 3026 | shtypes[ESHK(mtmp)->shoptype - SHOPBASE].name, |
| 3027 | /* in case shk name doesn't include Mr or Ms honorific */ |
| 3028 | mtmp->female ? "proprietrix" : "proprietor", |
| 3029 | herodidit ? "" : ","); |
| 3030 | } else if (mndx == PM_HIGH_CLERIC) { |
| 3031 | /* the high priest[ess] monster is not unique; we know that |
| 3032 | this is the first death for this particular high priest |
| 3033 | (because of the !mtmp->mrevived test above) */ |
| 3034 | howmany = 1; |
| 3035 | } |
| 3036 | |
| 3037 | /* killing a unique more than once doesn't get logged every time; |
| 3038 | the Wizard and the Riders can be killed more than once |
| 3039 | "naturally", others require deliberate player action such as |
| 3040 | use of undead turning to revive a corpse or petrification plus |
| 3041 | stone-to-flesh to create and revive a statue */ |
| 3042 | if (howmany <= 3 || howmany == 5 || howmany == 10 || howmany == 25 |
| 3043 | || (howmany % 50) == 0) { /* 50, 100, 150, 200, 250 */ |
| 3044 | char xtra[40]; /* space for " (Nth time)" when N > 1 */ |
| 3045 | long llevent_type = LL_UMONST; |
| 3046 | |
| 3047 | /* the first kill of any unique monster is a major event; |
| 3048 | all kills of the Wizard and the Riders are major when |
| 3049 | they're logged but they still don't get logged every time */ |
| 3050 | if (howmany == 1 || mtmp->iswiz || is_rider(mtmp->data)) |
| 3051 | llevent_type |= LL_ACHIEVE; |
| 3052 | xtra[0] = '\0'; |
| 3053 | if (howmany > 1) /* "(2nd time)" or "(50th time)" */ |
no test coverage detected