本文整理汇总了C++中Monnam函数的典型用法代码示例。如果您正苦于以下问题:C++ Monnam函数的具体用法?C++ Monnam怎么用?C++ Monnam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Monnam函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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
示例2: teleport_pet
boolean teleport_pet(struct monst *mtmp, boolean force_it)
{
struct obj *otmp;
if (mtmp == u.usteed)
return FALSE;
if (mtmp->mleashed) {
otmp = get_mleash(mtmp);
if (!otmp) {
impossible("%s is leashed, without a leash.", Monnam(mtmp));
goto release_it;
}
if (otmp->cursed && !force_it) {
yelp(mtmp);
return FALSE;
} else {
pline("Your leash goes slack.");
release_it:
m_unleash(mtmp, FALSE);
return TRUE;
}
}
return TRUE;
}
开发者ID:DanielT,项目名称:NitroHack,代码行数:25,代码来源:teleport.c
示例3: mtele_trap
void
mtele_trap(struct monst *mtmp, struct trap *trap, int in_sight)
{
char *monname;
if (tele_restrict(mtmp))
return;
if (teleport_pet(mtmp, FALSE)) {
/* save name with pre-movement visibility */
monname = Monnam(mtmp);
/* Note: don't remove the trap if a vault. Other- wise the monster
will be stuck there, since the guard isn't going to come for it... */
if (trap->once)
mvault_tele(mtmp);
else
rloc(mtmp, FALSE);
if (in_sight) {
if (canseemon(mtmp))
pline("%s seems disoriented.", monname);
else
pline("%s suddenly disappears!", monname);
seetrap(trap);
}
}
}
开发者ID:eatnumber1,项目名称:bingehack4,代码行数:27,代码来源:teleport.c
示例4: whimper
/* the sounds of distressed pets */
void whimper(struct monst *mtmp)
{
const char *whimper_verb = 0;
if (mtmp->msleeping || !mtmp->mcanmove || !mtmp->data->msound)
return;
/* presumably nearness and soundok checks have already been made */
if (Hallucination)
whimper_verb = h_sounds[rn2(SIZE(h_sounds))];
else switch (mtmp->data->msound) {
case MS_MEW:
case MS_GROWL:
whimper_verb = "whimper";
break;
case MS_BARK:
whimper_verb = "whine";
break;
case MS_SQEEK:
whimper_verb = "squeal";
break;
}
if (whimper_verb) {
pline("%s %s.", Monnam(mtmp), vtense(NULL, whimper_verb));
if (flags.run) nomul(0, NULL);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 6);
}
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:29,代码来源:sounds.c
示例5: 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
示例6: stealgold
void
stealgold(struct monst *mtmp)
{
struct gold *gold = g_at(u.ux, u.uy);
long tmp;
if(gold && ( !u.ugold || gold->amount > u.ugold || !rn2(5))) {
mtmp->mgold += gold->amount;
freegold(gold);
if(Invisible) newsym(u.ux, u.uy);
pline("%s quickly snatches some gold from between your feet!",
Monnam(mtmp));
if(!u.ugold || !rn2(5)) {
rloc(mtmp);
mtmp->mflee = 1;
}
} else if(u.ugold) {
u.ugold -= (tmp = somegold());
pline("Your purse feels lighter.");
mtmp->mgold += tmp;
rloc(mtmp);
mtmp->mflee = 1;
flags.botl = 1;
}
}
开发者ID:SylvestreG,项目名称:bitrig,代码行数:25,代码来源:hack.steal.c
示例7: stealgold
/*
* Steal gold coins only. Leprechauns don't care for lesser coins.
*/
void stealgold(struct monst *mtmp)
{
struct obj *fgold = gold_at(level, u.ux, u.uy);
struct obj *ygold;
long tmp;
/* skip lesser coins on the floor */
while (fgold && fgold->otyp != GOLD_PIECE) fgold = fgold->nexthere;
/* Do you have real gold? */
ygold = findgold(invent);
if (fgold && ( !ygold || fgold->quan > ygold->quan || !rn2(5))) {
obj_extract_self(fgold);
add_to_minv(mtmp, fgold);
newsym(u.ux, u.uy);
pline("%s quickly snatches some gold from between your %s!",
Monnam(mtmp), makeplural(body_part(FOOT)));
if (!ygold || !rn2(5)) {
if (!tele_restrict(mtmp)) rloc(level, mtmp, FALSE);
monflee(mtmp, 0, FALSE, FALSE);
}
} else if (ygold) {
const int gold_price = objects[GOLD_PIECE].oc_cost;
tmp = (somegold(money_cnt(invent)) + gold_price - 1) / gold_price;
tmp = min(tmp, ygold->quan);
if (tmp < ygold->quan) ygold = splitobj(ygold, tmp);
freeinv(ygold);
add_to_minv(mtmp, ygold);
pline("Your purse feels lighter.");
if (!tele_restrict(mtmp)) rloc(level, mtmp, FALSE);
monflee(mtmp, 0, FALSE, FALSE);
iflags.botl = 1;
}
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:38,代码来源:steal.c
示例8: paygd
/* Routine when dying or quitting with a vault guard around */
void paygd(void) {
struct monst *grd = findgd();
struct obj *gold;
int gx, gy;
char buf[BUFSZ];
if (!u.ugold || !grd)
return;
if (u.uinvault) {
Your("%ld %s goes into the Magic Memory Vault.", u.ugold, currency(u.ugold));
gx = u.ux;
gy = u.uy;
} else {
if (grd->mpeaceful) { /* guard has no "right" to your gold */
mongone(grd);
return;
}
mnexto(grd);
char name[BUFSZ];
Monnam(name, BUFSZ, grd);
pline("%s remits your gold to the vault.", name);
gx = rooms[EGD(grd)->vroom].lx + rn2(2);
gy = rooms[EGD(grd)->vroom].ly + rn2(2);
sprintf(buf, "To Croesus: here's the gold recovered from %s the %s.", plname, mons[u.umonster].mname);
make_grave(gx, gy, buf);
}
place_object(gold = mkgoldobj(u.ugold), gx, gy);
stackobj(gold);
mongone(grd);
}
开发者ID:thejoshwolfe,项目名称:nethack,代码行数:32,代码来源:vault.c
示例9: charm_snakes
/* Charm snakes in range. Note that the snakes are NOT tamed. */
static void
charm_snakes(int distance)
{
struct monst *mtmp = level->monlist;
int could_see_mon, was_peaceful;
while (mtmp) {
if (!DEADMONSTER(mtmp) && mtmp->data->mlet == S_SNAKE && mtmp->mcanmove
&& distu(mtmp->mx, mtmp->my) < distance) {
was_peaceful = mtmp->mpeaceful;
mtmp->mavenge = 0;
could_see_mon = canspotmon(mtmp);
mtmp->mundetected = 0;
msethostility(mtmp, FALSE, FALSE); /* does a newsym() */
if (canseemon(mtmp)) {
if (!could_see_mon)
pline(msgc_youdiscover,
"You notice %s, swaying with the music.",
a_monnam(mtmp));
else
pline(msgc_actionok,
"%s freezes, then sways with the music%s.",
Monnam(mtmp),
was_peaceful ? "" : ", and now seems quieter");
}
}
mtmp = mtmp->nmon;
}
}
开发者ID:FredrIQ,项目名称:fiqhack,代码行数:30,代码来源:music.c
示例10: stealarm
static int stealarm(void)
{
struct monst *mtmp;
struct obj *otmp;
for (otmp = invent; otmp; otmp = otmp->nobj) {
if (otmp->o_id == stealoid) {
for (mtmp = level->monlist; mtmp; mtmp = mtmp->nmon) {
if (mtmp->m_id == stealmid) {
if (DEADMONSTER(mtmp)) warning("stealarm(): dead monster stealing");
if (!dmgtype(mtmp->data, AD_SITM)) /* polymorphed */
goto botm;
if (otmp->unpaid)
subfrombill(otmp, shop_keeper(level, *u.ushops));
freeinv(otmp);
pline("%s steals %s!", Monnam(mtmp), doname(otmp));
mpickobj(mtmp,otmp); /* may free otmp */
/* Implies seduction, "you gladly hand over ..."
so we don't set mavenge bit here. */
monflee(mtmp, 0, FALSE, FALSE);
if (!tele_restrict(mtmp)) rloc(level, mtmp, FALSE);
break;
}
}
break;
}
}
botm: stealoid = 0;
return 0;
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:30,代码来源:steal.c
示例11: new_were
void new_were(struct monst *mon)
{
int pm;
pm = counter_were(monsndx(mon->data));
if (!pm) {
impossible("unknown lycanthrope %s.", mon->data->mname);
return;
}
if (canseemon(mon) && !Hallucination)
pline("%s changes into a %s.", Monnam(mon),
is_human(&mons[pm]) ? "human" :
mons[pm].mname+4);
set_mon_data(mon, &mons[pm], 0);
if (mon->msleeping || !mon->mcanmove) {
/* transformation wakens and/or revitalizes */
mon->msleeping = 0;
mon->mfrozen = 0; /* not asleep or paralyzed */
mon->mcanmove = 1;
}
/* regenerate by 1/4 of the lost hit points */
mon->mhp += (mon->mhpmax - mon->mhp) / 4;
newsym(mon->mx,mon->my);
mon_break_armor(mon, FALSE);
possibly_unwield(mon, FALSE);
}
开发者ID:DanielT,项目名称:NitroHack,代码行数:28,代码来源:were.c
示例12: breamq
int
breamq(struct monst *mtmp, int xdef, int ydef, const struct attack *mattk)
{
/* if new breath types are added, change AD_ACID to max type */
int typ = (mattk->adtyp == AD_RBRE) ? rnd(AD_ACID) : mattk->adtyp;
boolean youdef = u.ux == xdef && u.uy == ydef;
if (!youdef && distmin(mtmp->mx, mtmp->my, xdef, ydef) < 3)
return 0;
boolean linedup = qlined_up(mtmp, xdef, ydef, TRUE, FALSE);
if (linedup) {
if (mtmp->mcan) {
if (canhear()) {
if (mon_visible(mtmp))
pline("%s coughs.", Monnam(mtmp));
else
You_hear("a cough.");
}
return 0;
}
if (!mtmp->mspec_used && rn2(3)) {
if ((typ >= AD_MAGM) && (typ <= AD_ACID)) {
if (mon_visible(mtmp)) {
pline("%s breathes %s!", Monnam(mtmp), breathwep[typ - 1]);
action_interrupted();
}
buzz((int)(-20 - (typ - 1)), (int)mattk->damn, mtmp->mx,
mtmp->my, sgn(tbx), sgn(tby), 0);
/* breath runs out sometimes. Also, give monster some cunning;
don't breath if the target fell asleep. */
if (!rn2(3))
mtmp->mspec_used = 10 + rn2(20);
boolean sleeping = youdef ? u_helpless(hm_asleep) :
MON_AT(level, xdef, ydef) ?
m_at(level, xdef, ydef)->msleeping : FALSE;
if (typ == AD_SLEE && sleeping)
mtmp->mspec_used += rnd(20);
} else
impossible("Breath weapon %d used", typ - 1);
}
}
return 1;
}
开发者ID:FredrIQ,项目名称:nhfourk,代码行数:46,代码来源:mthrowu.c
示例13: inside_gas_cloud
boolean
inside_gas_cloud(void *p1, void *p2)
{
struct region *reg;
struct monst *mtmp;
long dam;
reg = (struct region *)p1;
dam = (long)reg->arg;
if (p2 == NULL) { /* This means *YOU* Bozo! */
if (nonliving(youmonst.data) || u.uinvulnerable)
return FALSE;
/* If you will unblind next turn, extend the blindness so that you do
* not get a "You can see again!" message immediately before being
* blinded again. */
if (!Blind || Blinded == 1)
make_blinded(2L, FALSE);
if (Breathless)
return FALSE;
if (!Poison_resistance) {
pline("Something is burning your %s!", makeplural(body_part(LUNG)));
pline("You cough and spit blood!");
losehp(rnd(dam) + 5, killer_msg(DIED, "a gas cloud"));
return FALSE;
} else {
pline("You cough!");
return FALSE;
}
} else { /* A monster is inside the cloud */
mtmp = (struct monst *)p2;
/* Non living and non breathing monsters are not concerned */
if (!nonliving(mtmp->data) && !breathless(mtmp->data)) {
if (cansee(mtmp->mx, mtmp->my))
pline("%s coughs!", Monnam(mtmp));
setmangry(mtmp);
if (haseyes(mtmp->data) && mtmp->mcansee) {
mtmp->mblinded = 1;
mtmp->mcansee = 0;
}
if (resists_poison(mtmp))
return FALSE;
mtmp->mhp -= rnd(dam) + 5;
if (mtmp->mhp <= 0) {
if (heros_fault(reg))
killed(mtmp);
else
monkilled(mtmp, "gas cloud", AD_DRST);
if (DEADMONSTER(mtmp)) { /* not lifesaved */
return TRUE;
}
}
}
}
return FALSE; /* Monster is still alive */
}
开发者ID:ComputerScienceHouse,项目名称:bingehack4,代码行数:56,代码来源:region.c
示例14: paybill
/* routine called after dying (or quitting) with nonempty bill */
void
paybill(void)
{
if (shlevel == dlevel && shopkeeper && ESHK(shopkeeper)->billct) {
addupbill();
if (total > u.ugold) {
shopkeeper->mgold += u.ugold;
u.ugold = 0;
pline("%s comes and takes all your possessions.",
Monnam(shopkeeper));
} else {
u.ugold -= total;
shopkeeper->mgold += total;
pline("%s comes and takes the %ld zorkmids you owed him.",
Monnam(shopkeeper), total);
}
setpaid(); /* in case we create bones */
}
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:20,代码来源:hack.shk.c
示例15: hitu
int
hitu(struct monst *mtmp, int dam)
{
int tmp, res;
nomul(0);
if(u.uswallow) return(0);
if(mtmp->mhide && mtmp->mundetected) {
mtmp->mundetected = 0;
if(!Blind) {
struct obj *obj;
if ((obj = o_at(mtmp->mx,mtmp->my)))
pline("%s was hidden under %s!",
Xmonnam(mtmp), doname(obj));
}
}
tmp = u.uac;
/* give people with Ac = -10 at least some vulnerability */
if(tmp < 0) {
dam += tmp; /* decrease damage */
if(dam <= 0) dam = 1;
tmp = -rn2(-tmp);
}
tmp += mtmp->data->mlevel;
if(multi < 0) tmp += 4;
if((Invis && mtmp->data->mlet != 'I') || !mtmp->mcansee) tmp -= 2;
if(mtmp->mtrapped) tmp -= 2;
if(tmp <= rnd(20)) {
if(Blind) pline("It misses.");
else pline("%s misses.",Monnam(mtmp));
res = 0;
} else {
if(Blind) pline("It hits!");
else pline("%s hits!",Monnam(mtmp));
losehp_m(dam, mtmp);
res = 1;
}
stop_occupation();
return(res);
}
开发者ID:lattera,项目名称:openbsd,代码行数:42,代码来源:hack.mhitu.c
示例16: paybill
/* routine called after dying (or quitting) with nonempty bill */
void paybill()
{
if (shlevel == dlevel && shopkeeper && ESHK(shopkeeper)->billct) {
addupbill();
if (total > you.ugold){
shopkeeper->mgold += you.ugold;
you.ugold = 0;
StrPrintF(ScratchBuffer, "%s comes and takes all your possessions.",
Monnam(shopkeeper));
message(ScratchBuffer);
} else {
you.ugold -= total;
shopkeeper->mgold += total;
StrPrintF(ScratchBuffer,
"%s comes and takes the %ld zorkmids you owed him.",
Monnam(shopkeeper), total);
message(ScratchBuffer);
}
setpaid(); /* in case we create bones */
}
}
开发者ID:BackupTheBerlios,项目名称:paleohack,代码行数:22,代码来源:shk.c
示例17: strcpy
/*
* Generates capitalized entity name, makes 2nd -> 3rd person conversion on
* verb, where necessary.
*/
static const char *E_phrase(struct entity *etmp, const char *verb)
{
static char wholebuf[80];
strcpy(wholebuf, is_u(etmp) ? "You" : Monnam(etmp->emon));
if (!*verb) return wholebuf;
strcat(wholebuf, " ");
if (is_u(etmp))
strcat(wholebuf, verb);
else
strcat(wholebuf, vtense(NULL, verb));
return wholebuf;
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:17,代码来源:dbridge.c
示例18: kick_steed
/* The player kicks or whips the steed */
void
kick_steed(void)
{
char He[4];
if (!u.usteed)
return;
/* [ALI] Various effects of kicking sleeping/paralyzed steeds */
if (u.usteed->msleeping || !u.usteed->mcanmove) {
/* We assume a message has just been output of the form "You kick
<steed>." */
strcpy(He, mhe(u.usteed));
*He = highc(*He);
if ((u.usteed->mcanmove || u.usteed->mfrozen) && !rn2(2)) {
if (u.usteed->mcanmove)
u.usteed->msleeping = 0;
else if (u.usteed->mfrozen > 2)
u.usteed->mfrozen -= 2;
else {
u.usteed->mfrozen = 0;
u.usteed->mcanmove = 1;
}
if (u.usteed->msleeping || !u.usteed->mcanmove)
pline("%s stirs.", He);
else
pline("%s rouses %sself!", He, mhim(u.usteed));
} else
pline("%s does not respond.", He);
return;
}
/* Make the steed less tame and check if it resists */
if (u.usteed->mtame)
u.usteed->mtame--;
if (!u.usteed->mtame && u.usteed->mleashed)
m_unleash(u.usteed, TRUE);
if (!u.usteed->mtame ||
(u.ulevel + u.usteed->mtame < rnd(MAXULEV / 2 + 5))) {
newsym(u.usteed->mx, u.usteed->my);
dismount_steed(DISMOUNT_THROWN);
return;
}
pline("%s gallops!", Monnam(u.usteed));
u.ugallop += rn1(20, 30);
return;
}
开发者ID:FredrIQ,项目名称:nhfourk,代码行数:49,代码来源:steed.c
示例19: setmangry
void setmangry(struct monst *mtmp)
{
if(mtmp->mpeaceful == 0) {
return;
}
if(mtmp->mtame != 0) {
return;
}
mtmp->mpeaceful = 0;
if(ishuman(mtmp) != 0) {
pline("%s get angry!", Monnam(mtmp));
}
}
开发者ID:tcadigan,项目名称:hack_1.0,代码行数:16,代码来源:hack.mon.c
示例20: stealamulet
int stealamulet(struct monst *mtmp)
{
struct obj *otmp;
for (otmp = invent; otmp; otmp = otmp->nobj) {
if (otmp->olet == AMULET_SYM) {
// might be an imitation one
if (otmp == uwep)
setuwep((struct obj *) 0);
freeinv(otmp);
mpickobj(mtmp, otmp);
pline("%s stole %s!", Monnam(mtmp), doname(otmp));
return 1;
}
}
return 0;
}
开发者ID:kleopatra999,项目名称:bsd-games-3,代码行数:17,代码来源:steal.c
注:本文中的Monnam函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论