|
|
|
@ -46,7 +46,6 @@ static int eat_ok(struct obj *);
|
|
|
|
|
static int offer_ok(struct obj *);
|
|
|
|
|
static int tin_ok(struct obj *);
|
|
|
|
|
|
|
|
|
|
/* also used to see if you're allowed to eat cats and dogs */
|
|
|
|
|
#define CANNIBAL_ALLOWED() (Role_if(PM_CAVE_DWELLER) || Race_if(PM_ORC))
|
|
|
|
|
|
|
|
|
|
/* monster types that cause hero to be turned into stone if eaten */
|
|
|
|
@ -84,8 +83,7 @@ static const struct victual_info zero_victual = { 0 };
|
|
|
|
|
static int getobj_else = 0;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Decide whether a particular object can be eaten by the possibly
|
|
|
|
|
* polymorphed character. Not used for monster checks.
|
|
|
|
|
* 决定一个特定的对象是否可以被可能已经变形的角色所吃。这个函数不用于检查怪物
|
|
|
|
|
*/
|
|
|
|
|
boolean
|
|
|
|
|
is_edible(register struct obj *obj)
|
|
|
|
@ -120,8 +118,7 @@ is_edible(register struct obj *obj)
|
|
|
|
|
return (boolean) (obj->oclass == FOOD_CLASS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* used for hero init, life saving (if choking), and prayer results of fix
|
|
|
|
|
starving, fix weak from hunger, or golden glow boon (if u.uhunger < 900) */
|
|
|
|
|
/* 用于英雄的初始化、生命挽救、修复因饥饿产生的负面效果以及提供增益效果 */
|
|
|
|
|
void
|
|
|
|
|
init_uhunger(void)
|
|
|
|
|
{
|
|
|
|
@ -176,7 +173,7 @@ eatmdone(void)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* called when hallucination is toggled */
|
|
|
|
|
/* 处理角色进食结束后的某些更新操作 */
|
|
|
|
|
void
|
|
|
|
|
eatmupdate(void)
|
|
|
|
|
{
|
|
|
|
@ -212,7 +209,7 @@ eatmupdate(void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ``[the(] singular(food, xname) [)]'' */
|
|
|
|
|
/* 这个函数的主要目的是根据给定的食物对象和布尔值来生成一个特定的名字。 */
|
|
|
|
|
static const char *
|
|
|
|
|
food_xname(struct obj *food, boolean the_pfx)
|
|
|
|
|
{
|
|
|
|
@ -241,7 +238,7 @@ food_xname(struct obj *food, boolean the_pfx)
|
|
|
|
|
*
|
|
|
|
|
* To a full belly all food is bad. (It.)
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
static void//述玩家角色吃东西时发生的情况的函数
|
|
|
|
|
choke(struct obj *food)
|
|
|
|
|
{
|
|
|
|
|
/* only happens if you were satiated */
|
|
|
|
@ -287,7 +284,7 @@ choke(struct obj *food)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* modify object wt. depending on time spent consuming it */
|
|
|
|
|
/*重新计算一个对象的重量 */
|
|
|
|
|
static void
|
|
|
|
|
recalc_wt(void)
|
|
|
|
|
{
|
|
|
|
@ -304,7 +301,7 @@ recalc_wt(void)
|
|
|
|
|
debugpline1("New weight = %d", piece->owt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* called when eating interrupted by an event */
|
|
|
|
|
/* 指示在进食回合结束后进行重置操作 */
|
|
|
|
|
void
|
|
|
|
|
reset_eat(void)
|
|
|
|
|
{
|
|
|
|
@ -318,7 +315,7 @@ reset_eat(void)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* base nutrition of a food-class object */
|
|
|
|
|
/* 计算并返回一个对象的营养值 */
|
|
|
|
|
unsigned
|
|
|
|
|
obj_nutrition(struct obj *otmp)
|
|
|
|
|
{
|
|
|
|
@ -377,7 +374,7 @@ touchfood(struct obj *otmp)
|
|
|
|
|
* do_reset_eat() at the beginning of eatfood()) and check for null pointers
|
|
|
|
|
* in do_reset_eat().
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
void//处理食物消失
|
|
|
|
|
food_disappears(struct obj *obj)
|
|
|
|
|
{
|
|
|
|
|
if (obj == gc.context.victual.piece)
|
|
|
|
@ -390,7 +387,7 @@ food_disappears(struct obj *obj)
|
|
|
|
|
/* renaming an object used to result in it having a different address,
|
|
|
|
|
so the sequence start eating/opening, get interrupted, name the food,
|
|
|
|
|
resume eating/opening would restart from scratch */
|
|
|
|
|
void
|
|
|
|
|
void//替换特定的食物对象。
|
|
|
|
|
food_substitution(struct obj *old_obj, struct obj *new_obj)
|
|
|
|
|
{
|
|
|
|
|
if (old_obj == gc.context.victual.piece) {
|
|
|
|
@ -403,7 +400,7 @@ food_substitution(struct obj *old_obj, struct obj *new_obj)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
static void//重置与食物相关的某些属性
|
|
|
|
|
do_reset_eat(void)
|
|
|
|
|
{
|
|
|
|
|
debugpline0("do_reset_eat...");
|
|
|
|
@ -430,7 +427,7 @@ do_reset_eat(void)
|
|
|
|
|
attribute or because of polymorph shape or worn or carried gear), return
|
|
|
|
|
its timeout, otherwise return 0 */
|
|
|
|
|
long
|
|
|
|
|
temp_resist(int prop)
|
|
|
|
|
temp_resist(int prop)//检查某个属性(由prop指定)是否具有临时抗性
|
|
|
|
|
{
|
|
|
|
|
struct prop *p = &u.uprops[prop];
|
|
|
|
|
long timeout = p->intrinsic & TIMEOUT;
|
|
|
|
@ -449,7 +446,7 @@ temp_resist(int prop)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if temp resist against 'prop' is about to timeout, extend it slightly */
|
|
|
|
|
static void
|
|
|
|
|
static void//判断当前属性(通过prop参数指定)是否具有临时抗性
|
|
|
|
|
maybe_extend_timed_resist(int prop)
|
|
|
|
|
{
|
|
|
|
|
long timeout = temp_resist(prop);
|
|
|
|
@ -468,7 +465,7 @@ maybe_extend_timed_resist(int prop)
|
|
|
|
|
|
|
|
|
|
/* called each move during eating process */
|
|
|
|
|
static int
|
|
|
|
|
eatfood(void)
|
|
|
|
|
eatfood(void)//处理角色进食的逻辑。
|
|
|
|
|
{
|
|
|
|
|
struct obj *food = gc.context.victual.piece;
|
|
|
|
|
|
|
|
|
@ -512,7 +509,7 @@ eatfood(void)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
done_eating(boolean message)
|
|
|
|
|
done_eating(boolean message)//处理角色完成进食后的逻辑。
|
|
|
|
|
{
|
|
|
|
|
struct obj *piece = gc.context.victual.piece;
|
|
|
|
|
|
|
|
|
@ -544,7 +541,7 @@ done_eating(boolean message)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
eating_conducts(struct permonst *pd)
|
|
|
|
|
eating_conducts(struct permonst *pd)//处理与角色进食相关的行为和记录。
|
|
|
|
|
{
|
|
|
|
|
int ll_conduct = 0;
|
|
|
|
|
|
|
|
|
@ -571,7 +568,7 @@ eating_conducts(struct permonst *pd)
|
|
|
|
|
|
|
|
|
|
/* handle side-effects of mind flayer's tentacle attack */
|
|
|
|
|
int
|
|
|
|
|
eat_brains(
|
|
|
|
|
eat_brains(//处理角色吃怪物的脑子的行为
|
|
|
|
|
struct monst *magr,
|
|
|
|
|
struct monst *mdef,
|
|
|
|
|
boolean visflag,
|
|
|
|
@ -720,7 +717,7 @@ eat_brains(
|
|
|
|
|
|
|
|
|
|
/* eating a corpse or egg of one's own species is usually naughty */
|
|
|
|
|
static boolean
|
|
|
|
|
maybe_cannibal(int pm, boolean allowmsg)
|
|
|
|
|
maybe_cannibal(int pm, boolean allowmsg)//判断角色是否可能成为食人族。
|
|
|
|
|
{
|
|
|
|
|
static NEARDATA long ate_brains = 0L;
|
|
|
|
|
struct permonst *fptr = &mons[pm]; /* food type */
|
|
|
|
@ -752,7 +749,7 @@ maybe_cannibal(int pm, boolean allowmsg)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
static void//它处理玩家尝试吃怪物肉的情况
|
|
|
|
|
cprefx(register int pm)
|
|
|
|
|
{
|
|
|
|
|
(void) maybe_cannibal(pm, TRUE);
|
|
|
|
@ -847,7 +844,7 @@ fix_petrification(void)
|
|
|
|
|
|
|
|
|
|
/* intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */
|
|
|
|
|
int
|
|
|
|
|
intrinsic_possible(int type, struct permonst *ptr)
|
|
|
|
|
intrinsic_possible(int type, struct permonst *ptr)//判断给定的怪物类型是否具有某些特性
|
|
|
|
|
{
|
|
|
|
|
int res = 0;
|
|
|
|
|
|
|
|
|
@ -918,7 +915,7 @@ intrinsic_possible(int type, struct permonst *ptr)
|
|
|
|
|
* intrinsic it is trying to give you.
|
|
|
|
|
*/
|
|
|
|
|
boolean
|
|
|
|
|
should_givit(int type, struct permonst *ptr)
|
|
|
|
|
should_givit(int type, struct permonst *ptr)//是否应该给予某种特性或能力。
|
|
|
|
|
{
|
|
|
|
|
int chance;
|
|
|
|
|
|
|
|
|
@ -960,7 +957,7 @@ temp_givit(int type, struct permonst *ptr)
|
|
|
|
|
* and what type of intrinsic it is trying to give you.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
givit(int type, register struct permonst *ptr)
|
|
|
|
|
givit(int type, register struct permonst *ptr)//是否给予怪物某种特性或能力。
|
|
|
|
|
{
|
|
|
|
|
debugpline1("Attempting to give intrinsic %d", type);
|
|
|
|
|
|
|
|
|
@ -1060,7 +1057,7 @@ givit(int type, register struct permonst *ptr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
eye_of_newt_buzz(void)
|
|
|
|
|
eye_of_newt_buzz(void)//加角色的某种魔法能量值
|
|
|
|
|
{
|
|
|
|
|
/* MRKR: "eye of newt" may give small magical energy boost */
|
|
|
|
|
if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
|
|
|
|
@ -1085,7 +1082,7 @@ eye_of_newt_buzz(void)
|
|
|
|
|
DISABLE_WARNING_FORMAT_NONLITERAL
|
|
|
|
|
|
|
|
|
|
/* called after completely consuming a corpse */
|
|
|
|
|
static void
|
|
|
|
|
static void//处理角色变身或模仿其他生物的功能
|
|
|
|
|
cpostfx(int pm)
|
|
|
|
|
{
|
|
|
|
|
int tmp = 0;
|
|
|
|
@ -1282,7 +1279,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL
|
|
|
|
|
* Non-deterministic; should only be called once per corpse.
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
corpse_intrinsic(struct permonst *ptr)
|
|
|
|
|
corpse_intrinsic(struct permonst *ptr)//检查一个怪物是否具有某种内在属性
|
|
|
|
|
{
|
|
|
|
|
/* Check the monster for all of the intrinsics. If this
|
|
|
|
|
* monster can give more than one, pick one to try to give
|
|
|
|
@ -1319,7 +1316,7 @@ corpse_intrinsic(struct permonst *ptr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
violated_vegetarian(void)
|
|
|
|
|
violated_vegetarian(void)//角色违反了素食主义的情节
|
|
|
|
|
{
|
|
|
|
|
u.uconduct.unvegetarian++;
|
|
|
|
|
if (Role_if(PM_MONK)) {
|
|
|
|
|