From 01fa321689287cb9962d714974e862855ad81bd4 Mon Sep 17 00:00:00 2001 From: nothere Date: Fri, 20 Jun 2003 03:41:56 +0000 Subject: [PATCH] =?utf8?q?=E5=90=B8=E8=A1=80=E9=AC=BC=E3=81=A8[=E5=90=B8?= =?utf8?q?=E8=A1=80=E9=AC=BC]=E3=81=AE=E6=B0=B8=E4=B9=85=E5=85=89=E6=BA=90?= =?utf8?q?+1=E3=82=92,=20=E8=87=AA=E5=88=86=E3=81=AE=E5=91=A8=E5=9B=B21?= =?utf8?q?=E3=83=9E=E3=82=B9=E3=81=A0=E3=81=91=E3=81=AE=E6=9A=97=E8=A6=96?= =?utf8?q?=E3=81=AB=E5=A4=89=E6=9B=B4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cave.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------- src/files.c | 2 -- src/types.h | 1 + src/xtra1.c | 12 +++++++---- 4 files changed, 67 insertions(+), 14 deletions(-) diff --git a/src/cave.c b/src/cave.c index 3a7f6c9a1..a8c6212cb 100644 --- a/src/cave.c +++ b/src/cave.c @@ -445,7 +445,15 @@ bool player_can_see_bold(int y, int x) /* Require line of sight to the grid */ if (!player_has_los_bold(y, x)) return (FALSE); - if (p_ptr->pclass == CLASS_NINJA) return TRUE; + /* Ninja or Vampire without lite */ + if (p_ptr->see_nocto > p_ptr->cur_lite) + { + if (p_ptr->see_nocto == MAX_SIGHT) return TRUE; + else + { + if ((y >= (py - 1)) && (y <= (py + 1)) && (x >= (px - 1)) && (x <= (px + 1))) return TRUE; + } + } /* Require "perma-lite" of the grid */ if (!(c_ptr->info & (CAVE_GLOW | CAVE_MNLT))) return (FALSE); @@ -884,6 +892,8 @@ void map_info(int y, int x, byte *ap, char *cp) byte a; byte c; + bool can_see_dark_grid; + /* Get the cave */ c_ptr = &cave[y][x]; @@ -893,11 +903,25 @@ void map_info(int y, int x, byte *ap, char *cp) /* Floors (etc) */ if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS)) { + /* Normal */ + if (p_ptr->see_nocto <= p_ptr->cur_lite) can_see_dark_grid = FALSE; + + /* Ninja or Vampire without lite */ + else + { + if (p_ptr->see_nocto == MAX_SIGHT) can_see_dark_grid = TRUE; + else + { + if ((y < (py - 1)) || (y > (py + 1)) || (x < (px - 1)) || (x > (px + 1))) can_see_dark_grid = FALSE; + else can_see_dark_grid = TRUE; + } + } + /* Memorized (or visible) floor */ if ((c_ptr->info & CAVE_MARK) || (((c_ptr->info & (CAVE_LITE | CAVE_MNLT)) || ((c_ptr->info & CAVE_VIEW) && - ((c_ptr->info & CAVE_GLOW) || (p_ptr->pclass == CLASS_NINJA)))) && + ((c_ptr->info & CAVE_GLOW) || can_see_dark_grid))) && !p_ptr->blind)) { /* Access floor */ @@ -1690,10 +1714,17 @@ void note_spot(int y, int x) /* Require line of sight to the grid */ if (!(c_ptr->info & (CAVE_VIEW))) return; - if (p_ptr->pclass != CLASS_NINJA) + /* Require "perma-lite" of the grid */ + if (!(c_ptr->info & (CAVE_GLOW | CAVE_MNLT))) { - /* Require "perma-lite" of the grid */ - if (!(c_ptr->info & (CAVE_GLOW | CAVE_MNLT))) return; + /* Neither Ninja nor Vampire without lite */ + if (p_ptr->see_nocto <= p_ptr->cur_lite) return; + + /* Hack -- Vampires' noctovision is limited to adjacent grids */ + else if (p_ptr->see_nocto == 1) + { + if ((y < (py - 1)) || (y > (py + 1)) || (x < (px - 1)) || (x > (px + 1))) return; + } } } @@ -1719,7 +1750,7 @@ void note_spot(int y, int x) { /* Option -- memorize all torch-lit floors */ if (view_torch_grids && - ((c_ptr->info & (CAVE_LITE | CAVE_MNLT)) || (p_ptr->pclass == CLASS_NINJA))) + ((c_ptr->info & (CAVE_LITE | CAVE_MNLT)) || p_ptr->see_nocto)) { /* Memorize */ c_ptr->info |= (CAVE_MARK); @@ -1747,8 +1778,8 @@ void note_spot(int y, int x) c_ptr->info |= (CAVE_MARK); } - /* Mwemorize walls seen by noctovision of Ninja */ - else if (p_ptr->pclass == CLASS_NINJA) + /* Mwemorize walls seen by noctovision of Ninja or Vampire */ + else if (p_ptr->see_nocto) { /* Memorize */ c_ptr->info |= (CAVE_MARK); @@ -4154,6 +4185,25 @@ void update_view(void) /* None left */ temp_n = 0; + + /*** Step 6 -- Vampires hack if without lite ***/ + + if ((p_ptr->see_nocto == 1) && !p_ptr->cur_lite && !p_ptr->blind) + { + /* Hack -- Vampires' noctovision is limited to adjacent grids */ + for (n = 0; n < 9; n++) + { + y = py + ddy_ddd[n]; + x = px + ddx_ddd[n]; + + /* Access the grid */ + c_ptr = &cave[y][x]; + + /* Add it to later visual update */ + cave_note_and_redraw_later(c_ptr, y, x); + } + } + /* Mega-Hack -- Visual update later */ p_ptr->update |= (PU_DELAY_VIS); } diff --git a/src/files.c b/src/files.c index 861b5311d..d4a489f12 100644 --- a/src/files.c +++ b/src/files.c @@ -2308,7 +2308,6 @@ static void player_flags(u32b flgs[TR_FLAG_SIZE]) add_flag(flgs, TR_HOLD_LIFE); add_flag(flgs, TR_RES_DARK); add_flag(flgs, TR_RES_NETHER); - if (p_ptr->pclass != CLASS_NINJA) add_flag(flgs, TR_LITE); add_flag(flgs, TR_RES_POIS); add_flag(flgs, TR_RES_COLD); add_flag(flgs, TR_SEE_INVIS); @@ -2456,7 +2455,6 @@ static void player_flags(u32b flgs[TR_FLAG_SIZE]) add_flag(flgs, TR_HOLD_LIFE); add_flag(flgs, TR_RES_DARK); add_flag(flgs, TR_RES_NETHER); - if (p_ptr->pclass != CLASS_NINJA) add_flag(flgs, TR_LITE); add_flag(flgs, TR_RES_POIS); add_flag(flgs, TR_RES_COLD); break; diff --git a/src/types.h b/src/types.h index 8e1749cd1..f9cdad6cc 100644 --- a/src/types.h +++ b/src/types.h @@ -1322,6 +1322,7 @@ struct player_type s16b ac; /* Base ac */ s16b see_infra; /* Infravision range */ + s16b see_nocto; /* Noctovision range */ s16b skill_dis; /* Skill: Disarming */ s16b skill_dev; /* Skill: Magic Devices */ diff --git a/src/xtra1.c b/src/xtra1.c index a8a83146d..d658a8d9a 100644 --- a/src/xtra1.c +++ b/src/xtra1.c @@ -3164,6 +3164,9 @@ void calc_bonuses(void) /* Base infravision (purely racial) */ p_ptr->see_infra = tmp_rp_ptr->infra; + /* Base noctovision (If player is neither Ninja nor Vampire, always 0) */ + p_ptr->see_nocto = 0; + /* Base skill -- disarming */ p_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis; @@ -3273,7 +3276,7 @@ void calc_bonuses(void) if (p_ptr->lev > 39) p_ptr->reflect = TRUE; break; case CLASS_NINJA: - /* Unencumbered Monks become faster every 10 levels */ + /* Unencumbered Ninjas become faster every 10 levels */ if (heavy_armor()) { new_speed -= (p_ptr->lev) / 10; @@ -3307,6 +3310,7 @@ void calc_bonuses(void) p_ptr->oppose_pois = 1; p_ptr->redraw |= PR_STATUS; } + if (p_ptr->see_nocto < MAX_SIGHT) p_ptr->see_nocto = MAX_SIGHT; break; } @@ -3360,7 +3364,7 @@ void calc_bonuses(void) new_speed += 3; p_ptr->to_a += 10; p_ptr->dis_to_a += 10; - if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE; + if (p_ptr->see_nocto < 1) p_ptr->see_nocto = 1; break; } } @@ -3495,7 +3499,7 @@ void calc_bonuses(void) p_ptr->resist_neth = TRUE; p_ptr->resist_cold = TRUE; p_ptr->resist_pois = TRUE; - if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE; + if (p_ptr->see_nocto < 1) p_ptr->see_nocto = 1; break; case RACE_SPECTRE: p_ptr->ffall = TRUE; @@ -3647,7 +3651,7 @@ void calc_bonuses(void) p_ptr->resist_blind = TRUE; p_ptr->resist_conf = TRUE; p_ptr->hold_life = TRUE; - if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE; + if (!p_ptr->see_nocto) p_ptr->lite = TRUE; if ((p_ptr->prace != RACE_KLACKON) && (p_ptr->prace != RACE_SPRITE)) /* Munchkin become faster */ -- 2.11.0