void summon_minion(aligntyp alignment, boolean talk) { struct monst *mon; int mnum; switch ((int)alignment) { case A_LAWFUL: mnum = lminion(); break; case A_NEUTRAL: mnum = PM_AIR_ELEMENTAL + rn2(4); break; case A_CHAOTIC: case A_NONE: mnum = ndemon(&u.uz, alignment); break; default: impossible("unaligned player?"); mnum = ndemon(&u.uz, A_NONE); break; } if (mnum == NON_PM) { mon = 0; } else if (mons[mnum].pxtyp == MX_NONE) { const struct permonst *pm = &mons[mnum]; mon = makemon(pm, level, u.ux, u.uy, MM_EMIN); if (mon) { mon->isminion = TRUE; EMIN(mon)->min_align = alignment; } } else if (roamer_type(&mons[mnum])) { mon = makemon(&mons[mnum], level, u.ux, u.uy, NO_MM_FLAGS); if (mon) { mon->isminion = TRUE; EPRI(mon)->shralign = alignment; } } else mon = makemon(&mons[mnum], level, u.ux, u.uy, NO_MM_FLAGS); if (mon) { if (talk) { pline("The voice of %s booms:", align_gname(alignment)); verbalize("Thou shalt pay for thy indiscretion!"); if (!Blind) pline("%s appears before you.", Amonnam(mon)); } mon->mpeaceful = FALSE; /* don't call set_malign(); player was naughty */ } }
// Display (part of a) line at a given location void edutils_line_display( int scrline, int id ) { const char* pline = edutils_line_get( id ); int nspaces = TERM_COLS, i; int longline = edutils_get_actsize( pline ) > TERM_COLS; edhw_gotoxy( 0, scrline ); if( longline ) edhw_longline( 1 ); if( edutilsh_is_selected( id ) ) edhw_markselected( 1 ); if( pline && ed_startx < strlen( pline ) ) for( i = 0; i < EMIN( strlen( pline ) - ed_startx, TERM_COLS ); i ++, nspaces -- ) edhw_writechar( pline[ ed_startx + i ] ); for( i = 0; i < nspaces; i ++ ) edhw_writechar( ' ' ); if( longline ) edhw_longline( 0 ); if( edutilsh_is_selected( id ) ) edhw_markselected( 0 ); }
void mstatusline(struct monst *mtmp) { aligntyp alignment; const char *info, *monnambuf; if (mtmp->ispriest || (mtmp->isminion && roamer_type(mtmp->data))) alignment = CONST_EPRI(mtmp)->shralign; else if (mtmp->isminion) alignment = EMIN(mtmp)->min_align; else { alignment = mtmp->data->maligntyp; alignment = (alignment > 0) ? A_LAWFUL : (alignment == A_NONE) ? A_NONE : (alignment < 0) ? A_CHAOTIC : A_NEUTRAL; } info = ""; if (mtmp->mtame) { info = msgcat(info, ", tame"); if (wizard) { info = msgprintf("%s (%d", info, mtmp->mtame); if (!mtmp->isminion) info = msgprintf("%s; hungry %u; apport %d", info, EDOG(mtmp)->hungrytime, EDOG(mtmp)->apport); info = msgcat(info, ")"); } } else if (mtmp->mpeaceful) info = msgcat(info, ", peaceful"); if (mtmp->meating) info = msgcat(info, ", eating"); if (mtmp->mcan) info = msgcat(info, ", cancelled"); if (mtmp->mconf) info = msgcat(info, ", confused"); if (mtmp->mblinded || !mtmp->mcansee) info = msgcat(info, ", blind"); if (mtmp->mstun) info = msgcat(info, ", stunned"); if (mtmp->msleeping) info = msgcat(info, ", asleep"); else if (mtmp->mfrozen || !mtmp->mcanmove) info = msgcat(info, ", can't move"); /* [arbitrary reason why it isn't moving] */ else if (mtmp->mstrategy & STRAT_WAITMASK) info = msgcat(info, ", meditating"); else if (mtmp->mflee) info = msgcat(info, ", scared"); if (mtmp->mtrapped) info = msgcat(info, ", trapped"); if (mtmp->mspeed) info = msgcat(info, mtmp->mspeed == MFAST ? ", fast" : mtmp->mspeed == MSLOW ? ", slow" : ", ???? speed"); if (mtmp->mundetected) info = msgcat(info, ", concealed"); if (mtmp->minvis) info = msgcat(info, ", invisible"); if (mtmp == u.ustuck) info = msgcat(info, (sticks(youmonst.data)) ? ", held by you" : Engulfed ? (is_animal(u.ustuck->data) ? ", swallowed you" : ", engulfed you") : ", holding you"); if (mtmp == u.usteed) info = msgcat(info, ", carrying you"); /* avoid "Status of the invisible newt ..., invisible" */ /* and unlike a normal mon_nam, use "saddled" even if it has a name */ monnambuf = x_monnam(mtmp, ARTICLE_THE, NULL, (SUPPRESS_IT | SUPPRESS_INVISIBLE), FALSE); pline("Status of %s (%s): Level %d HP %d(%d) Def %d%s.", monnambuf, align_str(alignment), mtmp->m_lev, mtmp->mhp, mtmp->mhpmax, 10 - find_mac(mtmp), info); }