void vampire_check_light_status(void) { static int _last_light_penalty = -1; if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) { _light_penalty = 1; if (!dun_level && is_daytime()) _light_penalty++; if (res_pct(RES_LITE) < 0) _light_penalty++; } else _light_penalty = 0; if (_light_penalty != _last_light_penalty) { _last_light_penalty = _light_penalty; if (_light_penalty) { int n = _light_penalty * _light_penalty * _light_penalty * MAX(1, dun_level/5); if (!fear_save_p(n)) { msg_print("You fear the light!"); fear_add_p(FEAR_SCARED); } } p_ptr->update |= PU_BONUS; p_ptr->redraw |= PR_STATUS; } }
static bool _mon_hook_wild_daytime_check(int r_idx) { bool result = TRUE; if (is_daytime()) { monster_race *r_ptr = &r_info[r_idx]; if (r_ptr->flags3 & RF3_HURT_LITE) return FALSE; } return result; }
/* Darken the grid */ static void project_feature_handler_DARK_WEAK(project_feature_handler_context_t *context) { const int x = context->x; const int y = context->y; if (player->depth != 0 || !is_daytime()) /* Turn off the light */ sqinfo_off(cave->squares[y][x].info, SQUARE_GLOW); /* Grid is in line of sight */ if (square_isview(cave, y, x)) { /* Observe */ context->obvious = true; /* Fully update the visuals */ player->upkeep->update |= (PU_FORGET_VIEW | PU_UPDATE_VIEW | PU_MONSTERS); } }
/** * Play an ambient sound dependent on dungeon level, and day or night in town */ void play_ambient_sound(void) { if (player->depth == 0) { if (is_daytime()) sound(MSG_AMBIENT_DAY); else sound(MSG_AMBIENT_NITE); } else if (player->depth <= 20) { sound(MSG_AMBIENT_DNG1); } else if (player->depth <= 40) { sound(MSG_AMBIENT_DNG2); } else if (player->depth <= 60) { sound(MSG_AMBIENT_DNG3); } else if (player->depth <= 80) { sound(MSG_AMBIENT_DNG4); } else { sound(MSG_AMBIENT_DNG5); } }