OSDN Git Service

Add Doxygen comment to xtra2.c.
[hengband/hengband.git] / src / snipe.c
1 /*!
2  * @file snipe.c
3  * @brief ¥¹¥Ê¥¤¥Ñ¡¼µ»Ç½¤Î¼ÂÁõ / Sniping
4  * @date 2014/01/18
5  * @author
6  * 2014 Deskull rearranged comment for Doxygen.\n
7  */
8
9 #include "angband.h"
10
11 #define MAX_SNIPE_POWERS 16
12
13 /*! ¥¹¥Ê¥¤¥Ñ¡¼µ»Ç½¾ðÊó¤Îtypedef */
14 typedef struct snipe_power snipe_power;
15
16 /*! ¥¹¥Ê¥¤¥Ñ¡¼µ»Ç½¾ðÊó¤Î¹½Â¤ÂΠ*/
17 struct snipe_power
18 {
19         int     min_lev;
20         int     mana_cost;
21         const char *name;
22 };
23
24 /*! ¥¹¥Ê¥¤¥Ñ¡¼µ»Ç½¤Î²òÀâ¥á¥Ã¥»¡¼¥¸ */
25 static const char *snipe_tips[MAX_SNIPE_POWERS] =
26 {
27 #ifdef JP
28         "Àº¿À¤ò½¸Ã椹¤ë¡£¼Í·â¤Î°ÒÎÏ¡¢ÀºÅÙ¤¬¾å¤¬¤ê¡¢¹âÅ٤ʼͷâ½Ñ¤¬»ÈÍѤǤ­¤ë¤è¤¦¤Ë¤Ê¤ë¡£",
29         "¸÷¤ëÌð¤òÊü¤Ä¡£¸÷¤Ë¼å¤¤¥â¥ó¥¹¥¿¡¼¤Ë°ÒÎϤòȯ´ø¤¹¤ë¡£",
30         "¼Í·â¤ò¹Ô¤Ã¤¿¸å¡¢Ã»µ÷Î¥¤Î½Ö´Ö°ÜÆ°¤ò¹Ô¤¦¡£",
31         "µ°Æ»¾å¤Î櫤ò¤¹¤Ù¤Æ̵¸ú¤Ë¤¹¤ëÄã¶õÈô¹Ô¤ÎÌð¤òÊü¤Ä¡£",
32         "²Ð±ê°À­¤ÎÌð¤òÊü¤Ä¡£",
33         "ÊɤòÊ´ºÕ¤¹¤ëÌð¤òÊü¤Ä¡£´ä¤Ç¤Ç¤­¤¿¥â¥ó¥¹¥¿¡¼¤È̵À¸Êª¤Î¥â¥ó¥¹¥¿¡¼¤Ë°ÒÎϤòȯ´ø¤¹¤ë¡£",
34         "Î䵤°À­¤ÎÌð¤òÊü¤Ä¡£",
35         "Ũ¤òÆͤ­Èô¤Ð¤¹Ìð¤òÊü¤Ä¡£",
36         "Ê£¿ô¤ÎŨ¤ò´ÓÄ̤¹¤ëÌð¤òÊü¤Ä¡£",
37         "Á±Îɤʥâ¥ó¥¹¥¿¡¼¤Ë°ÒÎϤòȯ´ø¤¹¤ëÌð¤òÊü¤Ä¡£",
38         "¼Ù°­¤Ê¥â¥ó¥¹¥¿¡¼¤Ë°ÒÎϤòȯ´ø¤¹¤ëÌð¤òÊü¤Ä¡£",
39         "Åö¤¿¤ë¤ÈÇúȯ¤¹¤ëÌð¤òÊü¤Ä¡£",
40         "2²ó¼Í·â¤ò¹Ô¤¦¡£",
41         "ÅÅ·â°À­¤ÎÌð¤òÊü¤Ä¡£",
42         "Ũ¤ÎµÞ½ê¤Ë¤á¤¬¤±¤ÆÌð¤òÊü¤Ä¡£À®¸ù¤¹¤ë¤ÈŨ¤ò°ì·â»à¤µ¤»¤ë¡£¼ºÇÔ¤¹¤ë¤È1¥À¥á¡¼¥¸¡£",
43         "Á´¤Æ¤Î¥â¥ó¥¹¥¿¡¼¤Ë¹â°ÒÎϤòȯ´ø¤¹¤ëÌð¤òÊü¤Ä¡£È¿Æ°¤Ë¤è¤ëÉû¼¡¸ú²Ì¤ò¼õ¤±¤ë¡£",
44 #else
45         "Concentrate your mind fot shooting.",
46         "Shot an allow with brightness.",
47         "Blink after shooting.",
48         "Shot an allow able to shatter traps.",
49         "Deals extra damege of fire.",
50         "Shot an allow able to shatter rocks.",
51         "Deals extra damege of ice.",
52         "An allow rushes away a target.",
53         "An allow pierces some monsters.",
54         "Deals more damage to good monsters.",
55         "Deals more damage to evil monsters.",
56         "An allow explodes when it hits a monster.",
57         "Shot allows twice.",
58         "Deals extra damege of lightning.",
59         "Deals quick death or 1 damage.",
60         "Deals great damage to all monsters, and some side effects to you.",
61 #endif
62 };
63
64 /*! ¥¹¥Ê¥¤¥Ñ¡¼µ»Ç½¥Æ¡¼¥Ö¥ë */
65 snipe_power snipe_powers[MAX_SNIPE_POWERS] =
66 {
67         /* Level gained,  cost,  name */
68 #ifdef JP
69         {  1,  0,  "Àº¿À½¸Ãæ" },
70         {  2,  1,  "¥Õ¥é¥Ã¥·¥å¥¢¥í¡¼" },
71         {  3,  1,  "¥·¥å¡¼¥È¡õ¥¢¥¦¥§¥¤" },
72         {  5,  1,  "²ò½ü¤ÎÌð" },
73         {  8,  2,  "²Ð±ê¤ÎÌð" },
74         { 10,  2,  "´äºÕ¤­" },
75         { 13,  2,  "Î䵤¤ÎÌð" },
76         { 18,  2,  "ÎõÉ÷ÃÆ"},
77         { 22,  3,  "´ÓÄÌÃÆ" },
78         { 25,  4,  "¼ÙÇ°ÃÆ"},
79         { 26,  4,  "ÇËËâÌð" },
80         { 30,  3,  "Çúȯ¤ÎÌð"},
81         { 32,  4,  "¥À¥Ö¥ë¥·¥ç¥Ã¥È" },
82         { 36,  3,  "¥×¥é¥º¥Þ¥Ü¥ë¥È" },
83         { 40,  3,  "¥Ë¡¼¥É¥ë¥·¥ç¥Ã¥È" },
84         { 48,  7,  "¥»¥¤¥ó¥È¥¹¥¿¡¼¥¢¥í¡¼" },
85 #else
86         {  1,  0,  "Concentration" },
87         {  2,  1,  "Flush Arrow" },
88         {  3,  1,  "Shoot & Away" },
89         {  5,  1,  "Disarm Shot" },
90         {  8,  2,  "Fire Shot" },
91         { 10,  2,  "Shatter Arrow" },
92         { 13,  2,  "Ice Shot" },
93         { 18,  2,  "Rushing Arrow"},
94         { 22,  3,  "Piercing Shot" },
95         { 25,  4,  "Evil Shot"},
96         { 26,  4,  "Holy Shot" },
97         { 30,  3,  "Missile"},
98         { 32,  4,  "Double Shot" },
99         { 36,  3,  "Plasma Bolt" },
100         { 40,  3,  "Needle Shot" },
101         { 48,  7,  "Saint Stars Arrow" },
102 #endif
103 };
104
105 /*! 
106  * @brief ¥¹¥Ê¥¤¥Ñ¡¼¤Î½¸ÃæÅٲû»
107  * @return ¾ï¤ËTRUE¤òÊÖ¤¹
108  */
109 static bool snipe_concentrate(void)
110 {
111         if ((int)p_ptr->concent < (2 + (p_ptr->lev + 5) / 10)) p_ptr->concent++;
112
113 #ifdef JP
114         msg_format("½¸Ã椷¤¿¡£(½¸ÃæÅÙ %d)", p_ptr->concent);
115 #else
116         msg_format("You concentrate deeply. (lvl %d)", p_ptr->concent);
117 #endif
118
119         reset_concent = FALSE;
120
121         /* Recalculate bonuses */
122         p_ptr->update |= (PU_BONUS);
123
124         p_ptr->redraw |= (PR_STATUS);
125
126         /* Update the monsters */
127         p_ptr->update |= (PU_MONSTERS);
128
129         return (TRUE);
130 }
131
132 /*! 
133  * @brief ¥¹¥Ê¥¤¥Ñ¡¼¤Î½¸ÃæÅ٥ꥻ¥Ã¥È
134  * @param msg TRUE¤Ê¤é¤Ð¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë
135  * @return ¤Ê¤·
136  */
137 void reset_concentration(bool msg)
138 {
139         if (msg)
140         {
141 #ifdef JP
142                 msg_print("½¸ÃæÎϤ¬ÅÓÀÚ¤ì¤Æ¤·¤Þ¤Ã¤¿¡£");
143 #else
144                 msg_print("Stop concentrating.");
145 #endif
146         }
147
148         p_ptr->concent = 0;
149         reset_concent = FALSE;
150
151         /* Recalculate bonuses */
152         p_ptr->update |= (PU_BONUS);
153
154         p_ptr->redraw |= (PR_STATUS);
155
156         /* Update the monsters */
157         p_ptr->update |= (PU_MONSTERS);
158 }
159
160 /*! 
161  * @brief ¥¹¥Ê¥¤¥Ñ¡¼¤Î½¸ÃæÅ٤ˤè¤ë¥À¥á¡¼¥¸¥Ü¡¼¥Ê¥¹¤ò²Ã»»¤¹¤ë
162  * @param tdam »»½ÐÃæ¤Î¥À¥á¡¼¥¸
163  * @return ½¸ÃæÅÙ½¤Àµ¤ò²Ã¤¨¤¿¥À¥á¡¼¥¸
164  */
165 int boost_concentration_damage(int tdam)
166 {
167         tdam *= (10 + p_ptr->concent);
168         tdam /= 10;
169
170         return (tdam);
171 }
172
173 /*! 
174  * @brief ¥¹¥Ê¥¤¥Ñ¡¼¤Îµ»Ç½¥ê¥¹¥È¤òɽ¼¨¤¹¤ë
175  * @return ¤Ê¤·
176  */
177 void display_snipe_list(void)
178 {
179         int             i;
180         int             y = 1;
181         int             x = 1;
182         int             plev = p_ptr->lev;
183         snipe_power     spell;
184         char            psi_desc[80];
185
186         /* Display a list of spells */
187         prt("", y, x);
188 #ifdef JP
189         put_str("̾Á°", y, x + 5);
190         put_str("Lv   MP", y, x + 35);
191 #else
192         put_str("Name", y, x + 5);
193         put_str("Lv Mana", y, x + 35);
194 #endif
195
196         /* Dump the spells */
197         for (i = 0; i < MAX_SNIPE_POWERS; i++)
198         {
199                 /* Access the available spell */
200                 spell = snipe_powers[i];
201                 if (spell.min_lev > plev) continue;
202                 if (spell.mana_cost > (int)p_ptr->concent) continue;
203
204                 /* Dump the spell */
205                 sprintf(psi_desc, "  %c) %-30s%2d %4d",
206                         I2A(i), spell.name, spell.min_lev, spell.mana_cost);
207
208                 Term_putstr(x, y + i + 1, -1, TERM_WHITE, psi_desc);
209         }
210         return;
211 }
212
213
214 /*! 
215  * @brief ¥¹¥Ê¥¤¥Ñ¡¼µ»Ç½¤òÁªÂò¤¹¤ë
216  * @param sn ÁªÂò¤·¤¿Æü쵻ǽID¡¢¥­¥ã¥ó¥»¥ë¤Î¾ì¹ç-1¡¢ÉÔÀµ¤ÊÁªÂò¤Î¾ì¹ç-2¤òÊÖ¤¹
217  * @param only_browse °ìÍ÷¤ò¸«¤ë¤À¤±¤Î¾ì¹çTRUE¤òÊÖ¤¹
218  * @return È¯Æ°²Äǽ¤ÊËâË¡¤òÁªÂò¤·¤¿¾ì¹çTRUE¡¢¥­¥ã¥ó¥»¥ë½èÍý¤«ÉÔÀµ¤ÊÁªÂò¤¬¹Ô¤ï¤ì¤¿¾ì¹çFALSE¤òÊÖ¤¹¡£
219  * Allow user to choose a mindcrafter power.\n
220  *\n
221  * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
222  * If the user hits escape, returns FALSE, and set '*sn' to -1\n
223  * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
224  *\n
225  * The "prompt" should be "cast", "recite", or "study"\n
226  * The "known" should be TRUE for cast/pray, FALSE for study\n
227  *\n
228  * nb: This function has a (trivial) display bug which will be obvious\n
229  * when you run it. It's probably easy to fix but I haven't tried,\n
230  * sorry.\n
231  */
232 static int get_snipe_power(int *sn, bool only_browse)
233 {
234         int             i;
235         int             num = 0;
236         int             y = 1;
237         int             x = 20;
238         int             plev = p_ptr->lev;
239         int             ask;
240         char            choice;
241         char            out_val[160];
242 #ifdef JP
243         cptr            p = "¼Í·â½Ñ";
244 #else
245         cptr            p = "power";
246 #endif
247         snipe_power     spell;
248         bool            flag, redraw;
249
250 #ifdef ALLOW_REPEAT /* TNB */
251
252         repeat_push(*sn);
253
254         /* Assume cancelled */
255         *sn = (-1);
256
257         /* Repeat previous command */
258         /* Get the spell, if available */
259         if (repeat_pull(sn))
260         {
261                 /* Verify the spell */
262                 if ((snipe_powers[*sn].min_lev <= plev) && (snipe_powers[*sn].mana_cost <= (int)p_ptr->concent))
263                 {
264                         /* Success */
265                         return (TRUE);
266                 }
267         }
268
269 #endif /* ALLOW_REPEAT -- TNB */
270
271         /* Nothing chosen yet */
272         flag = FALSE;
273
274         /* No redraw yet */
275         redraw = FALSE;
276
277         for (i = 0; i < MAX_SNIPE_POWERS; i++)
278         {
279                 if ((snipe_powers[i].min_lev <= plev) &&
280                         ((only_browse) || (snipe_powers[i].mana_cost <= (int)p_ptr->concent)))
281                 {
282                         num = i;
283                 }
284         }
285
286         /* Build a prompt (accept all spells) */
287         if (only_browse)
288         {
289 #ifdef JP
290                 (void)strnfmt(out_val, 78, "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤Ë¤Ä¤¤¤ÆÃΤê¤Þ¤¹¤«¡©",
291 #else
292                 (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
293 #endif
294                               p, I2A(0), I2A(num), p);
295         }
296         else
297         {
298 #ifdef JP
299                 (void)strnfmt(out_val, 78, "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò»È¤¤¤Þ¤¹¤«¡©",
300 #else
301                 (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
302 #endif
303                           p, I2A(0), I2A(num), p);
304         }
305
306         /* Get a spell from the user */
307         choice = always_show_list ? ESCAPE : 1;
308         while (!flag)
309         {
310                 if(choice == ESCAPE) choice = ' ';
311                 else if( !get_com(out_val, &choice, FALSE) )break; 
312
313                 /* Request redraw */
314                 if ((choice == ' ') || (choice == '*') || (choice == '?'))
315                 {
316                         /* Show the list */
317                         if (!redraw)
318                         {
319                                 char psi_desc[80];
320
321                                 /* Show list */
322                                 redraw = TRUE;
323
324                                 /* Save the screen */
325                                 if (!only_browse) screen_save();
326
327                                 /* Display a list of spells */
328                                 prt("", y, x);
329 #ifdef JP
330                                 put_str("̾Á°", y, x + 5);
331                                 if (only_browse) put_str("Lv   ½¸ÃæÅÙ", y, x + 35);
332 #else
333                                 put_str("Name", y, x + 5);
334                                 if (only_browse) put_str("Lv Pow", y, x + 35);
335 #endif
336
337                                 /* Dump the spells */
338                                 for (i = 0; i < MAX_SNIPE_POWERS; i++)
339                                 {
340                                         Term_erase(x, y + i + 1, 255);
341
342                                         /* Access the spell */
343                                         spell = snipe_powers[i];
344                                         if (spell.min_lev > plev) continue;
345                                         if (!only_browse && (spell.mana_cost > (int)p_ptr->concent)) continue;
346
347                                         /* Dump the spell --(-- */
348                                         if (only_browse)
349                                                 sprintf(psi_desc, "  %c) %-30s%2d %4d",
350                                                         I2A(i), spell.name,     spell.min_lev, spell.mana_cost);
351                                         else
352                                                 sprintf(psi_desc, "  %c) %-30s", I2A(i), spell.name);
353                                         prt(psi_desc, y + i + 1, x);
354                                 }
355
356                                 /* Clear the bottom line */
357                                 prt("", y + i + 1, x);
358                         }
359
360                         /* Hide the list */
361                         else
362                         {
363                                 /* Hide list */
364                                 redraw = FALSE;
365
366                                 /* Restore the screen */
367                                 if (!only_browse) screen_load();
368                         }
369
370                         /* Redo asking */
371                         continue;
372                 }
373
374                 /* Note verify */
375                 ask = isupper(choice);
376
377                 /* Lowercase */
378                 if (ask) choice = tolower(choice);
379
380                 /* Extract request */
381                 i = (islower(choice) ? A2I(choice) : -1);
382
383                 /* Totally Illegal */
384                 if ((i < 0) || (i > num) || 
385                         (!only_browse &&(snipe_powers[i].mana_cost > (int)p_ptr->concent)))
386                 {
387                         bell();
388                         continue;
389                 }
390
391                 /* Save the spell index */
392                 spell = snipe_powers[i];
393
394                 /* Verify it */
395                 if (ask)
396                 {
397                         char tmp_val[160];
398
399                         /* Prompt */
400 #ifdef JP
401                         (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡©", snipe_powers[i].name);
402 #else
403                         (void)strnfmt(tmp_val, 78, "Use %s? ", snipe_powers[i].name);
404 #endif
405
406                         /* Belay that order */
407                         if (!get_check(tmp_val)) continue;
408                 }
409
410                 /* Stop the loop */
411                 flag = TRUE;
412         }
413
414         /* Restore the screen */
415         if (redraw && !only_browse) screen_load();
416
417         /* Show choices */
418         p_ptr->window |= (PW_SPELL);
419
420         /* Window stuff */
421         window_stuff();
422
423         /* Abort if needed */
424         if (!flag) return (FALSE);
425
426         /* Save the choice */
427         (*sn) = i;
428
429 #ifdef ALLOW_REPEAT /* TNB */
430
431         repeat_push(*sn);
432
433 #endif /* ALLOW_REPEAT -- TNB */
434
435         /* Success */
436         return (TRUE);
437 }
438
439 /*!
440  * @brief ¥¹¥Ê¥¤¥Ð¡¼µ»Ç½¤Î¥¹¥ì¥¤ÇÜΨ·×»»¤ò¹Ô¤¦ /
441  * Calcurate magnification of snipe technics
442  * @param mult ¥¹¥Ê¥¤¥Ð¡¼µ»Ç½¤Î¥¹¥ì¥¤¸ú²Ì°ÊÁ°¤Ë»»½Ð¤·¤Æ¤¤¤ë¿Í×ÁǤÎÇÜΨ(/10ÇÜ)
443  * @param m_ptr ÌÜɸ¤È¤Ê¤ë¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
444  * @return ¥¹¥ì¥¤¤ÎÇÜΨ(/10ÇÜ)
445  */
446 int tot_dam_aux_snipe(int mult, monster_type *m_ptr)
447 {
448         monster_race *r_ptr = &r_info[m_ptr->r_idx];
449         bool seen = is_seen(m_ptr);
450
451         switch (snipe_type)
452         {
453         case SP_LITE:
454                 if (r_ptr->flags3 & (RF3_HURT_LITE))
455                 {
456                         int n = 20 + p_ptr->concent;
457                         if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
458                         if (mult < n) mult = n;
459                 }
460                 break;
461         case SP_FIRE:
462                 if (r_ptr->flagsr & RFR_IM_FIRE)
463                 {
464                         if (seen) r_ptr->r_flagsr |= RFR_IM_FIRE;
465                 }
466                 else
467                 {
468                         int n = 15 + (p_ptr->concent * 3);
469                         if (mult < n) mult = n;
470                 }
471                 break;
472         case SP_COLD:
473                 if (r_ptr->flagsr & RFR_IM_COLD)
474                 {
475                         if (seen) r_ptr->r_flagsr |= RFR_IM_COLD;
476                 }
477                 else
478                 {
479                         int n = 15 + (p_ptr->concent * 3);
480                         if (mult < n) mult = n;
481                 }
482                 break;
483         case SP_ELEC:
484                 if (r_ptr->flagsr & RFR_IM_ELEC)
485                 {
486                         if (seen) r_ptr->r_flagsr |= RFR_IM_ELEC;
487                 }
488                 else
489                 {
490                         int n = 18 + (p_ptr->concent * 4);
491                         if (mult < n) mult = n;
492                 }
493                 break;
494         case SP_KILL_WALL:
495                 if (r_ptr->flags3 & RF3_HURT_ROCK)
496                 {
497                         int n = 15 + (p_ptr->concent * 2);
498                         if (seen) r_ptr->r_flags3 |= RF3_HURT_ROCK;
499                         if (mult < n) mult = n;
500                 }
501                 else if (r_ptr->flags3 & RF3_NONLIVING)
502                 {
503                         int n = 15 + (p_ptr->concent * 2);
504                         if (seen) r_ptr->r_flags3 |= RF3_NONLIVING;
505                         if (mult < n) mult = n;
506                 }
507                 break;
508         case SP_EVILNESS:
509                 if (r_ptr->flags3 & RF3_GOOD)
510                 {
511                         int n = 15 + (p_ptr->concent * 4);
512                         if (seen) r_ptr->r_flags3 |= RF3_GOOD;
513                         if (mult < n) mult = n;
514                 }
515                 break;
516         case SP_HOLYNESS:
517                 if (r_ptr->flags3 & RF3_EVIL)
518                 {
519                         int n = 12 + (p_ptr->concent * 3);
520                         if (seen) r_ptr->r_flags3 |= RF3_EVIL;
521                         if (r_ptr->flags3 & (RF3_HURT_LITE))
522                         {
523                                 n += (p_ptr->concent * 3);
524                                 if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
525                         }
526                         if (mult < n) mult = n;
527                 }
528                 break;
529         case SP_FINAL:
530                 if (mult < 50) mult = 50;
531                 break;
532         }
533
534         return (mult);
535 }
536
537
538 /*!
539  * @brief ¥¹¥Ê¥¤¥Ñ¡¼µ»Ç½¤Îȯư /
540  * do_cmd_cast calls this function if the player's class is 'snipe'.
541  * @param spell È¯Æ°¤¹¤ëÆü쵻ǽ¤ÎID
542  * @return ½èÍý¤ò¼Â¹Ô¤·¤¿¤éTRUE¡¢¥­¥ã¥ó¥»¥ë¤·¤¿¾ì¹çFALSE¤òÊÖ¤¹¡£
543  */
544 static bool cast_sniper_spell(int spell)
545 {
546         object_type *o_ptr = &inventory[INVEN_BOW];
547
548         if (o_ptr->tval != TV_BOW)
549         {
550 #ifdef JP
551                 msg_print("µÝ¤òÁõÈ÷¤·¤Æ¤¤¤Ê¤¤¡ª");
552 #else
553                 msg_print("You wield no bow!");
554 #endif
555                 return (FALSE);
556         }
557
558         /* spell code */
559         switch (spell)
560         {
561         case 0: /* Concentration */
562                 if (!snipe_concentrate()) return (FALSE);
563                 energy_use = 100;
564                 return (TRUE);
565         case 1: snipe_type = SP_LITE; break;
566         case 2: snipe_type = SP_AWAY; break;
567         case 3: snipe_type = SP_KILL_TRAP; break;
568         case 4: snipe_type = SP_FIRE; break;
569         case 5: snipe_type = SP_KILL_WALL; break;
570         case 6: snipe_type = SP_COLD; break;
571         case 7: snipe_type = SP_RUSH; break;
572         case 8: snipe_type = SP_PIERCE; break;
573         case 9: snipe_type = SP_EVILNESS; break;
574         case 10: snipe_type = SP_HOLYNESS; break;
575         case 11: snipe_type = SP_EXPLODE; break;
576         case 12: snipe_type = SP_DOUBLE; break;
577         case 13: snipe_type = SP_ELEC; break;
578         case 14: snipe_type = SP_NEEDLE; break;
579         case 15: snipe_type = SP_FINAL; break;
580         default:
581 #ifdef JP
582                 msg_print("¤Ê¤Ë¡©");
583 #else
584                 msg_print("Zap?");
585 #endif
586         }
587
588         command_cmd = 'f';
589         do_cmd_fire();
590         snipe_type = 0;
591
592         return (is_fired);
593 }
594
595 /*!
596  * @brief ¥¹¥Ê¥¤¥Ñ¡¼µ»Ç½¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
597  * @return ¤Ê¤·
598  */
599 void do_cmd_snipe(void)
600 {
601         int             n = 0;
602         bool            cast;
603
604
605         /* not if confused */
606         if (p_ptr->confused)
607         {
608 #ifdef JP
609                 msg_print("º®Í𤷤Ƥ¤¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
610 #else
611                 msg_print("You are too confused!");
612 #endif
613                 return;
614         }
615
616         /* not if hullucinated */
617         if (p_ptr->image)
618         {
619 #ifdef JP
620                 msg_print("¸¸³Ð¤¬¸«¤¨¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
621 #else
622                 msg_print("You are too hallucinated!");
623 #endif
624                 return;
625         }
626
627         /* not if stuned */
628         if (p_ptr->stun)
629         {
630 #ifdef JP
631                 msg_print("Ƭ¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
632 #else
633                 msg_print("You are too stuned!");
634 #endif
635                 return;
636         }
637
638         /* get power */
639         if (!get_snipe_power(&n, FALSE)) return;
640
641         sound(SOUND_SHOOT);
642
643         /* Cast the spell */
644         cast = cast_sniper_spell(n);
645
646         if (!cast) return;
647 #if 0
648         /* Take a turn */
649         energy_use = 100;
650 #endif
651         /* Redraw mana */
652         p_ptr->redraw |= (PR_HP | PR_MANA);
653
654         /* Window stuff */
655         p_ptr->window |= (PW_PLAYER);
656         p_ptr->window |= (PW_SPELL);
657 }
658
659 /*!
660  * @brief ¥¹¥Ê¥¤¥Ñ¡¼µ»Ç½¥³¥Þ¥ó¥É¤Îɽ¼¨ /
661  * @return ¤Ê¤·
662  */
663 void do_cmd_snipe_browse(void)
664 {
665         int n = 0;
666         int j, line;
667         char temp[62 * 4];
668
669         screen_save();
670
671         while(1)
672         {
673                 /* get power */
674                 if (!get_snipe_power(&n, TRUE))
675                 {
676                         screen_load();
677                         return;
678                 }
679
680                 /* Clear lines, position cursor  (really should use strlen here) */
681                 Term_erase(12, 22, 255);
682                 Term_erase(12, 21, 255);
683                 Term_erase(12, 20, 255);
684                 Term_erase(12, 19, 255);
685                 Term_erase(12, 18, 255);
686
687                 roff_to_buf(snipe_tips[n], 62, temp, sizeof(temp));
688                 for(j = 0, line = 19; temp[j]; j += (1 + strlen(&temp[j])))
689                 {
690                         prt(&temp[j], line, 15);
691                         line++;
692                 }
693         }
694 }