Пример #1
0
/* Returns 1 if monster died moving, 0 otherwise */
int dochug(struct monst *mtmp)
{
    struct permonst *mdat;
    int tmp = 0;

    if((mtmp->cham != 0) && (rn2(6) == 0)) {
        newcham(mtmp, &mons[(dlevel + 14) + rn2((CMNUM - 14) - dlevel)]);
    }

    mdat = mtmp->data;

    if(mdat->mlevel < 0) {
        panic("bad monster %c (%d)", mdat->mlet, mdat->mlevel);
    }

    if((((moves % 20) == 0) || (index("ViT", mdat->mlet) != 0))
       && (mtmp->mhp < mtmp->orig_hp)) {
        /* Regenerate monsters. */
        ++mtmp->mhp;
    }

    if(mtmp->mfroz != 0) {
        /* Frozen monsters don't do anything. */
        return 0;
    }

    if(mtmp->msleep != 0) {
        /* Wake up a monster, or get out of here. */
        if((cansee(mtmp->mx, mtmp->my) != 0)
	   && (Stealth == 0)
	   && ((index("NL", mdat->mlet) == 0)
	       || (rn2(50) == 0))
	   && ((Aggravate_monster != 0) 
	       || ((rn2(7) == 0) && (mtmp->mimic == 0)))) {
            mtmp->msleep = 0;
        }
        else {
            return 0;
        }
    }

    /* Not frozen or sleeping: wipe out texts written in the dust */
    wipe_engr_at(mtmp->mx, mtmp->my, 1);

    /* Confused monsters get unconfused with small probability */
    if((mtmp->mconf != 0) && (rn2(50) == 0)) {
        mtmp->mconf = 0;
    }

    /* Some monsters teleport */
    if((mtmp->mflee != 0)
       && (index("tNL", mdat->mlet) != 0) 
       && (rn2(40) == 0)) {
        rloc(mtmp);

        return 0;
    }

    if(mdat->mmove < rnd(6)) {
        return 0;
    }

    if((mtmp->mflee != 0)
       || (mtmp->mconf != 0)
       || ((index("BIuy", mdat->mlet) != 0) && (rn2(4) == 0))
       || ((mdat->mlet == 'L') 
           && (u.ugold == 0)
           && ((mtmp->mgold != 0) || (rn2(2) != 0)))
       || (dist(mtmp->mx, mtmp->my) > 2)
       || ((mtmp->mcansee == 0) && (rn2(4) == 0))
       || (mtmp->mpeaceful != 0)) {
        tmp = m_move(mtmp, 0);
        if((tmp != 0) && (mdat->mmove < 12)) {
            if(tmp == 2) {
                return 1;
            }
            else {
                return 0;
            }
        }
    }

    if(tmp == 2) {
        /* Monster died moving */
        return 1;
    }

    if((index("Ea", mdat->mlet) == 0) 
       && (dist(mtmp->mx, mtmp->my) < 3)
       && (mtmp->mpeaceful == 0)
       && (u.uhp > 0)
       && (sengr_at("Elbereth", u.ux, u.uy) == 0)
       && (sobj_at(SCR_SCARE_MONSTER, u.ux, u.uy) == 0)) {
        if(mhitu(mtmp) != 0) {
            /* Monster died (e.g. 'y' or 'F') */
            return 1;
        }   
    }
        
    /* Extra movement for fast monsters */
    if((mdat->mmove - 12) > rnd(12)) {
        tmp = m_move(mtmp, 1);
    }

    if(tmp == 2) {
        return 1;
    }
    else {
        return 0;
    }
}
Пример #2
0
void u_wipe_engr(int cnt)
{
	if (can_reach_floor())
		wipe_engr_at(level, u.ux, u.uy, cnt);
}
Пример #3
0
void
u_wipe_engr(int cnt)
{
	if(!u.uswallow && !Levitation)
		wipe_engr_at(u.ux, u.uy, cnt);
}