本文整理汇总了C++中cansee函数的典型用法代码示例。如果您正苦于以下问题:C++ cansee函数的具体用法?C++ cansee怎么用?C++ cansee使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cansee函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: open_drawbridge
/*
* Open the drawbridge located at x,y
*/
void open_drawbridge(int x, int y)
{
struct rm *loc1, *loc2;
struct trap *t;
int x2, y2;
loc1 = &level->locations[x][y];
if (loc1->typ != DRAWBRIDGE_UP) return;
x2 = x; y2 = y;
get_wall_for_db(&x2,&y2);
if (cansee(x,y) || cansee(x2,y2))
pline("You see a drawbridge %s down!",
(distu(x2,y2) < distu(x,y)) ? "going" : "coming");
loc1->typ = DRAWBRIDGE_DOWN;
loc2 = &level->locations[x2][y2];
loc2->typ = DOOR;
loc2->doormask = D_NODOOR;
set_entity(x, y, &(occupants[0]));
set_entity(x2, y2, &(occupants[1]));
do_entity(&(occupants[0])); /* do set_entity after first */
set_entity(x2, y2, &(occupants[1])); /* do_entity for worm tails */
do_entity(&(occupants[1]));
revive_nasty(x,y,NULL);
delallobj(x, y);
if ((t = t_at(level, x, y)) != 0) deltrap(level, t);
if ((t = t_at(level, x2, y2)) != 0) deltrap(level, t);
newsym(x, y);
newsym(x2, y2);
unblock_point(x2,y2); /* vision */
if (Is_stronghold(&u.uz)) u.uevent.uopened_dbridge = TRUE;
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:34,代码来源:dbridge.c
示例2: relobj
/* release the objects the killed animal has stolen */
void
relobj(struct monst *mtmp, int show)
{
struct obj *otmp, *otmp2;
for(otmp = mtmp->minvent; otmp; otmp = otmp2){
otmp->ox = mtmp->mx;
otmp->oy = mtmp->my;
otmp2 = otmp->nobj;
otmp->nobj = fobj;
fobj = otmp;
stackobj(fobj);
if(show & cansee(mtmp->mx,mtmp->my))
atl(otmp->ox,otmp->oy,otmp->olet);
}
mtmp->minvent = (struct obj *) 0;
if(mtmp->mgold || mtmp->data->mlet == 'L') {
long tmp;
tmp = (mtmp->mgold > 10000) ? 10000 : mtmp->mgold;
mkgold((long)(tmp + d(dlevel,30)), mtmp->mx, mtmp->my);
if(show & cansee(mtmp->mx,mtmp->my))
atl(mtmp->mx,mtmp->my,'$');
}
}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:26,代码来源:hack.steal.c
示例3: close_drawbridge
/*
* Close the drawbridge located at x,y.
* Returns TRUE if the drawbridge was closed, FALSE otherwise.
*/
boolean close_drawbridge(int x, int y)
{
struct rm *loc1, *loc2;
struct monst *m;
struct trap *t;
int x2, y2;
loc1 = &level->locations[x][y];
if (loc1->typ != DRAWBRIDGE_DOWN) return FALSE;
/* A huge monster will block the drawbridge. */
if ((m = m_at(level, x, y)) && hugemonst(m->data)) {
pline("%s blocks the drawbridge with %s weight!",
canseemon(level, m) ? Amonnam(m) : "Something",
canseemon(level, m) ? mhis(level, m) : "its");
return FALSE;
}
if (rn2(5) == 0) {
pline("The mechanism seems to have something stuck in it and won't close.");
return FALSE;
}
x2 = x; y2 = y;
get_wall_for_db(&x2,&y2);
if (cansee(x,y) || cansee(x2,y2))
pline("You see a drawbridge %s up!",
(((u.ux == x || u.uy == y) && !Underwater) ||
distu(x2,y2) < distu(x,y)) ? "coming" : "going");
loc1->typ = DRAWBRIDGE_UP;
loc2 = &level->locations[x2][y2];
loc2->typ = DBWALL;
switch (loc1->drawbridgemask & DB_DIR) {
case DB_NORTH:
case DB_SOUTH:
loc2->horizontal = TRUE;
break;
case DB_WEST:
case DB_EAST:
loc2->horizontal = FALSE;
break;
}
loc2->wall_info = W_NONDIGGABLE;
set_entity(x, y, &(occupants[0]));
set_entity(x2, y2, &(occupants[1]));
do_entity(&(occupants[0])); /* Do set_entity after first */
set_entity(x2, y2, &(occupants[1])); /* do_entity for worm tail */
do_entity(&(occupants[1]));
if (OBJ_AT(x, y) && flags.soundok)
You_hear("smashing and crushing.");
revive_nasty(x,y,NULL);
revive_nasty(x2,y2,NULL);
delallobj(x, y);
delallobj(x2, y2);
if ((t = t_at(level, x, y)) != 0) deltrap(level, t);
if ((t = t_at(level, x2, y2)) != 0) deltrap(level, t);
newsym(x, y);
newsym(x2, y2);
block_point(x2,y2); /* vision */
return TRUE;
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:62,代码来源:dbridge.c
示例4: close_drawbridge
/*
* Close the drawbridge located at x,y
*/
void
close_drawbridge(int x, int y)
{
struct rm *loc1, *loc2;
struct trap *t;
int x2, y2;
loc1 = &level->locations[x][y];
if (loc1->typ != DRAWBRIDGE_DOWN)
return;
x2 = x;
y2 = y;
get_wall_for_db(&x2, &y2);
if (cansee(x, y) || cansee(x2, y2))
pline("You see a drawbridge %s up!",
(((u.ux == x || u.uy == y) && !Underwater) ||
distu(x2, y2) < distu(x, y)) ? "coming" : "going");
else if (canhear())
pline("You hear chains rattling and gears turning.");
loc1->typ = DRAWBRIDGE_UP;
loc2 = &level->locations[x2][y2];
loc2->typ = DBWALL;
switch (loc1->drawbridgemask & DB_DIR) {
case DB_NORTH:
case DB_SOUTH:
loc2->horizontal = TRUE;
break;
case DB_WEST:
case DB_EAST:
loc2->horizontal = FALSE;
break;
}
loc2->wall_info = W_NONDIGGABLE;
set_entity(x, y, &(occupants[0]));
set_entity(x2, y2, &(occupants[1]));
do_entity(&(occupants[0])); /* Do set_entity after first */
set_entity(x2, y2, &(occupants[1])); /* do_entity for worm tail */
do_entity(&(occupants[1]));
if (OBJ_AT(x, y))
You_hear("smashing and crushing.");
revive_nasty(x, y, NULL);
revive_nasty(x2, y2, NULL);
delallobj(x, y);
delallobj(x2, y2);
if ((t = t_at(level, x, y)) != 0)
deltrap(level, t);
if ((t = t_at(level, x2, y2)) != 0)
deltrap(level, t);
del_engr_at(level, x, y);
del_engr_at(level, x2, y2);
newsym(x, y);
newsym(x2, y2);
block_point(x2, y2); /* vision */
}
开发者ID:FredrIQ,项目名称:nhfourk,代码行数:57,代码来源:dbridge.c
示例5: artifact_hit_drainlife
static boolean artifact_hit_drainlife(struct monst *magr, struct monst *mdef,
struct obj *otmp, int *dmgptr)
{
boolean youattack = (magr == &youmonst);
boolean youdefend = (mdef == &youmonst);
boolean vis = (!youattack && magr && cansee(magr->mx, magr->my))
|| (!youdefend && cansee(mdef->mx, mdef->my))
|| (youattack && u.uswallow && mdef == u.ustuck && !Blind);
if (!youdefend) {
if (vis) {
if (otmp->oartifact == ART_STORMBRINGER)
pline("The %s blade draws the life from %s!",
hcolor("black"),
mon_nam(mdef));
else
pline("%s draws the life from %s!",
The(distant_name(otmp, xname)),
mon_nam(mdef));
}
if (mdef->m_lev == 0) {
*dmgptr = 2 * mdef->mhp + FATAL_DAMAGE_MODIFIER;
} else {
int drain = rnd(8);
*dmgptr += drain;
mdef->mhpmax -= drain;
mdef->m_lev--;
drain /= 2;
if (drain) healup(drain, 0, FALSE, FALSE);
}
return vis;
} else { /* youdefend */
int oldhpmax = u.uhpmax;
if (Blind)
pline("You feel an %s drain your life!",
otmp->oartifact == ART_STORMBRINGER ?
"unholy blade" : "object");
else if (otmp->oartifact == ART_STORMBRINGER)
pline("The %s blade drains your life!",
hcolor("black"));
else
pline("%s drains your life!",
The(distant_name(otmp, xname)));
losexp("life drainage");
if (magr && magr->mhp < magr->mhpmax) {
magr->mhp += (oldhpmax - u.uhpmax)/2;
if (magr->mhp > magr->mhpmax) magr->mhp = magr->mhpmax;
}
return TRUE;
}
return FALSE;
}
开发者ID:DanielT,项目名称:NitroHack,代码行数:53,代码来源:artifact.c
示例6: relobj
/* release the objects the creature is carrying */
// bool is_pet /* If true, pet should keep wielded/worn items */
void relobj ( struct monst *mtmp, int show, bool is_pet) {
struct obj *otmp;
int omx = mtmp->mx, omy = mtmp->my;
struct obj *keepobj = 0;
struct obj *wep = MON_WEP(mtmp);
bool item1 = false, item2 = false;
if (!is_pet || mindless(mtmp->data) || is_animal(mtmp->data))
item1 = item2 = true;
if (!tunnels(mtmp->data) || !needspick(mtmp->data))
item1 = true;
while ((otmp = mtmp->minvent) != 0) {
obj_extract_self(otmp);
/* special case: pick-axe and unicorn horn are non-worn */
/* items that we also want pets to keep 1 of */
/* (It is a coincidence that these can also be wielded.) */
if (otmp->owornmask || otmp == wep ||
((!item1 && otmp->otyp == PICK_AXE) ||
(!item2 && otmp->otyp == UNICORN_HORN && !otmp->cursed))) {
if (is_pet) { /* dont drop worn/wielded item */
if (otmp->otyp == PICK_AXE)
item1 = true;
if (otmp->otyp == UNICORN_HORN && !otmp->cursed)
item2 = true;
otmp->nobj = keepobj;
keepobj = otmp;
continue;
}
}
mdrop_obj(mtmp, otmp, is_pet && flags.verbose);
}
/* put kept objects back */
while ((otmp = keepobj) != (struct obj *)0) {
keepobj = otmp->nobj;
(void) add_to_minv(mtmp, otmp);
}
if (mtmp->mgold) {
long g = mtmp->mgold;
(void) mkgold(g, omx, omy);
if (is_pet && cansee(omx, omy) && flags.verbose) {
message_monster_int(MSG_M_DROPS_X_GOLD_PIECES, mtmp, g);
}
mtmp->mgold = 0L;
}
if (show & cansee(omx, omy))
newsym(omx, omy);
}
开发者ID:thejoshwolfe,项目名称:nethack,代码行数:52,代码来源:steal.c
示例7: getclosest
spaceShip* yarrAI :: getclosest()
{
/// Look around and find the ship closest to this one in its vision
///
/// Returns a ship pointer on success,
/// returns a NULL POINTER on failure
SPfloat closest_dist = view_dist + 1; // higher than vision to ensure we see things
spaceShip* closest_ship = NULL;
vector<spaceShip*>::iterator ships_i;
for (ships_i = puppet->sector->ships.begin() ;
ships_i != puppet->sector->ships.end() ;
ships_i++)
{
if( (*ships_i)->team_id != puppet->team_id )
if( cansee((*ships_i)->pos))
{
SPfloat this_dist = puppet->pos.dist( (*ships_i)->pos );
if( this_dist < closest_dist)
closest_ship = (*ships_i);
}
}
return closest_ship;
}
开发者ID:nihilocrat,项目名称:yarrwars,代码行数:27,代码来源:yarrAI.cpp
示例8: mdrop_obj
/* drop one object taken from a (possibly dead) monster's inventory */
static void mdrop_obj (struct monst *mon, struct obj *obj, bool verbosely) {
int omx = mon->mx, omy = mon->my;
if (obj->owornmask) {
/* perform worn item handling if the monster is still alive */
if (mon->mhp > 0) {
mon->misc_worn_check &= ~obj->owornmask;
update_mon_intrinsics(mon, obj, false, true);
/* obj_no_longer_held(obj); -- done by place_object */
if (obj->owornmask & W_WEP) setmnotwielded(mon, obj);
/* don't charge for an owned saddle on dead steed */
} else if (mon->mtame && (obj->owornmask & W_SADDLE) &&
!obj->unpaid && costly_spot(omx, omy)) {
obj->no_charge = 1;
}
obj->owornmask = 0L;
}
if (verbosely && cansee(omx, omy)) {
message_monster_object(MSG_M_DROPS_O, mon, obj);
}
if (!flooreffects(obj, omx, omy, "fall")) {
place_object(obj, omx, omy);
stackobj(obj);
}
}
开发者ID:thejoshwolfe,项目名称:nethack,代码行数:26,代码来源:steal.c
示例9: worm_move
void
worm_move(struct monst *mtmp)
{
struct wseg *wtmp, *whd;
int tmp = mtmp->wormno;
wtmp = newseg();
wtmp->wx = mtmp->mx;
wtmp->wy = mtmp->my;
wtmp->nseg = 0;
(whd = wheads[tmp])->nseg = wtmp;
wheads[tmp] = wtmp;
if (cansee(whd->wx, whd->wy)) {
unpmon(mtmp);
atl(whd->wx, whd->wy, '~');
whd->wdispl = 1;
} else
whd->wdispl = 0;
if (wgrowtime[tmp] <= moves) {
if (!wgrowtime[tmp])
wgrowtime[tmp] = moves + rnd(5);
else
wgrowtime[tmp] += 2 + rnd(15);
mtmp->mhpmax += 3;
mtmp->mhp += 3;
return;
}
whd = wsegs[tmp];
wsegs[tmp] = whd->nseg;
remseg(whd);
}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:31,代码来源:hack.worm.c
示例10: tamedog
int
tamedog(struct monst *mtmp, struct obj *obj)
{
struct monst *mtmp2;
if(flags.moonphase == FULL_MOON && night() && rn2(6))
return(0);
/* If we cannot tame him, at least he's no longer afraid. */
mtmp->mflee = 0;
mtmp->mfleetim = 0;
if(mtmp->mtame || mtmp->mfroz ||
#ifndef NOWORM
mtmp->wormno ||
#endif /* NOWORM */
mtmp->isshk || mtmp->isgd || strchr(" &@12", mtmp->data->mlet))
return(0); /* no tame long worms? */
if(obj) {
if(dogfood(obj) >= MANFOOD) return(0);
if(cansee(mtmp->mx,mtmp->my)){
pline("%s devours the %s.", Monnam(mtmp),
objects[obj->otyp].oc_name);
}
obfree(obj, (struct obj *) 0);
}
mtmp2 = newmonst(sizeof(struct edog) + mtmp->mnamelth);
*mtmp2 = *mtmp;
mtmp2->mxlth = sizeof(struct edog);
if(mtmp->mnamelth)
(void) strlcpy(NAME(mtmp2), NAME(mtmp), mtmp2->mnamelth);
initedog(mtmp2);
replmon(mtmp,mtmp2);
return(1);
}
开发者ID:jyin0813,项目名称:OpenBSD-src,代码行数:34,代码来源:hack.dog.c
示例11: mdrop_obj
/* drop one object taken from a (possibly dead) monster's inventory */
static void mdrop_obj(struct monst *mon, struct obj *obj, boolean verbosely)
{
int omx = mon->mx, omy = mon->my;
if (obj->owornmask) {
/* perform worn item handling if the monster is still alive */
if (mon->mhp > 0) {
mon->misc_worn_check &= ~obj->owornmask;
update_mon_intrinsics(level, mon, obj, FALSE, TRUE);
/* obj_no_longer_held(obj); -- done by place_object */
if (obj->owornmask & W_WEP) setmnotwielded(mon, obj);
/* don't charge for an owned saddle on dead steed */
} else if (mon->mtame && (obj->owornmask & W_SADDLE) &&
!obj->unpaid && costly_spot(omx, omy)) {
obj->no_charge = 1;
}
obj->owornmask = 0L;
}
if (verbosely && cansee(omx, omy))
pline("%s drops %s.", Monnam(mon), distant_name(obj, doname));
if (!flooreffects(obj, omx, omy, "fall")) {
place_object(obj, level, omx, omy);
stackobj(obj);
}
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:26,代码来源:steal.c
示例12: fall
void
fall(THING *obj, int pr)
{
PLACE *pp;
coord fpos;
if (fallpos(&obj->o_pos, &fpos))
{
pp = INDEX(fpos.y, fpos.x);
pp->p_ch = obj->o_type;
obj->o_pos = fpos;
if (cansee(fpos.y, fpos.x))
{
if (pp->p_monst != NULL)
pp->p_monst->t_oldch = obj->o_type;
else
mvaddch(fpos.y, fpos.x, obj->o_type);
}
attach(lvl_obj, obj);
return;
}
if (pr)
{
if (has_hit)
{
endmsg();
has_hit = FALSE;
}
msg("the %s vanishes as it hits the ground",
weap_info[obj->o_which].oi_name);
}
discard(obj);
}
开发者ID:RoguelikeRestorationProject,项目名称:rogue5.4,代码行数:33,代码来源:weapons.c
示例13: hit
void
hit(const char *str, struct monst *mtmp, const char *force)
/* force: usually either "." or "!" */
{
if(!cansee(mtmp->mx,mtmp->my)) pline("The %s hits it.", str);
else pline("The %s hits %s%s", str, monnam(mtmp), force);
}
开发者ID:blakeney,项目名称:slack,代码行数:7,代码来源:hack.zap.c
示例14: dochugw
int dochugw(struct monst *mtmp)
{
int x = mtmp->mx;
int y = mtmp->my;
int d = dochug(mtmp);
int dd;
/* Monster still alive */
if(d == 0) {
if(Warning != 0) {
if(mtmp->mpeaceful == 0) {
dd = dist(mtmp->mx, mtmp->my);
if(dd < dist(x,y)) {
if(dd < 100) {
if((cansee(mtmp->mx, mtmp->my) == 0)
|| ((mtmp->minvis != 0) && (See_invisible == 0))) {
if(mtmp->data->mlevel > warnlevel) {
warnlevel = mtmp->data->mlevel;
}
}
}
}
}
}
}
return d;
}
开发者ID:tcadigan,项目名称:hack_1.0,代码行数:28,代码来源:hack.mon.c
示例15: do_motion
/*
* do the actual motion on the screen done by an object traveling
* across the room
*/
void
do_motion(struct object *obj, int ydelta, int xdelta, struct thing *tp)
{
/*
* Come fly with us ...
*/
obj->o_pos = tp->t_pos ;
for ( ; ;) {
register int ch ;
/*
* Erase the old one
*/
if (!ce(obj->o_pos, tp->t_pos) &&
cansee(unc(obj->o_pos)) &&
mvwinch(cw, obj->o_pos.y, obj->o_pos.x) != ' ') {
mvwaddch(cw, obj->o_pos.y, obj->o_pos.x, show(obj->o_pos.y, obj->o_pos.x)) ;
}
/*
* Get the new position
*/
obj->o_pos.y += ydelta ;
obj->o_pos.x += xdelta ;
if (shoot_ok(ch = winat(obj->o_pos.y, obj->o_pos.x)) && ch != DOOR && !ce(obj->o_pos, hero)) {
/*
* It hasn't hit anything yet, so display it
* If it alright.
*/
if (cansee(unc(obj->o_pos)) &&
mvwinch(cw, obj->o_pos.y, obj->o_pos.x) != ' ') {
mvwaddch(cw, obj->o_pos.y, obj->o_pos.x, obj->o_type) ;
draw(cw) ;
}
continue ;
}
/* don't want objects to end up in wall, or fall through
* so back it up.
*/
if (ch == '|' || ch == '-' || ch == SECRETDOOR || ch == ' ')
{
obj->o_pos.y -= ydelta ;
obj->o_pos.x -= xdelta ;
}
break ;
}
}
开发者ID:RoguelikeRestorationProject,项目名称:urogue1.02,代码行数:51,代码来源:weapons.c
示例16: runners
void
runners(void)
{
register struct linked_list *item;
register struct thing *tp = NULL;
for(item = mlist; item != NULL; item = next(item)) {
tp = THINGPTR(item);
turn_on(*tp, ISREADY);
}
for (;;) {
for (item = mlist; item != NULL; item = next(item)) {
tp = THINGPTR(item);
if (on(*tp, ISREADY))
break;
}
if (item == NULL)
break;
turn_off(*tp, ISREADY);
if (on(*tp, ISHELD) && rnd(tp->t_stats.s_lvl) > 11) {
turn_off(*tp, ISHELD);
turn_on(*tp, ISRUN);
turn_off(*tp, ISDISGUISE);
tp->t_dest = &hero;
if (tp->t_stats.s_hpt < tp->maxstats.s_hpt)
turn_on(*tp, ISFLEE);
if (cansee(tp->t_pos.y, tp->t_pos.x))
msg("The %s breaks free from the hold spell!!!",
monsters[tp->t_index].m_name);
}
if (off(*tp, ISHELD) && on(*tp, ISRUN)) {
register int flee;
/* Should monster run away? */
flee = (on(*tp, ISFLEE) ||
((tp->t_dest == &hero) && on(player, ISINWALL) &&
off(*tp, CANINWALL)));
if (off(*tp, ISSLOW) || tp->t_turn) {
doctor(tp);
do_chase(tp, flee);
}
if (off(*tp, ISDEAD) && on(*tp, ISHASTE)) {
doctor(tp);
do_chase(tp, flee);
}
if (off(*tp, ISDEAD)) {
tp->t_turn ^= TRUE;
tp->t_wasshot = FALSE; /* Not shot anymore */
}
}
}
}
开发者ID:RoguelikeRestorationProject,项目名称:urogue1.02,代码行数:59,代码来源:chase.c
示例17: do_motion
coord
do_motion(int ob, int ydelta, int xdelta, struct thing *tp)
{
coord pos;
/* Come fly with us ... */
pos = tp->t_pos;
for (;;)
{
int ch;
/* Erase the old one */
if (!ce(pos, tp->t_pos) &&
cansee(pos.y, pos.x) &&
mvwinch(cw, pos.y, pos.x) != ' ')
{
mvwaddch(cw, pos.y, pos.x, show(pos.y, pos.x));
}
/* Get the new position */
pos.y += ydelta;
pos.x += xdelta;
if (shoot_ok(ch = winat(pos.y, pos.x)) &&
ch != DOOR && !ce(pos, hero))
{
/* It hasn't hit anything yet, so display it if it alright. */
if (cansee(pos.y, pos.x) &&
mvwinch(cw, pos.y, pos.x) != ' ')
{
mvwaddch(cw, pos.y, pos.x, ob);
wrefresh(cw);
}
continue;
}
break;
}
return(pos);
}
开发者ID:RoguelikeRestorationProject,项目名称:urogue,代码行数:46,代码来源:weapons.c
示例18: visuals
/*
* visuals:
* change the characters for the player
*/
visuals()
{
register THING *tp;
register bool seemonst;
if (!after)
return;
/*
* change the things
*/
for (tp = lvl_obj; tp != NULL; tp = next(tp))
if (cansee(tp->o_pos.y, tp->o_pos.x)) {
PC_GFX_PASSGE_COLOR(tp->o_pos.y, tp->o_pos.x, 0, 0x70);
mvaddrawch(tp->o_pos.y, tp->o_pos.x, rnd_thing());
PC_GFX_NOCOLOR(0x70);
}
/*
* change the stairs
*/
if (!seenstairs && cansee(stairs.y, stairs.x)) {
PC_GFX_PASSGE_COLOR(stairs.y, stairs.x, 0, 0x70);
mvaddrawch(stairs.y, stairs.x, rnd_thing());
PC_GFX_NOCOLOR(0x70);
}
/*
* change the monsters
*/
seemonst = on(player, SEEMONST);
for (tp = mlist; tp != NULL; tp = next(tp))
if (see_monst(tp)){
PC_GFX_PASSGE_COLOR(tp->t_pos.y, tp->t_pos.x, 0, 0x70);
if (tp->t_type == 'M' && tp->t_disguise != 'M')
mvaddrawch(tp->t_pos.y, tp->t_pos.x, rnd_thing());
else
mvaddrawch(tp->t_pos.y, tp->t_pos.x, rnd(26) + 'A');
PC_GFX_NOCOLOR(0x70);
}
else if (seemonst)
{
standout();
mvaddrawch(tp->t_pos.y, tp->t_pos.x, rnd(26) + 'A');
standend();
}
}
开发者ID:mikeyk730,项目名称:Game-Rogue,代码行数:50,代码来源:daemons.c
示例19: miss
void
miss(const char *str, struct monst *mtmp)
{
if (!cansee(mtmp->mx, mtmp->my))
pline("The %s misses it.", str);
else
pline("The %s misses %s.", str, monnam(mtmp));
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:8,代码来源:hack.zap.c
示例20: relobj
/* release the objects the creature is carrying */
void
relobj(struct monst *mtmp, int show, boolean is_pet)
{ /* If true, pet should keep wielded/worn items */
struct obj *otmp;
int omx = mtmp->mx, omy = mtmp->my;
struct obj *keepobj = 0;
struct obj *wep = MON_WEP(mtmp), *hwep = attacktype(mtmp->data, AT_WEAP)
? select_hwep(mtmp) : (struct obj *)0, *proj =
attacktype(mtmp->data, AT_WEAP)
? select_rwep(mtmp) : (struct obj *)0, *rwep;
boolean item1 = FALSE, item2 = FALSE;
rwep = attacktype(mtmp->data, AT_WEAP) ? propellor : &zeroobj;
if (!is_pet || mindless(mtmp->data) || is_animal(mtmp->data))
item1 = item2 = TRUE;
if (!tunnels(mtmp->data) || !needspick(mtmp->data))
item1 = TRUE;
while ((otmp = mtmp->minvent) != 0) {
obj_extract_self(otmp);
/* special case: pick-axe and unicorn horn are non-worn */
/* items that we also want pets to keep 1 of */
/* (It is a coincidence that these can also be wielded.) */
if (otmp->owornmask || otmp == wep || otmp == hwep || otmp == rwep ||
otmp == proj ||
would_prefer_hwep(mtmp, otmp) || /* cursed item in hand? */
would_prefer_rwep(mtmp, otmp) || could_use_item(mtmp, otmp) ||
((!rwep || rwep == &zeroobj) &&
(is_ammo(otmp) || is_launcher(otmp))) ||
(rwep && rwep != &zeroobj && ammo_and_launcher(otmp, rwep)) ||
((!item1 && otmp->otyp == PICK_AXE) ||
(!item2 && otmp->otyp == UNICORN_HORN && !otmp->cursed))) {
if (is_pet) { /* dont drop worn/wielded item */
if (otmp->otyp == PICK_AXE)
item1 = TRUE;
if (otmp->otyp == UNICORN_HORN && !otmp->cursed)
item2 = TRUE;
otmp->nobj = keepobj;
keepobj = otmp;
continue;
}
}
if (otmp == wep)
setmnotwielded(mtmp, otmp);
mdrop_obj(mtmp, otmp, is_pet && flags.verbose);
}
/* put kept objects back */
while ((otmp = keepobj) != NULL) {
keepobj = otmp->nobj;
add_to_minv(mtmp, otmp);
}
if (show & cansee(omx, omy))
newsym(omx, omy);
}
开发者ID:chasetopher,项目名称:NetHack-4,代码行数:59,代码来源:steal.c
注:本文中的cansee函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论