OSDN Git Service

In Vault Quest, target weapons must not be auto-picked by diceboost.
[hengband/hengband.git] / src / xtra2.c
index f87fb6f..76d95eb 100644 (file)
@@ -1513,7 +1513,7 @@ msg_print("
                number = 0; /* Pets drop no stuff */
        if (!drop_item && (r_ptr->d_char != '$')) number = 0;
        
-       if((r_ptr->flags2 & (RF2_MULTIPLY)) && (r_ptr->r_pkills > 1024))
+       if((r_ptr->flags2 & (RF2_MULTIPLY)) && (r_ptr->r_akills > 1024))
                number = 0; /* Limit of Multiply monster drop */
 
        /* Hack -- handle creeping coins */
@@ -2381,6 +2381,24 @@ bool change_panel(int dy, int dx)
        return (FALSE);
 }
 
+bool change_panel_xy(int y, int x)
+{
+       int dy = 0, dx = 0;
+       int wid, hgt;
+
+       /* Get size */
+       get_screen_size(&wid, &hgt);
+
+       if (y < panel_row_min) dy = -1;
+       if (y > panel_row_max) dy = 1;
+       if (x < panel_col_min) dx = -1;
+       if (x > panel_col_max) dx = 1;
+
+       if (!dy && !dx) return (FALSE);
+
+       return change_panel(dy, dx);
+}
+
 
 /*
  * Given an row (y) and col (x), this routine detects when a move
@@ -3018,14 +3036,32 @@ static bool target_set_accept(int y, int x)
 static void target_set_prepare(int mode)
 {
        int y, x;
+       int min_hgt, max_hgt, min_wid, max_wid;
+
+       if (mode & TARGET_KILL)
+       {
+               /* Inner range */
+               min_hgt = MAX((py - MAX_RANGE), 0);
+               max_hgt = MIN((py + MAX_RANGE), cur_hgt - 1);
+               min_wid = MAX((px - MAX_RANGE), 0);
+               max_wid = MIN((px + MAX_RANGE), cur_wid - 1);
+       }
+       else /* not targetting */
+       {
+               /* Inner panel */
+               min_hgt = panel_row_min;
+               max_hgt = panel_row_max;
+               min_wid = panel_col_min;
+               max_wid = panel_col_max;
+       }
 
        /* Reset "temp" array */
        temp_n = 0;
 
        /* Scan the current panel */
-       for (y = panel_row_min; y <= panel_row_max; y++)
+       for (y = min_hgt; y <= max_hgt; y++)
        {
-               for (x = panel_col_min; x <= panel_col_max; x++)
+               for (x = min_wid; x <= max_wid; x++)
                {
                        cave_type *c_ptr;
 
@@ -3075,6 +3111,9 @@ static void target_set_prepare(int mode)
                temp_x[1] = tmp;
        }
 }
+void target_set_prepare_look(){
+       target_set_prepare(TARGET_LOOK);
+}
 
 
 /*
@@ -3636,7 +3675,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                        p_ptr->inside_quest = c_ptr->special;
 
                        /* Get the quest text */
-                       init_flags = INIT_SHOW_TEXT;
+                       init_flags = INIT_NAME_ONLY;
 
                        process_dungeon_file("q_info.txt", 0, 0, 0, 0);
 
@@ -3814,8 +3853,7 @@ bool target_set(int mode)
        cave_type               *c_ptr;
 
        int wid, hgt;
-
-
+       
        /* Get size */
        get_screen_size(&wid, &hgt);
 
@@ -3842,6 +3880,9 @@ bool target_set(int mode)
                        y = temp_y[m];
                        x = temp_x[m];
 
+                       /* Set forcus */
+                       change_panel_xy(y, x);
+
                        if (!(mode & TARGET_LOOK)) prt_path(y, x);
 
                        /* Access */
@@ -3868,9 +3909,12 @@ strcpy(info, "q
 #endif
 
                        }
-
+                       
                        /* Describe and Prompt */
-                       while (!(query = target_set_aux(y, x, mode, info)));
+                       while (TRUE){
+                               query = target_set_aux(y, x, mode, info);
+                               if(query)break;
+                       }
 
                        /* Cancel tracking */
                        /* health_track(0); */
