4 /* Purpose: misc code */
7 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
9 * This software may be copied and distributed for educational, research, and
10 * not for profit purposes provided that this copyright and statement are
11 * included in all such copies.
20 * Converts stat num into a six-char (right justified) string
22 void cnv_stat(int val, char *out_val)
27 int bonus = (val - 18);
31 sprintf(out_val, "18/%3s", "***");
33 else if (bonus >= 100)
35 sprintf(out_val, "18/%03d", bonus);
39 sprintf(out_val, " 18/%02d", bonus);
46 sprintf(out_val, " %2d", val);
53 * Modify a stat value by a "modifier", return new value
55 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
56 * Or even: 18/13, 18/23, 18/33, ..., 18/220
58 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
59 * Or even: 18/13, 18/03, 18, 17, ..., 3
61 s16b modify_stat_value(int value, int amount)
68 /* Apply each point */
69 for (i = 0; i < amount; i++)
71 /* One point at a time */
72 if (value < 18) value++;
74 /* Ten "points" at a time */
82 /* Apply each point */
83 for (i = 0; i < (0 - amount); i++)
85 /* Ten points at a time */
86 if (value >= 18+10) value -= 10;
88 /* Hack -- prevent weirdness */
89 else if (value > 18) value = 18;
91 /* One point at a time */
92 else if (value > 3) value--;
96 /* Return new value */
103 * Print character info at given row, column in a 13 char field
105 static void prt_field(cptr info, int row, int col)
107 /* Dump 13 spaces to clear */
108 c_put_str(TERM_WHITE, " ", row, col);
110 /* Dump the info itself */
111 c_put_str(TERM_L_BLUE, info, row, col);
116 * Whether daytime or not
118 bool is_daytime(void)
120 s32b len = TURNS_PER_TICK * TOWN_DAWN;
121 if ((turn % len) < (len / 2))
128 * Extract day, hour, min
130 void extract_day_hour_min(int *day, int *hour, int *min)
132 s32b len = TURNS_PER_TICK * TOWN_DAWN;
133 s32b tick = turn % len + len / 4;
135 if ((p_ptr->prace == RACE_VAMPIRE) ||
136 (p_ptr->prace == RACE_SKELETON) ||
137 (p_ptr->prace == RACE_ZOMBIE) ||
138 (p_ptr->prace == RACE_SPECTRE))
139 *day = (turn - (TURNS_PER_TICK * TOWN_DAWN *3/4)) / len + 1;
141 *day = (turn + (TURNS_PER_TICK * TOWN_DAWN /4))/ len + 1;
142 *hour = (24 * tick / len) % 24;
143 *min = (1440 * tick / len) % 60;
153 /* Dump 13 spaces to clear */
154 c_put_str(TERM_WHITE, " ", ROW_DAY, COL_DAY);
156 extract_day_hour_min(&day, &hour, &min);
158 /* Dump the info itself */
159 c_put_str(TERM_WHITE, format(
165 day), ROW_DAY, COL_DAY);
167 c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
173 if (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)
174 && (quest[p_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
180 else if (p_ptr->wild_mode)
186 else if (p_ptr->inside_arena)
192 else if (p_ptr->inside_battle)
196 return "Monster Arena";
198 else if (!dun_level && p_ptr->town_num)
199 return town[p_ptr->town_num].name;
201 return d_name+d_info[dungeon_type].name;
207 static void prt_dungeon(void)
212 /* Dump 13 spaces to clear */
213 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
215 dungeon_name = map_name();
217 col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
218 if (col < 0) col = 0;
220 /* Dump the info itself */
221 c_put_str(TERM_L_UMBER, format("%s",dungeon_name),
229 * Print character stat in given row, column
231 static void prt_stat(int stat)
235 /* Display "injured" stat */
236 if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
238 put_str(stat_names_reduced[stat], ROW_STAT + stat, 0);
239 cnv_stat(p_ptr->stat_use[stat], tmp);
240 c_put_str(TERM_YELLOW, tmp, ROW_STAT + stat, COL_STAT + 6);
243 /* Display "healthy" stat */
246 put_str(stat_names[stat], ROW_STAT + stat, 0);
247 cnv_stat(p_ptr->stat_use[stat], tmp);
248 c_put_str(TERM_L_GREEN, tmp, ROW_STAT + stat, COL_STAT + 6);
251 /* Indicate natural maximum */
252 if (p_ptr->stat_max[stat] == p_ptr->stat_max_max[stat])
255 /* ÆüËܸì¤Ë¤«¤Ö¤é¤Ê¤¤¤è¤¦¤Ëɽ¼¨°ÌÃÖ¤òÊѹ¹ */
256 put_str("!", ROW_STAT + stat, 5);
258 put_str("!", ROW_STAT + stat, 3);
266 * Data structure for status bar
268 #define BAR_TSUYOSHI 0
269 #define BAR_HALLUCINATION 1
270 #define BAR_BLINDNESS 2
271 #define BAR_PARALYZE 3
272 #define BAR_CONFUSE 4
273 #define BAR_POISONED 5
275 #define BAR_LEVITATE 7
276 #define BAR_REFLECTION 8
277 #define BAR_PASSWALL 9
278 #define BAR_WRAITH 10
279 #define BAR_PROTEVIL 11
280 #define BAR_KAWARIMI 12
281 #define BAR_MAGICDEFENSE 13
282 #define BAR_EXPAND 14
283 #define BAR_STONESKIN 15
284 #define BAR_MULTISHADOW 16
285 #define BAR_REGMAGIC 17
286 #define BAR_ULTIMATE 18
287 #define BAR_INVULN 19
288 #define BAR_IMMACID 20
289 #define BAR_RESACID 21
290 #define BAR_IMMELEC 22
291 #define BAR_RESELEC 23
292 #define BAR_IMMFIRE 24
293 #define BAR_RESFIRE 25
294 #define BAR_IMMCOLD 26
295 #define BAR_RESCOLD 27
296 #define BAR_RESPOIS 28
297 #define BAR_RESNETH 29
298 #define BAR_RESTIME 30
299 #define BAR_DUSTROBE 31
300 #define BAR_SHFIRE 32
302 #define BAR_SHHOLY 34
303 #define BAR_EYEEYE 35
304 #define BAR_BLESSED 36
305 #define BAR_HEROISM 37
306 #define BAR_BERSERK 38
307 #define BAR_ATTKFIRE 39
308 #define BAR_ATTKCOLD 40
309 #define BAR_ATTKELEC 41
310 #define BAR_ATTKACID 42
311 #define BAR_ATTKPOIS 43
312 #define BAR_ATTKCONF 44
313 #define BAR_SENSEUNSEEN 45
314 #define BAR_TELEPATHY 46
315 #define BAR_REGENERATION 47
316 #define BAR_INFRAVISION 48
317 #define BAR_STEALTH 49
318 #define BAR_SUPERSTEALTH 50
319 #define BAR_RECALL 51
330 {TERM_YELLOW, "¤Ä", "¤Ä¤è¤·"},
331 {TERM_VIOLET, "¸¸", "¸¸³Ð"},
332 {TERM_L_DARK, "ÌÕ", "ÌÕÌÜ"},
333 {TERM_RED, "áã", "Ëãáã"},
334 {TERM_VIOLET, "Íð", "º®Íð"},
335 {TERM_GREEN, "ÆÇ", "ÆÇ"},
336 {TERM_BLUE, "¶²", "¶²ÉÝ"},
337 {TERM_L_BLUE, "Éâ", "ÉâÍ·"},
338 {TERM_SLATE, "È¿", "È¿¼Í"},
339 {TERM_SLATE, "ÊÉ", "ÊÉÈ´¤±"},
340 {TERM_L_DARK, "Í©", "Í©ÂÎ"},
341 {TERM_SLATE, "¼Ù", "ËɼÙ"},
342 {TERM_VIOLET, "ÊÑ", "ÊѤï¤ê¿È"},
343 {TERM_YELLOW, "Ëâ", "ËâË¡³»"},
344 {TERM_L_UMBER, "¿", "¿¤Ó"},
345 {TERM_WHITE, "ÀÐ", "ÀÐÈ©"},
346 {TERM_L_BLUE, "ʬ", "ʬ¿È"},
347 {TERM_SLATE, "ËÉ", "ËâË¡Ëɸæ"},
348 {TERM_YELLOW, "µæ", "µæ¶Ë"},
349 {TERM_YELLOW, "̵", "̵Ũ"},
350 {TERM_L_GREEN, "»À", "»ÀÌȱÖ"},
351 {TERM_GREEN, "»À", "ÂÑ»À"},
352 {TERM_L_BLUE, "ÅÅ", "ÅÅÌȱÖ"},
353 {TERM_BLUE, "ÅÅ", "ÂÑÅÅ"},
354 {TERM_L_RED, "²Ð", "²ÐÌȱÖ"},
355 {TERM_RED, "²Ð", "ÂѲÐ"},
356 {TERM_WHITE, "Îä", "ÎäÌȱÖ"},
357 {TERM_SLATE, "Îä", "ÂÑÎä"},
358 {TERM_GREEN, "ÆÇ", "ÂÑÆÇ"},
359 {TERM_L_DARK, "¹ö", "ÂÑÃϹö"},
360 {TERM_L_BLUE, "»þ", "ÂÑ»þ´Ö"},
361 {TERM_L_DARK, "¶À", "¶À¥ª¡¼¥é"},
362 {TERM_L_RED, "¥ª", "²Ð¥ª¡¼¥é"},
363 {TERM_WHITE, "Æ®", "Æ®µ¤"},
364 {TERM_WHITE, "À»", "À»¥ª¡¼¥é"},
365 {TERM_VIOLET, "ÌÜ", "ÌܤˤÏÌÜ"},
366 {TERM_WHITE, "½Ë", "½ËÊ¡"},
367 {TERM_WHITE, "ͦ", "ͦ"},
368 {TERM_RED, "¶¸", "¶¸Íð"},
369 {TERM_L_RED, "²Ð", "Ëâ·õ²Ð"},
370 {TERM_WHITE, "Îä", "Ëâ·õÎä"},
371 {TERM_L_BLUE, "ÅÅ", "Ëâ·õÅÅ"},
372 {TERM_SLATE, "»À", "Ëâ·õ»À"},
373 {TERM_L_GREEN, "ÆÇ", "Ëâ·õÆÇ"},
374 {TERM_RED, "Íð", "º®ÍðÂÇ·â"},
375 {TERM_L_BLUE, "»ë", "Æ©ÌÀ»ë"},
376 {TERM_ORANGE, "¥Æ", "¥Æ¥ì¥Ñ¥·"},
377 {TERM_L_BLUE, "²ó", "²óÉü"},
378 {TERM_L_RED, "ÀÖ", "ÀÖ³°"},
379 {TERM_UMBER, "±£", "±£Ì©"},
380 {TERM_YELLOW, "±£", "Ķ±£Ì©"},
381 {TERM_WHITE, "µ¢", "µ¢´Ô"},
382 {TERM_WHITE, "¸½", "¸½¼ÂÊÑÍÆ"},
387 {TERM_YELLOW, "Ts", "Tsuyoshi"},
388 {TERM_VIOLET, "Hu", "Hullc"},
389 {TERM_L_DARK, "Bl", "Blind"},
390 {TERM_RED, "Pa", "Paralyzed"},
391 {TERM_VIOLET, "Cf", "Confused"},
392 {TERM_GREEN, "Po", "Poisoned"},
393 {TERM_BLUE, "Af", "Afraid"},
394 {TERM_L_BLUE, "Lv", "Levit"},
395 {TERM_SLATE, "Rf", "Reflect"},
396 {TERM_SLATE, "Pw", "PassWall"},
397 {TERM_L_DARK, "Wr", "Wraith"},
398 {TERM_SLATE, "Ev", "PrtEvl"},
399 {TERM_VIOLET, "Kw", "Kawarimi"},
400 {TERM_YELLOW, "Md", "MgcArm"},
401 {TERM_L_UMBER, "Eh", "Expand"},
402 {TERM_WHITE, "Ss", "StnSkn"},
403 {TERM_L_BLUE, "Ms", "MltShdw"},
404 {TERM_SLATE, "Rm", "ResMag"},
405 {TERM_YELLOW, "Ul", "Ultima"},
406 {TERM_YELLOW, "Iv", "Invuln"},
407 {TERM_L_GREEN, "IAc", "ImmAcid"},
408 {TERM_GREEN, "Ac", "Acid"},
409 {TERM_L_BLUE, "IEl", "ImmElec"},
410 {TERM_BLUE, "El", "Elec"},
411 {TERM_L_RED, "IFi", "ImmFire"},
412 {TERM_RED, "Fi", "Fire"},
413 {TERM_WHITE, "ICo", "ImmCold"},
414 {TERM_SLATE, "Co", "Cold"},
415 {TERM_GREEN, "Po", "Pois"},
416 {TERM_L_DARK, "Nt", "Nthr"},
417 {TERM_L_BLUE, "Ti", "Time"},
418 {TERM_L_DARK, "Mr", "Mirr"},
419 {TERM_L_RED, "SFi", "SFire"},
420 {TERM_WHITE, "Fo", "Force"},
421 {TERM_WHITE, "Ho", "Holy"},
422 {TERM_VIOLET, "Ee", "EyeEye"},
423 {TERM_WHITE, "Bs", "Bless"},
424 {TERM_WHITE, "He", "Hero"},
425 {TERM_RED, "Br", "Berserk"},
426 {TERM_L_RED, "BFi", "BFire"},
427 {TERM_WHITE, "BCo", "BCold"},
428 {TERM_L_BLUE, "BEl", "BElec"},
429 {TERM_SLATE, "BAc", "BAcid"},
430 {TERM_L_GREEN, "BPo", "BPois"},
431 {TERM_RED, "TCf", "TchCnf"},
432 {TERM_L_BLUE, "Se", "SInv"},
433 {TERM_ORANGE, "Te", "Telepa"},
434 {TERM_L_BLUE, "Rg", "Regen"},
435 {TERM_L_RED, "If", "Infr"},
436 {TERM_UMBER, "Sl", "Stealth"},
437 {TERM_YELLOW, "Stlt", "Stealth"},
438 {TERM_WHITE, "Rc", "Recall"},
439 {TERM_WHITE, "Al", "Alter"},
444 #define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
445 #define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
451 static void prt_status(void)
454 int wid, hgt, row_statbar, max_col_statbar;
455 int i, col = 0, num = 0;
458 Term_get_size(&wid, &hgt);
459 row_statbar = hgt + ROW_STATBAR;
460 max_col_statbar = wid + MAX_COL_STATBAR;
462 Term_erase(0, row_statbar, max_col_statbar);
464 bar_flags[0] = bar_flags[1] = 0L;
467 if (p_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
470 if (p_ptr->image) ADD_FLG(BAR_HALLUCINATION);
473 if (p_ptr->blind) ADD_FLG(BAR_BLINDNESS);
476 if (p_ptr->paralyzed) ADD_FLG(BAR_PARALYZE);
479 if (p_ptr->confused) ADD_FLG(BAR_CONFUSE);
482 if (p_ptr->poisoned) ADD_FLG(BAR_POISONED);
484 /* Times see-invisible */
485 if (p_ptr->tim_invis) ADD_FLG(BAR_SENSEUNSEEN);
488 if (p_ptr->tim_esp || music_singing(MUSIC_MIND)) ADD_FLG(BAR_TELEPATHY);
490 /* Timed regenerate */
491 if (p_ptr->tim_regen) ADD_FLG(BAR_REGENERATION);
493 /* Timed infra-vision */
494 if (p_ptr->tim_infra) ADD_FLG(BAR_INFRAVISION);
496 /* Protection from evil */
497 if (p_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
499 /* Invulnerability */
500 if (p_ptr->invuln || music_singing(MUSIC_INVULN)) ADD_FLG(BAR_INVULN);
503 if (p_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
506 if (p_ptr->kabenuke) ADD_FLG(BAR_PASSWALL);
508 if (p_ptr->tim_reflect) ADD_FLG(BAR_REFLECTION);
511 if (p_ptr->hero || music_singing(MUSIC_HERO) || music_singing(MUSIC_SHERO)) ADD_FLG(BAR_HEROISM);
513 /* Super Heroism / berserk */
514 if (p_ptr->shero) ADD_FLG(BAR_BERSERK);
517 if (p_ptr->blessed || music_singing(MUSIC_BLESS)) ADD_FLG(BAR_BLESSED);
520 if (p_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);
522 if (p_ptr->tsubureru) ADD_FLG(BAR_EXPAND);
524 if (p_ptr->shield) ADD_FLG(BAR_STONESKIN);
526 if (p_ptr->special_defense & NINJA_KAWARIMI) ADD_FLG(BAR_KAWARIMI);
529 if (p_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
530 if (p_ptr->oppose_acid || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU)) ADD_FLG(BAR_RESACID);
532 /* Oppose Lightning */
533 if (p_ptr->special_defense & DEFENSE_ELEC) ADD_FLG(BAR_IMMELEC);
534 if (p_ptr->oppose_elec || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU)) ADD_FLG(BAR_RESELEC);
537 if (p_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
538 if (p_ptr->oppose_fire || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU)) ADD_FLG(BAR_RESFIRE);
541 if (p_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
542 if (p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU)) ADD_FLG(BAR_RESCOLD);
545 if (p_ptr->oppose_pois || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU)) ADD_FLG(BAR_RESPOIS);
548 if (p_ptr->word_recall) ADD_FLG(BAR_RECALL);
551 if (p_ptr->alter_reality) ADD_FLG(BAR_ALTER);
554 if (p_ptr->afraid) ADD_FLG(BAR_AFRAID);
557 if (p_ptr->tim_res_time) ADD_FLG(BAR_RESTIME);
559 if (p_ptr->multishadow) ADD_FLG(BAR_MULTISHADOW);
561 /* Confusing Hands */
562 if (p_ptr->special_attack & ATTACK_CONFUSE) ADD_FLG(BAR_ATTKCONF);
564 if (p_ptr->resist_magic) ADD_FLG(BAR_REGMAGIC);
566 /* Ultimate-resistance */
567 if (p_ptr->ult_res) ADD_FLG(BAR_ULTIMATE);
570 if (p_ptr->tim_ffall) ADD_FLG(BAR_LEVITATE);
572 if (p_ptr->tim_res_nether) ADD_FLG(BAR_RESNETH);
574 if (p_ptr->dustrobe) ADD_FLG(BAR_DUSTROBE);
577 if (p_ptr->special_attack & ATTACK_FIRE) ADD_FLG(BAR_ATTKFIRE);
578 if (p_ptr->special_attack & ATTACK_COLD) ADD_FLG(BAR_ATTKCOLD);
579 if (p_ptr->special_attack & ATTACK_ELEC) ADD_FLG(BAR_ATTKELEC);
580 if (p_ptr->special_attack & ATTACK_ACID) ADD_FLG(BAR_ATTKACID);
581 if (p_ptr->special_attack & ATTACK_POIS) ADD_FLG(BAR_ATTKPOIS);
582 if (p_ptr->special_defense & NINJA_S_STEALTH) ADD_FLG(BAR_SUPERSTEALTH);
585 if (p_ptr->tim_sh_fire) ADD_FLG(BAR_SHFIRE);
587 if (p_ptr->tim_stealth || music_singing(MUSIC_STEALTH)) ADD_FLG(BAR_STEALTH);
589 if (p_ptr->tim_sh_touki) ADD_FLG(BAR_TOUKI);
592 if (p_ptr->tim_sh_holy) ADD_FLG(BAR_SHHOLY);
594 /* An Eye for an Eye */
595 if (p_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
597 /* Calcurate length */
598 for (i = 0; bar[i].sstr; i++)
602 col += strlen(bar[i].lstr) + 1;
607 /* If there are not excess spaces for long strings, use short one */
608 if (col - 1 > max_col_statbar)
613 for (i = 0; bar[i].sstr; i++)
617 col += strlen(bar[i].sstr);
621 /* If there are excess spaces for short string, use more */
622 if (col - 1 <= max_col_statbar - (num-1))
630 /* Centering display column */
631 col = (max_col_statbar - col) / 2;
633 /* Display status bar */
634 for (i = 0; bar[i].sstr; i++)
639 if (space == 2) str = bar[i].lstr;
640 else str = bar[i].sstr;
642 c_put_str(bar[i].attr, str, row_statbar, col);
644 if (space > 0) col++;
645 if (col > max_col_statbar) break;
653 * Prints "title", including "wizard" or "winner" as needed.
655 static void prt_title(void)
664 /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½ ¾Î¹æ */
673 else if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
675 if ((p_ptr->arena_number > MAX_ARENA_MONS+2) && (p_ptr->arena_number < 99))
678 /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½ ¾Î¹æ */
688 /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½ ¾Î¹æ */
700 my_strcpy(str, player_title[p_ptr->pclass][(p_ptr->lev - 1) / 5], sizeof(str));
704 prt_field(p, ROW_TITLE, COL_TITLE);
711 static void prt_level(void)
716 sprintf(tmp, "%5d", p_ptr->lev);
718 sprintf(tmp, "%6d", p_ptr->lev);
722 if (p_ptr->lev >= p_ptr->max_plv)
725 put_str("¥ì¥Ù¥ë ", ROW_LEVEL, 0);
726 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 7);
728 put_str("LEVEL ", ROW_LEVEL, 0);
729 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 6);
736 put_str("x¥ì¥Ù¥ë", ROW_LEVEL, 0);
737 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 7);
739 put_str("Level ", ROW_LEVEL, 0);
740 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 6);
748 * Display the experience
750 static void prt_exp(void)
755 (void)sprintf(out_val, "%7ld", (long)p_ptr->exp);
757 (void)sprintf(out_val, "%8ld", (long)p_ptr->exp);
761 if (p_ptr->exp >= p_ptr->max_exp)
764 if (p_ptr->prace == RACE_ANDROID) put_str("¶¯²½ ", ROW_EXP, 0);
765 else put_str("·Ð¸³ ", ROW_EXP, 0);
766 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 5);
768 if (p_ptr->prace == RACE_ANDROID) put_str("Cst ", ROW_EXP, 0);
769 else put_str("EXP ", ROW_EXP, 0);
770 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 4);
777 put_str("x·Ð¸³", ROW_EXP, 0);
778 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 5);
780 put_str("Exp ", ROW_EXP, 0);
781 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 4);
789 * Prints current gold
791 static void prt_gold(void)
796 put_str("¡ð ", ROW_GOLD, COL_GOLD);
798 put_str("AU ", ROW_GOLD, COL_GOLD);
801 sprintf(tmp, "%9ld", (long)p_ptr->au);
802 c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
810 static void prt_ac(void)
815 /* AC ¤Îɽ¼¨Êý¼°¤òÊѹ¹¤·¤Æ¤¤¤ë */
816 put_str(" £Á£Ã( )", ROW_AC, COL_AC);
817 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
818 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 6);
820 put_str("Cur AC ", ROW_AC, COL_AC);
821 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
822 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 7);
829 * Prints Cur/Max hit points
831 static void prt_hp(void)
833 /* ¥Ò¥Ã¥È¥Ý¥¤¥ó¥È¤Îɽ¼¨ÊýË¡¤òÊѹ¹ */
839 /* put_str(" £È£Ð¡¦£Í£Ð", ROW_HPMP, COL_HPMP); */
841 put_str("HP", ROW_CURHP, COL_CURHP);
843 /* ¸½ºß¤Î¥Ò¥Ã¥È¥Ý¥¤¥ó¥È */
844 sprintf(tmp, "%4d", p_ptr->chp);
846 if (p_ptr->chp >= p_ptr->mhp)
848 color = TERM_L_GREEN;
850 else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
859 c_put_str(color, tmp, ROW_CURHP, COL_CURHP+3);
862 put_str( "/", ROW_CURHP, COL_CURHP + 7 );
864 /* ºÇÂç¥Ò¥Ã¥È¥Ý¥¤¥ó¥È */
865 sprintf(tmp, "%4d", p_ptr->mhp);
866 color = TERM_L_GREEN;
868 c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
873 * Prints players max/cur spell points
875 static void prt_sp(void)
877 /* ¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È¤Îɽ¼¨ÊýË¡¤òÊѹ¹¤·¤Æ¤¤¤ë */
882 /* Do not show mana unless it matters */
883 if (!mp_ptr->spell_book) return;
886 /* put_str(" £Í£Ð / ºÇÂç", ROW_MAXSP, COL_MAXSP); */
889 put_str("MP", ROW_CURSP, COL_CURSP);
891 put_str("SP", ROW_CURSP, COL_CURSP);
894 /* ¸½ºß¤Î¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È */
895 sprintf(tmp, "%4d", p_ptr->csp);
897 if (p_ptr->csp >= p_ptr->msp)
899 color = TERM_L_GREEN;
901 else if (p_ptr->csp > p_ptr->msp / 5)
910 c_put_str(color, tmp, ROW_CURSP, COL_CURSP+3);
913 put_str( "/", ROW_CURSP, COL_CURSP + 7 );
915 /* ºÇÂç¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È */
916 sprintf(tmp, "%4d", p_ptr->msp);
917 color = TERM_L_GREEN;
919 c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
924 * Prints depth in stat area
926 static void prt_depth(void)
929 int wid, hgt, row_depth, col_depth;
931 Term_get_size(&wid, &hgt);
932 col_depth = wid + COL_DEPTH;
933 row_depth = hgt + ROW_DEPTH;
938 strcpy(depths, "ÃϾå");
940 strcpy(depths, "Surf.");
943 else if (p_ptr->inside_quest && !dungeon_type)
946 strcpy(depths, "ÃϾå");
948 strcpy(depths, "Quest");
952 else if (depth_in_feet)
955 (void)sprintf(depths, "%d ft", dun_level * 50);
957 (void)sprintf(depths, "%d ft", dun_level * 50);
964 sprintf(depths, "%d ³¬", dun_level);
966 (void)sprintf(depths, "Lev %d", dun_level);
971 /* Right-Adjust the "depth", and clear old values */
972 prt(format("%7s", depths), row_depth, col_depth);
977 * Prints status of hunger
979 static void prt_hunger(void)
981 /* Fainting / Starving */
982 if (p_ptr->food < PY_FOOD_FAINT)
985 c_put_str(TERM_RED, "¿ê¼å ", ROW_HUNGRY, COL_HUNGRY);
987 c_put_str(TERM_RED, "Weak ", ROW_HUNGRY, COL_HUNGRY);
993 else if (p_ptr->food < PY_FOOD_WEAK)
996 c_put_str(TERM_ORANGE, "¿ê¼å ", ROW_HUNGRY, COL_HUNGRY);
998 c_put_str(TERM_ORANGE, "Weak ", ROW_HUNGRY, COL_HUNGRY);
1004 else if (p_ptr->food < PY_FOOD_ALERT)
1007 c_put_str(TERM_YELLOW, "¶õÊ¢ ", ROW_HUNGRY, COL_HUNGRY);
1009 c_put_str(TERM_YELLOW, "Hungry", ROW_HUNGRY, COL_HUNGRY);
1015 else if (p_ptr->food < PY_FOOD_FULL)
1017 c_put_str(TERM_L_GREEN, " ", ROW_HUNGRY, COL_HUNGRY);
1021 else if (p_ptr->food < PY_FOOD_MAX)
1024 c_put_str(TERM_L_GREEN, "ËþÊ¢ ", ROW_HUNGRY, COL_HUNGRY);
1026 c_put_str(TERM_L_GREEN, "Full ", ROW_HUNGRY, COL_HUNGRY);
1035 c_put_str(TERM_GREEN, "¿©²á¤®", ROW_HUNGRY, COL_HUNGRY);
1037 c_put_str(TERM_GREEN, "Gorged", ROW_HUNGRY, COL_HUNGRY);
1045 * Prints Searching, Resting, Paralysis, or 'count' status
1046 * Display is always exactly 10 characters wide (see below)
1048 * This function was a major bottleneck when resting, so a lot of
1049 * the text formatting code was optimized in place below.
1051 static void prt_state(void)
1053 byte attr = TERM_WHITE;
1060 if (command_rep > 999)
1063 sprintf(text, "%2d00", command_rep / 100);
1065 (void)sprintf(text, "%2d00", command_rep / 100);
1072 sprintf(text, " %2d", command_rep);
1074 (void)sprintf(text, " %2d", command_rep);
1083 switch(p_ptr->action)
1088 strcpy(text, "õº÷");
1090 strcpy(text, "Sear");
1098 /* Start with "Rest" */
1106 /* Extensive (timed) rest */
1107 if (resting >= 1000)
1112 text[1] = '0' + (i % 10);
1113 text[0] = '0' + (i / 10);
1116 /* Long (timed) rest */
1117 else if (resting >= 100)
1120 text[3] = '0' + (i % 10);
1122 text[2] = '0' + (i % 10);
1123 text[1] = '0' + (i / 10);
1126 /* Medium (timed) rest */
1127 else if (resting >= 10)
1130 text[3] = '0' + (i % 10);
1131 text[2] = '0' + (i / 10);
1134 /* Short (timed) rest */
1135 else if (resting > 0)
1138 text[3] = '0' + (i);
1141 /* Rest until healed */
1142 else if (resting == -1)
1144 text[0] = text[1] = text[2] = text[3] = '*';
1147 /* Rest until done */
1148 else if (resting == -2)
1150 text[0] = text[1] = text[2] = text[3] = '&';
1157 strcpy(text, "³Ø½¬");
1159 strcpy(text, "lear");
1161 if (new_mane) attr = TERM_L_RED;
1167 strcpy(text, "Äà¤ê");
1169 strcpy(text, "fish");
1176 for (i = 0; i < MAX_KAMAE; i++)
1177 if (p_ptr->special_defense & (KAMAE_GENBU << i)) break;
1180 case 0: attr = TERM_GREEN;break;
1181 case 1: attr = TERM_WHITE;break;
1182 case 2: attr = TERM_L_BLUE;break;
1183 case 3: attr = TERM_L_RED;break;
1185 strcpy(text, kamae_shurui[i].desc);
1191 for (i = 0; i < MAX_KATA; i++)
1192 if (p_ptr->special_defense & (KATA_IAI << i)) break;
1193 strcpy(text, kata_shurui[i].desc);
1199 strcpy(text, "²Î ");
1201 strcpy(text, "Sing");
1205 case ACTION_HAYAGAKE:
1208 strcpy(text, "®¶î");
1210 strcpy(text, "Fast");
1222 /* Display the info (or blanks) */
1223 c_put_str(attr, format("%5.5s",text), ROW_STATE, COL_STATE);
1228 * Prints the speed of a character. -CJS-
1230 static void prt_speed(void)
1232 int i = p_ptr->pspeed;
1233 bool is_fast = (p_ptr->fast || music_singing(MUSIC_SPEED) || music_singing(MUSIC_SHERO));
1235 byte attr = TERM_WHITE;
1237 int wid, hgt, row_speed, col_speed;
1239 Term_get_size(&wid, &hgt);
1240 col_speed = wid + COL_SPEED;
1241 row_speed = hgt + ROW_SPEED;
1243 /* Hack -- Visually "undo" the Search Mode Slowdown */
1244 if (p_ptr->action == ACTION_SEARCH) i += 10;
1251 if (m_list[p_ptr->riding].fast && !m_list[p_ptr->riding].slow) attr = TERM_L_BLUE;
1252 else if (m_list[p_ptr->riding].slow && !m_list[p_ptr->riding].fast) attr = TERM_VIOLET;
1253 else attr = TERM_GREEN;
1255 else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
1256 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1257 else attr = TERM_L_GREEN;
1259 sprintf(buf, "%s(+%d)", (p_ptr->riding ? "¾èÇÏ" : "²Ã®"), (i - 110));
1261 sprintf(buf, "Fast(+%d)", (i - 110));
1271 if (m_list[p_ptr->riding].fast && !m_list[p_ptr->riding].slow) attr = TERM_L_BLUE;
1272 else if (m_list[p_ptr->riding].slow && !m_list[p_ptr->riding].fast) attr = TERM_VIOLET;
1273 else attr = TERM_RED;
1275 else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
1276 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1277 else attr = TERM_L_UMBER;
1279 sprintf(buf, "%s(-%d)", (p_ptr->riding ? "¾èÇÏ" : "¸ºÂ®"), (110 - i));
1281 sprintf(buf, "Slow(-%d)", (110 - i));
1284 else if (p_ptr->riding)
1288 strcpy(buf, "¾èÇÏÃæ");
1290 strcpy(buf, "Riding");
1294 /* Display the speed */
1295 c_put_str(attr, format("%-9s", buf), row_speed, col_speed);
1299 static void prt_study(void)
1301 int wid, hgt, row_study, col_study;
1303 Term_get_size(&wid, &hgt);
1304 col_study = wid + COL_STUDY;
1305 row_study = hgt + ROW_STUDY;
1307 if (p_ptr->new_spells)
1310 put_str("³Ø½¬", row_study, col_study);
1312 put_str("Stud", row_study, col_study);
1318 put_str(" ", row_study, col_study);
1323 static void prt_mane(void)
1325 int wid, hgt, row_study, col_study;
1327 Term_get_size(&wid, &hgt);
1328 col_study = wid + COL_STUDY;
1329 row_study = hgt + ROW_STUDY;
1331 if (p_ptr->pclass == CLASS_IMITATOR)
1333 if (p_ptr->mane_num)
1336 if (new_mane) attr = TERM_L_RED;
1337 else attr = TERM_WHITE;
1339 c_put_str(attr, "¤Þ¤Í", row_study, col_study);
1341 c_put_str(attr, "Mane", row_study, col_study);
1346 put_str(" ", row_study, col_study);
1352 static void prt_cut(void)
1359 c_put_str(TERM_L_RED, "Ã×Ì¿½ý ", ROW_CUT, COL_CUT);
1361 c_put_str(TERM_L_RED, "Mortal wound", ROW_CUT, COL_CUT);
1368 c_put_str(TERM_RED, "¤Ò¤É¤¤¿¼¼ê ", ROW_CUT, COL_CUT);
1370 c_put_str(TERM_RED, "Deep gash ", ROW_CUT, COL_CUT);
1377 c_put_str(TERM_RED, "½Å½ý ", ROW_CUT, COL_CUT);
1379 c_put_str(TERM_RED, "Severe cut ", ROW_CUT, COL_CUT);
1386 c_put_str(TERM_ORANGE, "ÂçÊѤʽý ", ROW_CUT, COL_CUT);
1388 c_put_str(TERM_ORANGE, "Nasty cut ", ROW_CUT, COL_CUT);
1395 c_put_str(TERM_ORANGE, "¤Ò¤É¤¤½ý ", ROW_CUT, COL_CUT);
1397 c_put_str(TERM_ORANGE, "Bad cut ", ROW_CUT, COL_CUT);
1404 c_put_str(TERM_YELLOW, "·Ú½ý ", ROW_CUT, COL_CUT);
1406 c_put_str(TERM_YELLOW, "Light cut ", ROW_CUT, COL_CUT);
1413 c_put_str(TERM_YELLOW, "¤«¤¹¤ê½ý ", ROW_CUT, COL_CUT);
1415 c_put_str(TERM_YELLOW, "Graze ", ROW_CUT, COL_CUT);
1421 put_str(" ", ROW_CUT, COL_CUT);
1427 static void prt_stun(void)
1429 int s = p_ptr->stun;
1434 c_put_str(TERM_RED, "°Õ¼±ÉÔÌÀÎÆ ", ROW_STUN, COL_STUN);
1436 c_put_str(TERM_RED, "Knocked out ", ROW_STUN, COL_STUN);
1443 c_put_str(TERM_ORANGE, "¤Ò¤É¤¯Û¯Û° ", ROW_STUN, COL_STUN);
1445 c_put_str(TERM_ORANGE, "Heavy stun ", ROW_STUN, COL_STUN);
1452 c_put_str(TERM_ORANGE, "ۯ۰ ", ROW_STUN, COL_STUN);
1454 c_put_str(TERM_ORANGE, "Stun ", ROW_STUN, COL_STUN);
1460 put_str(" ", ROW_STUN, COL_STUN);
1467 * Redraw the "monster health bar" -DRS-
1468 * Rather extensive modifications by -BEN-
1470 * The "monster health bar" provides visual feedback on the "health"
1471 * of the monster currently being "tracked". There are several ways
1472 * to "track" a monster, including targetting it, attacking it, and
1473 * affecting it (and nobody else) with a ranged attack.
1475 * Display the monster health bar (affectionately known as the
1476 * "health-o-meter"). Clear health bar if nothing is being tracked.
1477 * Auto-track current target monster when bored. Note that the
1478 * health-bar stops tracking any monster that "disappears".
1480 static void health_redraw(void)
1483 #ifdef DRS_SHOW_HEALTH_BAR
1486 if (!p_ptr->health_who)
1488 /* Erase the health bar */
1489 Term_erase(COL_INFO, ROW_INFO, 12);
1492 /* Tracking an unseen monster */
1493 else if (!m_list[p_ptr->health_who].ml)
1495 /* Indicate that the monster health is "unknown" */
1496 Term_putstr(COL_INFO, ROW_INFO, 12, TERM_WHITE, "[----------]");
1499 /* Tracking a hallucinatory monster */
1500 else if (p_ptr->image)
1502 /* Indicate that the monster health is "unknown" */
1503 Term_putstr(COL_INFO, ROW_INFO, 12, TERM_WHITE, "[----------]");
1506 /* Tracking a dead monster (???) */
1507 else if (!m_list[p_ptr->health_who].hp < 0)
1509 /* Indicate that the monster health is "unknown" */
1510 Term_putstr(COL_INFO, ROW_INFO, 12, TERM_WHITE, "[----------]");
1513 /* Tracking a visible monster */
1518 monster_type *m_ptr = &m_list[p_ptr->health_who];
1520 /* Default to almost dead */
1521 byte attr = TERM_RED;
1523 /* Extract the "percent" of health */
1524 pct = 100L * m_ptr->hp / m_ptr->maxhp;
1525 pct2 = 100L * m_ptr->hp / m_ptr->max_maxhp;
1528 if (pct >= 10) attr = TERM_L_RED;
1531 if (pct >= 25) attr = TERM_ORANGE;
1533 /* Somewhat Wounded */
1534 if (pct >= 60) attr = TERM_YELLOW;
1537 if (pct >= 100) attr = TERM_L_GREEN;
1540 if (m_ptr->monfear) attr = TERM_VIOLET;
1543 if (m_ptr->csleep) attr = TERM_BLUE;
1546 if (m_ptr->invulner) attr = TERM_WHITE;
1548 /* Convert percent into "health" */
1549 len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1551 /* Default to "unknown" */
1552 Term_putstr(COL_INFO, ROW_INFO, 12, TERM_WHITE, "[----------]");
1554 /* Dump the current "health" (use '*' symbols) */
1555 Term_putstr(COL_INFO + 1, ROW_INFO, len, attr, "**********");
1564 static void riding_health_redraw(void)
1567 #ifdef DRS_SHOW_HEALTH_BAR
1572 /* Erase the health bar */
1573 Term_erase(COL_RIDING_INFO, ROW_RIDING_INFO, 12);
1576 /* Tracking a hallucinatory monster */
1577 else if (p_ptr->image)
1579 /* Indicate that the monster health is "unknown" */
1580 Term_putstr(COL_RIDING_INFO, ROW_RIDING_INFO, 12, TERM_WHITE, "[----------]");
1583 /* Tracking a dead monster (???) */
1584 else if (!m_list[p_ptr->health_who].hp < 0)
1586 /* Indicate that the monster health is "unknown" */
1587 Term_putstr(COL_RIDING_INFO, ROW_RIDING_INFO, 12, TERM_WHITE, "[----------]");
1590 /* Tracking a visible monster */
1595 monster_type *m_ptr = &m_list[p_ptr->riding];
1597 /* Default to almost dead */
1598 byte attr = TERM_RED;
1600 /* Extract the "percent" of health */
1601 pct = 100L * m_ptr->hp / m_ptr->maxhp;
1602 pct2 = 100L * m_ptr->hp / m_ptr->max_maxhp;
1605 if (pct >= 10) attr = TERM_L_RED;
1608 if (pct >= 25) attr = TERM_ORANGE;
1610 /* Somewhat Wounded */
1611 if (pct >= 60) attr = TERM_YELLOW;
1614 if (pct >= 100) attr = TERM_L_GREEN;
1617 if (m_ptr->monfear) attr = TERM_VIOLET;
1620 if (m_ptr->csleep) attr = TERM_BLUE;
1623 if (m_ptr->invulner) attr = TERM_WHITE;
1625 /* Convert percent into "health" */
1626 len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1628 /* Default to "unknown" */
1629 Term_putstr(COL_RIDING_INFO, ROW_RIDING_INFO, 12, TERM_WHITE, "[----------]");
1631 /* Dump the current "health" (use '*' symbols) */
1632 Term_putstr(COL_RIDING_INFO + 1, ROW_RIDING_INFO, len, attr, "**********");
1642 * Display basic info (mostly left of map)
1644 static void prt_frame_basic(void)
1648 /* Race and Class */
1649 if (p_ptr->mimic_form)
1650 prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
1654 my_strcpy(str, rp_ptr->title, sizeof(str));
1655 prt_field(str, ROW_RACE, COL_RACE);
1657 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
1658 /* prt_field(ap_ptr->title, ROW_SEIKAKU, COL_SEIKAKU); */
1664 /* Level/Experience */
1669 for (i = 0; i < 6; i++) prt_stat(i);
1688 riding_health_redraw();
1693 * Display extra info (mostly below map)
1695 static void prt_frame_extra(void)
1720 * Hack -- display inventory in sub-windows
1722 static void fix_inven(void)
1727 for (j = 0; j < 8; j++)
1732 if (!angband_term[j]) continue;
1734 /* No relevant flags */
1735 if (!(window_flag[j] & (PW_INVEN))) continue;
1738 Term_activate(angband_term[j]);
1740 /* Display inventory */
1754 * Hack -- display equipment in sub-windows
1756 static void fix_equip(void)
1761 for (j = 0; j < 8; j++)
1766 if (!angband_term[j]) continue;
1768 /* No relevant flags */
1769 if (!(window_flag[j] & (PW_EQUIP))) continue;
1772 Term_activate(angband_term[j]);
1774 /* Display equipment */
1787 * Hack -- display equipment in sub-windows
1789 static void fix_spell(void)
1794 for (j = 0; j < 8; j++)
1799 if (!angband_term[j]) continue;
1801 /* No relevant flags */
1802 if (!(window_flag[j] & (PW_SPELL))) continue;
1805 Term_activate(angband_term[j]);
1807 /* Display spell list */
1808 display_spell_list();
1820 * Hack -- display character in sub-windows
1822 static void fix_player(void)
1827 for (j = 0; j < 8; j++)
1832 if (!angband_term[j]) continue;
1834 /* No relevant flags */
1835 if (!(window_flag[j] & (PW_PLAYER))) continue;
1838 Term_activate(angband_term[j]);
1842 /* Display player */
1856 * Hack -- display recent messages in sub-windows
1858 * XXX XXX XXX Adjust for width and split messages
1860 static void fix_message(void)
1867 for (j = 0; j < 8; j++)
1872 if (!angband_term[j]) continue;
1874 /* No relevant flags */
1875 if (!(window_flag[j] & (PW_MESSAGE))) continue;
1878 Term_activate(angband_term[j]);
1881 Term_get_size(&w, &h);
1884 for (i = 0; i < h; i++)
1886 /* Dump the message on the appropriate line */
1887 Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
1890 Term_locate(&x, &y);
1892 /* Clear to end of line */
1893 Term_erase(x, y, 255);
1906 * Hack -- display overhead view in sub-windows
1908 * Note that the "player" symbol does NOT appear on the map.
1910 static void fix_overhead(void)
1917 for (j = 0; j < 8; j++)
1923 if (!angband_term[j]) continue;
1925 /* No relevant flags */
1926 if (!(window_flag[j] & (PW_OVERHEAD))) continue;
1929 Term_activate(angband_term[j]);
1931 /* Full map in too small window is useless */
1932 Term_get_size(&wid, &hgt);
1933 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2)
1936 display_map(&cy, &cx);
1949 * Hack -- display dungeon view in sub-windows
1951 static void fix_dungeon(void)
1956 for (j = 0; j < 8; j++)
1961 if (!angband_term[j]) continue;
1963 /* No relevant flags */
1964 if (!(window_flag[j] & (PW_DUNGEON))) continue;
1967 Term_activate(angband_term[j]);
1969 /* Redraw dungeon view */
1982 * Hack -- display monster recall in sub-windows
1984 static void fix_monster(void)
1989 for (j = 0; j < 8; j++)
1994 if (!angband_term[j]) continue;
1996 /* No relevant flags */
1997 if (!(window_flag[j] & (PW_MONSTER))) continue;
2000 Term_activate(angband_term[j]);
2002 /* Display monster race info */
2003 if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
2015 * Hack -- display object recall in sub-windows
2017 static void fix_object(void)
2022 for (j = 0; j < 8; j++)
2027 if (!angband_term[j]) continue;
2029 /* No relevant flags */
2030 if (!(window_flag[j] & (PW_OBJECT))) continue;
2033 Term_activate(angband_term[j]);
2035 /* Display monster race info */
2036 if (p_ptr->object_kind_idx) display_koff(p_ptr->object_kind_idx);
2048 * Calculate number of spells player should have, and forget,
2049 * or remember, spells until that number is properly reflected.
2051 * Note that this function induces various "status" messages,
2052 * which must be bypasses until the character is created.
2054 static void calc_spells(void)
2056 int i, j, k, levels;
2058 int num_boukyaku = 0;
2067 /* Hack -- must be literate */
2068 if (!mp_ptr->spell_book) return;
2070 /* Hack -- wait for creation */
2071 if (!character_generated) return;
2073 /* Hack -- handle "xtra" mode */
2074 if (character_xtra) return;
2076 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
2078 p_ptr->new_spells = 0;
2082 p = spell_categoly_name(mp_ptr->spell_book);
2084 /* Determine the number of spells allowed */
2085 levels = p_ptr->lev - mp_ptr->spell_first + 1;
2087 /* Hack -- no negative spells */
2088 if (levels < 0) levels = 0;
2090 /* Extract total allowed spells */
2091 num_allowed = (adj_mag_study[p_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
2093 if ((p_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
2097 if (p_ptr->pclass == CLASS_SAMURAI)
2101 else if (p_ptr->realm2 == REALM_NONE)
2103 num_allowed = (num_allowed+1)/2;
2104 if (num_allowed>(32+bonus)) num_allowed = 32+bonus;
2106 else if ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))
2108 if (num_allowed>(96+bonus)) num_allowed = 96+bonus;
2112 if (num_allowed>(80+bonus)) num_allowed = 80+bonus;
2115 /* Count the number of spells we know */
2116 for (j = 0; j < 64; j++)
2118 /* Count known spells */
2120 (p_ptr->spell_forgotten1 & (1L << j)) :
2121 (p_ptr->spell_forgotten2 & (1L << (j - 32))))
2127 /* See how many spells we must forget or may learn */
2128 p_ptr->new_spells = num_allowed + p_ptr->add_spells + num_boukyaku - p_ptr->learned_spells;
2130 /* Forget spells which are too hard */
2131 for (i = 63; i >= 0; i--)
2133 /* Efficiency -- all done */
2134 if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
2136 /* Access the spell */
2137 j = p_ptr->spell_order[i];
2139 /* Skip non-spells */
2140 if (j >= 99) continue;
2144 if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2))
2147 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j];
2149 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32];
2152 s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2154 s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32];
2156 /* Skip spells we are allowed to know */
2157 if (s_ptr->slevel <= p_ptr->lev) continue;
2161 (p_ptr->spell_learned1 & (1L << j)) :
2162 (p_ptr->spell_learned2 & (1L << (j - 32))))
2164 /* Mark as forgotten */
2167 p_ptr->spell_forgotten1 |= (1L << j);
2168 which = p_ptr->realm1;
2172 p_ptr->spell_forgotten2 |= (1L << (j - 32));
2173 which = p_ptr->realm2;
2176 /* No longer known */
2179 p_ptr->spell_learned1 &= ~(1L << j);
2180 which = p_ptr->realm1;
2184 p_ptr->spell_learned2 &= ~(1L << (j - 32));
2185 which = p_ptr->realm2;
2190 msg_format("%s¤Î%s¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡£",
2191 spell_names[technic2magic(which)-1][j%32], p );
2193 msg_format("You have forgotten the %s of %s.", p,
2194 spell_names[technic2magic(which)-1][j%32]);
2198 /* One more can be learned */
2199 p_ptr->new_spells++;
2204 /* Forget spells if we know too many spells */
2205 for (i = 63; i >= 0; i--)
2207 /* Stop when possible */
2208 if (p_ptr->new_spells >= 0) break;
2210 /* Efficiency -- all done */
2211 if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
2213 /* Get the (i+1)th spell learned */
2214 j = p_ptr->spell_order[i];
2216 /* Skip unknown spells */
2217 if (j >= 99) continue;
2219 /* Forget it (if learned) */
2221 (p_ptr->spell_learned1 & (1L << j)) :
2222 (p_ptr->spell_learned2 & (1L << (j - 32))))
2224 /* Mark as forgotten */
2227 p_ptr->spell_forgotten1 |= (1L << j);
2228 which = p_ptr->realm1;
2232 p_ptr->spell_forgotten2 |= (1L << (j - 32));
2233 which = p_ptr->realm2;
2236 /* No longer known */
2239 p_ptr->spell_learned1 &= ~(1L << j);
2240 which = p_ptr->realm1;
2244 p_ptr->spell_learned2 &= ~(1L << (j - 32));
2245 which = p_ptr->realm2;
2250 msg_format("%s¤Î%s¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡£",
2251 spell_names[technic2magic(which)-1][j%32], p );
2253 msg_format("You have forgotten the %s of %s.", p,
2254 spell_names[technic2magic(which)-1][j%32]);
2258 /* One more can be learned */
2259 p_ptr->new_spells++;
2264 /* Check for spells to remember */
2265 for (i = 0; i < 64; i++)
2267 /* None left to remember */
2268 if (p_ptr->new_spells <= 0) break;
2270 /* Efficiency -- all done */
2271 if (!p_ptr->spell_forgotten1 && !p_ptr->spell_forgotten2) break;
2273 /* Get the next spell we learned */
2274 j = p_ptr->spell_order[i];
2276 /* Skip unknown spells */
2279 /* Access the spell */
2280 if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2))
2283 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j];
2285 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32];
2288 s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2290 s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32];
2292 /* Skip spells we cannot remember */
2293 if (s_ptr->slevel > p_ptr->lev) continue;
2295 /* First set of spells */
2297 (p_ptr->spell_forgotten1 & (1L << j)) :
2298 (p_ptr->spell_forgotten2 & (1L << (j - 32))))
2300 /* No longer forgotten */
2303 p_ptr->spell_forgotten1 &= ~(1L << j);
2304 which = p_ptr->realm1;
2308 p_ptr->spell_forgotten2 &= ~(1L << (j - 32));
2309 which = p_ptr->realm2;
2312 /* Known once more */
2315 p_ptr->spell_learned1 |= (1L << j);
2316 which = p_ptr->realm1;
2320 p_ptr->spell_learned2 |= (1L << (j - 32));
2321 which = p_ptr->realm2;
2326 msg_format("%s¤Î%s¤ò»×¤¤½Ð¤·¤¿¡£",
2327 spell_names[technic2magic(which)-1][j%32], p );
2329 msg_format("You have remembered the %s of %s.",
2330 p, spell_names[technic2magic(which)-1][j%32]);
2334 /* One less can be learned */
2335 p_ptr->new_spells--;
2341 if (p_ptr->realm2 == REALM_NONE)
2343 /* Count spells that can be learned */
2344 for (j = 0; j < 32; j++)
2346 if (!is_magic(p_ptr->realm1)) s_ptr = &technic_info[p_ptr->realm1-MIN_TECHNIC][j];
2347 else s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2349 /* Skip spells we cannot remember */
2350 if (s_ptr->slevel > p_ptr->lev) continue;
2352 /* Skip spells we already know */
2353 if (p_ptr->spell_learned1 & (1L << j))
2362 if ((p_ptr->new_spells > k) && ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK))) p_ptr->new_spells = k;
2365 if (p_ptr->new_spells < 0) p_ptr->new_spells = 0;
2367 /* Spell count changed */
2368 if (p_ptr->old_spells != p_ptr->new_spells)
2370 /* Message if needed */
2371 if (p_ptr->new_spells)
2375 if( p_ptr->new_spells < 10 ){
2376 msg_format("¤¢¤È %d ¤Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
2378 msg_format("¤¢¤È %d ¸Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
2381 msg_format("You can learn %d more %s%s.",
2382 p_ptr->new_spells, p,
2383 (p_ptr->new_spells != 1) ? "s" : "");
2388 /* Save the new_spells value */
2389 p_ptr->old_spells = p_ptr->new_spells;
2391 /* Redraw Study Status */
2392 p_ptr->redraw |= (PR_STUDY);
2394 /* Redraw object recall */
2395 p_ptr->window |= (PW_OBJECT);
2401 * Calculate maximum mana. You do not need to know any spells.
2402 * Note that mana is lowered by heavy (or inappropriate) armor.
2404 * This function induces status messages.
2406 static void calc_mana(void)
2408 int msp, levels, cur_wgt, max_wgt;
2413 /* Hack -- Must be literate */
2414 if (!mp_ptr->spell_book) return;
2416 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
2417 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
2418 (p_ptr->pclass == CLASS_BLUE_MAGE))
2420 levels = p_ptr->lev;
2424 if(mp_ptr->spell_first > p_ptr->lev)
2429 /* Display mana later */
2430 p_ptr->redraw |= (PR_MANA);
2434 /* Extract "effective" player level */
2435 levels = (p_ptr->lev - mp_ptr->spell_first) + 1;
2438 if (p_ptr->pclass == CLASS_SAMURAI)
2440 msp = (adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
2441 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
2445 /* Extract total mana */
2446 msp = adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] * (levels+3) / 4;
2448 /* Hack -- usually add one mana */
2451 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
2453 if (msp && (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp/2;
2455 /* Hack: High mages have a 25% mana bonus */
2456 if (msp && (p_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
2458 if (msp && (p_ptr->pclass == CLASS_SORCERER)) msp += msp*(25+p_ptr->lev)/100;
2461 /* Only mages are affected */
2462 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
2464 u32b flgs[TR_FLAG_SIZE];
2466 /* Assume player is not encumbered by gloves */
2467 p_ptr->cumber_glove = FALSE;
2469 /* Get the gloves */
2470 o_ptr = &inventory[INVEN_HANDS];
2472 /* Examine the gloves */
2473 object_flags(o_ptr, flgs);
2475 /* Normal gloves hurt mage-type spells */
2477 !(have_flag(flgs, TR_FREE_ACT)) &&
2478 !(have_flag(flgs, TR_MAGIC_MASTERY)) &&
2479 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
2482 p_ptr->cumber_glove = TRUE;
2485 msp = (3 * msp) / 4;
2490 /* Assume player not encumbered by armor */
2491 p_ptr->cumber_armor = FALSE;
2493 /* Weigh the armor */
2495 if(inventory[INVEN_RARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
2496 if(inventory[INVEN_LARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
2497 cur_wgt += inventory[INVEN_BODY].weight;
2498 cur_wgt += inventory[INVEN_HEAD].weight;
2499 cur_wgt += inventory[INVEN_OUTER].weight;
2500 cur_wgt += inventory[INVEN_HANDS].weight;
2501 cur_wgt += inventory[INVEN_FEET].weight;
2503 /* Subtract a percentage of maximum mana. */
2504 switch (p_ptr->pclass)
2506 /* For these classes, mana is halved if armour
2507 * is 30 pounds over their weight limit. */
2509 case CLASS_HIGH_MAGE:
2510 case CLASS_BLUE_MAGE:
2512 case CLASS_FORCETRAINER:
2513 case CLASS_SORCERER:
2515 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
2516 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
2520 /* Mana halved if armour is 40 pounds over weight limit. */
2525 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight*2/3;
2526 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight*2/3;
2530 case CLASS_MINDCRAFTER:
2531 case CLASS_BEASTMASTER:
2532 case CLASS_MIRROR_MASTER:
2534 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/2;
2535 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/2;
2539 /* Mana halved if armour is 50 pounds over weight limit. */
2542 case CLASS_RED_MAGE:
2543 case CLASS_WARRIOR_MAGE:
2545 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/3;
2546 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/3;
2550 /* Mana halved if armour is 60 pounds over weight limit. */
2552 case CLASS_CHAOS_WARRIOR:
2554 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/5;
2555 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/5;
2559 /* For new classes created, but not yet added to this formula. */
2566 /* Determine the weight allowance */
2567 max_wgt = mp_ptr->spell_weight;
2569 /* Heavy armor penalizes mana by a percentage. -LM- */
2570 if ((cur_wgt - max_wgt) > 0)
2573 p_ptr->cumber_armor = TRUE;
2575 /* Subtract a percentage of maximum mana. */
2576 switch (p_ptr->pclass)
2578 /* For these classes, mana is halved if armour
2579 * is 30 pounds over their weight limit. */
2581 case CLASS_HIGH_MAGE:
2582 case CLASS_BLUE_MAGE:
2584 msp -= msp * (cur_wgt - max_wgt) / 600;
2588 /* Mana halved if armour is 40 pounds over weight limit. */
2590 case CLASS_MINDCRAFTER:
2591 case CLASS_BEASTMASTER:
2593 case CLASS_FORCETRAINER:
2595 case CLASS_MIRROR_MASTER:
2597 msp -= msp * (cur_wgt - max_wgt) / 800;
2601 case CLASS_SORCERER:
2603 msp -= msp * (cur_wgt - max_wgt) / 900;
2607 /* Mana halved if armour is 50 pounds over weight limit. */
2611 case CLASS_RED_MAGE:
2613 msp -= msp * (cur_wgt - max_wgt) / 1000;
2617 /* Mana halved if armour is 60 pounds over weight limit. */
2619 case CLASS_CHAOS_WARRIOR:
2620 case CLASS_WARRIOR_MAGE:
2622 msp -= msp * (cur_wgt - max_wgt) / 1200;
2628 p_ptr->cumber_armor = FALSE;
2632 /* For new classes created, but not yet added to this formula. */
2635 msp -= msp * (cur_wgt - max_wgt) / 800;
2641 /* Mana can never be negative */
2642 if (msp < 0) msp = 0;
2645 /* Maximum mana has changed */
2646 if (p_ptr->msp != msp)
2648 /* Enforce maximum */
2649 if ((p_ptr->csp >= msp) && (p_ptr->pclass != CLASS_SAMURAI))
2652 p_ptr->csp_frac = 0;
2656 /* ¥ì¥Ù¥ë¥¢¥Ã¥×¤Î»þ¤Ï¾å¾ºÎ̤òɽ¼¨¤¹¤ë */
2657 if ((level_up == 1) && (msp > p_ptr->msp))
2659 msg_format("ºÇÂç¥Þ¥¸¥Ã¥¯¡¦¥Ý¥¤¥ó¥È¤¬ %d Áý²Ã¤·¤¿¡ª",
2660 (msp - p_ptr->msp));
2666 /* Display mana later */
2667 p_ptr->redraw |= (PR_MANA);
2670 p_ptr->window |= (PW_PLAYER);
2671 p_ptr->window |= (PW_SPELL);
2675 /* Hack -- handle "xtra" mode */
2676 if (character_xtra) return;
2678 /* Take note when "glove state" changes */
2679 if (p_ptr->old_cumber_glove != p_ptr->cumber_glove)
2682 if (p_ptr->cumber_glove)
2685 msg_print("¼ê¤¬Ê¤¤ï¤ì¤Æ¼öʸ¤¬¾§¤¨¤Ë¤¯¤¤´¶¤¸¤¬¤¹¤ë¡£");
2687 msg_print("Your covered hands feel unsuitable for spellcasting.");
2694 msg_print("¤³¤Î¼ê¤Î¾õÂ֤ʤ顢¤°¤Ã¤È¼öʸ¤¬¾§¤¨¤ä¤¹¤¤´¶¤¸¤À¡£");
2696 msg_print("Your hands feel more suitable for spellcasting.");
2702 p_ptr->old_cumber_glove = p_ptr->cumber_glove;
2706 /* Take note when "armor state" changes */
2707 if (p_ptr->old_cumber_armor != p_ptr->cumber_armor)
2710 if (p_ptr->cumber_armor)
2713 msg_print("ÁõÈ÷¤Î½Å¤µ¤ÇÆ°¤¤¬Æߤ¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¡£");
2715 msg_print("The weight of your equipment encumbers your movement.");
2722 msg_print("¤°¤Ã¤È³Ú¤ËÂΤòÆ°¤«¤»¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
2724 msg_print("You feel able to move more freely.");
2730 p_ptr->old_cumber_armor = p_ptr->cumber_armor;
2737 * Calculate the players (maximal) hit points
2738 * Adjust current hitpoints if necessary
2740 static void calc_hitpoints(void)
2745 /* Un-inflate "half-hitpoint bonus per level" value */
2746 bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128) * p_ptr->lev / 4;
2748 /* Calculate hitpoints */
2749 mhp = p_ptr->player_hp[p_ptr->lev - 1];
2751 if (p_ptr->mimic_form)
2753 if (p_ptr->pclass == CLASS_SORCERER)
2754 tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
2756 tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
2757 mhp = mhp * tmp_hitdie / p_ptr->hitdie;
2760 if (p_ptr->pclass == CLASS_SORCERER)
2762 if (p_ptr->lev < 30)
2763 mhp = (mhp * (45+p_ptr->lev) / 100);
2765 mhp = (mhp * 75 / 100);
2766 bonus = (bonus * 65 / 100);
2771 if (p_ptr->pclass == CLASS_BERSERKER)
2773 mhp = mhp*(110+(((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 110))/100;
2776 /* Always have at least one hitpoint per level */
2777 if (mhp < p_ptr->lev + 1) mhp = p_ptr->lev + 1;
2779 /* Factor in the hero / superhero settings */
2780 if (p_ptr->hero || music_singing(MUSIC_HERO) || music_singing(MUSIC_SHERO)) mhp += 10;
2781 if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
2782 if (p_ptr->tsuyoshi) mhp += 50;
2784 /* New maximum hitpoints */
2785 if (p_ptr->mhp != mhp)
2787 /* Enforce maximum */
2788 if (p_ptr->chp >= mhp)
2791 p_ptr->chp_frac = 0;
2795 /* ¥ì¥Ù¥ë¥¢¥Ã¥×¤Î»þ¤Ï¾å¾ºÎ̤òɽ¼¨¤¹¤ë */
2796 if ((level_up == 1) && (mhp > p_ptr->mhp))
2798 msg_format("ºÇÂç¥Ò¥Ã¥È¡¦¥Ý¥¤¥ó¥È¤¬ %d Áý²Ã¤·¤¿¡ª",
2799 (mhp - p_ptr->mhp) );
2802 /* Save the new max-hitpoints */
2805 /* Display hitpoints (later) */
2806 p_ptr->redraw |= (PR_HP);
2809 p_ptr->window |= (PW_PLAYER);
2816 * Extract and set the current "lite radius"
2818 * SWD: Experimental modification: multiple light sources have additive effect.
2821 static void calc_torch(void)
2825 u32b flgs[TR_FLAG_SIZE];
2827 /* Assume no light */
2828 p_ptr->cur_lite = 0;
2830 /* Loop through all wielded items */
2831 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2833 o_ptr = &inventory[i];
2835 /* Examine actual lites */
2836 if ((i == INVEN_LITE) && (o_ptr->k_idx) && (o_ptr->tval == TV_LITE))
2838 if (o_ptr->name2 == EGO_LITE_DARKNESS)
2840 if (o_ptr->sval == SV_LITE_TORCH)
2842 p_ptr->cur_lite -= 1;
2845 /* Lanterns (with fuel) provide more lite */
2846 else if (o_ptr->sval == SV_LITE_LANTERN)
2848 p_ptr->cur_lite -= 2;
2851 else if (o_ptr->sval == SV_LITE_FEANOR)
2853 p_ptr->cur_lite -= 3;
2856 /* Torches (with fuel) provide some lite */
2857 else if ((o_ptr->sval == SV_LITE_TORCH) && (o_ptr->xtra4 > 0))
2859 p_ptr->cur_lite += 1;
2862 /* Lanterns (with fuel) provide more lite */
2863 else if ((o_ptr->sval == SV_LITE_LANTERN) && (o_ptr->xtra4 > 0))
2865 p_ptr->cur_lite += 2;
2868 else if (o_ptr->sval == SV_LITE_FEANOR)
2870 p_ptr->cur_lite += 2;
2873 /* Artifact Lites provide permanent, bright, lite */
2874 else if (artifact_p(o_ptr))
2876 p_ptr->cur_lite += 3;
2879 if (o_ptr->name2 == EGO_LITE_SHINE) p_ptr->cur_lite++;
2883 /* Skip empty slots */
2884 if (!o_ptr->k_idx) continue;
2886 /* Extract the flags */
2887 object_flags(o_ptr, flgs);
2889 /* does this item glow? */
2890 if (have_flag(flgs, TR_LITE))
2892 if ((o_ptr->name2 == EGO_DARK) || (o_ptr->name1 == ART_NIGHT)) p_ptr->cur_lite--;
2893 else p_ptr->cur_lite++;
2899 /* max radius is 14 (was 5) without rewriting other code -- */
2900 /* see cave.c:update_lite() and defines.h:LITE_MAX */
2901 if (d_info[dungeon_type].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
2902 p_ptr->cur_lite = 1;
2905 * check if the player doesn't have light radius,
2906 * but does weakly glow as an intrinsic.
2908 if (p_ptr->cur_lite <= 0 && p_ptr->lite) p_ptr->cur_lite++;
2910 if (p_ptr->cur_lite > 14) p_ptr->cur_lite = 14;
2911 if (p_ptr->cur_lite < 0) p_ptr->cur_lite = 0;
2913 /* end experimental mods */
2915 /* Reduce lite when running if requested */
2916 if (running && view_reduce_lite)
2918 /* Reduce the lite radius if needed */
2919 if (p_ptr->cur_lite > 1) p_ptr->cur_lite = 1;
2922 /* Notice changes in the "lite radius" */
2923 if (p_ptr->old_lite != p_ptr->cur_lite)
2925 /* Update the lite */
2926 p_ptr->update |= (PU_LITE);
2928 /* Update the monsters */
2929 p_ptr->update |= (PU_MONSTERS);
2931 /* Remember the old lite */
2932 p_ptr->old_lite = p_ptr->cur_lite;
2934 if ((p_ptr->cur_lite > 0) && (p_ptr->special_defense & NINJA_S_STEALTH))
2935 set_superstealth(FALSE);
2942 * Computes current weight limit.
2944 static int weight_limit(void)
2948 /* Weight limit based only on strength */
2949 i = adj_str_wgt[p_ptr->stat_ind[A_STR]] * 100;
2950 if (p_ptr->pclass == CLASS_BERSERKER) i = i*3/2;
2952 /* Return the result */
2957 bool buki_motteruka(int i)
2959 return ((inventory[i].k_idx && inventory[i].tval >= TV_DIGGING && inventory[i].tval <= TV_SWORD) ? TRUE : FALSE);
2963 * Calculate the players current "state", taking into account
2964 * not only race/class intrinsics, but also objects being worn
2965 * and temporary spell effects.
2967 * See also calc_mana() and calc_hitpoints().
2969 * Take note of the new "speed code", in particular, a very strong
2970 * player will start slowing down as soon as he reaches 150 pounds,
2971 * but not until he reaches 450 pounds will he be half as fast as
2972 * a normal kobold. This both hurts and helps the player, hurts
2973 * because in the old days a player could just avoid 300 pounds,
2974 * and helps because now carrying 300 pounds is not very painful.
2976 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
2977 * damage, since that would affect non-combat things. These values
2978 * are actually added in later, at the appropriate place.
2980 * This function induces various "status" messages.
2982 void calc_bonuses(void)
2984 int i, j, hold, neutral[2];
2987 bool old_esp_animal;
2988 bool old_esp_undead;
2993 bool old_esp_dragon;
2997 bool old_esp_nonliving;
2998 bool old_esp_unique;
3005 u32b flgs[TR_FLAG_SIZE];
3007 bool yoiyami = FALSE;
3008 bool down_saving = FALSE;
3009 bool have_dd_s, have_dd_t, have_sw, have_kabe;
3010 bool easy_2weapon = FALSE;
3011 s16b this_o_idx, next_o_idx = 0;
3012 player_race *tmp_rp_ptr;
3015 /* Save the old speed */
3016 old_speed = p_ptr->pspeed;
3018 /* Save the old vision stuff */
3019 old_telepathy = p_ptr->telepathy;
3020 old_esp_animal = p_ptr->esp_animal;
3021 old_esp_undead = p_ptr->esp_undead;
3022 old_esp_demon = p_ptr->esp_demon;
3023 old_esp_orc = p_ptr->esp_orc;
3024 old_esp_troll = p_ptr->esp_troll;
3025 old_esp_giant = p_ptr->esp_giant;
3026 old_esp_dragon = p_ptr->esp_dragon;
3027 old_esp_human = p_ptr->esp_human;
3028 old_esp_evil = p_ptr->esp_evil;
3029 old_esp_good = p_ptr->esp_good;
3030 old_esp_nonliving = p_ptr->esp_nonliving;
3031 old_esp_unique = p_ptr->esp_unique;
3033 old_see_inv = p_ptr->see_inv;
3035 /* Save the old armor class */
3036 old_dis_ac = p_ptr->dis_ac;
3037 old_dis_to_a = p_ptr->dis_to_a;
3040 /* Clear extra blows/shots */
3041 extra_blows[0] = extra_blows[1] = extra_shots = 0;
3043 /* Clear the stat modifiers */
3044 for (i = 0; i < 6; i++) p_ptr->stat_add[i] = 0;
3047 /* Clear the Displayed/Real armor class */
3048 p_ptr->dis_ac = p_ptr->ac = 0;
3050 /* Clear the Displayed/Real Bonuses */
3051 p_ptr->dis_to_h[0] = p_ptr->to_h[0] = 0;
3052 p_ptr->dis_to_h[1] = p_ptr->to_h[1] = 0;
3053 p_ptr->dis_to_d[0] = p_ptr->to_d[0] = 0;
3054 p_ptr->dis_to_d[1] = p_ptr->to_d[1] = 0;
3055 p_ptr->dis_to_h_b = p_ptr->to_h_b = 0;
3056 p_ptr->dis_to_a = p_ptr->to_a = 0;
3060 p_ptr->to_m_chance = 0;
3062 /* Start with "normal" speed */
3063 p_ptr->pspeed = 110;
3065 /* Start with a single blow per turn */
3066 p_ptr->num_blow[0] = 1;
3067 p_ptr->num_blow[1] = 1;
3069 /* Start with a single shot per turn */
3070 p_ptr->num_fire = 100;
3072 /* Reset the "xtra" tval */
3073 p_ptr->tval_xtra = 0;
3075 /* Reset the "ammo" tval */
3076 p_ptr->tval_ammo = 0;
3078 /* Clear all the flags */
3080 p_ptr->bless_blade = FALSE;
3081 p_ptr->xtra_might = FALSE;
3082 p_ptr->impact[0] = FALSE;
3083 p_ptr->impact[1] = FALSE;
3084 p_ptr->pass_wall = FALSE;
3085 p_ptr->kill_wall = FALSE;
3086 p_ptr->dec_mana = FALSE;
3087 p_ptr->easy_spell = FALSE;
3088 p_ptr->heavy_spell = FALSE;
3089 p_ptr->see_inv = FALSE;
3090 p_ptr->free_act = FALSE;
3091 p_ptr->slow_digest = FALSE;
3092 p_ptr->regenerate = FALSE;
3093 p_ptr->can_swim = FALSE;
3094 p_ptr->ffall = FALSE;
3095 p_ptr->hold_life = FALSE;
3096 p_ptr->telepathy = FALSE;
3097 p_ptr->esp_animal = FALSE;
3098 p_ptr->esp_undead = FALSE;
3099 p_ptr->esp_demon = FALSE;
3100 p_ptr->esp_orc = FALSE;
3101 p_ptr->esp_troll = FALSE;
3102 p_ptr->esp_giant = FALSE;
3103 p_ptr->esp_dragon = FALSE;
3104 p_ptr->esp_human = FALSE;
3105 p_ptr->esp_evil = FALSE;
3106 p_ptr->esp_good = FALSE;
3107 p_ptr->esp_nonliving = FALSE;
3108 p_ptr->esp_unique = FALSE;
3109 p_ptr->lite = FALSE;
3110 p_ptr->sustain_str = FALSE;
3111 p_ptr->sustain_int = FALSE;
3112 p_ptr->sustain_wis = FALSE;
3113 p_ptr->sustain_con = FALSE;
3114 p_ptr->sustain_dex = FALSE;
3115 p_ptr->sustain_chr = FALSE;
3116 p_ptr->resist_acid = FALSE;
3117 p_ptr->resist_elec = FALSE;
3118 p_ptr->resist_fire = FALSE;
3119 p_ptr->resist_cold = FALSE;
3120 p_ptr->resist_pois = FALSE;
3121 p_ptr->resist_conf = FALSE;
3122 p_ptr->resist_sound = FALSE;
3123 p_ptr->resist_lite = FALSE;
3124 p_ptr->resist_dark = FALSE;
3125 p_ptr->resist_chaos = FALSE;
3126 p_ptr->resist_disen = FALSE;
3127 p_ptr->resist_shard = FALSE;
3128 p_ptr->resist_nexus = FALSE;
3129 p_ptr->resist_blind = FALSE;
3130 p_ptr->resist_neth = FALSE;
3131 p_ptr->resist_time = FALSE;
3132 p_ptr->resist_fear = FALSE;
3133 p_ptr->reflect = FALSE;
3134 p_ptr->sh_fire = FALSE;
3135 p_ptr->sh_elec = FALSE;
3136 p_ptr->sh_cold = FALSE;
3137 p_ptr->anti_magic = FALSE;
3138 p_ptr->anti_tele = FALSE;
3139 p_ptr->warning = FALSE;
3140 p_ptr->mighty_throw = FALSE;
3142 p_ptr->immune_acid = FALSE;
3143 p_ptr->immune_elec = FALSE;
3144 p_ptr->immune_fire = FALSE;
3145 p_ptr->immune_cold = FALSE;
3147 p_ptr->ryoute = FALSE;
3148 p_ptr->migite = FALSE;
3149 p_ptr->hidarite = FALSE;
3150 p_ptr->no_flowed = FALSE;
3154 if (p_ptr->mimic_form) tmp_rp_ptr = &mimic_info[p_ptr->mimic_form];
3155 else tmp_rp_ptr = &race_info[p_ptr->prace];
3157 /* Base infravision (purely racial) */
3158 p_ptr->see_infra = tmp_rp_ptr->infra;
3160 /* Base skill -- disarming */
3161 p_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis;
3163 /* Base skill -- magic devices */
3164 p_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
3166 /* Base skill -- saving throw */
3167 p_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav;
3169 /* Base skill -- stealth */
3170 p_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl;
3172 /* Base skill -- searching ability */
3173 p_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh;
3175 /* Base skill -- searching frequency */
3176 p_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos;
3178 /* Base skill -- combat (normal) */
3179 p_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn;
3181 /* Base skill -- combat (shooting) */
3182 p_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3184 /* Base skill -- combat (throwing) */
3185 p_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3187 /* Base skill -- digging */
3188 p_ptr->skill_dig = 0;
3190 if (buki_motteruka(INVEN_RARM) && (empty_hands(FALSE) & 0x00000001) && ((inventory[INVEN_RARM].weight > 99) || (inventory[INVEN_RARM].tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE))) p_ptr->ryoute = TRUE;
3191 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) == 3) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE))) p_ptr->ryoute = TRUE;
3192 if (buki_motteruka(INVEN_RARM) || !buki_motteruka(INVEN_LARM)) p_ptr->migite = TRUE;
3193 if (buki_motteruka(INVEN_LARM)) p_ptr->hidarite = TRUE;
3195 if (p_ptr->special_defense & KAMAE_MASK)
3197 if (empty_hands(TRUE) < 2)
3199 set_action(ACTION_NONE);
3203 switch (p_ptr->pclass)
3206 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3207 if (p_ptr->lev > 44) p_ptr->regenerate = TRUE;
3210 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3212 case CLASS_CHAOS_WARRIOR:
3213 if (p_ptr->lev > 29) p_ptr->resist_chaos = TRUE;
3214 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3216 case CLASS_MINDCRAFTER:
3217 if (p_ptr->lev > 9) p_ptr->resist_fear = TRUE;
3218 if (p_ptr->lev > 19) p_ptr->sustain_wis = TRUE;
3219 if (p_ptr->lev > 29) p_ptr->resist_conf = TRUE;
3220 if (p_ptr->lev > 39) p_ptr->telepathy = TRUE;
3223 case CLASS_FORCETRAINER:
3224 /* Unencumbered Monks become faster every 10 levels */
3225 if (!(heavy_armor()))
3227 if (!((p_ptr->prace == RACE_KLACKON) ||
3228 (p_ptr->prace == RACE_SPRITE) ||
3229 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3230 p_ptr->pspeed += (p_ptr->lev) / 10;
3232 /* Free action if unencumbered at level 25 */
3233 if (p_ptr->lev > 24)
3234 p_ptr->free_act = TRUE;
3237 case CLASS_SORCERER:
3239 p_ptr->dis_to_a -= 50;
3242 p_ptr->resist_sound = TRUE;
3245 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3247 case CLASS_BERSERKER:
3249 p_ptr->sustain_str = TRUE;
3250 p_ptr->sustain_dex = TRUE;
3251 p_ptr->sustain_con = TRUE;
3252 p_ptr->regenerate = TRUE;
3253 p_ptr->free_act = TRUE;
3255 if (p_ptr->lev > 29) p_ptr->pspeed++;
3256 if (p_ptr->lev > 39) p_ptr->pspeed++;
3257 if (p_ptr->lev > 44) p_ptr->pspeed++;
3258 if (p_ptr->lev > 49) p_ptr->pspeed++;
3259 p_ptr->to_a += 10+p_ptr->lev/2;
3260 p_ptr->dis_to_a += 10+p_ptr->lev/2;
3261 p_ptr->skill_dig += (100+p_ptr->lev*8);
3262 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3263 p_ptr->redraw |= PR_STATUS;
3265 case CLASS_MIRROR_MASTER:
3266 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3269 /* Unencumbered Monks become faster every 10 levels */
3272 p_ptr->pspeed -= (p_ptr->lev) / 10;
3273 p_ptr->skill_stl -= (p_ptr->lev)/10;
3275 else if (!inventory[INVEN_LARM].tval || p_ptr->hidarite)
3278 if (!((p_ptr->prace == RACE_KLACKON) ||
3279 (p_ptr->prace == RACE_SPRITE) ||
3280 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3281 p_ptr->pspeed += (p_ptr->lev) / 10;
3282 p_ptr->skill_stl += (p_ptr->lev)/10;
3284 /* Free action if unencumbered at level 25 */
3285 if (p_ptr->lev > 24)
3286 p_ptr->free_act = TRUE;
3288 if (!inventory[INVEN_LARM].tval || p_ptr->hidarite)
3290 p_ptr->to_a += p_ptr->lev/2+5;
3291 p_ptr->dis_to_a += p_ptr->lev/2+5;
3293 p_ptr->slow_digest = TRUE;
3294 p_ptr->resist_fear = TRUE;
3295 if (p_ptr->lev > 19) p_ptr->resist_pois = TRUE;
3296 if (p_ptr->lev > 24) p_ptr->sustain_dex = TRUE;
3297 if (p_ptr->lev > 29) p_ptr->see_inv = TRUE;
3298 if (p_ptr->lev > 44)
3300 p_ptr->oppose_pois = 1;
3301 p_ptr->redraw |= PR_STATUS;
3307 if (p_ptr->mimic_form)
3309 switch(p_ptr->mimic_form)
3312 p_ptr->hold_life=TRUE;
3313 p_ptr->resist_chaos=TRUE;
3314 p_ptr->resist_neth=TRUE;
3315 p_ptr->resist_fire=TRUE;
3316 p_ptr->oppose_fire = 1;
3317 p_ptr->see_inv=TRUE;
3319 p_ptr->redraw |= PR_STATUS;
3321 p_ptr->dis_to_a += 10;
3323 case MIMIC_DEMON_LORD:
3324 p_ptr->hold_life=TRUE;
3325 p_ptr->resist_chaos=TRUE;
3326 p_ptr->resist_neth=TRUE;
3327 p_ptr->immune_fire=TRUE;
3328 p_ptr->resist_acid = TRUE;
3329 p_ptr->resist_fire=TRUE;
3330 p_ptr->resist_cold = TRUE;
3331 p_ptr->resist_elec = TRUE;
3332 p_ptr->resist_pois = TRUE;
3333 p_ptr->resist_conf = TRUE;
3334 p_ptr->resist_disen = TRUE;
3335 p_ptr->resist_nexus = TRUE;
3336 p_ptr->resist_fear = TRUE;
3337 p_ptr->sh_fire = TRUE;
3338 p_ptr->see_inv = TRUE;
3339 p_ptr->telepathy = TRUE;
3340 p_ptr->ffall = TRUE;
3341 p_ptr->kill_wall = TRUE;
3344 p_ptr->dis_to_a += 20;
3347 p_ptr->resist_dark = TRUE;
3348 p_ptr->hold_life = TRUE;
3349 p_ptr->resist_neth = TRUE;
3350 p_ptr->resist_cold = TRUE;
3351 p_ptr->resist_pois = TRUE;
3352 p_ptr->see_inv = TRUE;
3355 p_ptr->dis_to_a += 10;
3356 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3362 switch (p_ptr->prace)
3365 p_ptr->resist_lite = TRUE;
3368 p_ptr->sustain_dex = TRUE;
3371 p_ptr->free_act = TRUE;
3374 p_ptr->resist_blind = TRUE;
3377 p_ptr->resist_dark = TRUE;
3379 case RACE_HALF_TROLL:
3380 p_ptr->sustain_str = TRUE;
3382 if (p_ptr->lev > 14)
3384 /* High level trolls heal fast... */
3385 p_ptr->regenerate = TRUE;
3387 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_BERSERKER)
3389 p_ptr->slow_digest = TRUE;
3390 /* Let's not make Regeneration
3391 * a disadvantage for the poor warriors who can
3392 * never learn a spell that satisfies hunger (actually
3393 * neither can rogues, but half-trolls are not
3394 * supposed to play rogues) */
3399 p_ptr->sustain_con = TRUE;
3400 p_ptr->regenerate = TRUE; /* Amberites heal fast... */
3403 p_ptr->resist_lite = TRUE;
3404 p_ptr->see_inv = TRUE;
3406 case RACE_BARBARIAN:
3407 p_ptr->resist_fear = TRUE;
3409 case RACE_HALF_OGRE:
3410 p_ptr->resist_dark = TRUE;
3411 p_ptr->sustain_str = TRUE;
3413 case RACE_HALF_GIANT:
3414 p_ptr->sustain_str = TRUE;
3415 p_ptr->resist_shard = TRUE;
3417 case RACE_HALF_TITAN:
3418 p_ptr->resist_chaos = TRUE;
3421 p_ptr->resist_sound = TRUE;
3424 p_ptr->resist_acid = TRUE;
3425 if (p_ptr->lev > 19) p_ptr->immune_acid = TRUE;
3428 p_ptr->resist_conf = TRUE;
3429 p_ptr->resist_acid = TRUE;
3431 /* Klackons become faster */
3432 p_ptr->pspeed += (p_ptr->lev) / 10;
3435 p_ptr->resist_pois = TRUE;
3438 p_ptr->resist_disen = TRUE;
3439 p_ptr->resist_dark = TRUE;
3442 p_ptr->resist_dark = TRUE;
3443 if (p_ptr->lev > 19) p_ptr->see_inv = TRUE;
3445 case RACE_DRACONIAN:
3446 p_ptr->ffall = TRUE;
3447 if (p_ptr->lev > 4) p_ptr->resist_fire = TRUE;
3448 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3449 if (p_ptr->lev > 14) p_ptr->resist_acid = TRUE;
3450 if (p_ptr->lev > 19) p_ptr->resist_elec = TRUE;
3451 if (p_ptr->lev > 34) p_ptr->resist_pois = TRUE;
3453 case RACE_MIND_FLAYER:
3454 p_ptr->sustain_int = TRUE;
3455 p_ptr->sustain_wis = TRUE;
3456 if (p_ptr->lev > 14) p_ptr->see_inv = TRUE;
3457 if (p_ptr->lev > 29) p_ptr->telepathy = TRUE;
3460 p_ptr->resist_fire = TRUE;
3461 if (p_ptr->lev > 9) p_ptr->see_inv = TRUE;
3464 p_ptr->slow_digest = TRUE;
3465 p_ptr->free_act = TRUE;
3466 p_ptr->see_inv = TRUE;
3467 p_ptr->resist_pois = TRUE;
3468 if (p_ptr->lev > 34) p_ptr->hold_life = TRUE;
3471 p_ptr->resist_shard = TRUE;
3472 p_ptr->hold_life = TRUE;
3473 p_ptr->see_inv = TRUE;
3474 p_ptr->resist_pois = TRUE;
3475 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3478 p_ptr->resist_neth = TRUE;
3479 p_ptr->hold_life = TRUE;
3480 p_ptr->see_inv = TRUE;
3481 p_ptr->resist_pois = TRUE;
3482 p_ptr->slow_digest = TRUE;
3483 if (p_ptr->lev > 4) p_ptr->resist_cold = TRUE;
3486 p_ptr->resist_dark = TRUE;
3487 p_ptr->hold_life = TRUE;
3488 p_ptr->resist_neth = TRUE;
3489 p_ptr->resist_cold = TRUE;
3490 p_ptr->resist_pois = TRUE;
3491 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3494 p_ptr->ffall = TRUE;
3495 p_ptr->free_act = TRUE;
3496 p_ptr->resist_neth = TRUE;
3497 p_ptr->hold_life = TRUE;
3498 p_ptr->see_inv = TRUE;
3499 p_ptr->resist_pois = TRUE;
3500 p_ptr->slow_digest = TRUE;
3501 p_ptr->resist_cold = TRUE;
3502 p_ptr->pass_wall = TRUE;
3503 if (p_ptr->lev > 34) p_ptr->telepathy = TRUE;
3506 p_ptr->ffall = TRUE;
3507 p_ptr->resist_lite = TRUE;
3509 /* Sprites become faster */
3510 p_ptr->pspeed += (p_ptr->lev) / 10;
3513 p_ptr->resist_conf = TRUE;
3514 p_ptr->resist_sound = TRUE;
3517 /* Ents dig like maniacs, but only with their hands. */
3518 if (!inventory[INVEN_RARM].k_idx)
3519 p_ptr->skill_dig += p_ptr->lev * 10;
3520 /* Ents get tougher and stronger as they age, but lose dexterity. */
3521 if (p_ptr->lev > 25) p_ptr->stat_add[A_STR]++;
3522 if (p_ptr->lev > 40) p_ptr->stat_add[A_STR]++;
3523 if (p_ptr->lev > 45) p_ptr->stat_add[A_STR]++;
3525 if (p_ptr->lev > 25) p_ptr->stat_add[A_DEX]--;
3526 if (p_ptr->lev > 40) p_ptr->stat_add[A_DEX]--;
3527 if (p_ptr->lev > 45) p_ptr->stat_add[A_DEX]--;
3529 if (p_ptr->lev > 25) p_ptr->stat_add[A_CON]++;
3530 if (p_ptr->lev > 40) p_ptr->stat_add[A_CON]++;
3531 if (p_ptr->lev > 45) p_ptr->stat_add[A_CON]++;
3534 p_ptr->ffall = TRUE;
3535 p_ptr->see_inv = TRUE;
3538 p_ptr->resist_fire = TRUE;
3539 p_ptr->resist_neth = TRUE;
3540 p_ptr->hold_life = TRUE;
3542 p_ptr->see_inv = TRUE;
3543 if (p_ptr->lev > 44)
3545 p_ptr->oppose_fire = 1;
3546 p_ptr->redraw |= PR_STATUS;
3550 p_ptr->sustain_con = TRUE;
3553 p_ptr->ffall = TRUE;
3556 p_ptr->resist_conf = TRUE;
3559 p_ptr->slow_digest = TRUE;
3560 p_ptr->free_act = TRUE;
3561 p_ptr->resist_pois = TRUE;
3562 p_ptr->hold_life = TRUE;
3570 if (p_ptr->ult_res || (p_ptr->special_defense & KATA_MUSOU))
3572 p_ptr->see_inv = TRUE;
3573 p_ptr->free_act = TRUE;
3574 p_ptr->slow_digest = TRUE;
3575 p_ptr->regenerate = TRUE;
3576 p_ptr->ffall = TRUE;
3577 p_ptr->hold_life = TRUE;
3578 p_ptr->telepathy = TRUE;
3580 p_ptr->sustain_str = TRUE;
3581 p_ptr->sustain_int = TRUE;
3582 p_ptr->sustain_wis = TRUE;
3583 p_ptr->sustain_con = TRUE;
3584 p_ptr->sustain_dex = TRUE;
3585 p_ptr->sustain_chr = TRUE;
3586 p_ptr->resist_acid = TRUE;
3587 p_ptr->resist_elec = TRUE;
3588 p_ptr->resist_fire = TRUE;
3589 p_ptr->resist_cold = TRUE;
3590 p_ptr->resist_pois = TRUE;
3591 p_ptr->resist_conf = TRUE;
3592 p_ptr->resist_sound = TRUE;
3593 p_ptr->resist_lite = TRUE;
3594 p_ptr->resist_dark = TRUE;
3595 p_ptr->resist_chaos = TRUE;
3596 p_ptr->resist_disen = TRUE;
3597 p_ptr->resist_shard = TRUE;
3598 p_ptr->resist_nexus = TRUE;
3599 p_ptr->resist_blind = TRUE;
3600 p_ptr->resist_neth = TRUE;
3601 p_ptr->resist_fear = TRUE;
3602 p_ptr->reflect = TRUE;
3603 p_ptr->sh_fire = TRUE;
3604 p_ptr->sh_elec = TRUE;
3605 p_ptr->sh_cold = TRUE;
3607 p_ptr->dis_to_a += 100;
3609 /* Temporary shield */
3610 else if (p_ptr->tsubureru || p_ptr->shield || p_ptr->magicdef)
3613 p_ptr->dis_to_a += 50;
3616 if (p_ptr->tim_res_nether)
3618 p_ptr->resist_neth = TRUE;
3620 if (p_ptr->tim_sh_fire)
3622 p_ptr->sh_fire = TRUE;
3624 if (p_ptr->tim_res_time)
3626 p_ptr->resist_time = TRUE;
3630 if (p_ptr->pseikaku == SEIKAKU_SEXY) p_ptr->cursed |= (TRC_AGGRAVATE);
3631 if (p_ptr->pseikaku == SEIKAKU_NAMAKE) p_ptr->to_m_chance += 10;
3632 if (p_ptr->pseikaku == SEIKAKU_KIREMONO) p_ptr->to_m_chance -= 3;
3633 if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) p_ptr->to_m_chance++;
3636 if (p_ptr->pseikaku == SEIKAKU_LUCKY) p_ptr->muta3 |= MUT3_GOOD_LUCK;
3638 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
3640 p_ptr->resist_blind = TRUE;
3641 p_ptr->resist_conf = TRUE;
3642 p_ptr->hold_life = TRUE;
3643 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3645 if ((p_ptr->prace != RACE_KLACKON) && (p_ptr->prace != RACE_SPRITE))
3646 /* Munchkin become faster */
3647 p_ptr->pspeed += (p_ptr->lev) / 10 + 5;
3652 if (!(r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_PASS_WALL))
3653 p_ptr->pass_wall = FALSE;
3654 if (r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_KILL_WALL)
3655 p_ptr->pass_wall = TRUE;
3657 if (music_singing(MUSIC_WALL)) p_ptr->kill_wall = TRUE;
3659 if (p_ptr->kill_wall) p_ptr->pass_wall = TRUE;
3661 /* Hack -- apply racial/class stat maxes */
3662 /* Apply the racial modifiers */
3663 for (i = 0; i < 6; i++)
3665 /* Modify the stats for "race" */
3666 p_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
3670 /* I'm adding the mutations here for the lack of a better place... */
3673 /* Hyper Strength */
3674 if (p_ptr->muta3 & MUT3_HYPER_STR)
3676 p_ptr->stat_add[A_STR] += 4;
3680 if (p_ptr->muta3 & MUT3_PUNY)
3682 p_ptr->stat_add[A_STR] -= 4;
3685 /* Living computer */
3686 if (p_ptr->muta3 & MUT3_HYPER_INT)
3688 p_ptr->stat_add[A_INT] += 4;
3689 p_ptr->stat_add[A_WIS] += 4;
3693 if (p_ptr->muta3 & MUT3_MORONIC)
3695 p_ptr->stat_add[A_INT] -= 4;
3696 p_ptr->stat_add[A_WIS] -= 4;
3699 if (p_ptr->muta3 & MUT3_RESILIENT)
3701 p_ptr->stat_add[A_CON] += 4;
3704 if (p_ptr->muta3 & MUT3_XTRA_FAT)
3706 p_ptr->stat_add[A_CON] += 2;
3710 if (p_ptr->muta3 & MUT3_ALBINO)
3712 p_ptr->stat_add[A_CON] -= 4;
3715 if (p_ptr->muta3 & MUT3_FLESH_ROT)
3717 p_ptr->stat_add[A_CON] -= 2;
3718 p_ptr->stat_add[A_CHR] -= 1;
3719 p_ptr->regenerate = FALSE;
3720 /* Cancel innate regeneration */
3723 if (p_ptr->muta3 & MUT3_SILLY_VOI)
3725 p_ptr->stat_add[A_CHR] -= 4;
3728 if (p_ptr->muta3 & MUT3_BLANK_FAC)
3730 p_ptr->stat_add[A_CHR] -= 1;
3733 if (p_ptr->muta3 & MUT3_XTRA_EYES)
3735 p_ptr->skill_fos += 15;
3736 p_ptr->skill_srh += 15;
3739 if (p_ptr->muta3 & MUT3_MAGIC_RES)
3741 p_ptr->skill_sav += (15 + (p_ptr->lev / 5));
3744 if (p_ptr->muta3 & MUT3_XTRA_NOIS)
3746 p_ptr->skill_stl -= 3;
3749 if (p_ptr->muta3 & MUT3_INFRAVIS)
3751 p_ptr->see_infra += 3;
3754 if (p_ptr->muta3 & MUT3_XTRA_LEGS)
3759 if (p_ptr->muta3 & MUT3_SHORT_LEG)
3764 if (p_ptr->muta3 & MUT3_ELEC_TOUC)
3766 p_ptr->sh_elec = TRUE;
3769 if (p_ptr->muta3 & MUT3_FIRE_BODY)
3771 p_ptr->sh_fire = TRUE;
3775 if (p_ptr->muta3 & MUT3_WART_SKIN)
3777 p_ptr->stat_add[A_CHR] -= 2;
3779 p_ptr->dis_to_a += 5;
3782 if (p_ptr->muta3 & MUT3_SCALES)
3784 p_ptr->stat_add[A_CHR] -= 1;
3786 p_ptr->dis_to_a += 10;
3789 if (p_ptr->muta3 & MUT3_IRON_SKIN)
3791 p_ptr->stat_add[A_DEX] -= 1;
3793 p_ptr->dis_to_a += 25;
3796 if (p_ptr->muta3 & MUT3_WINGS)
3798 p_ptr->ffall = TRUE;
3801 if (p_ptr->muta3 & MUT3_FEARLESS)
3803 p_ptr->resist_fear = TRUE;
3806 if (p_ptr->muta3 & MUT3_REGEN)
3808 p_ptr->regenerate = TRUE;
3811 if (p_ptr->muta3 & MUT3_ESP)
3813 p_ptr->telepathy = TRUE;
3816 if (p_ptr->muta3 & MUT3_LIMBER)
3818 p_ptr->stat_add[A_DEX] += 3;
3821 if (p_ptr->muta3 & MUT3_ARTHRITIS)
3823 p_ptr->stat_add[A_DEX] -= 3;
3826 if (p_ptr->muta3 & MUT3_MOTION)
3828 p_ptr->free_act = TRUE;
3829 p_ptr->skill_stl += 1;
3832 if (p_ptr->muta3 & MUT3_ILL_NORM)
3834 p_ptr->stat_add[A_CHR] = 0;
3838 if (p_ptr->tsuyoshi)
3840 p_ptr->stat_add[A_STR] += 4;
3841 p_ptr->stat_add[A_CON] += 4;
3844 /* Scan the usable inventory */
3845 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3847 int bonus_to_h, bonus_to_d;
3848 o_ptr = &inventory[i];
3850 /* Skip non-objects */
3851 if (!o_ptr->k_idx) continue;
3853 /* Extract the item flags */
3854 object_flags(o_ptr, flgs);
3856 p_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
3857 if (o_ptr->name1 == ART_CHAINSWORD) p_ptr->cursed |= TRC_CHAINSWORD;
3860 if (have_flag(flgs, TR_STR)) p_ptr->stat_add[A_STR] += o_ptr->pval;
3861 if (have_flag(flgs, TR_INT)) p_ptr->stat_add[A_INT] += o_ptr->pval;
3862 if (have_flag(flgs, TR_WIS)) p_ptr->stat_add[A_WIS] += o_ptr->pval;
3863 if (have_flag(flgs, TR_DEX)) p_ptr->stat_add[A_DEX] += o_ptr->pval;
3864 if (have_flag(flgs, TR_CON)) p_ptr->stat_add[A_CON] += o_ptr->pval;
3865 if (have_flag(flgs, TR_CHR)) p_ptr->stat_add[A_CHR] += o_ptr->pval;
3867 if (have_flag(flgs, TR_MAGIC_MASTERY)) p_ptr->skill_dev += 8*o_ptr->pval;
3869 /* Affect stealth */
3870 if (have_flag(flgs, TR_STEALTH)) p_ptr->skill_stl += o_ptr->pval;
3872 /* Affect searching ability (factor of five) */
3873 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_srh += (o_ptr->pval * 5);
3875 /* Affect searching frequency (factor of five) */
3876 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_fos += (o_ptr->pval * 5);
3878 /* Affect infravision */
3879 if (have_flag(flgs, TR_INFRA)) p_ptr->see_infra += o_ptr->pval;
3881 /* Affect digging (factor of 20) */
3882 if (have_flag(flgs, TR_TUNNEL)) p_ptr->skill_dig += (o_ptr->pval * 20);
3885 if (have_flag(flgs, TR_SPEED)) p_ptr->pspeed += o_ptr->pval;
3888 if (have_flag(flgs, TR_BLOWS))
3890 if((i == INVEN_RARM || i == INVEN_RIGHT) && !p_ptr->ryoute) extra_blows[0] += o_ptr->pval;
3891 else if((i == INVEN_LARM || i == INVEN_LEFT) && !p_ptr->ryoute) extra_blows[1] += o_ptr->pval;
3892 else {extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval;}
3895 /* Hack -- cause earthquakes */
3896 if (have_flag(flgs, TR_IMPACT)) p_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
3899 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
3902 if (have_flag(flgs, TR_AGGRAVATE)) p_ptr->cursed |= TRC_AGGRAVATE;
3903 if (have_flag(flgs, TR_DRAIN_EXP)) p_ptr->cursed |= TRC_DRAIN_EXP;
3904 if (have_flag(flgs, TR_TY_CURSE)) p_ptr->cursed |= TRC_TY_CURSE;
3905 if (have_flag(flgs, TR_DEC_MANA)) p_ptr->dec_mana = TRUE;
3906 if (have_flag(flgs, TR_BLESSED)) p_ptr->bless_blade = TRUE;
3907 if (have_flag(flgs, TR_XTRA_MIGHT)) p_ptr->xtra_might = TRUE;
3908 if (have_flag(flgs, TR_SLOW_DIGEST)) p_ptr->slow_digest = TRUE;
3909 if (have_flag(flgs, TR_REGEN)) p_ptr->regenerate = TRUE;
3910 if (have_flag(flgs, TR_TELEPATHY)) p_ptr->telepathy = TRUE;
3911 if (have_flag(flgs, TR_ESP_ANIMAL)) p_ptr->esp_animal = TRUE;
3912 if (have_flag(flgs, TR_ESP_UNDEAD)) p_ptr->esp_undead = TRUE;
3913 if (have_flag(flgs, TR_ESP_DEMON)) p_ptr->esp_demon = TRUE;
3914 if (have_flag(flgs, TR_ESP_ORC)) p_ptr->esp_orc = TRUE;
3915 if (have_flag(flgs, TR_ESP_TROLL)) p_ptr->esp_troll = TRUE;
3916 if (have_flag(flgs, TR_ESP_GIANT)) p_ptr->esp_giant = TRUE;
3917 if (have_flag(flgs, TR_ESP_DRAGON)) p_ptr->esp_dragon = TRUE;
3918 if (have_flag(flgs, TR_ESP_HUMAN)) p_ptr->esp_human = TRUE;
3919 if (have_flag(flgs, TR_ESP_EVIL)) p_ptr->esp_evil = TRUE;
3920 if (have_flag(flgs, TR_ESP_GOOD)) p_ptr->esp_good = TRUE;
3921 if (have_flag(flgs, TR_ESP_NONLIVING)) p_ptr->esp_nonliving = TRUE;
3922 if (have_flag(flgs, TR_ESP_UNIQUE)) p_ptr->esp_unique = TRUE;
3924 if (have_flag(flgs, TR_SEE_INVIS)) p_ptr->see_inv = TRUE;
3925 if (have_flag(flgs, TR_FEATHER)) p_ptr->ffall = TRUE;
3926 if (have_flag(flgs, TR_FREE_ACT)) p_ptr->free_act = TRUE;
3927 if (have_flag(flgs, TR_HOLD_LIFE)) p_ptr->hold_life = TRUE;
3928 if (have_flag(flgs, TR_WARNING)){
3929 if (!o_ptr->inscription || !(strchr(quark_str(o_ptr->inscription),'$')))
3930 p_ptr->warning = TRUE;
3933 if (have_flag(flgs, TR_TELEPORT))
3935 if (cursed_p(o_ptr)) p_ptr->cursed |= TRC_TELEPORT;
3938 cptr insc = quark_str(o_ptr->inscription);
3940 if (o_ptr->inscription &&
3941 (strchr(insc, '.') || strchr(insc, '%')))
3944 * {.} will stop random teleportation.
3945 * {%} includes '.' after conversion.
3950 /* Controlled random teleportation */
3951 p_ptr->cursed |= TRC_TELEPORT_SELF;
3956 /* Immunity flags */
3957 if (have_flag(flgs, TR_IM_FIRE)) p_ptr->immune_fire = TRUE;
3958 if (have_flag(flgs, TR_IM_ACID)) p_ptr->immune_acid = TRUE;
3959 if (have_flag(flgs, TR_IM_COLD)) p_ptr->immune_cold = TRUE;
3960 if (have_flag(flgs, TR_IM_ELEC)) p_ptr->immune_elec = TRUE;
3962 /* Resistance flags */
3963 if (have_flag(flgs, TR_RES_ACID)) p_ptr->resist_acid = TRUE;
3964 if (have_flag(flgs, TR_RES_ELEC)) p_ptr->resist_elec = TRUE;
3965 if (have_flag(flgs, TR_RES_FIRE)) p_ptr->resist_fire = TRUE;
3966 if (have_flag(flgs, TR_RES_COLD)) p_ptr->resist_cold = TRUE;
3967 if (have_flag(flgs, TR_RES_POIS)) p_ptr->resist_pois = TRUE;
3968 if (have_flag(flgs, TR_RES_FEAR)) p_ptr->resist_fear = TRUE;
3969 if (have_flag(flgs, TR_RES_CONF)) p_ptr->resist_conf = TRUE;
3970 if (have_flag(flgs, TR_RES_SOUND)) p_ptr->resist_sound = TRUE;
3971 if (have_flag(flgs, TR_RES_LITE)) p_ptr->resist_lite = TRUE;
3972 if (have_flag(flgs, TR_RES_DARK)) p_ptr->resist_dark = TRUE;
3973 if (have_flag(flgs, TR_RES_CHAOS)) p_ptr->resist_chaos = TRUE;
3974 if (have_flag(flgs, TR_RES_DISEN)) p_ptr->resist_disen = TRUE;
3975 if (have_flag(flgs, TR_RES_SHARDS)) p_ptr->resist_shard = TRUE;
3976 if (have_flag(flgs, TR_RES_NEXUS)) p_ptr->resist_nexus = TRUE;
3977 if (have_flag(flgs, TR_RES_BLIND)) p_ptr->resist_blind = TRUE;
3978 if (have_flag(flgs, TR_RES_NETHER)) p_ptr->resist_neth = TRUE;
3980 if (have_flag(flgs, TR_REFLECT)) p_ptr->reflect = TRUE;
3981 if (have_flag(flgs, TR_SH_FIRE)) p_ptr->sh_fire = TRUE;
3982 if (have_flag(flgs, TR_SH_ELEC)) p_ptr->sh_elec = TRUE;
3983 if (have_flag(flgs, TR_SH_COLD)) p_ptr->sh_cold = TRUE;
3984 if (have_flag(flgs, TR_NO_MAGIC)) p_ptr->anti_magic = TRUE;
3985 if (have_flag(flgs, TR_NO_TELE)) p_ptr->anti_tele = TRUE;
3988 if (have_flag(flgs, TR_SUST_STR)) p_ptr->sustain_str = TRUE;
3989 if (have_flag(flgs, TR_SUST_INT)) p_ptr->sustain_int = TRUE;
3990 if (have_flag(flgs, TR_SUST_WIS)) p_ptr->sustain_wis = TRUE;
3991 if (have_flag(flgs, TR_SUST_DEX)) p_ptr->sustain_dex = TRUE;
3992 if (have_flag(flgs, TR_SUST_CON)) p_ptr->sustain_con = TRUE;
3993 if (have_flag(flgs, TR_SUST_CHR)) p_ptr->sustain_chr = TRUE;
3995 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
3996 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
3997 if (o_ptr->name2 == EGO_RING_RES_TIME) p_ptr->resist_time = TRUE;
3998 if (o_ptr->name2 == EGO_RING_THROW) p_ptr->mighty_throw = TRUE;
3999 if (have_flag(flgs, TR_EASY_SPELL)) p_ptr->easy_spell = TRUE;
4000 if (o_ptr->name2 == EGO_AMU_FOOL) p_ptr->heavy_spell = TRUE;
4001 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
4003 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
4005 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4007 p_ptr->to_m_chance += 10;
4011 p_ptr->to_m_chance += 3;
4015 if (o_ptr->tval == TV_CAPTURE) continue;
4017 /* Modify the base armor class */
4018 p_ptr->ac += o_ptr->ac;
4020 /* The base armor class is always known */
4021 p_ptr->dis_ac += o_ptr->ac;
4023 /* Apply the bonuses to armor class */
4024 p_ptr->to_a += o_ptr->to_a;
4026 /* Apply the mental bonuses to armor class, if known */
4027 if (object_known_p(o_ptr)) p_ptr->dis_to_a += o_ptr->to_a;
4029 if (o_ptr->curse_flags & TRC_LOW_MELEE)
4031 int slot = i - INVEN_RARM;
4034 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4036 p_ptr->to_h[slot] -= 15;
4037 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 15;
4041 p_ptr->to_h[slot] -= 5;
4042 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 5;
4047 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4049 p_ptr->to_h_b -= 15;
4050 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 15;
4055 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 5;
4060 if (o_ptr->curse_flags & TRC_LOW_AC)
4062 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4065 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 30;
4070 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 10;
4074 /* Hack -- do not apply "weapon" bonuses */
4075 if (i == INVEN_RARM && buki_motteruka(i)) continue;
4076 if (i == INVEN_LARM && buki_motteruka(i)) continue;
4078 /* Hack -- do not apply "bow" bonuses */
4079 if (i == INVEN_BOW) continue;
4081 bonus_to_h = o_ptr->to_h;
4082 bonus_to_d = o_ptr->to_d;
4084 if (p_ptr->pclass == CLASS_NINJA)
4086 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h+1)/2;
4087 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d+1)/2;
4090 /* To Bow and Natural attack */
4092 /* Apply the bonuses to hit/damage */
4093 p_ptr->to_h_b += bonus_to_h;
4094 p_ptr->to_h_m += bonus_to_h;
4095 p_ptr->to_d_m += bonus_to_d;
4097 /* Apply the mental bonuses tp hit/damage, if known */
4098 if (object_known_p(o_ptr)) p_ptr->dis_to_h_b += bonus_to_h;
4101 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !p_ptr->ryoute)
4103 /* Apply the bonuses to hit/damage */
4104 p_ptr->to_h[i-INVEN_RIGHT] += bonus_to_h;
4105 p_ptr->to_d[i-INVEN_RIGHT] += bonus_to_d;
4107 /* Apply the mental bonuses tp hit/damage, if known */
4108 if (object_known_p(o_ptr))
4110 p_ptr->dis_to_h[i-INVEN_RIGHT] += bonus_to_h;
4111 p_ptr->dis_to_d[i-INVEN_RIGHT] += bonus_to_d;
4114 else if (p_ptr->migite && p_ptr->hidarite)
4116 /* Apply the bonuses to hit/damage */
4117 p_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4118 p_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4119 p_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4120 p_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4122 /* Apply the mental bonuses tp hit/damage, if known */
4123 if (object_known_p(o_ptr))
4125 p_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4126 p_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4127 p_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4128 p_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4133 /* Apply the bonuses to hit/damage */
4134 p_ptr->to_h[0] += bonus_to_h;
4135 p_ptr->to_d[0] += bonus_to_d;
4137 /* Apply the mental bonuses tp hit/damage, if known */
4138 if (object_known_p(o_ptr))
4140 p_ptr->dis_to_h[0] += bonus_to_h;
4141 p_ptr->dis_to_d[0] += bonus_to_d;
4146 if (p_ptr->cursed & TRC_TELEPORT) p_ptr->cursed &= ~(TRC_TELEPORT_SELF);
4148 /* Monks get extra ac for armour _not worn_ */
4149 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor())
4151 if (!(inventory[INVEN_BODY].k_idx))
4153 p_ptr->to_a += (p_ptr->lev * 3) / 2;
4154 p_ptr->dis_to_a += (p_ptr->lev * 3) / 2;
4156 if (!(inventory[INVEN_OUTER].k_idx) && (p_ptr->lev > 15))
4158 p_ptr->to_a += ((p_ptr->lev - 13) / 3);
4159 p_ptr->dis_to_a += ((p_ptr->lev - 13) / 3);
4161 if (!(inventory[INVEN_LARM].k_idx) && (p_ptr->lev > 10))
4163 p_ptr->to_a += ((p_ptr->lev - 8) / 3);
4164 p_ptr->dis_to_a += ((p_ptr->lev - 8) / 3);
4166 if (!(inventory[INVEN_HEAD].k_idx) && (p_ptr->lev > 4))
4168 p_ptr->to_a += (p_ptr->lev - 2) / 3;
4169 p_ptr->dis_to_a += (p_ptr->lev -2) / 3;
4171 if (!(inventory[INVEN_HANDS].k_idx))
4173 p_ptr->to_a += (p_ptr->lev / 2);
4174 p_ptr->dis_to_a += (p_ptr->lev / 2);
4176 if (!(inventory[INVEN_FEET].k_idx))
4178 p_ptr->to_a += (p_ptr->lev / 3);
4179 p_ptr->dis_to_a += (p_ptr->lev / 3);
4181 if (p_ptr->special_defense & KAMAE_BYAKKO)
4183 p_ptr->stat_add[A_STR] += 2;
4184 p_ptr->stat_add[A_DEX] += 2;
4185 p_ptr->stat_add[A_CON] -= 3;
4187 else if (p_ptr->special_defense & KAMAE_SEIRYU)
4190 else if (p_ptr->special_defense & KAMAE_GENBU)
4192 p_ptr->stat_add[A_INT] -= 1;
4193 p_ptr->stat_add[A_WIS] -= 1;
4194 p_ptr->stat_add[A_DEX] -= 2;
4195 p_ptr->stat_add[A_CON] += 3;
4197 else if (p_ptr->special_defense & KAMAE_SUZAKU)
4199 p_ptr->stat_add[A_STR] -= 2;
4200 p_ptr->stat_add[A_INT] += 1;
4201 p_ptr->stat_add[A_WIS] += 1;
4202 p_ptr->stat_add[A_DEX] += 2;
4203 p_ptr->stat_add[A_CON] -= 2;
4207 if (p_ptr->special_defense & KATA_KOUKIJIN)
4209 for (i = 0; i < 6; i++)
4210 p_ptr->stat_add[i] += 5;
4212 p_ptr->dis_to_a -= 50;
4215 /* Hack -- aura of fire also provides light */
4216 if (p_ptr->sh_fire) p_ptr->lite = TRUE;
4218 /* Golems also get an intrinsic AC bonus */
4219 if ((p_ptr->prace == RACE_GOLEM) || (p_ptr->prace == RACE_ANDROID))
4221 p_ptr->to_a += 10 + (p_ptr->lev * 2 / 5);
4222 p_ptr->dis_to_a += 10 + (p_ptr->lev * 2 / 5);
4225 /* Calculate stats */
4226 for (i = 0; i < 6; i++)
4230 /* Extract the new "stat_use" value for the stat */
4231 top = modify_stat_value(p_ptr->stat_max[i], p_ptr->stat_add[i]);
4233 /* Notice changes */
4234 if (p_ptr->stat_top[i] != top)
4236 /* Save the new value */
4237 p_ptr->stat_top[i] = top;
4239 /* Redisplay the stats later */
4240 p_ptr->redraw |= (PR_STATS);
4243 p_ptr->window |= (PW_PLAYER);
4247 /* Extract the new "stat_use" value for the stat */
4248 use = modify_stat_value(p_ptr->stat_cur[i], p_ptr->stat_add[i]);
4250 if ((i == A_CHR) && (p_ptr->muta3 & MUT3_ILL_NORM))
4252 /* 10 to 18/90 charisma, guaranteed, based on level */
4253 if (use < 8 + 2 * p_ptr->lev)
4255 use = 8 + 2 * p_ptr->lev;
4259 /* Notice changes */
4260 if (p_ptr->stat_use[i] != use)
4262 /* Save the new value */
4263 p_ptr->stat_use[i] = use;
4265 /* Redisplay the stats later */
4266 p_ptr->redraw |= (PR_STATS);
4269 p_ptr->window |= (PW_PLAYER);
4273 /* Values: 3, 4, ..., 17 */
4274 if (use <= 18) ind = (use - 3);
4276 /* Ranges: 18/00-18/09, ..., 18/210-18/219 */
4277 else if (use <= 18+219) ind = (15 + (use - 18) / 10);
4279 /* Range: 18/220+ */
4282 /* Notice changes */
4283 if (p_ptr->stat_ind[i] != ind)
4285 /* Save the new index */
4286 p_ptr->stat_ind[i] = ind;
4288 /* Change in CON affects Hitpoints */
4291 p_ptr->update |= (PU_HP);
4294 /* Change in INT may affect Mana/Spells */
4295 else if (i == A_INT)
4297 if (mp_ptr->spell_stat == A_INT)
4299 p_ptr->update |= (PU_MANA | PU_SPELLS);
4303 /* Change in WIS may affect Mana/Spells */
4304 else if (i == A_WIS)
4306 if (mp_ptr->spell_stat == A_WIS)
4308 p_ptr->update |= (PU_MANA | PU_SPELLS);
4312 /* Change in WIS may affect Mana/Spells */
4313 else if (i == A_CHR)
4315 if (mp_ptr->spell_stat == A_CHR)
4317 p_ptr->update |= (PU_MANA | PU_SPELLS);
4322 p_ptr->window |= (PW_PLAYER);
4327 /* Apply temporary "stun" */
4328 if (p_ptr->stun > 50)
4330 p_ptr->to_h[0] -= 20;
4331 p_ptr->to_h[1] -= 20;
4332 p_ptr->to_h_b -= 20;
4333 p_ptr->to_h_m -= 20;
4334 p_ptr->dis_to_h[0] -= 20;
4335 p_ptr->dis_to_h[1] -= 20;
4336 p_ptr->dis_to_h_b -= 20;
4337 p_ptr->to_d[0] -= 20;
4338 p_ptr->to_d[1] -= 20;
4339 p_ptr->to_d_m -= 20;
4340 p_ptr->dis_to_d[0] -= 20;
4341 p_ptr->dis_to_d[1] -= 20;
4343 else if (p_ptr->stun)
4345 p_ptr->to_h[0] -= 5;
4346 p_ptr->to_h[1] -= 5;
4349 p_ptr->dis_to_h[0] -= 5;
4350 p_ptr->dis_to_h[1] -= 5;
4351 p_ptr->dis_to_h_b -= 5;
4352 p_ptr->to_d[0] -= 5;
4353 p_ptr->to_d[1] -= 5;
4355 p_ptr->dis_to_d[0] -= 5;
4356 p_ptr->dis_to_d[1] -= 5;
4360 if (p_ptr->wraith_form)
4362 p_ptr->reflect = TRUE;
4365 /* Temporary blessing */
4366 if (p_ptr->blessed || music_singing(MUSIC_BLESS))
4369 p_ptr->dis_to_a += 5;
4370 p_ptr->to_h[0] += 10;
4371 p_ptr->to_h[1] += 10;
4372 p_ptr->to_h_b += 10;
4373 p_ptr->to_h_m += 10;
4374 p_ptr->dis_to_h[0] += 10;
4375 p_ptr->dis_to_h[1] += 10;
4376 p_ptr->dis_to_h_b += 10;
4379 if (p_ptr->magicdef)
4381 p_ptr->resist_blind = TRUE;
4382 p_ptr->resist_conf = TRUE;
4383 p_ptr->reflect = TRUE;
4384 p_ptr->free_act = TRUE;
4385 p_ptr->ffall = TRUE;
4388 /* Temporary "Hero" */
4389 if (p_ptr->hero || music_singing(MUSIC_HERO) || music_singing(MUSIC_SHERO))
4391 p_ptr->to_h[0] += 12;
4392 p_ptr->to_h[1] += 12;
4393 p_ptr->to_h_b += 12;
4394 p_ptr->to_h_m += 12;
4395 p_ptr->dis_to_h[0] += 12;
4396 p_ptr->dis_to_h[1] += 12;
4397 p_ptr->dis_to_h_b += 12;
4400 /* Temporary "Beserk" */
4403 p_ptr->to_h[0] += 12;
4404 p_ptr->to_h[1] += 12;
4405 p_ptr->to_h_b -= 12;
4406 p_ptr->to_h_m += 12;
4407 p_ptr->to_d[0] += 3+(p_ptr->lev/5);
4408 p_ptr->to_d[1] += 3+(p_ptr->lev/5);
4409 p_ptr->to_d_m += 3+(p_ptr->lev/5);
4410 p_ptr->dis_to_h[0] += 12;
4411 p_ptr->dis_to_h[1] += 12;
4412 p_ptr->dis_to_h_b -= 12;
4413 p_ptr->dis_to_d[0] += 3+(p_ptr->lev/5);
4414 p_ptr->dis_to_d[1] += 3+(p_ptr->lev/5);
4416 p_ptr->dis_to_a -= 10;
4417 p_ptr->skill_stl -= 7;
4418 p_ptr->skill_dev -= 20;
4419 p_ptr->skill_sav -= 30;
4420 p_ptr->skill_srh -= 15;
4421 p_ptr->skill_fos -= 15;
4422 p_ptr->skill_tht -= 20;
4423 p_ptr->skill_dig += 30;
4426 /* Temporary "fast" */
4427 if (p_ptr->fast || music_singing(MUSIC_SPEED) || music_singing(MUSIC_SHERO))
4429 p_ptr->pspeed += 10;
4432 /* Temporary "slow" */
4435 p_ptr->pspeed -= 10;
4438 /* Temporary "telepathy" */
4439 if (p_ptr->tim_esp || music_singing(MUSIC_MIND))
4441 p_ptr->telepathy = TRUE;
4444 if (p_ptr->ele_immune)
4446 if (p_ptr->special_defense & DEFENSE_ACID)
4447 p_ptr->immune_acid = TRUE;
4448 else if (p_ptr->special_defense & DEFENSE_ELEC)
4449 p_ptr->immune_elec = TRUE;
4450 else if (p_ptr->special_defense & DEFENSE_FIRE)
4451 p_ptr->immune_fire = TRUE;
4452 else if (p_ptr->special_defense & DEFENSE_COLD)
4453 p_ptr->immune_cold = TRUE;
4456 /* Temporary see invisible */
4457 if (p_ptr->tim_invis)
4459 p_ptr->see_inv = TRUE;
4462 /* Temporary infravision boost */
4463 if (p_ptr->tim_infra)
4465 p_ptr->see_infra+=3;
4468 /* Temporary regeneration boost */
4469 if (p_ptr->tim_regen)
4471 p_ptr->regenerate = TRUE;
4474 /* Temporary levitation */
4475 if (p_ptr->tim_ffall)
4477 p_ptr->ffall = TRUE;
4480 /* Hack -- Hero/Shero -> Res fear */
4481 if (p_ptr->hero || p_ptr->shero || music_singing(MUSIC_HERO) || music_singing(MUSIC_SHERO))
4483 p_ptr->resist_fear = TRUE;
4487 /* Hack -- Telepathy Change */
4488 if (p_ptr->telepathy != old_telepathy)
4490 p_ptr->update |= (PU_MONSTERS);
4493 if ((p_ptr->esp_animal != old_esp_animal) ||
4494 (p_ptr->esp_undead != old_esp_undead) ||
4495 (p_ptr->esp_demon != old_esp_demon) ||
4496 (p_ptr->esp_orc != old_esp_orc) ||
4497 (p_ptr->esp_troll != old_esp_troll) ||
4498 (p_ptr->esp_giant != old_esp_giant) ||
4499 (p_ptr->esp_dragon != old_esp_dragon) ||
4500 (p_ptr->esp_human != old_esp_human) ||
4501 (p_ptr->esp_evil != old_esp_evil) ||
4502 (p_ptr->esp_good != old_esp_good) ||
4503 (p_ptr->esp_nonliving != old_esp_nonliving) ||
4504 (p_ptr->esp_unique != old_esp_unique))
4506 p_ptr->update |= (PU_MONSTERS);
4509 /* Hack -- See Invis Change */
4510 if (p_ptr->see_inv != old_see_inv)
4512 p_ptr->update |= (PU_MONSTERS);
4515 /* Bloating slows the player down (a little) */
4516 if (p_ptr->food >= PY_FOOD_MAX) p_ptr->pspeed -= 10;
4518 if (p_ptr->special_defense & KAMAE_SUZAKU) p_ptr->pspeed += 10;
4520 if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
4522 p_ptr->to_h[0] += (p_ptr->skill_exp[GINOU_SUDE]-4000)/200;
4523 p_ptr->dis_to_h[0] += (p_ptr->skill_exp[GINOU_SUDE]-4000)/200;
4526 if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
4528 int penalty1, penalty2;
4529 penalty1 = ((100-p_ptr->skill_exp[GINOU_NITOURYU]/160) - (130-inventory[INVEN_RARM].weight)/8);
4530 penalty2 = ((100-p_ptr->skill_exp[GINOU_NITOURYU]/160) - (130-inventory[INVEN_LARM].weight)/8);
4531 if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN))
4533 penalty1 = penalty1 / 2 - 5;
4534 penalty2 = penalty2 / 2 - 5;
4537 p_ptr->dis_to_a += 10;
4541 if (penalty1 > 0) penalty1 /= 2;
4542 if (penalty2 > 0) penalty2 /= 2;
4544 else if ((inventory[INVEN_LARM].tval == TV_SWORD) && ((inventory[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (inventory[INVEN_LARM].sval == SV_WAKIZASHI)))
4546 penalty1 = MAX(0, penalty1 - 10);
4547 penalty2 = MAX(0, penalty2 - 10);
4549 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
4551 penalty1 = MIN(0, penalty1);
4552 penalty2 = MIN(0, penalty2);
4554 p_ptr->dis_to_a += 10;
4558 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
4560 if ((inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
4563 if (inventory[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
4564 if (inventory[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
4565 p_ptr->to_h[0] -= penalty1;
4566 p_ptr->to_h[1] -= penalty2;
4567 p_ptr->dis_to_h[0] -= penalty1;
4568 p_ptr->dis_to_h[1] -= penalty2;
4571 /* Extract the current weight (in tenth pounds) */
4572 j = p_ptr->total_weight;
4574 /* Extract the "weight limit" (in tenth pounds) */
4579 int speed = m_list[p_ptr->riding].mspeed;
4580 if (m_list[p_ptr->riding].mspeed > 110)
4582 p_ptr->pspeed = 110 + (s16b)((speed-110)*(p_ptr->skill_exp[GINOU_RIDING]*3 + p_ptr->lev*160L - 10000L)/(22000L));
4583 if (p_ptr->pspeed < 110) p_ptr->pspeed = 110;
4587 p_ptr->pspeed = speed;
4589 if (m_list[p_ptr->riding].fast) p_ptr->pspeed += 10;
4590 if (m_list[p_ptr->riding].slow) p_ptr->pspeed -= 10;
4591 if (r_info[m_list[p_ptr->riding].r_idx].flags7 & RF7_CAN_FLY) p_ptr->ffall = TRUE;
4592 if (r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE;
4594 if (p_ptr->skill_exp[GINOU_RIDING] < 2000) j += (p_ptr->wt*3*(2000 - p_ptr->skill_exp[GINOU_RIDING]))/2000;
4596 i = 3000 + r_info[m_list[p_ptr->riding].r_idx].level * 50;
4599 /* XXX XXX XXX Apply "encumbrance" from weight */
4600 if (j > i/2) p_ptr->pspeed -= ((j - (i/2)) / (i / 10));
4602 /* Searching slows the player down */
4603 if (p_ptr->action == ACTION_SEARCH) p_ptr->pspeed -= 10;
4605 /* Actual Modifier Bonuses (Un-inflate stat bonuses) */
4606 p_ptr->to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4607 p_ptr->to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4608 p_ptr->to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4609 p_ptr->to_d_m += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4610 p_ptr->to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4611 p_ptr->to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4612 p_ptr->to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4613 p_ptr->to_h_m += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4614 p_ptr->to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4615 p_ptr->to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4616 p_ptr->to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4617 p_ptr->to_h_m += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4619 /* Displayed Modifier Bonuses (Un-inflate stat bonuses) */
4620 p_ptr->dis_to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4621 p_ptr->dis_to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4622 p_ptr->dis_to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4623 p_ptr->dis_to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4624 p_ptr->dis_to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4625 p_ptr->dis_to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4626 p_ptr->dis_to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4627 p_ptr->dis_to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4628 p_ptr->dis_to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4631 /* Obtain the "hold" value */
4632 hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
4635 /* Examine the "current bow" */
4636 o_ptr = &inventory[INVEN_BOW];
4639 /* Assume not heavy */
4640 p_ptr->heavy_shoot = FALSE;
4642 /* It is hard to carholdry a heavy bow */
4643 if (hold < o_ptr->weight / 10)
4645 /* Hard to wield a heavy bow */
4646 p_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
4647 p_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
4650 p_ptr->heavy_shoot = TRUE;
4654 /* Compute "extra shots" if needed */
4657 /* Analyze the launcher */
4658 switch (o_ptr->sval)
4662 p_ptr->tval_ammo = TV_SHOT;
4670 p_ptr->tval_ammo = TV_ARROW;
4677 p_ptr->tval_ammo = TV_BOLT;
4682 p_ptr->tval_ammo = TV_NO_AMMO;
4687 /* Apply special flags */
4688 if (o_ptr->k_idx && !p_ptr->heavy_shoot)
4691 p_ptr->num_fire += (extra_shots * 100);
4693 /* Hack -- Rangers love Bows */
4694 if ((p_ptr->pclass == CLASS_RANGER) &&
4695 (p_ptr->tval_ammo == TV_ARROW))
4697 p_ptr->num_fire += (p_ptr->lev * 4);
4700 if ((p_ptr->pclass == CLASS_CAVALRY) &&
4701 (p_ptr->tval_ammo == TV_ARROW))
4703 p_ptr->num_fire += (p_ptr->lev * 3);
4706 if (p_ptr->pclass == CLASS_ARCHER)
4708 if (p_ptr->tval_ammo == TV_ARROW)
4709 p_ptr->num_fire += ((p_ptr->lev * 5)+50);
4710 else if ((p_ptr->tval_ammo == TV_BOLT) || (p_ptr->tval_ammo == TV_SHOT))
4711 p_ptr->num_fire += (p_ptr->lev * 4);
4715 * Addendum -- also "Reward" high level warriors,
4716 * with _any_ missile weapon -- TY
4718 if (p_ptr->pclass == CLASS_WARRIOR &&
4719 (p_ptr->tval_ammo <= TV_BOLT) &&
4720 (p_ptr->tval_ammo >= TV_SHOT))
4722 p_ptr->num_fire += (p_ptr->lev * 2);
4724 if ((p_ptr->pclass == CLASS_ROGUE) &&
4725 (p_ptr->tval_ammo == TV_SHOT))
4727 p_ptr->num_fire += (p_ptr->lev * 4);
4735 for(i = 0 ; i < 2 ; i++)
4737 /* Examine the "main weapon" */
4738 o_ptr = &inventory[INVEN_RARM+i];
4740 object_flags(o_ptr, flgs);
4742 /* Assume not heavy */
4743 p_ptr->heavy_wield[i] = FALSE;
4744 p_ptr->icky_wield[i] = FALSE;
4745 p_ptr->riding_wield[i] = FALSE;
4747 if (!buki_motteruka(INVEN_RARM+i)) {p_ptr->num_blow[i]=1;continue;}
4748 /* It is hard to hold a heavy weapon */
4749 if (hold < o_ptr->weight / 10)
4751 /* Hard to wield a heavy weapon */
4752 p_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
4753 p_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
4756 p_ptr->heavy_wield[i] = TRUE;
4758 else if (p_ptr->ryoute && (hold < o_ptr->weight/5)) omoi = TRUE;
4760 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
4763 p_ptr->dis_to_a += 5;
4766 /* Normal weapons */
4767 if (o_ptr->k_idx && !p_ptr->heavy_wield[i])
4769 int str_index, dex_index;
4771 int num = 0, wgt = 0, mul = 0, div = 0;
4773 /* Analyze the class */
4774 switch (p_ptr->pclass)
4778 num = 6; wgt = 70; mul = 5; break;
4781 case CLASS_BERSERKER:
4782 num = 6; wgt = 70; mul = 7; break;
4786 case CLASS_HIGH_MAGE:
4787 case CLASS_BLUE_MAGE:
4788 num = 3; wgt = 100; mul = 2; break;
4790 /* Priest, Mindcrafter */
4792 case CLASS_MAGIC_EATER:
4793 case CLASS_MINDCRAFTER:
4794 num = 5; wgt = 100; mul = 3; break;
4798 num = 5; wgt = 40; mul = 3; break;
4802 num = 5; wgt = 70; mul = 4; break;
4807 num = 5; wgt = 70; mul = 4; break;
4811 num = 5; wgt = 150; mul = 5; break;
4814 case CLASS_WARRIOR_MAGE:
4815 case CLASS_RED_MAGE:
4816 num = 5; wgt = 70; mul = 3; break;
4819 case CLASS_CHAOS_WARRIOR:
4820 num = 5; wgt = 70; mul = 4; break;
4824 num = 5; wgt = 60; mul = 3; break;
4828 num = 4; wgt = 100; mul = 3; break;
4831 case CLASS_IMITATOR:
4832 num = 5; wgt = 70; mul = 4; break;
4835 case CLASS_BEASTMASTER:
4836 num = 5; wgt = 70; mul = 3; break;
4839 if ((p_ptr->riding) && (have_flag(flgs, TR_RIDING))) {num = 5; wgt = 70; mul = 4;}
4840 else {num = 5; wgt = 100; mul = 3;}
4844 case CLASS_SORCERER:
4845 num = 1; wgt = 1; mul = 1; break;
4847 /* Archer, Magic eater */
4850 num = 4; wgt = 70; mul = 2; break;
4853 case CLASS_FORCETRAINER:
4854 num = 4; wgt = 60; mul = 2; break;
4857 case CLASS_MIRROR_MASTER:
4858 num = 3; wgt = 100; mul = 3; break;
4862 num = 4; wgt = 20; mul = 1; break;
4865 /* Enforce a minimum "weight" (tenth pounds) */
4866 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
4868 /* Access the strength vs weight */
4869 str_index = (adj_str_blow[p_ptr->stat_ind[A_STR]] * mul / div);
4871 if (p_ptr->ryoute && !omoi) str_index++;
4872 if (p_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index-1);
4875 if (str_index > 11) str_index = 11;
4877 /* Index by dexterity */
4878 dex_index = (adj_dex_blow[p_ptr->stat_ind[A_DEX]]);
4881 if (dex_index > 11) dex_index = 11;
4883 /* Use the blows table */
4884 p_ptr->num_blow[i] = blows_table[str_index][dex_index];
4887 if (p_ptr->num_blow[i] > num) p_ptr->num_blow[i] = num;
4889 /* Add in the "bonus blows" */
4890 p_ptr->num_blow[i] += extra_blows[i];
4893 if (p_ptr->pclass == CLASS_WARRIOR) p_ptr->num_blow[i] += (p_ptr->lev / 40);
4894 else if (p_ptr->pclass == CLASS_BERSERKER)
4896 p_ptr->num_blow[i] += (p_ptr->lev / 23);
4898 else if ((p_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (p_ptr->stat_ind[A_DEX] >= 30)) p_ptr->num_blow[i] ++;
4900 if (p_ptr->special_defense & KATA_FUUJIN) p_ptr->num_blow[i] -= 1;
4902 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) p_ptr->num_blow[i] = 1;
4905 /* Require at least one blow */
4906 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
4908 /* Boost digging skill by weapon weight */
4909 p_ptr->skill_dig += (o_ptr->weight / 10);
4913 /* Priest weapon penalty for non-blessed edged weapons */
4914 if ((p_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
4915 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
4917 /* Reduce the real bonuses */
4918 p_ptr->to_h[i] -= 2;
4919 p_ptr->to_d[i] -= 2;
4921 /* Reduce the mental bonuses */
4922 p_ptr->dis_to_h[i] -= 2;
4923 p_ptr->dis_to_d[i] -= 2;
4926 p_ptr->icky_wield[i] = TRUE;
4928 else if (p_ptr->pclass == CLASS_BERSERKER)
4930 p_ptr->to_h[i] += p_ptr->lev/5;
4931 p_ptr->to_d[i] += p_ptr->lev/6;
4932 p_ptr->dis_to_h[i] += p_ptr->lev/5;
4933 p_ptr->dis_to_d[i] += p_ptr->lev/6;
4934 if (!p_ptr->hidarite || p_ptr->ryoute)
4936 p_ptr->to_h[i] += p_ptr->lev/5;
4937 p_ptr->to_d[i] += p_ptr->lev/6;
4938 p_ptr->dis_to_h[i] += p_ptr->lev/5;
4939 p_ptr->dis_to_d[i] += p_ptr->lev/6;
4942 else if (p_ptr->pclass == CLASS_SORCERER)
4944 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
4946 /* Reduce the real bonuses */
4947 p_ptr->to_h[i] -= 200;
4948 p_ptr->to_d[i] -= 200;
4950 /* Reduce the mental bonuses */
4951 p_ptr->dis_to_h[i] -= 200;
4952 p_ptr->dis_to_d[i] -= 200;
4955 p_ptr->icky_wield[i] = TRUE;
4959 /* Reduce the real bonuses */
4960 p_ptr->to_h[i] -= 30;
4961 p_ptr->to_d[i] -= 10;
4963 /* Reduce the mental bonuses */
4964 p_ptr->dis_to_h[i] -= 30;
4965 p_ptr->dis_to_d[i] -= 10;
4970 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
4972 p_ptr->to_h[i] +=15;
4973 p_ptr->dis_to_h[i] +=15;
4975 else if (!(have_flag(flgs, TR_RIDING)))
4978 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
4984 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
4986 if (penalty < 30) penalty = 30;
4988 p_ptr->to_h[i] -= penalty;
4989 p_ptr->dis_to_h[i] -= penalty;
4992 p_ptr->riding_wield[i] = TRUE;
5001 p_ptr->riding_ryoute = FALSE;
5002 if (p_ptr->ryoute || !empty_hands(FALSE)) p_ptr->riding_ryoute = TRUE;
5004 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
5006 if (p_ptr->tval_ammo != TV_ARROW) penalty = 5;
5010 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
5012 if (penalty < 30) penalty = 30;
5014 if (p_ptr->tval_ammo == TV_BOLT) penalty *= 2;
5015 p_ptr->to_h_b -= penalty;
5016 p_ptr->dis_to_h_b -= penalty;
5019 /* Different calculation for monks with empty hands */
5020 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1))
5022 int blow_base = p_ptr->lev + adj_dex_blow[p_ptr->stat_ind[A_DEX]];
5023 p_ptr->num_blow[0] = 0;
5025 if (p_ptr->pclass == CLASS_FORCETRAINER)
5027 if (blow_base > 18) p_ptr->num_blow[0]++;
5028 if (blow_base > 31) p_ptr->num_blow[0]++;
5029 if (blow_base > 44) p_ptr->num_blow[0]++;
5030 if (blow_base > 58) p_ptr->num_blow[0]++;
5031 if (p_ptr->magic_num1[0])
5033 p_ptr->to_d[0] += (p_ptr->magic_num1[0]/5);
5034 p_ptr->dis_to_d[0] += (p_ptr->magic_num1[0]/5);
5039 if (blow_base > 12) p_ptr->num_blow[0]++;
5040 if (blow_base > 22) p_ptr->num_blow[0]++;
5041 if (blow_base > 31) p_ptr->num_blow[0]++;
5042 if (blow_base > 39) p_ptr->num_blow[0]++;
5043 if (blow_base > 46) p_ptr->num_blow[0]++;
5044 if (blow_base > 53) p_ptr->num_blow[0]++;
5045 if (blow_base > 59) p_ptr->num_blow[0]++;
5048 if (heavy_armor() && (p_ptr->pclass != CLASS_BERSERKER))
5049 p_ptr->num_blow[0] /= 2;
5052 p_ptr->to_h[0] += (p_ptr->lev / 3);
5053 p_ptr->dis_to_h[0] += (p_ptr->lev / 3);
5055 p_ptr->to_d[0] += (p_ptr->lev / 6);
5056 p_ptr->dis_to_d[0] += (p_ptr->lev / 6);
5059 if (p_ptr->special_defense & KAMAE_BYAKKO)
5062 p_ptr->dis_to_a -= 40;
5065 else if (p_ptr->special_defense & KAMAE_SEIRYU)
5068 p_ptr->dis_to_a -= 50;
5069 p_ptr->resist_acid = TRUE;
5070 p_ptr->resist_fire = TRUE;
5071 p_ptr->resist_elec = TRUE;
5072 p_ptr->resist_cold = TRUE;
5073 p_ptr->resist_pois = TRUE;
5074 p_ptr->sh_fire = TRUE;
5075 p_ptr->sh_elec = TRUE;
5076 p_ptr->sh_cold = TRUE;
5077 p_ptr->ffall = TRUE;
5079 else if (p_ptr->special_defense & KAMAE_GENBU)
5081 p_ptr->to_a += (p_ptr->lev*p_ptr->lev)/50;
5082 p_ptr->dis_to_a += (p_ptr->lev*p_ptr->lev)/50;
5083 p_ptr->reflect = TRUE;
5084 p_ptr->num_blow[0] -= 2;
5085 if ((p_ptr->pclass == CLASS_MONK) && (p_ptr->lev > 42)) p_ptr->num_blow[0]--;
5086 if (p_ptr->num_blow[0] < 0) p_ptr->num_blow[0] = 0;
5088 else if (p_ptr->special_defense & KAMAE_SUZAKU)
5090 p_ptr->to_h[0] -= (p_ptr->lev / 3);
5091 p_ptr->to_d[0] -= (p_ptr->lev / 6);
5093 p_ptr->dis_to_h[0] -= (p_ptr->lev / 3);
5094 p_ptr->dis_to_d[0] -= (p_ptr->lev / 6);
5095 p_ptr->num_blow[0] /= 2;
5096 p_ptr->ffall = TRUE;
5099 p_ptr->num_blow[0] += 1+extra_blows[0];
5102 monk_armour_aux = FALSE;
5106 monk_armour_aux = TRUE;
5109 for (i = 0 ; i < 2 ; i++)
5111 if(buki_motteruka(INVEN_RARM+i))
5113 int tval = inventory[INVEN_RARM+i].tval - TV_BOW;
5114 int sval = inventory[INVEN_RARM+i].sval;
5116 p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval]-4000)/200;
5117 p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval]-4000)/200;
5118 if ((p_ptr->pclass == CLASS_MONK) && !(s_info[CLASS_MONK].w_max[tval][sval]))
5120 p_ptr->to_h[i] -= 40;
5121 p_ptr->dis_to_h[i] -= 40;
5122 p_ptr->icky_wield[i] = TRUE;
5124 else if ((p_ptr->pclass == CLASS_FORCETRAINER) && !(s_info[CLASS_FORCETRAINER].w_max[tval][sval]))
5126 p_ptr->to_h[i] -= 40;
5127 p_ptr->dis_to_h[i] -= 40;
5128 p_ptr->icky_wield[i] = TRUE;
5130 else if (p_ptr->pclass == CLASS_NINJA)
5132 if ((s_info[CLASS_NINJA].w_max[tval][sval] <= 4000) || (inventory[INVEN_LARM-i].tval == TV_SHIELD))
5134 p_ptr->to_h[i] -= 40;
5135 p_ptr->dis_to_h[i] -= 40;
5136 p_ptr->icky_wield[i] = TRUE;
5137 p_ptr->num_blow[i] /= 2;
5138 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
5144 /* Temporary lightspeed */
5145 if ((p_ptr->lightspeed && !p_ptr->riding) || (p_ptr->pspeed > 209))
5147 p_ptr->pspeed = 209;
5149 if (p_ptr->pspeed < 11) p_ptr->pspeed = 11;
5151 /* Display the speed (if needed) */
5152 if (p_ptr->pspeed != old_speed) p_ptr->redraw |= (PR_SPEED);
5156 if (p_ptr->to_a > (0 - p_ptr->ac))
5157 p_ptr->to_a = 0 - p_ptr->ac;
5158 if (p_ptr->dis_to_a > (0 - p_ptr->dis_ac))
5159 p_ptr->dis_to_a = 0 - p_ptr->dis_ac;
5162 /* Redraw armor (if needed) */
5163 if ((p_ptr->dis_ac != old_dis_ac) || (p_ptr->dis_to_a != old_dis_to_a))
5166 p_ptr->redraw |= (PR_ARMOR);
5169 p_ptr->window |= (PW_PLAYER);
5173 if (p_ptr->ryoute && !omoi)
5175 int bonus_to_h=0, bonus_to_d=0;
5176 bonus_to_d = ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128)/2;
5177 bonus_to_h = ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128) + ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
5179 p_ptr->to_h[0] += MAX(bonus_to_h,1);
5180 p_ptr->dis_to_h[0] += MAX(bonus_to_h,1);
5181 p_ptr->to_d[0] += MAX(bonus_to_d,1);
5182 p_ptr->dis_to_d[0] += MAX(bonus_to_d,1);
5185 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) == 3)) p_ptr->ryoute = FALSE;
5187 /* Affect Skill -- stealth (bonus one) */
5188 p_ptr->skill_stl += 1;
5190 if (p_ptr->tim_stealth || music_singing(MUSIC_STEALTH))
5191 p_ptr->skill_stl += 99;
5193 /* Affect Skill -- disarming (DEX and INT) */
5194 p_ptr->skill_dis += adj_dex_dis[p_ptr->stat_ind[A_DEX]];
5195 p_ptr->skill_dis += adj_int_dis[p_ptr->stat_ind[A_INT]];
5197 /* Affect Skill -- magic devices (INT) */
5198 p_ptr->skill_dev += adj_int_dev[p_ptr->stat_ind[A_INT]];
5200 /* Affect Skill -- saving throw (WIS) */
5201 p_ptr->skill_sav += adj_wis_sav[p_ptr->stat_ind[A_WIS]];
5203 /* Affect Skill -- digging (STR) */
5204 p_ptr->skill_dig += adj_str_dig[p_ptr->stat_ind[A_STR]];
5206 /* Affect Skill -- disarming (Level, by Class) */
5207 p_ptr->skill_dis += ((cp_ptr->x_dis * p_ptr->lev / 10) + (ap_ptr->a_dis * p_ptr->lev / 50));
5209 /* Affect Skill -- magic devices (Level, by Class) */
5210 p_ptr->skill_dev += ((cp_ptr->x_dev * p_ptr->lev / 10) + (ap_ptr->a_dev * p_ptr->lev / 50));
5212 /* Affect Skill -- saving throw (Level, by Class) */
5213 p_ptr->skill_sav += ((cp_ptr->x_sav * p_ptr->lev / 10) + (ap_ptr->a_sav * p_ptr->lev / 50));
5215 /* Affect Skill -- stealth (Level, by Class) */
5216 p_ptr->skill_stl += (cp_ptr->x_stl * p_ptr->lev / 10);
5218 /* Affect Skill -- search ability (Level, by Class) */
5219 p_ptr->skill_srh += (cp_ptr->x_srh * p_ptr->lev / 10);
5221 /* Affect Skill -- search frequency (Level, by Class) */
5222 p_ptr->skill_fos += (cp_ptr->x_fos * p_ptr->lev / 10);
5224 /* Affect Skill -- combat (normal) (Level, by Class) */
5225 p_ptr->skill_thn += ((cp_ptr->x_thn * p_ptr->lev / 10) + (ap_ptr->a_thn * p_ptr->lev / 50));
5227 /* Affect Skill -- combat (shooting) (Level, by Class) */
5228 p_ptr->skill_thb += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5230 /* Affect Skill -- combat (throwing) (Level, by Class) */
5231 p_ptr->skill_tht += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5234 if ((prace_is_(RACE_S_FAIRY)) && (p_ptr->pseikaku != SEIKAKU_SEXY) && (p_ptr->cursed & TRC_AGGRAVATE))
5236 p_ptr->cursed &= ~(TRC_AGGRAVATE);
5237 p_ptr->skill_stl = MIN(p_ptr->skill_stl - 3, (p_ptr->skill_stl + 2) / 2);
5240 /* Limit Skill -- stealth from 0 to 30 */
5241 if (p_ptr->skill_stl > 30) p_ptr->skill_stl = 30;
5242 if (p_ptr->skill_stl < 0) p_ptr->skill_stl = 0;
5244 /* Limit Skill -- digging from 1 up */
5245 if (p_ptr->skill_dig < 1) p_ptr->skill_dig = 1;
5247 if (p_ptr->anti_magic && (p_ptr->skill_sav < (90 + p_ptr->lev))) p_ptr->skill_sav = 90 + p_ptr->lev;
5249 if (p_ptr->tsubureru) p_ptr->skill_sav = 10;
5251 if ((p_ptr->ult_res || p_ptr->resist_magic || p_ptr->magicdef) && (p_ptr->skill_sav < (95 + p_ptr->lev))) p_ptr->skill_sav = 95 + p_ptr->lev;
5253 if (down_saving) p_ptr->skill_sav /= 2;
5255 /* Hack -- handle "xtra" mode */
5256 if (character_xtra) return;
5258 /* Take note when "heavy bow" changes */
5259 if (p_ptr->old_heavy_shoot != p_ptr->heavy_shoot)
5262 if (p_ptr->heavy_shoot)
5265 msg_print("¤³¤ó¤Ê½Å¤¤µÝ¤òÁõÈ÷¤·¤Æ¤¤¤ë¤Î¤ÏÂçÊѤÀ¡£");
5267 msg_print("You have trouble wielding such a heavy bow.");
5271 else if (inventory[INVEN_BOW].k_idx)
5274 msg_print("¤³¤ÎµÝ¤Ê¤éÁõÈ÷¤·¤Æ¤¤¤Æ¤â¿É¤¯¤Ê¤¤¡£");
5276 msg_print("You have no trouble wielding your bow.");
5283 msg_print("½Å¤¤µÝ¤òÁõÈ÷¤«¤é¤Ï¤º¤·¤ÆÂΤ¬³Ú¤Ë¤Ê¤Ã¤¿¡£");
5285 msg_print("You feel relieved to put down your heavy bow.");
5291 p_ptr->old_heavy_shoot = p_ptr->heavy_shoot;
5294 for(i = 0 ; i < 2 ; i++)
5296 /* Take note when "heavy weapon" changes */
5297 if (p_ptr->old_heavy_wield[i] != p_ptr->heavy_wield[i])
5300 if (p_ptr->heavy_wield[i])
5303 msg_print("¤³¤ó¤Ê½Å¤¤Éð´ï¤òÁõÈ÷¤·¤Æ¤¤¤ë¤Î¤ÏÂçÊѤÀ¡£");
5305 msg_print("You have trouble wielding such a heavy weapon.");
5309 else if (buki_motteruka(INVEN_RARM+i))
5312 msg_print("¤³¤ì¤Ê¤éÁõÈ÷¤·¤Æ¤¤¤Æ¤â¿É¤¯¤Ê¤¤¡£");
5314 msg_print("You have no trouble wielding your weapon.");
5318 else if (p_ptr->heavy_wield[1-i])
5321 msg_print("¤Þ¤ÀÉð´ï¤¬½Å¤¤¡£");
5323 msg_print("You have still trouble wielding a heavy weapon.");
5330 msg_print("½Å¤¤Éð´ï¤òÁõÈ÷¤«¤é¤Ï¤º¤·¤ÆÂΤ¬³Ú¤Ë¤Ê¤Ã¤¿¡£");
5332 msg_print("You feel relieved to put down your heavy weapon.");
5338 p_ptr->old_heavy_wield[i] = p_ptr->heavy_wield[i];
5341 /* Take note when "heavy weapon" changes */
5342 if (p_ptr->old_riding_wield[i] != p_ptr->riding_wield[i])
5345 if (p_ptr->riding_wield[i])
5348 msg_print("¤³¤ÎÉð´ï¤Ï¾èÇÏÃæ¤Ë»È¤¦¤Ë¤Ï¤à¤«¤Ê¤¤¤è¤¦¤À¡£");
5350 msg_print("This weapon is not suitable for use while riding.");
5354 else if (!p_ptr->riding)
5357 msg_print("¤³¤ÎÉð´ï¤ÏÅÌÊâ¤Ç»È¤¤¤ä¤¹¤¤¡£");
5359 msg_print("This weapon was not suitable for use while riding.");
5363 else if (buki_motteruka(INVEN_RARM+i))
5366 msg_print("¤³¤ì¤Ê¤é¾èÇÏÃæ¤Ë¤Ô¤Ã¤¿¤ê¤À¡£");
5368 msg_print("This weapon is suitable for use while riding.");
5373 p_ptr->old_riding_wield[i] = p_ptr->riding_wield[i];
5376 /* Take note when "illegal weapon" changes */
5377 if (p_ptr->old_icky_wield[i] != p_ptr->icky_wield[i])
5380 if (p_ptr->icky_wield[i])
5383 msg_print("º£¤ÎÁõÈ÷¤Ï¤É¤¦¤â¼«Ê¬¤Ë¤Õ¤µ¤ï¤·¤¯¤Ê¤¤µ¤¤¬¤¹¤ë¡£");
5385 msg_print("You do not feel comfortable with your weapon.");
5389 chg_virtue(V_FAITH, -1);
5392 else if (buki_motteruka(INVEN_RARM+i))
5395 msg_print("º£¤ÎÁõÈ÷¤Ï¼«Ê¬¤Ë¤Õ¤µ¤ï¤·¤¤µ¤¤¬¤¹¤ë¡£");
5397 msg_print("You feel comfortable with your weapon.");
5404 msg_print("ÁõÈ÷¤ò¤Ï¤º¤·¤¿¤é¿ïʬ¤Èµ¤¤¬³Ú¤Ë¤Ê¤Ã¤¿¡£");
5406 msg_print("You feel more comfortable after removing your weapon.");
5412 p_ptr->old_icky_wield[i] = p_ptr->icky_wield[i];
5416 if (p_ptr->riding && (p_ptr->old_riding_ryoute != p_ptr->riding_ryoute))
5419 if (p_ptr->riding_ryoute)
5422 msg_print("ξ¼ê¤¬¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ÆÇϤòÁà¤ì¤Ê¤¤¡£");
5424 msg_print("You are using both hand for fighting, and you can't control a riding pet.");
5430 msg_print("¼ê¤¬¶õ¤¤¤ÆÇϤòÁà¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
5432 msg_print("You began to control riding pet with one hand.");
5436 p_ptr->old_riding_ryoute = p_ptr->riding_ryoute;
5439 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (monk_armour_aux != monk_notify_aux))
5444 msg_print("ÁõÈ÷¤¬½Å¤¯¤Æ¥Ð¥é¥ó¥¹¤ò¼è¤ì¤Ê¤¤¡£");
5446 msg_print("The weight of your armor disrupts your balance.");
5451 chg_virtue(V_HARMONY, -1);
5456 msg_print("¥Ð¥é¥ó¥¹¤¬¤È¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
5458 msg_print("You regain your balance.");
5461 monk_notify_aux = monk_armour_aux;
5465 p_ptr->align = friend_align;
5467 /* Determine player alignment */
5468 for (i = 0; i < 8; i++)
5470 if ((p_ptr->vir_types[i] == V_HARMONY) || (p_ptr->vir_types[i] == V_NATURE))
5475 else if (p_ptr->vir_types[i] == V_UNLIFE) p_ptr->align -= p_ptr->virtues[i];
5476 else if (p_ptr->vir_types[i] == V_JUSTICE) p_ptr->align += (p_ptr->virtues[i]*2);
5477 else if (p_ptr->vir_types[i] != V_CHANCE) p_ptr->align += p_ptr->virtues[i];
5479 if ((inventory[INVEN_RARM].name1 == ART_IRON_BALL) || (inventory[INVEN_LARM].name1 == ART_IRON_BALL)) p_ptr->align -= 1000;
5480 if (prace_is_(RACE_ANGEL)) p_ptr->align += 200;
5481 if ((prace_is_(RACE_DEMON)) || (p_ptr->mimic_form == MIMIC_DEMON_LORD) || (p_ptr->mimic_form == MIMIC_DEMON)) p_ptr->align -= 200;
5485 if (p_ptr->align > 0)
5487 p_ptr->align -= (p_ptr->virtues[neutral[j]]/2);
5488 if (p_ptr->align < 0) p_ptr->align = 0;
5490 else if (p_ptr->align < 0)
5492 p_ptr->align += (p_ptr->virtues[neutral[j]]/2);
5493 if (p_ptr->align > 0) p_ptr->align = 0;
5501 for (i = 0; i < INVEN_PACK; i++)
5503 if ((inventory[i].tval == TV_SORCERY_BOOK) && (inventory[i].sval == 2)) have_dd_s = TRUE;
5504 if ((inventory[i].tval == TV_TRUMP_BOOK) && (inventory[i].sval == 1)) have_dd_t = TRUE;
5505 if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE;
5506 if ((inventory[i].tval == TV_ENCHANT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE;
5508 for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
5512 /* Acquire object */
5513 o_ptr = &o_list[this_o_idx];
5515 /* Acquire next object */
5516 next_o_idx = o_ptr->next_o_idx;
5518 if ((o_ptr->tval == TV_SORCERY_BOOK) && (o_ptr->sval == 3)) have_dd_s = TRUE;
5519 if ((o_ptr->tval == TV_TRUMP_BOOK) && (o_ptr->sval == 1)) have_dd_t = TRUE;
5520 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
5521 if ((o_ptr->tval == TV_ENCHANT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
5524 if ((p_ptr->pass_wall && !p_ptr->kill_wall) || p_ptr->kabenuke || p_ptr->wraith_form) p_ptr->no_flowed = TRUE;
5526 if (have_dd_s && ((p_ptr->realm1 == REALM_SORCERY) || (p_ptr->realm2 == REALM_SORCERY) || (p_ptr->pclass == CLASS_SORCERER)))
5528 magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY-1][SPELL_DD_S];
5529 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5532 if (have_dd_t && ((p_ptr->realm1 == REALM_TRUMP) || (p_ptr->realm2 == REALM_TRUMP) || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)))
5534 magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP-1][SPELL_DD_T];
5535 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5538 if (have_sw && ((p_ptr->realm1 == REALM_NATURE) || (p_ptr->realm2 == REALM_NATURE) || (p_ptr->pclass == CLASS_SORCERER)))
5540 magic_type *s_ptr = &mp_ptr->info[REALM_NATURE-1][SPELL_SW];
5541 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5544 if (have_kabe && ((p_ptr->realm1 == REALM_ENCHANT) || (p_ptr->realm2 == REALM_ENCHANT) || (p_ptr->pclass == CLASS_SORCERER)))
5546 magic_type *s_ptr = &mp_ptr->info[REALM_ENCHANT-1][SPELL_KABE];
5547 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5554 * Handle "p_ptr->notice"
5556 void notice_stuff(void)
5559 if (!p_ptr->notice) return;
5562 /* Actually do auto-destroy */
5563 if (p_ptr->notice & (PN_AUTODESTROY))
5565 p_ptr->notice &= ~(PN_AUTODESTROY);
5566 delayed_auto_destroy();
5569 /* Combine the pack */
5570 if (p_ptr->notice & (PN_COMBINE))
5572 p_ptr->notice &= ~(PN_COMBINE);
5576 /* Reorder the pack */
5577 if (p_ptr->notice & (PN_REORDER))
5579 p_ptr->notice &= ~(PN_REORDER);
5586 * Handle "p_ptr->update"
5588 void update_stuff(void)
5591 if (!p_ptr->update) return;
5594 if (p_ptr->update & (PU_BONUS))
5596 p_ptr->update &= ~(PU_BONUS);
5600 if (p_ptr->update & (PU_TORCH))
5602 p_ptr->update &= ~(PU_TORCH);
5606 if (p_ptr->update & (PU_HP))
5608 p_ptr->update &= ~(PU_HP);
5612 if (p_ptr->update & (PU_MANA))
5614 p_ptr->update &= ~(PU_MANA);
5618 if (p_ptr->update & (PU_SPELLS))
5620 p_ptr->update &= ~(PU_SPELLS);
5625 /* Character is not ready yet, no screen updates */
5626 if (!character_generated) return;
5629 /* Character is in "icky" mode, no screen updates */
5630 if (character_icky) return;
5633 if (p_ptr->update & (PU_UN_LITE))
5635 p_ptr->update &= ~(PU_UN_LITE);
5639 if (p_ptr->update & (PU_UN_VIEW))
5641 p_ptr->update &= ~(PU_UN_VIEW);
5645 if (p_ptr->update & (PU_VIEW))
5647 p_ptr->update &= ~(PU_VIEW);
5651 if (p_ptr->update & (PU_LITE))
5653 p_ptr->update &= ~(PU_LITE);
5658 if (p_ptr->update & (PU_FLOW))
5660 p_ptr->update &= ~(PU_FLOW);
5664 if (p_ptr->update & (PU_DISTANCE))
5666 p_ptr->update &= ~(PU_DISTANCE);
5668 /* Still need to call update_monsters(FALSE) after update_mon_lite() */
5669 /* p_ptr->update &= ~(PU_MONSTERS); */
5671 update_monsters(TRUE);
5674 if (p_ptr->update & (PU_MON_LITE))
5676 p_ptr->update &= ~(PU_MON_LITE);
5680 if (p_ptr->update & (PU_MONSTERS))
5682 p_ptr->update &= ~(PU_MONSTERS);
5683 update_monsters(FALSE);
5689 * Handle "p_ptr->redraw"
5691 void redraw_stuff(void)
5694 if (!p_ptr->redraw) return;
5697 /* Character is not ready yet, no screen updates */
5698 if (!character_generated) return;
5701 /* Character is in "icky" mode, no screen updates */
5702 if (character_icky) return;
5706 /* Hack -- clear the screen */
5707 if (p_ptr->redraw & (PR_WIPE))
5709 p_ptr->redraw &= ~(PR_WIPE);
5715 if (p_ptr->redraw & (PR_MAP))
5717 p_ptr->redraw &= ~(PR_MAP);
5722 if (p_ptr->redraw & (PR_BASIC))
5724 p_ptr->redraw &= ~(PR_BASIC);
5725 p_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
5726 p_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
5727 p_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
5728 p_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
5734 if (p_ptr->redraw & (PR_EQUIPPY))
5736 p_ptr->redraw &= ~(PR_EQUIPPY);
5737 print_equippy(); /* To draw / delete equippy chars */
5740 if (p_ptr->redraw & (PR_MISC))
5742 p_ptr->redraw &= ~(PR_MISC);
5743 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
5744 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
5748 if (p_ptr->redraw & (PR_TITLE))
5750 p_ptr->redraw &= ~(PR_TITLE);
5754 if (p_ptr->redraw & (PR_LEV))
5756 p_ptr->redraw &= ~(PR_LEV);
5760 if (p_ptr->redraw & (PR_EXP))
5762 p_ptr->redraw &= ~(PR_EXP);
5766 if (p_ptr->redraw & (PR_STATS))
5768 p_ptr->redraw &= ~(PR_STATS);
5777 if (p_ptr->redraw & (PR_STATUS))
5779 p_ptr->redraw &= ~(PR_STATUS);
5783 if (p_ptr->redraw & (PR_ARMOR))
5785 p_ptr->redraw &= ~(PR_ARMOR);
5789 if (p_ptr->redraw & (PR_HP))
5791 p_ptr->redraw &= ~(PR_HP);
5795 if (p_ptr->redraw & (PR_MANA))
5797 p_ptr->redraw &= ~(PR_MANA);
5801 if (p_ptr->redraw & (PR_GOLD))
5803 p_ptr->redraw &= ~(PR_GOLD);
5807 if (p_ptr->redraw & (PR_DEPTH))
5809 p_ptr->redraw &= ~(PR_DEPTH);
5813 if (p_ptr->redraw & (PR_HEALTH))
5815 p_ptr->redraw &= ~(PR_HEALTH);
5819 if (p_ptr->redraw & (PR_UHEALTH))
5821 p_ptr->redraw &= ~(PR_UHEALTH);
5822 riding_health_redraw();
5826 if (p_ptr->redraw & (PR_EXTRA))
5828 p_ptr->redraw &= ~(PR_EXTRA);
5829 p_ptr->redraw &= ~(PR_CUT | PR_STUN);
5830 p_ptr->redraw &= ~(PR_HUNGER);
5831 p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_MANE | PR_STATUS);
5835 if (p_ptr->redraw & (PR_CUT))
5837 p_ptr->redraw &= ~(PR_CUT);
5841 if (p_ptr->redraw & (PR_STUN))
5843 p_ptr->redraw &= ~(PR_STUN);
5847 if (p_ptr->redraw & (PR_HUNGER))
5849 p_ptr->redraw &= ~(PR_HUNGER);
5853 if (p_ptr->redraw & (PR_STATE))
5855 p_ptr->redraw &= ~(PR_STATE);
5859 if (p_ptr->redraw & (PR_SPEED))
5861 p_ptr->redraw &= ~(PR_SPEED);
5865 if (p_ptr->pclass == CLASS_IMITATOR)
5867 if (p_ptr->redraw & (PR_MANE))
5869 p_ptr->redraw &= ~(PR_MANE);
5873 else if (p_ptr->redraw & (PR_STUDY))
5875 p_ptr->redraw &= ~(PR_STUDY);
5882 * Handle "p_ptr->window"
5884 void window_stuff(void)
5892 if (!p_ptr->window) return;
5895 for (j = 0; j < 8; j++)
5897 /* Save usable flags */
5898 if (angband_term[j]) mask |= window_flag[j];
5901 /* Apply usable flags */
5902 p_ptr->window &= mask;
5905 if (!p_ptr->window) return;
5908 /* Display inventory */
5909 if (p_ptr->window & (PW_INVEN))
5911 p_ptr->window &= ~(PW_INVEN);
5915 /* Display equipment */
5916 if (p_ptr->window & (PW_EQUIP))
5918 p_ptr->window &= ~(PW_EQUIP);
5922 /* Display spell list */
5923 if (p_ptr->window & (PW_SPELL))
5925 p_ptr->window &= ~(PW_SPELL);
5929 /* Display player */
5930 if (p_ptr->window & (PW_PLAYER))
5932 p_ptr->window &= ~(PW_PLAYER);
5936 /* Display overhead view */
5937 if (p_ptr->window & (PW_MESSAGE))
5939 p_ptr->window &= ~(PW_MESSAGE);
5943 /* Display overhead view */
5944 if (p_ptr->window & (PW_OVERHEAD))
5946 p_ptr->window &= ~(PW_OVERHEAD);
5950 /* Display overhead view */
5951 if (p_ptr->window & (PW_DUNGEON))
5953 p_ptr->window &= ~(PW_DUNGEON);
5957 /* Display monster recall */
5958 if (p_ptr->window & (PW_MONSTER))
5960 p_ptr->window &= ~(PW_MONSTER);
5964 /* Display object recall */
5965 if (p_ptr->window & (PW_OBJECT))
5967 p_ptr->window &= ~(PW_OBJECT);
5974 * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
5976 void handle_stuff(void)
5979 if (p_ptr->update) update_stuff();
5982 if (p_ptr->redraw) redraw_stuff();
5985 if (p_ptr->window) window_stuff();
5989 s16b empty_hands(bool is_monk)
5992 if (is_monk && (p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_BERSERKER)) return FALSE;
5994 if (!(inventory[INVEN_RARM].k_idx)) kaerichi +=2;
5995 if (!(inventory[INVEN_LARM].k_idx)) kaerichi +=1;
6000 bool heavy_armor(void)
6002 u16b monk_arm_wgt = 0;
6004 if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE;
6006 /* Weight the armor */
6007 if(inventory[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_RARM].weight;
6008 if(inventory[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_LARM].weight;
6009 monk_arm_wgt += inventory[INVEN_BODY].weight;
6010 monk_arm_wgt += inventory[INVEN_HEAD].weight;
6011 monk_arm_wgt += inventory[INVEN_OUTER].weight;
6012 monk_arm_wgt += inventory[INVEN_HANDS].weight;
6013 monk_arm_wgt += inventory[INVEN_FEET].weight;
6015 return (monk_arm_wgt > (100 + (p_ptr->lev * 4)));
6018 int number_of_quests(void)
6022 /* Clear the counter */
6025 for (j = MIN_RANDOM_QUEST; j < MAX_RANDOM_QUEST+1; j++)
6027 if (quest[j].status != QUEST_STATUS_UNTAKEN)
6029 /* Increment count of quests taken. */
6034 /* Return the number of quests taken */