@@ -4466,6 +4510,7 @@ msg_print("
 bool get_rep_dir(int *dp, bool under)
 {
        int dir;
+       cptr prompt;
 
        /* Initialize */
        (*dp) = 0;
@@ -4483,24 +4528,36 @@ bool get_rep_dir(int *dp, bool under)
 
 #endif /* ALLOW_REPEAT -- TNB */
 
+       if (under)
+       {
+               prompt = _("Êý¸þ ('.'­¸µ, ESC¤ÇÃæÃÇ)? ", "Direction ('.' at feet, Escape to cancel)? ");
+       }
+       else
+       {
+               prompt = _("Êý¸þ (ESC¤ÇÃæÃÇ)? ", "Direction (Escape to cancel)? ");
+       }
+       
        /* Get a direction */
        while (!dir)
        {
                char ch;
 
                /* Get a command (or Cancel) */
-#ifdef JP
-if (!get_com("Êý¸þ (ESC¤ÇÃæÃÇ)? ", &ch, TRUE)) break;
-#else
-               if (!get_com("Direction (Escape to cancel)? ", &ch, TRUE)) break;
-#endif
-
+               if (!get_com(prompt, &ch, TRUE)) break;
 
-               /* Look up the direction */
-               dir = get_keymap_dir(ch);
+               /* Look down */
+               if ((under) && ((ch == '5') || (ch == '-') || (ch == '.')))
+               {
+                       dir = 5;
+               }
+               else
+               {
+                       /* Look up the direction */
+                       dir = get_keymap_dir(ch);
 
-               /* Oops */
-               if (!dir) bell();
+                       /* Oops */
+                       if (!dir) bell();
+               }
        }
 
        /* Prevent weirdness */
@@ -6255,3 +6312,174 @@ int spell_exp_level(int spell_exp)
        else if (spell_exp < SPELL_EXP_MASTER) return EXP_LEVEL_EXPERT;
        else return EXP_LEVEL_MASTER;
 }
+
+
+/*
+ * Display a rumor and apply its effects
+ */
+
+int rumor_num(char *zz, int max_idx)
+{
+       if (strcmp(zz, "*") == 0) return randint1(max_idx - 1);
+       return atoi(zz);
+}
+
+cptr rumor_bind_name(char *base, cptr fullname)
+{
+       char *s, *v;
+
+       s = strstr(base, "{Name}");
+       if (s)
+       {
+               s[0] = '\0';
+               v = format("%s%s%s", base, fullname, (s + 6));
+       }
+       else
+       {
+               v = base;
+       }
+
+       return v;
+}
+
+void display_rumor(bool ex)
+{
+       bool err;
+       int section = 0;
+       char Rumor[1024];
+
+       if (ex)
+       {
+               if (randint0(3) == 0) section = 1;
+       }
+
+#ifdef JP
+       err = get_rnd_line_jonly("rumors_j.txt", section, Rumor, 10);
+       if (err) strcpy(Rumor, "±³¤Î±½¤â¤¢¤ë¡£");
+#else
+       err = get_rnd_line("rumors.txt", section, Rumor);
+       if (err) strcpy(Rumor, "Some rumors are wrong.");
+#endif
+
+       err = TRUE;
+
+       if (strncmp(Rumor, "R:", 2) == 0)
+       {
+               char *zz[4];
+               cptr rumor_msg = NULL;
+               cptr rumor_eff = NULL;
+               char fullname[1024] = "";
+
+               if (tokenize(Rumor + 2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
+               {
+                       if (strcmp(zz[0], "ARTIFACT") == 0)
+                       {
+                               int a_idx, k_idx;
+                               object_type forge;
+                               object_type *q_ptr = &forge;
+                               artifact_type *a_ptr;
+
+                               while (1)
+                               {
+                                       a_idx = rumor_num(zz[1], max_a_idx);
+
+                                       a_ptr = &a_info[a_idx];
+                                       if (a_ptr->name) break;
+                               }
+
+                               k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
+                               object_prep(q_ptr, k_idx);
+                               q_ptr->name1 = a_idx;
+                               q_ptr->ident = IDENT_STORE;
+                               object_desc(fullname, q_ptr, OD_NAME_ONLY);
+                       }
+                       else if  (strcmp(zz[0], "MONSTER") == 0)
+                       {
+                               int r_idx;
+                               monster_race *r_ptr;
+
+                               while(1)
+                               {
+                                       r_idx = rumor_num(zz[1], max_r_idx);
+                                       r_ptr = &r_info[r_idx];
+                                       if (r_ptr->name) break;
+                               }
+
+                               strcpy(fullname, r_name + r_ptr->name);
+
+                               /* Remember this monster */
+                               if (!r_ptr->r_sights)
+                               {
+                                       r_ptr->r_sights++;
+                               }
+                       }
+                       else if  (strcmp(zz[0], "DUNGEON") == 0)
+                       {
+                               int d_idx;
+                               dungeon_info_type *d_ptr;
+
+                               while (1)
+                               {
+                                       d_idx = rumor_num(zz[1], max_d_idx);
+                                       d_ptr = &d_info[d_idx];
+                                       if (d_ptr->name) break;
+                               }
+
+                               strcpy(fullname, d_name + d_ptr->name);
+
+                               if (!max_dlv[d_idx])
+                               {
+                                       max_dlv[d_idx] = d_ptr->mindepth;
+#ifdef JP
+                                       rumor_eff = format("%s¤Ëµ¢´Ô¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£", fullname);
+#else
+                                       rumor_eff = format("You can recall to %s.", fullname);
+#endif
+                               }
+                       }
+                       else if  (strcmp(zz[0], "TOWN") == 0)
+                       {
+                               int t_idx;
+                               s32b visit;
+
+                               while(1)
+                               {
+                                       t_idx = rumor_num(zz[1], NO_TOWN);
+                                       if (town[t_idx].name) break;
+                               }
+
+                               strcpy(fullname, town[t_idx].name);
+
+                               visit = (1L << (t_idx - 1));
+                               if ((t_idx != SECRET_TOWN) && !(p_ptr->visit & visit))
+                               {
+                                       p_ptr->visit |= visit;
+#ifdef JP
+                                       rumor_eff = format("%s¤Ë¹Ô¤Ã¤¿¤³¤È¤¬¤¢¤ëµ¤¤¬¤¹¤ë¡£", fullname);
+#else
+                                       rumor_eff = format("You feel you have been to %s.", fullname);
+#endif
+                               }
+                       }
+
+                       rumor_msg = rumor_bind_name(zz[2], fullname);
+                       msg_print(rumor_msg);
+                       if (rumor_eff) 
+                       {
+                               msg_print(NULL);
+                               msg_print(rumor_eff);
+                       }
+                       err = FALSE;
+               }
+       /* error */
+#ifdef JP
+               if (err) msg_print("¤³¤Î¾ðÊó¤Ï´Ö°ã¤Ã¤Æ¤¤¤ë¡£");
+#else
+               if (err) msg_print("This information is wrong.");
+#endif
+       }
+                       else
+       {
+               msg_format("%s", Rumor);
+       }
+}