5 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
7 * This software may be copied and distributed for educational, research,
8 * and not for profit purposes provided that this copyright and statement
9 * are included in all such copies. Other copyrights may also apply.
12 /* Purpose: misc code */
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 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
133 s32b turn_in_today = (turn + A_DAY / 4) % A_DAY;
135 switch (p_ptr->start_race)
141 *day = (turn - A_DAY * 3 / 4) / A_DAY + 1;
144 *day = (turn + A_DAY / 4) / A_DAY + 1;
147 *hour = (24 * turn_in_today / A_DAY) % 24;
148 *min = (1440 * turn_in_today / A_DAY) % 60;
158 /* Dump 13 spaces to clear */
159 c_put_str(TERM_WHITE, " ", ROW_DAY, COL_DAY);
161 extract_day_hour_min(&day, &hour, &min);
163 /* Dump the info itself */
165 if (day < 1000) c_put_str(TERM_WHITE, format("%2dÆüÌÜ", day), ROW_DAY, COL_DAY);
166 else c_put_str(TERM_WHITE, "***ÆüÌÜ", ROW_DAY, COL_DAY);
168 if (day < 1000) c_put_str(TERM_WHITE, format("Day%3d", day), ROW_DAY, COL_DAY);
169 else c_put_str(TERM_WHITE, "Day***", ROW_DAY, COL_DAY);
172 c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
178 if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)
179 && (quest[p_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
185 else if (p_ptr->wild_mode)
191 else if (p_ptr->inside_arena)
197 else if (p_ptr->inside_battle)
201 return "Monster Arena";
203 else if (!dun_level && p_ptr->town_num)
204 return town[p_ptr->town_num].name;
206 return d_name+d_info[dungeon_type].name;
212 static void prt_dungeon(void)
217 /* Dump 13 spaces to clear */
218 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
220 dungeon_name = map_name();
222 col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
223 if (col < 0) col = 0;
225 /* Dump the info itself */
226 c_put_str(TERM_L_UMBER, format("%s",dungeon_name),
234 * Print character stat in given row, column
236 static void prt_stat(int stat)
240 /* Display "injured" stat */
241 if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
243 put_str(stat_names_reduced[stat], ROW_STAT + stat, 0);
244 cnv_stat(p_ptr->stat_use[stat], tmp);
245 c_put_str(TERM_YELLOW, tmp, ROW_STAT + stat, COL_STAT + 6);
248 /* Display "healthy" stat */
251 put_str(stat_names[stat], ROW_STAT + stat, 0);
252 cnv_stat(p_ptr->stat_use[stat], tmp);
253 c_put_str(TERM_L_GREEN, tmp, ROW_STAT + stat, COL_STAT + 6);
256 /* Indicate natural maximum */
257 if (p_ptr->stat_max[stat] == p_ptr->stat_max_max[stat])
260 /* ÆüËܸì¤Ë¤«¤Ö¤é¤Ê¤¤¤è¤¦¤Ëɽ¼¨°ÌÃÖ¤òÊѹ¹ */
261 put_str("!", ROW_STAT + stat, 5);
263 put_str("!", ROW_STAT + stat, 3);
271 * Data structure for status bar
273 #define BAR_TSUYOSHI 0
274 #define BAR_HALLUCINATION 1
275 #define BAR_BLINDNESS 2
276 #define BAR_PARALYZE 3
277 #define BAR_CONFUSE 4
278 #define BAR_POISONED 5
280 #define BAR_LEVITATE 7
281 #define BAR_REFLECTION 8
282 #define BAR_PASSWALL 9
283 #define BAR_WRAITH 10
284 #define BAR_PROTEVIL 11
285 #define BAR_KAWARIMI 12
286 #define BAR_MAGICDEFENSE 13
287 #define BAR_EXPAND 14
288 #define BAR_STONESKIN 15
289 #define BAR_MULTISHADOW 16
290 #define BAR_REGMAGIC 17
291 #define BAR_ULTIMATE 18
292 #define BAR_INVULN 19
293 #define BAR_IMMACID 20
294 #define BAR_RESACID 21
295 #define BAR_IMMELEC 22
296 #define BAR_RESELEC 23
297 #define BAR_IMMFIRE 24
298 #define BAR_RESFIRE 25
299 #define BAR_IMMCOLD 26
300 #define BAR_RESCOLD 27
301 #define BAR_RESPOIS 28
302 #define BAR_RESNETH 29
303 #define BAR_RESTIME 30
304 #define BAR_DUSTROBE 31
305 #define BAR_SHFIRE 32
307 #define BAR_SHHOLY 34
308 #define BAR_EYEEYE 35
309 #define BAR_BLESSED 36
310 #define BAR_HEROISM 37
311 #define BAR_BERSERK 38
312 #define BAR_ATTKFIRE 39
313 #define BAR_ATTKCOLD 40
314 #define BAR_ATTKELEC 41
315 #define BAR_ATTKACID 42
316 #define BAR_ATTKPOIS 43
317 #define BAR_ATTKCONF 44
318 #define BAR_SENSEUNSEEN 45
319 #define BAR_TELEPATHY 46
320 #define BAR_REGENERATION 47
321 #define BAR_INFRAVISION 48
322 #define BAR_STEALTH 49
323 #define BAR_SUPERSTEALTH 50
324 #define BAR_RECALL 51
326 #define BAR_SHCOLD 53
327 #define BAR_SHELEC 54
328 #define BAR_SHSHADOW 55
331 #define BAR_ANTIMULTI 58
332 #define BAR_ANTITELE 59
333 #define BAR_ANTIMAGIC 60
334 #define BAR_PATIENCE 61
335 #define BAR_REVENGE 62
336 #define BAR_RUNESWORD 63
337 #define BAR_VAMPILIC 64
339 #define BAR_ESP_EVIL 66
348 {TERM_YELLOW, "¤Ä", "¤Ä¤è¤·"},
349 {TERM_VIOLET, "¸¸", "¸¸³Ð"},
350 {TERM_L_DARK, "ÌÕ", "ÌÕÌÜ"},
351 {TERM_RED, "áã", "Ëãáã"},
352 {TERM_VIOLET, "Íð", "º®Íð"},
353 {TERM_GREEN, "ÆÇ", "ÆÇ"},
354 {TERM_BLUE, "¶²", "¶²ÉÝ"},
355 {TERM_L_BLUE, "Éâ", "ÉâÍ·"},
356 {TERM_SLATE, "È¿", "È¿¼Í"},
357 {TERM_SLATE, "ÊÉ", "ÊÉÈ´¤±"},
358 {TERM_L_DARK, "Í©", "Í©ÂÎ"},
359 {TERM_SLATE, "¼Ù", "ËɼÙ"},
360 {TERM_VIOLET, "ÊÑ", "ÊѤï¤ê¿È"},
361 {TERM_YELLOW, "Ëâ", "ËâË¡³»"},
362 {TERM_L_UMBER, "¿", "¿¤Ó"},
363 {TERM_WHITE, "ÀÐ", "ÀÐÈ©"},
364 {TERM_L_BLUE, "ʬ", "ʬ¿È"},
365 {TERM_SLATE, "ËÉ", "ËâË¡Ëɸæ"},
366 {TERM_YELLOW, "µæ", "µæ¶Ë"},
367 {TERM_YELLOW, "̵", "̵Ũ"},
368 {TERM_L_GREEN, "»À", "»ÀÌȱÖ"},
369 {TERM_GREEN, "»À", "ÂÑ»À"},
370 {TERM_L_BLUE, "ÅÅ", "ÅÅÌȱÖ"},
371 {TERM_BLUE, "ÅÅ", "ÂÑÅÅ"},
372 {TERM_L_RED, "²Ð", "²ÐÌȱÖ"},
373 {TERM_RED, "²Ð", "ÂѲÐ"},
374 {TERM_WHITE, "Îä", "ÎäÌȱÖ"},
375 {TERM_SLATE, "Îä", "ÂÑÎä"},
376 {TERM_GREEN, "ÆÇ", "ÂÑÆÇ"},
377 {TERM_L_DARK, "¹ö", "ÂÑÃϹö"},
378 {TERM_L_BLUE, "»þ", "ÂÑ»þ´Ö"},
379 {TERM_L_DARK, "¶À", "¶À¥ª¡¼¥é"},
380 {TERM_L_RED, "¥ª", "²Ð¥ª¡¼¥é"},
381 {TERM_WHITE, "Æ®", "Æ®µ¤"},
382 {TERM_WHITE, "À»", "À»¥ª¡¼¥é"},
383 {TERM_VIOLET, "ÌÜ", "ÌܤˤÏÌÜ"},
384 {TERM_WHITE, "½Ë", "½ËÊ¡"},
385 {TERM_WHITE, "ͦ", "ͦ"},
386 {TERM_RED, "¶¸", "¶¸Íð"},
387 {TERM_L_RED, "²Ð", "Ëâ·õ²Ð"},
388 {TERM_WHITE, "Îä", "Ëâ·õÎä"},
389 {TERM_L_BLUE, "ÅÅ", "Ëâ·õÅÅ"},
390 {TERM_SLATE, "»À", "Ëâ·õ»À"},
391 {TERM_L_GREEN, "ÆÇ", "Ëâ·õÆÇ"},
392 {TERM_RED, "Íð", "º®ÍðÂÇ·â"},
393 {TERM_L_BLUE, "»ë", "Æ©ÌÀ»ë"},
394 {TERM_ORANGE, "¥Æ", "¥Æ¥ì¥Ñ¥·"},
395 {TERM_L_BLUE, "²ó", "²óÉü"},
396 {TERM_L_RED, "ÀÖ", "ÀÖ³°"},
397 {TERM_UMBER, "±£", "±£Ì©"},
398 {TERM_YELLOW, "±£", "Ķ±£Ì©"},
399 {TERM_WHITE, "µ¢", "µ¢´Ô"},
400 {TERM_WHITE, "¸½", "¸½¼ÂÊÑÍÆ"},
402 {TERM_WHITE, "¥ª", "ɹ¥ª¡¼¥é"},
403 {TERM_BLUE, "¥ª", "ÅÅ¥ª¡¼¥é"},
404 {TERM_L_DARK, "¥ª", "±Æ¥ª¡¼¥é"},
405 {TERM_YELLOW, "ÏÓ", "ÏÓÎ϶¯²½"},
406 {TERM_RED, "Æù", "ÆùÂζ¯²½"},
407 {TERM_L_DARK, "¿£", "È¿Áý¿£"},
408 {TERM_ORANGE, "¥Æ", "È¿¥Æ¥ì¥Ý"},
409 {TERM_RED, "Ëâ", "È¿ËâË¡"},
410 {TERM_SLATE, "²æ", "²æËý"},
411 {TERM_SLATE, "Àë", "Àë¹ð"},
412 {TERM_L_DARK, "·õ", "Ëâ·õ²½"},
413 {TERM_RED, "µÛ", "µÛ·ìÂÇ·â"},
414 {TERM_WHITE, "²ó", "²óÉü"},
415 {TERM_L_DARK, "´¶", "¼Ù°´¶ÃÎ"},
420 {TERM_YELLOW, "Ts", "Tsuyoshi"},
421 {TERM_VIOLET, "Ha", "Halluc"},
422 {TERM_L_DARK, "Bl", "Blind"},
423 {TERM_RED, "Pa", "Paralyzed"},
424 {TERM_VIOLET, "Cf", "Confused"},
425 {TERM_GREEN, "Po", "Poisoned"},
426 {TERM_BLUE, "Af", "Afraid"},
427 {TERM_L_BLUE, "Lv", "Levit"},
428 {TERM_SLATE, "Rf", "Reflect"},
429 {TERM_SLATE, "Pw", "PassWall"},
430 {TERM_L_DARK, "Wr", "Wraith"},
431 {TERM_SLATE, "Ev", "PrtEvl"},
432 {TERM_VIOLET, "Kw", "Kawarimi"},
433 {TERM_YELLOW, "Md", "MgcArm"},
434 {TERM_L_UMBER, "Eh", "Expand"},
435 {TERM_WHITE, "Ss", "StnSkn"},
436 {TERM_L_BLUE, "Ms", "MltShdw"},
437 {TERM_SLATE, "Rm", "ResMag"},
438 {TERM_YELLOW, "Ul", "Ultima"},
439 {TERM_YELLOW, "Iv", "Invuln"},
440 {TERM_L_GREEN, "IAc", "ImmAcid"},
441 {TERM_GREEN, "Ac", "Acid"},
442 {TERM_L_BLUE, "IEl", "ImmElec"},
443 {TERM_BLUE, "El", "Elec"},
444 {TERM_L_RED, "IFi", "ImmFire"},
445 {TERM_RED, "Fi", "Fire"},
446 {TERM_WHITE, "ICo", "ImmCold"},
447 {TERM_SLATE, "Co", "Cold"},
448 {TERM_GREEN, "Po", "Pois"},
449 {TERM_L_DARK, "Nt", "Nthr"},
450 {TERM_L_BLUE, "Ti", "Time"},
451 {TERM_L_DARK, "Mr", "Mirr"},
452 {TERM_L_RED, "SFi", "SFire"},
453 {TERM_WHITE, "Fo", "Force"},
454 {TERM_WHITE, "Ho", "Holy"},
455 {TERM_VIOLET, "Ee", "EyeEye"},
456 {TERM_WHITE, "Bs", "Bless"},
457 {TERM_WHITE, "He", "Hero"},
458 {TERM_RED, "Br", "Berserk"},
459 {TERM_L_RED, "BFi", "BFire"},
460 {TERM_WHITE, "BCo", "BCold"},
461 {TERM_L_BLUE, "BEl", "BElec"},
462 {TERM_SLATE, "BAc", "BAcid"},
463 {TERM_L_GREEN, "BPo", "BPois"},
464 {TERM_RED, "TCf", "TchCnf"},
465 {TERM_L_BLUE, "Se", "SInv"},
466 {TERM_ORANGE, "Te", "Telepa"},
467 {TERM_L_BLUE, "Rg", "Regen"},
468 {TERM_L_RED, "If", "Infr"},
469 {TERM_UMBER, "Sl", "Stealth"},
470 {TERM_YELLOW, "Stlt", "Stealth"},
471 {TERM_WHITE, "Rc", "Recall"},
472 {TERM_WHITE, "Al", "Alter"},
474 {TERM_WHITE, "SCo", "SCold"},
475 {TERM_BLUE, "SEl", "SElec"},
476 {TERM_L_DARK, "SSh", "SShadow"},
477 {TERM_YELLOW, "EMi", "ExMight"},
478 {TERM_RED, "Bu", "BuildUp"},
479 {TERM_L_DARK, "AMl", "AntiMulti"},
480 {TERM_ORANGE, "AT", "AntiTele"},
481 {TERM_RED, "AM", "AntiMagic"},
482 {TERM_SLATE, "Pa", "Patience"},
483 {TERM_SLATE, "Rv", "Revenge"},
484 {TERM_L_DARK, "Rs", "RuneSword"},
485 {TERM_RED, "Vm", "Vampiric"},
486 {TERM_WHITE, "Cu", "Cure"},
487 {TERM_L_DARK, "ET", "EvilTele"},
492 #define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
493 #define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
499 static void prt_status(void)
502 int wid, hgt, row_statbar, max_col_statbar;
503 int i, col = 0, num = 0;
506 Term_get_size(&wid, &hgt);
507 row_statbar = hgt + ROW_STATBAR;
508 max_col_statbar = wid + MAX_COL_STATBAR;
510 Term_erase(0, row_statbar, max_col_statbar);
512 bar_flags[0] = bar_flags[1] = bar_flags[2] = 0L;
515 if (p_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
518 if (p_ptr->image) ADD_FLG(BAR_HALLUCINATION);
521 if (p_ptr->blind) ADD_FLG(BAR_BLINDNESS);
524 if (p_ptr->paralyzed) ADD_FLG(BAR_PARALYZE);
527 if (p_ptr->confused) ADD_FLG(BAR_CONFUSE);
530 if (p_ptr->poisoned) ADD_FLG(BAR_POISONED);
532 /* Times see-invisible */
533 if (p_ptr->tim_invis) ADD_FLG(BAR_SENSEUNSEEN);
536 if (IS_TIM_ESP()) ADD_FLG(BAR_TELEPATHY);
538 /* Timed regenerate */
539 if (p_ptr->tim_regen) ADD_FLG(BAR_REGENERATION);
541 /* Timed infra-vision */
542 if (p_ptr->tim_infra) ADD_FLG(BAR_INFRAVISION);
544 /* Protection from evil */
545 if (p_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
547 /* Invulnerability */
548 if (IS_INVULN()) ADD_FLG(BAR_INVULN);
551 if (p_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
554 if (p_ptr->kabenuke) ADD_FLG(BAR_PASSWALL);
556 if (p_ptr->tim_reflect) ADD_FLG(BAR_REFLECTION);
559 if (IS_HERO()) ADD_FLG(BAR_HEROISM);
561 /* Super Heroism / berserk */
562 if (p_ptr->shero) ADD_FLG(BAR_BERSERK);
565 if (IS_BLESSED()) ADD_FLG(BAR_BLESSED);
568 if (p_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);
570 if (p_ptr->tsubureru) ADD_FLG(BAR_EXPAND);
572 if (p_ptr->shield) ADD_FLG(BAR_STONESKIN);
574 if (p_ptr->special_defense & NINJA_KAWARIMI) ADD_FLG(BAR_KAWARIMI);
577 if (p_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
578 if (IS_OPPOSE_ACID()) ADD_FLG(BAR_RESACID);
580 /* Oppose Lightning */
581 if (p_ptr->special_defense & DEFENSE_ELEC) ADD_FLG(BAR_IMMELEC);
582 if (IS_OPPOSE_ELEC()) ADD_FLG(BAR_RESELEC);
585 if (p_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
586 if (IS_OPPOSE_FIRE()) ADD_FLG(BAR_RESFIRE);
589 if (p_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
590 if (IS_OPPOSE_COLD()) ADD_FLG(BAR_RESCOLD);
593 if (IS_OPPOSE_POIS()) ADD_FLG(BAR_RESPOIS);
596 if (p_ptr->word_recall) ADD_FLG(BAR_RECALL);
599 if (p_ptr->alter_reality) ADD_FLG(BAR_ALTER);
602 if (p_ptr->afraid) ADD_FLG(BAR_AFRAID);
605 if (p_ptr->tim_res_time) ADD_FLG(BAR_RESTIME);
607 if (p_ptr->multishadow) ADD_FLG(BAR_MULTISHADOW);
609 /* Confusing Hands */
610 if (p_ptr->special_attack & ATTACK_CONFUSE) ADD_FLG(BAR_ATTKCONF);
612 if (p_ptr->resist_magic) ADD_FLG(BAR_REGMAGIC);
614 /* Ultimate-resistance */
615 if (p_ptr->ult_res) ADD_FLG(BAR_ULTIMATE);
618 if (p_ptr->tim_levitation) ADD_FLG(BAR_LEVITATE);
620 if (p_ptr->tim_res_nether) ADD_FLG(BAR_RESNETH);
622 if (p_ptr->dustrobe) ADD_FLG(BAR_DUSTROBE);
625 if (p_ptr->special_attack & ATTACK_FIRE) ADD_FLG(BAR_ATTKFIRE);
626 if (p_ptr->special_attack & ATTACK_COLD) ADD_FLG(BAR_ATTKCOLD);
627 if (p_ptr->special_attack & ATTACK_ELEC) ADD_FLG(BAR_ATTKELEC);
628 if (p_ptr->special_attack & ATTACK_ACID) ADD_FLG(BAR_ATTKACID);
629 if (p_ptr->special_attack & ATTACK_POIS) ADD_FLG(BAR_ATTKPOIS);
630 if (p_ptr->special_defense & NINJA_S_STEALTH) ADD_FLG(BAR_SUPERSTEALTH);
632 if (p_ptr->tim_sh_fire) ADD_FLG(BAR_SHFIRE);
635 if (IS_TIM_STEALTH()) ADD_FLG(BAR_STEALTH);
637 if (p_ptr->tim_sh_touki) ADD_FLG(BAR_TOUKI);
640 if (p_ptr->tim_sh_holy) ADD_FLG(BAR_SHHOLY);
642 /* An Eye for an Eye */
643 if (p_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
646 if (p_ptr->realm1 == REALM_HEX)
648 if (hex_spelling(HEX_BLESS)) ADD_FLG(BAR_BLESSED);
649 if (hex_spelling(HEX_DEMON_AURA)) { ADD_FLG(BAR_SHFIRE); ADD_FLG(BAR_REGENERATION); }
650 if (hex_spelling(HEX_XTRA_MIGHT)) ADD_FLG(BAR_MIGHT);
651 if (hex_spelling(HEX_DETECT_EVIL)) ADD_FLG(BAR_ESP_EVIL);
652 if (hex_spelling(HEX_ICE_ARMOR)) ADD_FLG(BAR_SHCOLD);
653 if (hex_spelling(HEX_RUNESWORD)) ADD_FLG(BAR_RUNESWORD);
654 if (hex_spelling(HEX_BUILDING)) ADD_FLG(BAR_BUILD);
655 if (hex_spelling(HEX_ANTI_TELE)) ADD_FLG(BAR_ANTITELE);
656 if (hex_spelling(HEX_SHOCK_CLOAK)) ADD_FLG(BAR_SHELEC);
657 if (hex_spelling(HEX_SHADOW_CLOAK)) ADD_FLG(BAR_SHSHADOW);
658 if (hex_spelling(HEX_CONFUSION)) ADD_FLG(BAR_ATTKCONF);
659 if (hex_spelling(HEX_EYE_FOR_EYE)) ADD_FLG(BAR_EYEEYE);
660 if (hex_spelling(HEX_ANTI_MULTI)) ADD_FLG(BAR_ANTIMULTI);
661 if (hex_spelling(HEX_VAMP_BLADE)) ADD_FLG(BAR_VAMPILIC);
662 if (hex_spelling(HEX_ANTI_MAGIC)) ADD_FLG(BAR_ANTIMAGIC);
663 if (hex_spelling(HEX_CURE_LIGHT) ||
664 hex_spelling(HEX_CURE_SERIOUS) ||
665 hex_spelling(HEX_CURE_CRITICAL)) ADD_FLG(BAR_CURE);
667 if (p_ptr->magic_num2[2])
669 if (p_ptr->magic_num2[1] == 1) ADD_FLG(BAR_PATIENCE);
670 if (p_ptr->magic_num2[1] == 2) ADD_FLG(BAR_REVENGE);
674 /* Calcurate length */
675 for (i = 0; bar[i].sstr; i++)
679 col += strlen(bar[i].lstr) + 1;
684 /* If there are not excess spaces for long strings, use short one */
685 if (col - 1 > max_col_statbar)
690 for (i = 0; bar[i].sstr; i++)
694 col += strlen(bar[i].sstr);
698 /* If there are excess spaces for short string, use more */
699 if (col - 1 <= max_col_statbar - (num-1))
707 /* Centering display column */
708 col = (max_col_statbar - col) / 2;
710 /* Display status bar */
711 for (i = 0; bar[i].sstr; i++)
716 if (space == 2) str = bar[i].lstr;
717 else str = bar[i].sstr;
719 c_put_str(bar[i].attr, str, row_statbar, col);
721 if (space > 0) col++;
722 if (col > max_col_statbar) break;
730 * Prints "title", including "wizard" or "winner" as needed.
732 static void prt_title(void)
741 /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½ ¾Î¹æ */
750 else if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
752 if (p_ptr->arena_number > MAX_ARENA_MONS + 2)
755 /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½ ¾Î¹æ */
764 /* ±ÑÆüÀÚ¤êÂؤ¨µ¡Ç½ ¾Î¹æ */
775 my_strcpy(str, player_title[p_ptr->pclass][(p_ptr->lev - 1) / 5], sizeof(str));
779 prt_field(p, ROW_TITLE, COL_TITLE);
786 static void prt_level(void)
791 sprintf(tmp, "%5d", p_ptr->lev);
793 sprintf(tmp, "%6d", p_ptr->lev);
797 if (p_ptr->lev >= p_ptr->max_plv)
800 put_str("¥ì¥Ù¥ë ", ROW_LEVEL, 0);
801 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 7);
803 put_str("LEVEL ", ROW_LEVEL, 0);
804 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 6);
811 put_str("x¥ì¥Ù¥ë", ROW_LEVEL, 0);
812 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 7);
814 put_str("Level ", ROW_LEVEL, 0);
815 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 6);
823 * Display the experience
825 static void prt_exp(void)
829 if ((!exp_need)||(p_ptr->prace == RACE_ANDROID))
832 (void)sprintf(out_val, "%7ld", (long)p_ptr->exp);
834 (void)sprintf(out_val, "%8ld", (long)p_ptr->exp);
839 if (p_ptr->lev >= PY_MAX_LEVEL)
841 (void)sprintf(out_val, "********");
846 (void)sprintf(out_val, "%7ld", (long)(player_exp [p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp);
848 (void)sprintf(out_val, "%8ld", (long)(player_exp [p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp);
853 if (p_ptr->exp >= p_ptr->max_exp)
856 if (p_ptr->prace == RACE_ANDROID) put_str("¶¯²½ ", ROW_EXP, 0);
857 else put_str("·Ð¸³ ", ROW_EXP, 0);
858 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 5);
860 if (p_ptr->prace == RACE_ANDROID) put_str("Cst ", ROW_EXP, 0);
861 else put_str("EXP ", ROW_EXP, 0);
862 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 4);
869 put_str("x·Ð¸³", ROW_EXP, 0);
870 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 5);
872 put_str("Exp ", ROW_EXP, 0);
873 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 4);
880 * Prints current gold
882 static void prt_gold(void)
887 put_str("¡ð ", ROW_GOLD, COL_GOLD);
889 put_str("AU ", ROW_GOLD, COL_GOLD);
892 sprintf(tmp, "%9ld", (long)p_ptr->au);
893 c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
901 static void prt_ac(void)
906 /* AC ¤Îɽ¼¨Êý¼°¤òÊѹ¹¤·¤Æ¤¤¤ë */
907 put_str(" £Á£Ã( )", ROW_AC, COL_AC);
908 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
909 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 6);
911 put_str("Cur AC ", ROW_AC, COL_AC);
912 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
913 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 7);
920 * Prints Cur/Max hit points
922 static void prt_hp(void)
924 /* ¥Ò¥Ã¥È¥Ý¥¤¥ó¥È¤Îɽ¼¨ÊýË¡¤òÊѹ¹ */
930 /* put_str(" £È£Ð¡¦£Í£Ð", ROW_HPMP, COL_HPMP); */
932 put_str("HP", ROW_CURHP, COL_CURHP);
934 /* ¸½ºß¤Î¥Ò¥Ã¥È¥Ý¥¤¥ó¥È */
935 sprintf(tmp, "%4ld", (long int)p_ptr->chp);
937 if (p_ptr->chp >= p_ptr->mhp)
939 color = TERM_L_GREEN;
941 else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
950 c_put_str(color, tmp, ROW_CURHP, COL_CURHP+3);
953 put_str( "/", ROW_CURHP, COL_CURHP + 7 );
955 /* ºÇÂç¥Ò¥Ã¥È¥Ý¥¤¥ó¥È */
956 sprintf(tmp, "%4ld", (long int)p_ptr->mhp);
957 color = TERM_L_GREEN;
959 c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
964 * Prints players max/cur spell points
966 static void prt_sp(void)
968 /* ¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È¤Îɽ¼¨ÊýË¡¤òÊѹ¹¤·¤Æ¤¤¤ë */
973 /* Do not show mana unless it matters */
974 if (!mp_ptr->spell_book) return;
977 /* put_str(" £Í£Ð / ºÇÂç", ROW_MAXSP, COL_MAXSP); */
980 put_str("MP", ROW_CURSP, COL_CURSP);
982 put_str("SP", ROW_CURSP, COL_CURSP);
985 /* ¸½ºß¤Î¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È */
986 sprintf(tmp, "%4ld", (long int)p_ptr->csp);
988 if (p_ptr->csp >= p_ptr->msp)
990 color = TERM_L_GREEN;
992 else if (p_ptr->csp > (p_ptr->msp * mana_warn) / 10)
1001 c_put_str(color, tmp, ROW_CURSP, COL_CURSP+3);
1004 put_str( "/", ROW_CURSP, COL_CURSP + 7 );
1006 /* ºÇÂç¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È */
1007 sprintf(tmp, "%4ld", (long int)p_ptr->msp);
1008 color = TERM_L_GREEN;
1010 c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
1015 * Prints depth in stat area
1017 static void prt_depth(void)
1020 int wid, hgt, row_depth, col_depth;
1021 byte attr = TERM_WHITE;
1023 Term_get_size(&wid, &hgt);
1024 col_depth = wid + COL_DEPTH;
1025 row_depth = hgt + ROW_DEPTH;
1030 strcpy(depths, "ÃϾå");
1032 strcpy(depths, "Surf.");
1035 else if (p_ptr->inside_quest && !dungeon_type)
1038 strcpy(depths, "ÃϾå");
1040 strcpy(depths, "Quest");
1046 if (depth_in_feet) (void)sprintf(depths, "%d ft", dun_level * 50);
1047 else (void)sprintf(depths, "%d ³¬", dun_level);
1049 if (depth_in_feet) (void)sprintf(depths, "%d ft", dun_level * 50);
1050 else (void)sprintf(depths, "Lev %d", dun_level);
1054 /* Get color of level based on feeling -JSV- */
1055 switch (p_ptr->feeling)
1057 case 0: attr = TERM_SLATE; break; /* Unknown */
1058 case 1: attr = TERM_L_BLUE; break; /* Special */
1059 case 2: attr = TERM_VIOLET; break; /* Horrible visions */
1060 case 3: attr = TERM_RED; break; /* Very dangerous */
1061 case 4: attr = TERM_L_RED; break; /* Very bad feeling */
1062 case 5: attr = TERM_ORANGE; break; /* Bad feeling */
1063 case 6: attr = TERM_YELLOW; break; /* Nervous */
1064 case 7: attr = TERM_L_UMBER; break; /* Luck is turning */
1065 case 8: attr = TERM_L_WHITE; break; /* Don't like */
1066 case 9: attr = TERM_WHITE; break; /* Reasonably safe */
1067 case 10: attr = TERM_WHITE; break; /* Boring place */
1071 /* Right-Adjust the "depth", and clear old values */
1072 c_prt(attr, format("%7s", depths), row_depth, col_depth);
1077 * Prints status of hunger
1079 static void prt_hunger(void)
1081 /* Fainting / Starving */
1082 if (p_ptr->food < PY_FOOD_FAINT)
1085 c_put_str(TERM_RED, "¿ê¼å ", ROW_HUNGRY, COL_HUNGRY);
1087 c_put_str(TERM_RED, "Weak ", ROW_HUNGRY, COL_HUNGRY);
1093 else if (p_ptr->food < PY_FOOD_WEAK)
1096 c_put_str(TERM_ORANGE, "¿ê¼å ", ROW_HUNGRY, COL_HUNGRY);
1098 c_put_str(TERM_ORANGE, "Weak ", ROW_HUNGRY, COL_HUNGRY);
1104 else if (p_ptr->food < PY_FOOD_ALERT)
1107 c_put_str(TERM_YELLOW, "¶õÊ¢ ", ROW_HUNGRY, COL_HUNGRY);
1109 c_put_str(TERM_YELLOW, "Hungry", ROW_HUNGRY, COL_HUNGRY);
1115 else if (p_ptr->food < PY_FOOD_FULL)
1117 c_put_str(TERM_L_GREEN, " ", ROW_HUNGRY, COL_HUNGRY);
1121 else if (p_ptr->food < PY_FOOD_MAX)
1124 c_put_str(TERM_L_GREEN, "ËþÊ¢ ", ROW_HUNGRY, COL_HUNGRY);
1126 c_put_str(TERM_L_GREEN, "Full ", ROW_HUNGRY, COL_HUNGRY);
1135 c_put_str(TERM_GREEN, "¿©²á¤®", ROW_HUNGRY, COL_HUNGRY);
1137 c_put_str(TERM_GREEN, "Gorged", ROW_HUNGRY, COL_HUNGRY);
1145 * Prints Searching, Resting, Paralysis, or 'count' status
1146 * Display is always exactly 10 characters wide (see below)
1148 * This function was a major bottleneck when resting, so a lot of
1149 * the text formatting code was optimized in place below.
1151 static void prt_state(void)
1153 byte attr = TERM_WHITE;
1160 if (command_rep > 999)
1163 sprintf(text, "%2d00", command_rep / 100);
1165 (void)sprintf(text, "%2d00", command_rep / 100);
1172 sprintf(text, " %2d", command_rep);
1174 (void)sprintf(text, " %2d", command_rep);
1183 switch(p_ptr->action)
1188 strcpy(text, "õº÷");
1190 strcpy(text, "Sear");
1198 /* Start with "Rest" */
1206 /* Extensive (timed) rest */
1207 if (resting >= 1000)
1212 text[1] = '0' + (i % 10);
1213 text[0] = '0' + (i / 10);
1216 /* Long (timed) rest */
1217 else if (resting >= 100)
1220 text[3] = '0' + (i % 10);
1222 text[2] = '0' + (i % 10);
1223 text[1] = '0' + (i / 10);
1226 /* Medium (timed) rest */
1227 else if (resting >= 10)
1230 text[3] = '0' + (i % 10);
1231 text[2] = '0' + (i / 10);
1234 /* Short (timed) rest */
1235 else if (resting > 0)
1238 text[3] = '0' + (i);
1241 /* Rest until healed */
1242 else if (resting == -1)
1244 text[0] = text[1] = text[2] = text[3] = '*';
1247 /* Rest until done */
1248 else if (resting == -2)
1250 text[0] = text[1] = text[2] = text[3] = '&';
1257 strcpy(text, "³Ø½¬");
1259 strcpy(text, "lear");
1261 if (new_mane) attr = TERM_L_RED;
1267 strcpy(text, "Äà¤ê");
1269 strcpy(text, "fish");
1276 for (i = 0; i < MAX_KAMAE; i++)
1277 if (p_ptr->special_defense & (KAMAE_GENBU << i)) break;
1280 case 0: attr = TERM_GREEN;break;
1281 case 1: attr = TERM_WHITE;break;
1282 case 2: attr = TERM_L_BLUE;break;
1283 case 3: attr = TERM_L_RED;break;
1285 strcpy(text, kamae_shurui[i].desc);
1291 for (i = 0; i < MAX_KATA; i++)
1292 if (p_ptr->special_defense & (KATA_IAI << i)) break;
1293 strcpy(text, kata_shurui[i].desc);
1299 strcpy(text, "²Î ");
1301 strcpy(text, "Sing");
1305 case ACTION_HAYAGAKE:
1308 strcpy(text, "®¶î");
1310 strcpy(text, "Fast");
1317 strcpy(text, "±Ó¾§");
1319 strcpy(text, "Spel");
1331 /* Display the info (or blanks) */
1332 c_put_str(attr, format("%5.5s",text), ROW_STATE, COL_STATE);
1337 * Prints the speed of a character. -CJS-
1339 static void prt_speed(void)
1341 int i = p_ptr->pspeed;
1342 bool is_fast = IS_FAST();
1344 byte attr = TERM_WHITE;
1346 int wid, hgt, row_speed, col_speed;
1348 Term_get_size(&wid, &hgt);
1349 col_speed = wid + COL_SPEED;
1350 row_speed = hgt + ROW_SPEED;
1352 /* Hack -- Visually "undo" the Search Mode Slowdown */
1353 if (p_ptr->action == ACTION_SEARCH && !p_ptr->lightspeed) i += 10;
1360 monster_type *m_ptr = &m_list[p_ptr->riding];
1361 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1362 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1363 else attr = TERM_GREEN;
1365 else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
1366 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1367 else attr = TERM_L_GREEN;
1369 sprintf(buf, "%s(+%d)", (p_ptr->riding ? "¾èÇÏ" : "²Ã®"), (i - 110));
1371 sprintf(buf, "Fast(+%d)", (i - 110));
1381 monster_type *m_ptr = &m_list[p_ptr->riding];
1382 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1383 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1384 else attr = TERM_RED;
1386 else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
1387 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1388 else attr = TERM_L_UMBER;
1390 sprintf(buf, "%s(-%d)", (p_ptr->riding ? "¾èÇÏ" : "¸ºÂ®"), (110 - i));
1392 sprintf(buf, "Slow(-%d)", (110 - i));
1395 else if (p_ptr->riding)
1399 strcpy(buf, "¾èÇÏÃæ");
1401 strcpy(buf, "Riding");
1405 /* Display the speed */
1406 c_put_str(attr, format("%-9s", buf), row_speed, col_speed);
1410 static void prt_study(void)
1412 int wid, hgt, row_study, col_study;
1414 Term_get_size(&wid, &hgt);
1415 col_study = wid + COL_STUDY;
1416 row_study = hgt + ROW_STUDY;
1418 if (p_ptr->new_spells)
1421 put_str("³Ø½¬", row_study, col_study);
1423 put_str("Stud", row_study, col_study);
1429 put_str(" ", row_study, col_study);
1434 static void prt_imitation(void)
1436 int wid, hgt, row_study, col_study;
1438 Term_get_size(&wid, &hgt);
1439 col_study = wid + COL_STUDY;
1440 row_study = hgt + ROW_STUDY;
1442 if (p_ptr->pclass == CLASS_IMITATOR)
1444 if (p_ptr->mane_num)
1447 if (new_mane) attr = TERM_L_RED;
1448 else attr = TERM_WHITE;
1450 c_put_str(attr, "¤Þ¤Í", row_study, col_study);
1452 c_put_str(attr, "Imit", row_study, col_study);
1457 put_str(" ", row_study, col_study);
1463 static void prt_cut(void)
1470 c_put_str(TERM_L_RED, "Ã×Ì¿½ý ", ROW_CUT, COL_CUT);
1472 c_put_str(TERM_L_RED, "Mortal wound", ROW_CUT, COL_CUT);
1479 c_put_str(TERM_RED, "¤Ò¤É¤¤¿¼¼ê ", ROW_CUT, COL_CUT);
1481 c_put_str(TERM_RED, "Deep gash ", ROW_CUT, COL_CUT);
1488 c_put_str(TERM_RED, "½Å½ý ", ROW_CUT, COL_CUT);
1490 c_put_str(TERM_RED, "Severe cut ", ROW_CUT, COL_CUT);
1497 c_put_str(TERM_ORANGE, "ÂçÊѤʽý ", ROW_CUT, COL_CUT);
1499 c_put_str(TERM_ORANGE, "Nasty cut ", ROW_CUT, COL_CUT);
1506 c_put_str(TERM_ORANGE, "¤Ò¤É¤¤½ý ", ROW_CUT, COL_CUT);
1508 c_put_str(TERM_ORANGE, "Bad cut ", ROW_CUT, COL_CUT);
1515 c_put_str(TERM_YELLOW, "·Ú½ý ", ROW_CUT, COL_CUT);
1517 c_put_str(TERM_YELLOW, "Light cut ", ROW_CUT, COL_CUT);
1524 c_put_str(TERM_YELLOW, "¤«¤¹¤ê½ý ", ROW_CUT, COL_CUT);
1526 c_put_str(TERM_YELLOW, "Graze ", ROW_CUT, COL_CUT);
1532 put_str(" ", ROW_CUT, COL_CUT);
1538 static void prt_stun(void)
1540 int s = p_ptr->stun;
1545 c_put_str(TERM_RED, "°Õ¼±ÉÔÌÀÎÆ ", ROW_STUN, COL_STUN);
1547 c_put_str(TERM_RED, "Knocked out ", ROW_STUN, COL_STUN);
1554 c_put_str(TERM_ORANGE, "¤Ò¤É¤¯Û¯Û° ", ROW_STUN, COL_STUN);
1556 c_put_str(TERM_ORANGE, "Heavy stun ", ROW_STUN, COL_STUN);
1563 c_put_str(TERM_ORANGE, "ۯ۰ ", ROW_STUN, COL_STUN);
1565 c_put_str(TERM_ORANGE, "Stun ", ROW_STUN, COL_STUN);
1571 put_str(" ", ROW_STUN, COL_STUN);
1578 * Redraw the "monster health bar" -DRS-
1579 * Rather extensive modifications by -BEN-
1581 * The "monster health bar" provides visual feedback on the "health"
1582 * of the monster currently being "tracked". There are several ways
1583 * to "track" a monster, including targetting it, attacking it, and
1584 * affecting it (and nobody else) with a ranged attack.
1586 * Display the monster health bar (affectionately known as the
1587 * "health-o-meter"). Clear health bar if nothing is being tracked.
1588 * Auto-track current target monster when bored. Note that the
1589 * health-bar stops tracking any monster that "disappears".
1591 static void health_redraw(bool riding)
1595 monster_type *m_ptr;
1599 health_who = p_ptr->riding;
1600 row = ROW_RIDING_INFO;
1601 col = COL_RIDING_INFO;
1605 health_who = p_ptr->health_who;
1610 m_ptr = &m_list[health_who];
1615 /* Erase the health bar */
1616 Term_erase(col, row, 12);
1619 /* Tracking an unseen monster */
1620 else if (!m_ptr->ml)
1622 /* Indicate that the monster health is "unknown" */
1623 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1626 /* Tracking a hallucinatory monster */
1627 else if (p_ptr->image)
1629 /* Indicate that the monster health is "unknown" */
1630 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1633 /* Tracking a dead monster (???) */
1634 else if (m_ptr->hp < 0)
1636 /* Indicate that the monster health is "unknown" */
1637 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1640 /* Tracking a visible monster */
1643 /* Extract the "percent" of health */
1644 int pct = 100L * m_ptr->hp / m_ptr->maxhp;
1645 int pct2 = 100L * m_ptr->hp / m_ptr->max_maxhp;
1647 /* Convert percent into "health" */
1648 int len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1650 /* Default to almost dead */
1651 byte attr = TERM_RED;
1654 if (MON_INVULNER(m_ptr)) attr = TERM_WHITE;
1657 else if (MON_CSLEEP(m_ptr)) attr = TERM_BLUE;
1660 else if (MON_MONFEAR(m_ptr)) attr = TERM_VIOLET;
1663 else if (pct >= 100) attr = TERM_L_GREEN;
1665 /* Somewhat Wounded */
1666 else if (pct >= 60) attr = TERM_YELLOW;
1669 else if (pct >= 25) attr = TERM_ORANGE;
1672 else if (pct >= 10) attr = TERM_L_RED;
1674 /* Default to "unknown" */
1675 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1677 /* Dump the current "health" (use '*' symbols) */
1678 Term_putstr(col + 1, row, len, attr, "**********");
1685 * Display basic info (mostly left of map)
1687 static void prt_frame_basic(void)
1691 /* Race and Class */
1692 if (p_ptr->mimic_form)
1693 prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
1697 my_strcpy(str, rp_ptr->title, sizeof(str));
1698 prt_field(str, ROW_RACE, COL_RACE);
1700 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
1701 /* prt_field(ap_ptr->title, ROW_SEIKAKU, COL_SEIKAKU); */
1707 /* Level/Experience */
1712 for (i = 0; i < 6; i++) prt_stat(i);
1730 health_redraw(FALSE);
1731 health_redraw(TRUE);
1736 * Display extra info (mostly below map)
1738 static void prt_frame_extra(void)
1763 * Hack -- display inventory in sub-windows
1765 static void fix_inven(void)
1770 for (j = 0; j < 8; j++)
1775 if (!angband_term[j]) continue;
1777 /* No relevant flags */
1778 if (!(window_flag[j] & (PW_INVEN))) continue;
1781 Term_activate(angband_term[j]);
1783 /* Display inventory */
1796 * Print monster info in line
1798 * nnn : number or unique(U) or wanted unique(W)
1799 * X : symbol of monster
1800 * LV : monster lv if known
1801 * name: name of monster
1803 static void print_monster_line(int x, int y, monster_type* m_ptr, int n_same){
1806 int r_idx = m_ptr->ap_r_idx;
1807 monster_race* r_ptr = &r_info[r_idx];
1811 //Number of 'U'nique
1812 if(r_ptr->flags1&RF1_UNIQUE){//unique
1813 bool is_kubi = FALSE;
1814 for(i=0;i<MAX_KUBI;i++){
1815 if(kubi_r_idx[i] == r_idx){
1820 Term_addstr(-1, TERM_WHITE, is_kubi?" W":" U");
1822 sprintf(buf, "%3d", n_same);
1823 Term_addstr(-1, TERM_WHITE, buf);
1826 Term_addstr(-1, TERM_WHITE, " ");
1827 //Term_add_bigch(r_ptr->d_attr, r_ptr->d_char);
1828 //Term_addstr(-1, TERM_WHITE, "/");
1829 Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
1831 if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
1832 sprintf(buf, " %2d", r_ptr->level);
1836 Term_addstr(-1, TERM_WHITE, buf);
1838 sprintf(buf, " %s ", r_name+r_ptr->name);
1839 Term_addstr(-1, TERM_WHITE, buf);
1841 //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
1845 max_lines : ºÇÂ粿¹ÔÉÁ²è¤¹¤ë¤«¡¥
1847 void print_monster_list(int x, int y, int max_lines){
1849 monster_type* last_mons = NULL;
1850 monster_type* m_ptr = NULL;
1854 for(i=0;i<temp_n;i++){
1855 cave_type* c_ptr = &cave[temp_y[i]][temp_x[i]];
1856 if(!c_ptr->m_idx || !m_list[c_ptr->m_idx].ml)continue;//no mons or cannot look
1857 m_ptr = &m_list[c_ptr->m_idx];
1858 if(is_pet(m_ptr))continue;//pet
1859 if(!m_ptr->r_idx)continue;//dead?
1862 int r_idx = m_ptr->ap_r_idx;
1863 monster_race* r_ptr = &r_info[r_idx];
1864 cptr name = (r_name + r_ptr->name);
1865 cptr ename = (r_name + r_ptr->name);
1866 //¥ß¥ß¥Ã¥¯Îà¤ä¡Ö¤½¤ì¡×Åù¤Ï¡¢°ìÍ÷¤Ë½Ð¤Æ¤Ï¤¤¤±¤Ê¤¤
1867 if(r_ptr->flags1&RF1_CHAR_CLEAR)continue;
1868 if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue;
1869 //¡Ø¥Ì¥ë¡Ù¤Ï¡¢°ìÍ÷¤Ë½Ð¤Æ¤Ï¤¤¤±¤Ê¤¤
1870 if((strcmp(name, "À¸¤±¤ëµõ̵¡Ø¥Ì¥ë¡Ù")==0)||
1871 (strcmp(ename, "Null the Living Void")==0))continue;
1872 //"¶â̵¹¤¤Î»ØÎØ"¤Ï¡¢°ìÍ÷¤Ë½Ð¤Æ¤Ï¤¤¤±¤Ê¤¤
1873 if((strcmp(name, "¶â̵¹¤¤Î»ØÎØ")==0)||
1874 (strcmp(ename, "Plain Gold Ring")==0))continue;
1878 //¥½¡¼¥ÈºÑ¤ß¤Ê¤Î¤ÇƱ¤¸¥â¥ó¥¹¥¿¡¼¤ÏϢ³¤¹¤ë¡¥¤³¤ì¤òÍøÍѤ·¤ÆƱ¤¸¥â¥ó¥¹¥¿¡¼¤ò¥«¥¦¥ó¥È¡¤¤Þ¤È¤á¤Æɽ¼¨¤¹¤ë¡¥
1879 if(!last_mons){//ÀèƬ¥â¥ó¥¹¥¿¡¼
1885 if(last_mons->ap_r_idx == m_ptr->ap_r_idx){
1887 continue;//ɽ¼¨½èÍý¤ò¼¡¤Ë²ó¤¹
1889 //print last mons info
1890 print_monster_line(x, line++, last_mons, n_same);
1893 if(line-y-1==max_lines){//»Ä¤ê1¹Ô
1897 if(line-y-1==max_lines && i!=temp_n){
1898 Term_gotoxy(x, line);
1899 Term_addstr(-1, TERM_WHITE, "-- and more --");
1901 if(last_mons)print_monster_line(x, line++, last_mons, n_same);
1905 * Hack -- display monster list in sub-windows
1907 static void fix_monster_list(void)
1913 for (j = 0; j < 8; j++)
1918 if (!angband_term[j]) continue;
1920 /* No relevant flags */
1921 if (!(window_flag[j] & (PW_MONSTER_LIST))) continue;
1924 Term_activate(angband_term[j]);
1925 Term_get_size(&w, &h);
1929 target_set_prepare_look();//¥â¥ó¥¹¥¿¡¼°ìÍ÷¤òÀ¸À®¡¤¥½¡¼¥È
1930 print_monster_list(0, 0, h);
1944 * Hack -- display equipment in sub-windows
1946 static void fix_equip(void)
1951 for (j = 0; j < 8; j++)
1956 if (!angband_term[j]) continue;
1958 /* No relevant flags */
1959 if (!(window_flag[j] & (PW_EQUIP))) continue;
1962 Term_activate(angband_term[j]);
1964 /* Display equipment */
1977 * Hack -- display equipment in sub-windows
1979 static void fix_spell(void)
1984 for (j = 0; j < 8; j++)
1989 if (!angband_term[j]) continue;
1991 /* No relevant flags */
1992 if (!(window_flag[j] & (PW_SPELL))) continue;
1995 Term_activate(angband_term[j]);
1997 /* Display spell list */
1998 display_spell_list();
2010 * Hack -- display character in sub-windows
2012 static void fix_player(void)
2017 for (j = 0; j < 8; j++)
2022 if (!angband_term[j]) continue;
2024 /* No relevant flags */
2025 if (!(window_flag[j] & (PW_PLAYER))) continue;
2028 Term_activate(angband_term[j]);
2032 /* Display player */
2046 * Hack -- display recent messages in sub-windows
2048 * XXX XXX XXX Adjust for width and split messages
2050 static void fix_message(void)
2057 for (j = 0; j < 8; j++)
2062 if (!angband_term[j]) continue;
2064 /* No relevant flags */
2065 if (!(window_flag[j] & (PW_MESSAGE))) continue;
2068 Term_activate(angband_term[j]);
2071 Term_get_size(&w, &h);
2074 for (i = 0; i < h; i++)
2076 /* Dump the message on the appropriate line */
2077 Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
2080 Term_locate(&x, &y);
2082 /* Clear to end of line */
2083 Term_erase(x, y, 255);
2096 * Hack -- display overhead view in sub-windows
2098 * Note that the "player" symbol does NOT appear on the map.
2100 static void fix_overhead(void)
2107 for (j = 0; j < 8; j++)
2113 if (!angband_term[j]) continue;
2115 /* No relevant flags */
2116 if (!(window_flag[j] & (PW_OVERHEAD))) continue;
2119 Term_activate(angband_term[j]);
2121 /* Full map in too small window is useless */
2122 Term_get_size(&wid, &hgt);
2123 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2)
2126 display_map(&cy, &cx);
2139 * Hack -- display dungeon view in sub-windows
2141 static void fix_dungeon(void)
2146 for (j = 0; j < 8; j++)
2151 if (!angband_term[j]) continue;
2153 /* No relevant flags */
2154 if (!(window_flag[j] & (PW_DUNGEON))) continue;
2157 Term_activate(angband_term[j]);
2159 /* Redraw dungeon view */
2172 * Hack -- display monster recall in sub-windows
2174 static void fix_monster(void)
2179 for (j = 0; j < 8; j++)
2184 if (!angband_term[j]) continue;
2186 /* No relevant flags */
2187 if (!(window_flag[j] & (PW_MONSTER))) continue;
2190 Term_activate(angband_term[j]);
2192 /* Display monster race info */
2193 if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
2205 * Hack -- display object recall in sub-windows
2207 static void fix_object(void)
2212 for (j = 0; j < 8; j++)
2217 if (!angband_term[j]) continue;
2219 /* No relevant flags */
2220 if (!(window_flag[j] & (PW_OBJECT))) continue;
2223 Term_activate(angband_term[j]);
2225 /* Display monster race info */
2226 if (p_ptr->object_kind_idx) display_koff(p_ptr->object_kind_idx);
2238 * Calculate number of spells player should have, and forget,
2239 * or remember, spells until that number is properly reflected.
2241 * Note that this function induces various "status" messages,
2242 * which must be bypasses until the character is created.
2244 static void calc_spells(void)
2246 int i, j, k, levels;
2248 int num_boukyaku = 0;
2250 const magic_type *s_ptr;
2257 /* Hack -- must be literate */
2258 if (!mp_ptr->spell_book) return;
2260 /* Hack -- wait for creation */
2261 if (!character_generated) return;
2263 /* Hack -- handle "xtra" mode */
2264 if (character_xtra) return;
2266 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
2268 p_ptr->new_spells = 0;
2272 p = spell_category_name(mp_ptr->spell_book);
2274 /* Determine the number of spells allowed */
2275 levels = p_ptr->lev - mp_ptr->spell_first + 1;
2277 /* Hack -- no negative spells */
2278 if (levels < 0) levels = 0;
2280 /* Extract total allowed spells */
2281 num_allowed = (adj_mag_study[p_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
2283 if ((p_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
2287 if (p_ptr->pclass == CLASS_SAMURAI)
2291 else if (p_ptr->realm2 == REALM_NONE)
2293 num_allowed = (num_allowed+1)/2;
2294 if (num_allowed>(32+bonus)) num_allowed = 32+bonus;
2296 else if ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))
2298 if (num_allowed>(96+bonus)) num_allowed = 96+bonus;
2302 if (num_allowed>(80+bonus)) num_allowed = 80+bonus;
2305 /* Count the number of spells we know */
2306 for (j = 0; j < 64; j++)
2308 /* Count known spells */
2310 (p_ptr->spell_forgotten1 & (1L << j)) :
2311 (p_ptr->spell_forgotten2 & (1L << (j - 32))))
2317 /* See how many spells we must forget or may learn */
2318 p_ptr->new_spells = num_allowed + p_ptr->add_spells + num_boukyaku - p_ptr->learned_spells;
2320 /* Forget spells which are too hard */
2321 for (i = 63; i >= 0; i--)
2323 /* Efficiency -- all done */
2324 if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
2326 /* Access the spell */
2327 j = p_ptr->spell_order[i];
2329 /* Skip non-spells */
2330 if (j >= 99) continue;
2334 if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2))
2337 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j];
2339 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32];
2342 s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2344 s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32];
2346 /* Skip spells we are allowed to know */
2347 if (s_ptr->slevel <= p_ptr->lev) continue;
2351 (p_ptr->spell_learned1 & (1L << j)) :
2352 (p_ptr->spell_learned2 & (1L << (j - 32))))
2354 /* Mark as forgotten */
2357 p_ptr->spell_forgotten1 |= (1L << j);
2358 which = p_ptr->realm1;
2362 p_ptr->spell_forgotten2 |= (1L << (j - 32));
2363 which = p_ptr->realm2;
2366 /* No longer known */
2369 p_ptr->spell_learned1 &= ~(1L << j);
2370 which = p_ptr->realm1;
2374 p_ptr->spell_learned2 &= ~(1L << (j - 32));
2375 which = p_ptr->realm2;
2380 msg_format("%s¤Î%s¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡£",
2381 do_spell(which, j%32, SPELL_NAME), p );
2383 msg_format("You have forgotten the %s of %s.", p,
2384 do_spell(which, j%32, SPELL_NAME));
2388 /* One more can be learned */
2389 p_ptr->new_spells++;
2394 /* Forget spells if we know too many spells */
2395 for (i = 63; i >= 0; i--)
2397 /* Stop when possible */
2398 if (p_ptr->new_spells >= 0) break;
2400 /* Efficiency -- all done */
2401 if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
2403 /* Get the (i+1)th spell learned */
2404 j = p_ptr->spell_order[i];
2406 /* Skip unknown spells */
2407 if (j >= 99) continue;
2409 /* Forget it (if learned) */
2411 (p_ptr->spell_learned1 & (1L << j)) :
2412 (p_ptr->spell_learned2 & (1L << (j - 32))))
2414 /* Mark as forgotten */
2417 p_ptr->spell_forgotten1 |= (1L << j);
2418 which = p_ptr->realm1;
2422 p_ptr->spell_forgotten2 |= (1L << (j - 32));
2423 which = p_ptr->realm2;
2426 /* No longer known */
2429 p_ptr->spell_learned1 &= ~(1L << j);
2430 which = p_ptr->realm1;
2434 p_ptr->spell_learned2 &= ~(1L << (j - 32));
2435 which = p_ptr->realm2;
2440 msg_format("%s¤Î%s¤ò˺¤ì¤Æ¤·¤Þ¤Ã¤¿¡£",
2441 do_spell(which, j%32, SPELL_NAME), p );
2443 msg_format("You have forgotten the %s of %s.", p,
2444 do_spell(which, j%32, SPELL_NAME));
2448 /* One more can be learned */
2449 p_ptr->new_spells++;
2454 /* Check for spells to remember */
2455 for (i = 0; i < 64; i++)
2457 /* None left to remember */
2458 if (p_ptr->new_spells <= 0) break;
2460 /* Efficiency -- all done */
2461 if (!p_ptr->spell_forgotten1 && !p_ptr->spell_forgotten2) break;
2463 /* Get the next spell we learned */
2464 j = p_ptr->spell_order[i];
2466 /* Skip unknown spells */
2469 /* Access the spell */
2470 if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2))
2473 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j];
2475 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32];
2478 s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2480 s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32];
2482 /* Skip spells we cannot remember */
2483 if (s_ptr->slevel > p_ptr->lev) continue;
2485 /* First set of spells */
2487 (p_ptr->spell_forgotten1 & (1L << j)) :
2488 (p_ptr->spell_forgotten2 & (1L << (j - 32))))
2490 /* No longer forgotten */
2493 p_ptr->spell_forgotten1 &= ~(1L << j);
2494 which = p_ptr->realm1;
2498 p_ptr->spell_forgotten2 &= ~(1L << (j - 32));
2499 which = p_ptr->realm2;
2502 /* Known once more */
2505 p_ptr->spell_learned1 |= (1L << j);
2506 which = p_ptr->realm1;
2510 p_ptr->spell_learned2 |= (1L << (j - 32));
2511 which = p_ptr->realm2;
2516 msg_format("%s¤Î%s¤ò»×¤¤½Ð¤·¤¿¡£",
2517 do_spell(which, j%32, SPELL_NAME), p );
2519 msg_format("You have remembered the %s of %s.",
2520 p, do_spell(which, j%32, SPELL_NAME));
2524 /* One less can be learned */
2525 p_ptr->new_spells--;
2531 if (p_ptr->realm2 == REALM_NONE)
2533 /* Count spells that can be learned */
2534 for (j = 0; j < 32; j++)
2536 if (!is_magic(p_ptr->realm1)) s_ptr = &technic_info[p_ptr->realm1-MIN_TECHNIC][j];
2537 else s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2539 /* Skip spells we cannot remember */
2540 if (s_ptr->slevel > p_ptr->lev) continue;
2542 /* Skip spells we already know */
2543 if (p_ptr->spell_learned1 & (1L << j))
2552 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;
2555 if (p_ptr->new_spells < 0) p_ptr->new_spells = 0;
2557 /* Spell count changed */
2558 if (p_ptr->old_spells != p_ptr->new_spells)
2560 /* Message if needed */
2561 if (p_ptr->new_spells)
2565 if( p_ptr->new_spells < 10 ){
2566 msg_format("¤¢¤È %d ¤Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
2568 msg_format("¤¢¤È %d ¸Ä¤Î%s¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells, p);
2571 msg_format("You can learn %d more %s%s.",
2572 p_ptr->new_spells, p,
2573 (p_ptr->new_spells != 1) ? "s" : "");
2578 /* Save the new_spells value */
2579 p_ptr->old_spells = p_ptr->new_spells;
2581 /* Redraw Study Status */
2582 p_ptr->redraw |= (PR_STUDY);
2584 /* Redraw object recall */
2585 p_ptr->window |= (PW_OBJECT);
2591 * Calculate maximum mana. You do not need to know any spells.
2592 * Note that mana is lowered by heavy (or inappropriate) armor.
2594 * This function induces status messages.
2596 static void calc_mana(void)
2598 int msp, levels, cur_wgt, max_wgt;
2603 /* Hack -- Must be literate */
2604 if (!mp_ptr->spell_book) return;
2606 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
2607 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
2608 (p_ptr->pclass == CLASS_BLUE_MAGE))
2610 levels = p_ptr->lev;
2614 if(mp_ptr->spell_first > p_ptr->lev)
2619 /* Display mana later */
2620 p_ptr->redraw |= (PR_MANA);
2624 /* Extract "effective" player level */
2625 levels = (p_ptr->lev - mp_ptr->spell_first) + 1;
2628 if (p_ptr->pclass == CLASS_SAMURAI)
2630 msp = (adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
2631 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
2635 /* Extract total mana */
2636 msp = adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] * (levels+3) / 4;
2638 /* Hack -- usually add one mana */
2641 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
2643 if (msp && (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp/2;
2645 /* Hack: High mages have a 25% mana bonus */
2646 if (msp && (p_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
2648 if (msp && (p_ptr->pclass == CLASS_SORCERER)) msp += msp*(25+p_ptr->lev)/100;
2651 /* Only mages are affected */
2652 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
2654 u32b flgs[TR_FLAG_SIZE];
2656 /* Assume player is not encumbered by gloves */
2657 p_ptr->cumber_glove = FALSE;
2659 /* Get the gloves */
2660 o_ptr = &inventory[INVEN_HANDS];
2662 /* Examine the gloves */
2663 object_flags(o_ptr, flgs);
2665 /* Normal gloves hurt mage-type spells */
2667 !(have_flag(flgs, TR_FREE_ACT)) &&
2668 !(have_flag(flgs, TR_DEC_MANA)) &&
2669 !(have_flag(flgs, TR_EASY_SPELL)) &&
2670 !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) &&
2671 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
2674 p_ptr->cumber_glove = TRUE;
2677 msp = (3 * msp) / 4;
2682 /* Assume player not encumbered by armor */
2683 p_ptr->cumber_armor = FALSE;
2685 /* Weigh the armor */
2687 if(inventory[INVEN_RARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
2688 if(inventory[INVEN_LARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
2689 cur_wgt += inventory[INVEN_BODY].weight;
2690 cur_wgt += inventory[INVEN_HEAD].weight;
2691 cur_wgt += inventory[INVEN_OUTER].weight;
2692 cur_wgt += inventory[INVEN_HANDS].weight;
2693 cur_wgt += inventory[INVEN_FEET].weight;
2695 /* Subtract a percentage of maximum mana. */
2696 switch (p_ptr->pclass)
2698 /* For these classes, mana is halved if armour
2699 * is 30 pounds over their weight limit. */
2701 case CLASS_HIGH_MAGE:
2702 case CLASS_BLUE_MAGE:
2704 case CLASS_FORCETRAINER:
2705 case CLASS_SORCERER:
2707 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
2708 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
2712 /* Mana halved if armour is 40 pounds over weight limit. */
2717 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight*2/3;
2718 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight*2/3;
2722 case CLASS_MINDCRAFTER:
2723 case CLASS_BEASTMASTER:
2724 case CLASS_MIRROR_MASTER:
2726 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/2;
2727 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/2;
2731 /* Mana halved if armour is 50 pounds over weight limit. */
2734 case CLASS_RED_MAGE:
2735 case CLASS_WARRIOR_MAGE:
2737 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/3;
2738 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/3;
2742 /* Mana halved if armour is 60 pounds over weight limit. */
2744 case CLASS_CHAOS_WARRIOR:
2746 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/5;
2747 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/5;
2751 /* For new classes created, but not yet added to this formula. */
2758 /* Determine the weight allowance */
2759 max_wgt = mp_ptr->spell_weight;
2761 /* Heavy armor penalizes mana by a percentage. -LM- */
2762 if ((cur_wgt - max_wgt) > 0)
2765 p_ptr->cumber_armor = TRUE;
2767 /* Subtract a percentage of maximum mana. */
2768 switch (p_ptr->pclass)
2770 /* For these classes, mana is halved if armour
2771 * is 30 pounds over their weight limit. */
2773 case CLASS_HIGH_MAGE:
2774 case CLASS_BLUE_MAGE:
2776 msp -= msp * (cur_wgt - max_wgt) / 600;
2780 /* Mana halved if armour is 40 pounds over weight limit. */
2782 case CLASS_MINDCRAFTER:
2783 case CLASS_BEASTMASTER:
2785 case CLASS_FORCETRAINER:
2787 case CLASS_MIRROR_MASTER:
2789 msp -= msp * (cur_wgt - max_wgt) / 800;
2793 case CLASS_SORCERER:
2795 msp -= msp * (cur_wgt - max_wgt) / 900;
2799 /* Mana halved if armour is 50 pounds over weight limit. */
2803 case CLASS_RED_MAGE:
2805 msp -= msp * (cur_wgt - max_wgt) / 1000;
2809 /* Mana halved if armour is 60 pounds over weight limit. */
2811 case CLASS_CHAOS_WARRIOR:
2812 case CLASS_WARRIOR_MAGE:
2814 msp -= msp * (cur_wgt - max_wgt) / 1200;
2820 p_ptr->cumber_armor = FALSE;
2824 /* For new classes created, but not yet added to this formula. */
2827 msp -= msp * (cur_wgt - max_wgt) / 800;
2833 /* Mana can never be negative */
2834 if (msp < 0) msp = 0;
2837 /* Maximum mana has changed */
2838 if (p_ptr->msp != msp)
2840 /* Enforce maximum */
2841 if ((p_ptr->csp >= msp) && (p_ptr->pclass != CLASS_SAMURAI))
2844 p_ptr->csp_frac = 0;
2848 /* ¥ì¥Ù¥ë¥¢¥Ã¥×¤Î»þ¤Ï¾å¾ºÎ̤òɽ¼¨¤¹¤ë */
2849 if ((level_up == 1) && (msp > p_ptr->msp))
2851 msg_format("ºÇÂç¥Þ¥¸¥Ã¥¯¡¦¥Ý¥¤¥ó¥È¤¬ %d Áý²Ã¤·¤¿¡ª",
2852 (msp - p_ptr->msp));
2858 /* Display mana later */
2859 p_ptr->redraw |= (PR_MANA);
2862 p_ptr->window |= (PW_PLAYER);
2863 p_ptr->window |= (PW_SPELL);
2867 /* Hack -- handle "xtra" mode */
2868 if (character_xtra) return;
2870 /* Take note when "glove state" changes */
2871 if (p_ptr->old_cumber_glove != p_ptr->cumber_glove)
2874 if (p_ptr->cumber_glove)
2877 msg_print("¼ê¤¬Ê¤¤ï¤ì¤Æ¼öʸ¤¬¾§¤¨¤Ë¤¯¤¤´¶¤¸¤¬¤¹¤ë¡£");
2879 msg_print("Your covered hands feel unsuitable for spellcasting.");
2886 msg_print("¤³¤Î¼ê¤Î¾õÂ֤ʤ顢¤°¤Ã¤È¼öʸ¤¬¾§¤¨¤ä¤¹¤¤´¶¤¸¤À¡£");
2888 msg_print("Your hands feel more suitable for spellcasting.");
2894 p_ptr->old_cumber_glove = p_ptr->cumber_glove;
2898 /* Take note when "armor state" changes */
2899 if (p_ptr->old_cumber_armor != p_ptr->cumber_armor)
2902 if (p_ptr->cumber_armor)
2905 msg_print("ÁõÈ÷¤Î½Å¤µ¤ÇÆ°¤¤¬Æߤ¯¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¡£");
2907 msg_print("The weight of your equipment encumbers your movement.");
2914 msg_print("¤°¤Ã¤È³Ú¤ËÂΤòÆ°¤«¤»¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
2916 msg_print("You feel able to move more freely.");
2922 p_ptr->old_cumber_armor = p_ptr->cumber_armor;
2929 * Calculate the players (maximal) hit points
2930 * Adjust current hitpoints if necessary
2932 static void calc_hitpoints(void)
2937 /* Un-inflate "half-hitpoint bonus per level" value */
2938 bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128) * p_ptr->lev / 4;
2940 /* Calculate hitpoints */
2941 mhp = p_ptr->player_hp[p_ptr->lev - 1];
2943 if (p_ptr->mimic_form)
2945 if (p_ptr->pclass == CLASS_SORCERER)
2946 tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
2948 tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
2949 mhp = mhp * tmp_hitdie / p_ptr->hitdie;
2952 if (p_ptr->pclass == CLASS_SORCERER)
2954 if (p_ptr->lev < 30)
2955 mhp = (mhp * (45+p_ptr->lev) / 100);
2957 mhp = (mhp * 75 / 100);
2958 bonus = (bonus * 65 / 100);
2963 if (p_ptr->pclass == CLASS_BERSERKER)
2965 mhp = mhp*(110+(((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 110))/100;
2968 /* Always have at least one hitpoint per level */
2969 if (mhp < p_ptr->lev + 1) mhp = p_ptr->lev + 1;
2971 /* Factor in the hero / superhero settings */
2972 if (IS_HERO()) mhp += 10;
2973 if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
2974 if (p_ptr->tsuyoshi) mhp += 50;
2976 /* Factor in the hex spell settings */
2977 if (hex_spelling(HEX_XTRA_MIGHT)) mhp += 15;
2978 if (hex_spelling(HEX_BUILDING)) mhp += 60;
2980 /* New maximum hitpoints */
2981 if (p_ptr->mhp != mhp)
2983 /* Enforce maximum */
2984 if (p_ptr->chp >= mhp)
2987 p_ptr->chp_frac = 0;
2991 /* ¥ì¥Ù¥ë¥¢¥Ã¥×¤Î»þ¤Ï¾å¾ºÎ̤òɽ¼¨¤¹¤ë */
2992 if ((level_up == 1) && (mhp > p_ptr->mhp))
2994 msg_format("ºÇÂç¥Ò¥Ã¥È¡¦¥Ý¥¤¥ó¥È¤¬ %d Áý²Ã¤·¤¿¡ª",
2995 (mhp - p_ptr->mhp) );
2998 /* Save the new max-hitpoints */
3001 /* Display hitpoints (later) */
3002 p_ptr->redraw |= (PR_HP);
3005 p_ptr->window |= (PW_PLAYER);
3012 * Extract and set the current "lite radius"
3014 * SWD: Experimental modification: multiple light sources have additive effect.
3017 static void calc_torch(void)
3021 u32b flgs[TR_FLAG_SIZE];
3023 /* Assume no light */
3024 p_ptr->cur_lite = 0;
3026 /* Loop through all wielded items */
3027 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3029 o_ptr = &inventory[i];
3031 /* Examine actual lites */
3032 if ((i == INVEN_LITE) && (o_ptr->k_idx) && (o_ptr->tval == TV_LITE))
3034 if (o_ptr->name2 == EGO_LITE_DARKNESS)
3036 if (o_ptr->sval == SV_LITE_TORCH)
3038 p_ptr->cur_lite -= 1;
3041 /* Lanterns (with fuel) provide more lite */
3042 else if (o_ptr->sval == SV_LITE_LANTERN)
3044 p_ptr->cur_lite -= 2;
3047 else if (o_ptr->sval == SV_LITE_FEANOR)
3049 p_ptr->cur_lite -= 3;
3052 /* Torches (with fuel) provide some lite */
3053 else if ((o_ptr->sval == SV_LITE_TORCH) && (o_ptr->xtra4 > 0))
3055 p_ptr->cur_lite += 1;
3058 /* Lanterns (with fuel) provide more lite */
3059 else if ((o_ptr->sval == SV_LITE_LANTERN) && (o_ptr->xtra4 > 0))
3061 p_ptr->cur_lite += 2;
3064 else if (o_ptr->sval == SV_LITE_FEANOR)
3066 p_ptr->cur_lite += 2;
3069 /* Artifact Lites provide permanent, bright, lite */
3070 else if (object_is_fixed_artifact(o_ptr))
3072 p_ptr->cur_lite += 3;
3075 if (o_ptr->name2 == EGO_LITE_SHINE) p_ptr->cur_lite++;
3079 /* Skip empty slots */
3080 if (!o_ptr->k_idx) continue;
3082 /* Extract the flags */
3083 object_flags(o_ptr, flgs);
3085 /* does this item glow? */
3086 if (have_flag(flgs, TR_LITE))
3088 if ((o_ptr->name2 == EGO_DARK) || (o_ptr->name1 == ART_NIGHT)) p_ptr->cur_lite--;
3089 else p_ptr->cur_lite++;
3095 /* max radius is 14 (was 5) without rewriting other code -- */
3096 /* see cave.c:update_lite() and defines.h:LITE_MAX */
3097 if (d_info[dungeon_type].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
3098 p_ptr->cur_lite = 1;
3101 * check if the player doesn't have light radius,
3102 * but does weakly glow as an intrinsic.
3104 if (p_ptr->cur_lite <= 0 && p_ptr->lite) p_ptr->cur_lite++;
3106 if (p_ptr->cur_lite > 14) p_ptr->cur_lite = 14;
3107 if (p_ptr->cur_lite < 0) p_ptr->cur_lite = 0;
3109 /* end experimental mods */
3111 /* Notice changes in the "lite radius" */
3112 if (p_ptr->old_lite != p_ptr->cur_lite)
3115 /* Hack -- PU_MON_LITE for monsters' darkness */
3116 p_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
3118 /* Remember the old lite */
3119 p_ptr->old_lite = p_ptr->cur_lite;
3121 if ((p_ptr->cur_lite > 0) && (p_ptr->special_defense & NINJA_S_STEALTH))
3122 set_superstealth(FALSE);
3129 * Computes current weight limit.
3131 u32b weight_limit(void)
3135 /* Weight limit based only on strength */
3136 i = (u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
3137 if (p_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
3139 /* Return the result */
3144 bool buki_motteruka(int i)
3146 return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE);
3151 * Calculate the players current "state", taking into account
3152 * not only race/class intrinsics, but also objects being worn
3153 * and temporary spell effects.
3155 * See also calc_mana() and calc_hitpoints().
3157 * Take note of the new "speed code", in particular, a very strong
3158 * player will start slowing down as soon as he reaches 150 pounds,
3159 * but not until he reaches 450 pounds will he be half as fast as
3160 * a normal kobold. This both hurts and helps the player, hurts
3161 * because in the old days a player could just avoid 300 pounds,
3162 * and helps because now carrying 300 pounds is not very painful.
3164 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
3165 * damage, since that would affect non-combat things. These values
3166 * are actually added in later, at the appropriate place.
3168 * This function induces various "status" messages.
3170 void calc_bonuses(void)
3172 int i, j, hold, neutral[2];
3174 int default_hand = 0;
3175 int empty_hands_status = empty_hands(TRUE);
3179 u32b flgs[TR_FLAG_SIZE];
3181 bool yoiyami = FALSE;
3182 bool down_saving = FALSE;
3184 bool have_dd_s = FALSE, have_dd_t = FALSE;
3186 bool have_sw = FALSE, have_kabe = FALSE;
3187 bool easy_2weapon = FALSE;
3188 bool riding_levitation = FALSE;
3189 s16b this_o_idx, next_o_idx = 0;
3190 const player_race *tmp_rp_ptr;
3192 /* Save the old vision stuff */
3193 bool old_telepathy = p_ptr->telepathy;
3194 bool old_esp_animal = p_ptr->esp_animal;
3195 bool old_esp_undead = p_ptr->esp_undead;
3196 bool old_esp_demon = p_ptr->esp_demon;
3197 bool old_esp_orc = p_ptr->esp_orc;
3198 bool old_esp_troll = p_ptr->esp_troll;
3199 bool old_esp_giant = p_ptr->esp_giant;
3200 bool old_esp_dragon = p_ptr->esp_dragon;
3201 bool old_esp_human = p_ptr->esp_human;
3202 bool old_esp_evil = p_ptr->esp_evil;
3203 bool old_esp_good = p_ptr->esp_good;
3204 bool old_esp_nonliving = p_ptr->esp_nonliving;
3205 bool old_esp_unique = p_ptr->esp_unique;
3206 bool old_see_inv = p_ptr->see_inv;
3207 bool old_mighty_throw = p_ptr->mighty_throw;
3209 /* Save the old armor class */
3210 bool old_dis_ac = p_ptr->dis_ac;
3211 bool old_dis_to_a = p_ptr->dis_to_a;
3214 /* Clear extra blows/shots */
3215 extra_blows[0] = extra_blows[1] = extra_shots = 0;
3217 /* Clear the stat modifiers */
3218 for (i = 0; i < 6; i++) p_ptr->stat_add[i] = 0;
3221 /* Clear the Displayed/Real armor class */
3222 p_ptr->dis_ac = p_ptr->ac = 0;
3224 /* Clear the Displayed/Real Bonuses */
3225 p_ptr->dis_to_h[0] = p_ptr->to_h[0] = 0;
3226 p_ptr->dis_to_h[1] = p_ptr->to_h[1] = 0;
3227 p_ptr->dis_to_d[0] = p_ptr->to_d[0] = 0;
3228 p_ptr->dis_to_d[1] = p_ptr->to_d[1] = 0;
3229 p_ptr->dis_to_h_b = p_ptr->to_h_b = 0;
3230 p_ptr->dis_to_a = p_ptr->to_a = 0;
3234 p_ptr->to_m_chance = 0;
3236 /* Clear the Extra Dice Bonuses */
3237 p_ptr->to_dd[0] = p_ptr->to_ds[0] = 0;
3238 p_ptr->to_dd[1] = p_ptr->to_ds[1] = 0;
3240 /* Start with "normal" speed */
3243 /* Start with a single blow per turn */
3244 p_ptr->num_blow[0] = 1;
3245 p_ptr->num_blow[1] = 1;
3247 /* Start with a single shot per turn */
3248 p_ptr->num_fire = 100;
3250 /* Reset the "xtra" tval */
3251 p_ptr->tval_xtra = 0;
3253 /* Reset the "ammo" tval */
3254 p_ptr->tval_ammo = 0;
3256 /* Clear all the flags */
3258 p_ptr->bless_blade = FALSE;
3259 p_ptr->xtra_might = FALSE;
3260 p_ptr->impact[0] = FALSE;
3261 p_ptr->impact[1] = FALSE;
3262 p_ptr->pass_wall = FALSE;
3263 p_ptr->kill_wall = FALSE;
3264 p_ptr->dec_mana = FALSE;
3265 p_ptr->easy_spell = FALSE;
3266 p_ptr->heavy_spell = FALSE;
3267 p_ptr->see_inv = FALSE;
3268 p_ptr->free_act = FALSE;
3269 p_ptr->slow_digest = FALSE;
3270 p_ptr->regenerate = FALSE;
3271 p_ptr->can_swim = FALSE;
3272 p_ptr->levitation = FALSE;
3273 p_ptr->hold_life = FALSE;
3274 p_ptr->telepathy = FALSE;
3275 p_ptr->esp_animal = FALSE;
3276 p_ptr->esp_undead = FALSE;
3277 p_ptr->esp_demon = FALSE;
3278 p_ptr->esp_orc = FALSE;
3279 p_ptr->esp_troll = FALSE;
3280 p_ptr->esp_giant = FALSE;
3281 p_ptr->esp_dragon = FALSE;
3282 p_ptr->esp_human = FALSE;
3283 p_ptr->esp_evil = FALSE;
3284 p_ptr->esp_good = FALSE;
3285 p_ptr->esp_nonliving = FALSE;
3286 p_ptr->esp_unique = FALSE;
3287 p_ptr->lite = FALSE;
3288 p_ptr->sustain_str = FALSE;
3289 p_ptr->sustain_int = FALSE;
3290 p_ptr->sustain_wis = FALSE;
3291 p_ptr->sustain_con = FALSE;
3292 p_ptr->sustain_dex = FALSE;
3293 p_ptr->sustain_chr = FALSE;
3294 p_ptr->resist_acid = FALSE;
3295 p_ptr->resist_elec = FALSE;
3296 p_ptr->resist_fire = FALSE;
3297 p_ptr->resist_cold = FALSE;
3298 p_ptr->resist_pois = FALSE;
3299 p_ptr->resist_conf = FALSE;
3300 p_ptr->resist_sound = FALSE;
3301 p_ptr->resist_lite = FALSE;
3302 p_ptr->resist_dark = FALSE;
3303 p_ptr->resist_chaos = FALSE;
3304 p_ptr->resist_disen = FALSE;
3305 p_ptr->resist_shard = FALSE;
3306 p_ptr->resist_nexus = FALSE;
3307 p_ptr->resist_blind = FALSE;
3308 p_ptr->resist_neth = FALSE;
3309 p_ptr->resist_time = FALSE;
3310 p_ptr->resist_fear = FALSE;
3311 p_ptr->reflect = FALSE;
3312 p_ptr->sh_fire = FALSE;
3313 p_ptr->sh_elec = FALSE;
3314 p_ptr->sh_cold = FALSE;
3315 p_ptr->anti_magic = FALSE;
3316 p_ptr->anti_tele = FALSE;
3317 p_ptr->warning = FALSE;
3318 p_ptr->mighty_throw = FALSE;
3319 p_ptr->see_nocto = FALSE;
3321 p_ptr->immune_acid = FALSE;
3322 p_ptr->immune_elec = FALSE;
3323 p_ptr->immune_fire = FALSE;
3324 p_ptr->immune_cold = FALSE;
3326 p_ptr->ryoute = FALSE;
3327 p_ptr->migite = FALSE;
3328 p_ptr->hidarite = FALSE;
3329 p_ptr->no_flowed = FALSE;
3331 p_ptr->align = friend_align;
3333 if (p_ptr->mimic_form) tmp_rp_ptr = &mimic_info[p_ptr->mimic_form];
3334 else tmp_rp_ptr = &race_info[p_ptr->prace];
3336 /* Base infravision (purely racial) */
3337 p_ptr->see_infra = tmp_rp_ptr->infra;
3339 /* Base skill -- disarming */
3340 p_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis;
3342 /* Base skill -- magic devices */
3343 p_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
3345 /* Base skill -- saving throw */
3346 p_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav;
3348 /* Base skill -- stealth */
3349 p_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl;
3351 /* Base skill -- searching ability */
3352 p_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh;
3354 /* Base skill -- searching frequency */
3355 p_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos;
3357 /* Base skill -- combat (normal) */
3358 p_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn;
3360 /* Base skill -- combat (shooting) */
3361 p_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3363 /* Base skill -- combat (throwing) */
3364 p_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3366 /* Base skill -- digging */
3367 p_ptr->skill_dig = 0;
3369 if (buki_motteruka(INVEN_RARM)) p_ptr->migite = TRUE;
3370 if (buki_motteruka(INVEN_LARM))
3372 p_ptr->hidarite = TRUE;
3373 if (!p_ptr->migite) default_hand = 1;
3376 if (CAN_TWO_HANDS_WIELDING())
3378 if (p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) &&
3379 object_allow_two_hands_wielding(&inventory[INVEN_RARM]))
3381 p_ptr->ryoute = TRUE;
3383 else if (p_ptr->hidarite && (empty_hands(FALSE) == EMPTY_HAND_RARM) &&
3384 object_allow_two_hands_wielding(&inventory[INVEN_LARM]))
3386 p_ptr->ryoute = TRUE;
3390 switch (p_ptr->pclass)
3393 case CLASS_FORCETRAINER:
3394 case CLASS_BERSERKER:
3395 if (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3397 p_ptr->migite = TRUE;
3398 p_ptr->ryoute = TRUE;
3405 if (!p_ptr->migite && !p_ptr->hidarite)
3407 if (empty_hands_status & EMPTY_HAND_RARM) p_ptr->migite = TRUE;
3408 else if (empty_hands_status == EMPTY_HAND_LARM)
3410 p_ptr->hidarite = TRUE;
3415 if (p_ptr->special_defense & KAMAE_MASK)
3417 if (!(empty_hands_status & EMPTY_HAND_RARM))
3419 set_action(ACTION_NONE);
3423 switch (p_ptr->pclass)
3426 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3427 if (p_ptr->lev > 44) p_ptr->regenerate = TRUE;
3430 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3432 case CLASS_CHAOS_WARRIOR:
3433 if (p_ptr->lev > 29) p_ptr->resist_chaos = TRUE;
3434 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3436 case CLASS_MINDCRAFTER:
3437 if (p_ptr->lev > 9) p_ptr->resist_fear = TRUE;
3438 if (p_ptr->lev > 19) p_ptr->sustain_wis = TRUE;
3439 if (p_ptr->lev > 29) p_ptr->resist_conf = TRUE;
3440 if (p_ptr->lev > 39) p_ptr->telepathy = TRUE;
3443 case CLASS_FORCETRAINER:
3444 /* Unencumbered Monks become faster every 10 levels */
3445 if (!(heavy_armor()))
3447 if (!(prace_is_(RACE_KLACKON) ||
3448 prace_is_(RACE_SPRITE) ||
3449 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3450 new_speed += (p_ptr->lev) / 10;
3452 /* Free action if unencumbered at level 25 */
3453 if (p_ptr->lev > 24)
3454 p_ptr->free_act = TRUE;
3457 case CLASS_SORCERER:
3459 p_ptr->dis_to_a -= 50;
3462 p_ptr->resist_sound = TRUE;
3465 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3467 case CLASS_BERSERKER:
3469 p_ptr->sustain_str = TRUE;
3470 p_ptr->sustain_dex = TRUE;
3471 p_ptr->sustain_con = TRUE;
3472 p_ptr->regenerate = TRUE;
3473 p_ptr->free_act = TRUE;
3475 if (p_ptr->lev > 29) new_speed++;
3476 if (p_ptr->lev > 39) new_speed++;
3477 if (p_ptr->lev > 44) new_speed++;
3478 if (p_ptr->lev > 49) new_speed++;
3479 p_ptr->to_a += 10+p_ptr->lev/2;
3480 p_ptr->dis_to_a += 10+p_ptr->lev/2;
3481 p_ptr->skill_dig += (100+p_ptr->lev*8);
3482 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3483 p_ptr->redraw |= PR_STATUS;
3485 case CLASS_MIRROR_MASTER:
3486 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3489 /* Unencumbered Ninjas become faster every 10 levels */
3492 new_speed -= (p_ptr->lev) / 10;
3493 p_ptr->skill_stl -= (p_ptr->lev)/10;
3495 else if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
3496 (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
3499 if (!(prace_is_(RACE_KLACKON) ||
3500 prace_is_(RACE_SPRITE) ||
3501 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3502 new_speed += (p_ptr->lev) / 10;
3503 p_ptr->skill_stl += (p_ptr->lev)/10;
3505 /* Free action if unencumbered at level 25 */
3506 if (p_ptr->lev > 24)
3507 p_ptr->free_act = TRUE;
3509 if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
3510 (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
3512 p_ptr->to_a += p_ptr->lev/2+5;
3513 p_ptr->dis_to_a += p_ptr->lev/2+5;
3515 p_ptr->slow_digest = TRUE;
3516 p_ptr->resist_fear = TRUE;
3517 if (p_ptr->lev > 19) p_ptr->resist_pois = TRUE;
3518 if (p_ptr->lev > 24) p_ptr->sustain_dex = TRUE;
3519 if (p_ptr->lev > 29) p_ptr->see_inv = TRUE;
3520 if (p_ptr->lev > 44)
3522 p_ptr->oppose_pois = 1;
3523 p_ptr->redraw |= PR_STATUS;
3525 p_ptr->see_nocto = TRUE;
3530 if (p_ptr->mimic_form)
3532 switch (p_ptr->mimic_form)
3535 p_ptr->hold_life = TRUE;
3536 p_ptr->resist_chaos = TRUE;
3537 p_ptr->resist_neth = TRUE;
3538 p_ptr->resist_fire = TRUE;
3539 p_ptr->oppose_fire = 1;
3540 p_ptr->see_inv=TRUE;
3542 p_ptr->redraw |= PR_STATUS;
3544 p_ptr->dis_to_a += 10;
3545 p_ptr->align -= 200;
3547 case MIMIC_DEMON_LORD:
3548 p_ptr->hold_life = TRUE;
3549 p_ptr->resist_chaos = TRUE;
3550 p_ptr->resist_neth = TRUE;
3551 p_ptr->immune_fire = TRUE;
3552 p_ptr->resist_acid = TRUE;
3553 p_ptr->resist_fire = TRUE;
3554 p_ptr->resist_cold = TRUE;
3555 p_ptr->resist_elec = TRUE;
3556 p_ptr->resist_pois = TRUE;
3557 p_ptr->resist_conf = TRUE;
3558 p_ptr->resist_disen = TRUE;
3559 p_ptr->resist_nexus = TRUE;
3560 p_ptr->resist_fear = TRUE;
3561 p_ptr->sh_fire = TRUE;
3562 p_ptr->see_inv = TRUE;
3563 p_ptr->telepathy = TRUE;
3564 p_ptr->levitation = TRUE;
3565 p_ptr->kill_wall = TRUE;
3568 p_ptr->dis_to_a += 20;
3569 p_ptr->align -= 200;
3572 p_ptr->resist_dark = TRUE;
3573 p_ptr->hold_life = TRUE;
3574 p_ptr->resist_neth = TRUE;
3575 p_ptr->resist_cold = TRUE;
3576 p_ptr->resist_pois = TRUE;
3577 p_ptr->see_inv = TRUE;
3580 p_ptr->dis_to_a += 10;
3581 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3587 switch (p_ptr->prace)
3590 p_ptr->resist_lite = TRUE;
3593 p_ptr->hold_life = TRUE;
3596 p_ptr->free_act = TRUE;
3599 p_ptr->resist_blind = TRUE;
3602 p_ptr->resist_dark = TRUE;
3604 case RACE_HALF_TROLL:
3605 p_ptr->sustain_str = TRUE;
3607 if (p_ptr->lev > 14)
3609 /* High level trolls heal fast... */
3610 p_ptr->regenerate = TRUE;
3612 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_BERSERKER)
3614 p_ptr->slow_digest = TRUE;
3615 /* Let's not make Regeneration
3616 * a disadvantage for the poor warriors who can
3617 * never learn a spell that satisfies hunger (actually
3618 * neither can rogues, but half-trolls are not
3619 * supposed to play rogues) */
3624 p_ptr->sustain_con = TRUE;
3625 p_ptr->regenerate = TRUE; /* Amberites heal fast... */
3628 p_ptr->resist_lite = TRUE;
3629 p_ptr->see_inv = TRUE;
3631 case RACE_BARBARIAN:
3632 p_ptr->resist_fear = TRUE;
3634 case RACE_HALF_OGRE:
3635 p_ptr->resist_dark = TRUE;
3636 p_ptr->sustain_str = TRUE;
3638 case RACE_HALF_GIANT:
3639 p_ptr->sustain_str = TRUE;
3640 p_ptr->resist_shard = TRUE;
3642 case RACE_HALF_TITAN:
3643 p_ptr->resist_chaos = TRUE;
3646 p_ptr->resist_sound = TRUE;
3649 p_ptr->resist_acid = TRUE;
3650 if (p_ptr->lev > 19) p_ptr->immune_acid = TRUE;
3653 p_ptr->resist_conf = TRUE;
3654 p_ptr->resist_acid = TRUE;
3656 /* Klackons become faster */
3657 new_speed += (p_ptr->lev) / 10;
3660 p_ptr->resist_pois = TRUE;
3663 p_ptr->resist_disen = TRUE;
3664 p_ptr->resist_dark = TRUE;
3667 p_ptr->resist_dark = TRUE;
3668 if (p_ptr->lev > 19) p_ptr->see_inv = TRUE;
3670 case RACE_DRACONIAN:
3671 p_ptr->levitation = TRUE;
3672 if (p_ptr->lev > 4) p_ptr->resist_fire = TRUE;
3673 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3674 if (p_ptr->lev > 14) p_ptr->resist_acid = TRUE;
3675 if (p_ptr->lev > 19) p_ptr->resist_elec = TRUE;
3676 if (p_ptr->lev > 34) p_ptr->resist_pois = TRUE;
3678 case RACE_MIND_FLAYER:
3679 p_ptr->sustain_int = TRUE;
3680 p_ptr->sustain_wis = TRUE;
3681 if (p_ptr->lev > 14) p_ptr->see_inv = TRUE;
3682 if (p_ptr->lev > 29) p_ptr->telepathy = TRUE;
3685 p_ptr->resist_fire = TRUE;
3686 if (p_ptr->lev > 9) p_ptr->see_inv = TRUE;
3689 p_ptr->slow_digest = TRUE;
3690 p_ptr->free_act = TRUE;
3691 p_ptr->see_inv = TRUE;
3692 p_ptr->resist_pois = TRUE;
3693 if (p_ptr->lev > 34) p_ptr->hold_life = TRUE;
3696 p_ptr->resist_shard = TRUE;
3697 p_ptr->hold_life = TRUE;
3698 p_ptr->see_inv = TRUE;
3699 p_ptr->resist_pois = TRUE;
3700 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3703 p_ptr->resist_neth = TRUE;
3704 p_ptr->hold_life = TRUE;
3705 p_ptr->see_inv = TRUE;
3706 p_ptr->resist_pois = TRUE;
3707 p_ptr->slow_digest = TRUE;
3708 if (p_ptr->lev > 4) p_ptr->resist_cold = TRUE;
3711 p_ptr->resist_dark = TRUE;
3712 p_ptr->hold_life = TRUE;
3713 p_ptr->resist_neth = TRUE;
3714 p_ptr->resist_cold = TRUE;
3715 p_ptr->resist_pois = TRUE;
3716 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3719 p_ptr->levitation = TRUE;
3720 p_ptr->free_act = TRUE;
3721 p_ptr->resist_neth = TRUE;
3722 p_ptr->hold_life = TRUE;
3723 p_ptr->see_inv = TRUE;
3724 p_ptr->resist_pois = TRUE;
3725 p_ptr->slow_digest = TRUE;
3726 p_ptr->resist_cold = TRUE;
3727 p_ptr->pass_wall = TRUE;
3728 if (p_ptr->lev > 34) p_ptr->telepathy = TRUE;
3731 p_ptr->levitation = TRUE;
3732 p_ptr->resist_lite = TRUE;
3734 /* Sprites become faster */
3735 new_speed += (p_ptr->lev) / 10;
3738 p_ptr->resist_conf = TRUE;
3739 p_ptr->resist_sound = TRUE;
3742 /* Ents dig like maniacs, but only with their hands. */
3743 if (!inventory[INVEN_RARM].k_idx)
3744 p_ptr->skill_dig += p_ptr->lev * 10;
3745 /* Ents get tougher and stronger as they age, but lose dexterity. */
3746 if (p_ptr->lev > 25) p_ptr->stat_add[A_STR]++;
3747 if (p_ptr->lev > 40) p_ptr->stat_add[A_STR]++;
3748 if (p_ptr->lev > 45) p_ptr->stat_add[A_STR]++;
3750 if (p_ptr->lev > 25) p_ptr->stat_add[A_DEX]--;
3751 if (p_ptr->lev > 40) p_ptr->stat_add[A_DEX]--;
3752 if (p_ptr->lev > 45) p_ptr->stat_add[A_DEX]--;
3754 if (p_ptr->lev > 25) p_ptr->stat_add[A_CON]++;
3755 if (p_ptr->lev > 40) p_ptr->stat_add[A_CON]++;
3756 if (p_ptr->lev > 45) p_ptr->stat_add[A_CON]++;
3759 p_ptr->levitation = TRUE;
3760 p_ptr->see_inv = TRUE;
3761 p_ptr->align += 200;
3764 p_ptr->resist_fire = TRUE;
3765 p_ptr->resist_neth = TRUE;
3766 p_ptr->hold_life = TRUE;
3767 if (p_ptr->lev > 9) p_ptr->see_inv = TRUE;
3768 if (p_ptr->lev > 44)
3770 p_ptr->oppose_fire = 1;
3771 p_ptr->redraw |= PR_STATUS;
3773 p_ptr->align -= 200;
3776 p_ptr->sustain_con = TRUE;
3779 p_ptr->levitation = TRUE;
3782 p_ptr->resist_conf = TRUE;
3785 p_ptr->slow_digest = TRUE;
3786 p_ptr->free_act = TRUE;
3787 p_ptr->resist_pois = TRUE;
3788 p_ptr->hold_life = TRUE;
3796 if (p_ptr->ult_res || (p_ptr->special_defense & KATA_MUSOU))
3798 p_ptr->see_inv = TRUE;
3799 p_ptr->free_act = TRUE;
3800 p_ptr->slow_digest = TRUE;
3801 p_ptr->regenerate = TRUE;
3802 p_ptr->levitation = TRUE;
3803 p_ptr->hold_life = TRUE;
3804 p_ptr->telepathy = TRUE;
3806 p_ptr->sustain_str = TRUE;
3807 p_ptr->sustain_int = TRUE;
3808 p_ptr->sustain_wis = TRUE;
3809 p_ptr->sustain_con = TRUE;
3810 p_ptr->sustain_dex = TRUE;
3811 p_ptr->sustain_chr = TRUE;
3812 p_ptr->resist_acid = TRUE;
3813 p_ptr->resist_elec = TRUE;
3814 p_ptr->resist_fire = TRUE;
3815 p_ptr->resist_cold = TRUE;
3816 p_ptr->resist_pois = TRUE;
3817 p_ptr->resist_conf = TRUE;
3818 p_ptr->resist_sound = TRUE;
3819 p_ptr->resist_lite = TRUE;
3820 p_ptr->resist_dark = TRUE;
3821 p_ptr->resist_chaos = TRUE;
3822 p_ptr->resist_disen = TRUE;
3823 p_ptr->resist_shard = TRUE;
3824 p_ptr->resist_nexus = TRUE;
3825 p_ptr->resist_blind = TRUE;
3826 p_ptr->resist_neth = TRUE;
3827 p_ptr->resist_fear = TRUE;
3828 p_ptr->reflect = TRUE;
3829 p_ptr->sh_fire = TRUE;
3830 p_ptr->sh_elec = TRUE;
3831 p_ptr->sh_cold = TRUE;
3833 p_ptr->dis_to_a += 100;
3835 /* Temporary shield */
3836 else if (p_ptr->tsubureru || p_ptr->shield || p_ptr->magicdef)
3839 p_ptr->dis_to_a += 50;
3842 if (p_ptr->tim_res_nether)
3844 p_ptr->resist_neth = TRUE;
3846 if (p_ptr->tim_sh_fire)
3848 p_ptr->sh_fire = TRUE;
3850 if (p_ptr->tim_res_time)
3852 p_ptr->resist_time = TRUE;
3856 if (p_ptr->pseikaku == SEIKAKU_SEXY) p_ptr->cursed |= (TRC_AGGRAVATE);
3857 if (p_ptr->pseikaku == SEIKAKU_NAMAKE) p_ptr->to_m_chance += 10;
3858 if (p_ptr->pseikaku == SEIKAKU_KIREMONO) p_ptr->to_m_chance -= 3;
3859 if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) p_ptr->to_m_chance++;
3862 if (p_ptr->pseikaku == SEIKAKU_LUCKY) p_ptr->muta3 |= MUT3_GOOD_LUCK;
3864 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
3866 p_ptr->resist_blind = TRUE;
3867 p_ptr->resist_conf = TRUE;
3868 p_ptr->hold_life = TRUE;
3869 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3871 if ((p_ptr->prace != RACE_KLACKON) && (p_ptr->prace != RACE_SPRITE))
3872 /* Munchkin become faster */
3873 new_speed += (p_ptr->lev) / 10 + 5;
3876 if (music_singing(MUSIC_WALL))
3878 p_ptr->kill_wall = TRUE;
3881 /* Hack -- apply racial/class stat maxes */
3882 /* Apply the racial modifiers */
3883 for (i = 0; i < 6; i++)
3885 /* Modify the stats for "race" */
3886 p_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
3890 /* I'm adding the mutations here for the lack of a better place... */
3893 /* Hyper Strength */
3894 if (p_ptr->muta3 & MUT3_HYPER_STR)
3896 p_ptr->stat_add[A_STR] += 4;
3900 if (p_ptr->muta3 & MUT3_PUNY)
3902 p_ptr->stat_add[A_STR] -= 4;
3905 /* Living computer */
3906 if (p_ptr->muta3 & MUT3_HYPER_INT)
3908 p_ptr->stat_add[A_INT] += 4;
3909 p_ptr->stat_add[A_WIS] += 4;
3913 if (p_ptr->muta3 & MUT3_MORONIC)
3915 p_ptr->stat_add[A_INT] -= 4;
3916 p_ptr->stat_add[A_WIS] -= 4;
3919 if (p_ptr->muta3 & MUT3_RESILIENT)
3921 p_ptr->stat_add[A_CON] += 4;
3924 if (p_ptr->muta3 & MUT3_XTRA_FAT)
3926 p_ptr->stat_add[A_CON] += 2;
3930 if (p_ptr->muta3 & MUT3_ALBINO)
3932 p_ptr->stat_add[A_CON] -= 4;
3935 if (p_ptr->muta3 & MUT3_FLESH_ROT)
3937 p_ptr->stat_add[A_CON] -= 2;
3938 p_ptr->stat_add[A_CHR] -= 1;
3939 p_ptr->regenerate = FALSE;
3940 /* Cancel innate regeneration */
3943 if (p_ptr->muta3 & MUT3_SILLY_VOI)
3945 p_ptr->stat_add[A_CHR] -= 4;
3948 if (p_ptr->muta3 & MUT3_BLANK_FAC)
3950 p_ptr->stat_add[A_CHR] -= 1;
3953 if (p_ptr->muta3 & MUT3_XTRA_EYES)
3955 p_ptr->skill_fos += 15;
3956 p_ptr->skill_srh += 15;
3959 if (p_ptr->muta3 & MUT3_MAGIC_RES)
3961 p_ptr->skill_sav += (15 + (p_ptr->lev / 5));
3964 if (p_ptr->muta3 & MUT3_XTRA_NOIS)
3966 p_ptr->skill_stl -= 3;
3969 if (p_ptr->muta3 & MUT3_INFRAVIS)
3971 p_ptr->see_infra += 3;
3974 if (p_ptr->muta3 & MUT3_XTRA_LEGS)
3979 if (p_ptr->muta3 & MUT3_SHORT_LEG)
3984 if (p_ptr->muta3 & MUT3_ELEC_TOUC)
3986 p_ptr->sh_elec = TRUE;
3989 if (p_ptr->muta3 & MUT3_FIRE_BODY)
3991 p_ptr->sh_fire = TRUE;
3995 if (p_ptr->muta3 & MUT3_WART_SKIN)
3997 p_ptr->stat_add[A_CHR] -= 2;
3999 p_ptr->dis_to_a += 5;
4002 if (p_ptr->muta3 & MUT3_SCALES)
4004 p_ptr->stat_add[A_CHR] -= 1;
4006 p_ptr->dis_to_a += 10;
4009 if (p_ptr->muta3 & MUT3_IRON_SKIN)
4011 p_ptr->stat_add[A_DEX] -= 1;
4013 p_ptr->dis_to_a += 25;
4016 if (p_ptr->muta3 & MUT3_WINGS)
4018 p_ptr->levitation = TRUE;
4021 if (p_ptr->muta3 & MUT3_FEARLESS)
4023 p_ptr->resist_fear = TRUE;
4026 if (p_ptr->muta3 & MUT3_REGEN)
4028 p_ptr->regenerate = TRUE;
4031 if (p_ptr->muta3 & MUT3_ESP)
4033 p_ptr->telepathy = TRUE;
4036 if (p_ptr->muta3 & MUT3_LIMBER)
4038 p_ptr->stat_add[A_DEX] += 3;
4041 if (p_ptr->muta3 & MUT3_ARTHRITIS)
4043 p_ptr->stat_add[A_DEX] -= 3;
4046 if (p_ptr->muta3 & MUT3_MOTION)
4048 p_ptr->free_act = TRUE;
4049 p_ptr->skill_stl += 1;
4052 if (p_ptr->muta3 & MUT3_ILL_NORM)
4054 p_ptr->stat_add[A_CHR] = 0;
4058 if (p_ptr->tsuyoshi)
4060 p_ptr->stat_add[A_STR] += 4;
4061 p_ptr->stat_add[A_CON] += 4;
4064 /* Scan the usable inventory */
4065 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4067 int bonus_to_h, bonus_to_d;
4068 o_ptr = &inventory[i];
4070 /* Skip non-objects */
4071 if (!o_ptr->k_idx) continue;
4073 /* Extract the item flags */
4074 object_flags(o_ptr, flgs);
4076 p_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
4077 if (o_ptr->name1 == ART_CHAINSWORD) p_ptr->cursed |= TRC_CHAINSWORD;
4080 if (have_flag(flgs, TR_STR)) p_ptr->stat_add[A_STR] += o_ptr->pval;
4081 if (have_flag(flgs, TR_INT)) p_ptr->stat_add[A_INT] += o_ptr->pval;
4082 if (have_flag(flgs, TR_WIS)) p_ptr->stat_add[A_WIS] += o_ptr->pval;
4083 if (have_flag(flgs, TR_DEX)) p_ptr->stat_add[A_DEX] += o_ptr->pval;
4084 if (have_flag(flgs, TR_CON)) p_ptr->stat_add[A_CON] += o_ptr->pval;
4085 if (have_flag(flgs, TR_CHR)) p_ptr->stat_add[A_CHR] += o_ptr->pval;
4087 if (have_flag(flgs, TR_MAGIC_MASTERY)) p_ptr->skill_dev += 8*o_ptr->pval;
4089 /* Affect stealth */
4090 if (have_flag(flgs, TR_STEALTH)) p_ptr->skill_stl += o_ptr->pval;
4092 /* Affect searching ability (factor of five) */
4093 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_srh += (o_ptr->pval * 5);
4095 /* Affect searching frequency (factor of five) */
4096 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_fos += (o_ptr->pval * 5);
4098 /* Affect infravision */
4099 if (have_flag(flgs, TR_INFRA)) p_ptr->see_infra += o_ptr->pval;
4101 /* Affect digging (factor of 20) */
4102 if (have_flag(flgs, TR_TUNNEL)) p_ptr->skill_dig += (o_ptr->pval * 20);
4105 if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval;
4108 if (have_flag(flgs, TR_BLOWS))
4110 if((i == INVEN_RARM || i == INVEN_RIGHT) && !p_ptr->ryoute) extra_blows[0] += o_ptr->pval;
4111 else if((i == INVEN_LARM || i == INVEN_LEFT) && !p_ptr->ryoute) extra_blows[1] += o_ptr->pval;
4112 else {extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval;}
4115 /* Hack -- cause earthquakes */
4116 if (have_flag(flgs, TR_IMPACT)) p_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
4119 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
4122 if (have_flag(flgs, TR_AGGRAVATE)) p_ptr->cursed |= TRC_AGGRAVATE;
4123 if (have_flag(flgs, TR_DRAIN_EXP)) p_ptr->cursed |= TRC_DRAIN_EXP;
4124 if (have_flag(flgs, TR_TY_CURSE)) p_ptr->cursed |= TRC_TY_CURSE;
4125 if (have_flag(flgs, TR_ADD_L_CURSE)) p_ptr->cursed |= TRC_ADD_L_CURSE;
4126 if (have_flag(flgs, TR_ADD_H_CURSE)) p_ptr->cursed |= TRC_ADD_H_CURSE;
4127 if (have_flag(flgs, TR_DEC_MANA)) p_ptr->dec_mana = TRUE;
4128 if (have_flag(flgs, TR_BLESSED)) p_ptr->bless_blade = TRUE;
4129 if (have_flag(flgs, TR_XTRA_MIGHT)) p_ptr->xtra_might = TRUE;
4130 if (have_flag(flgs, TR_SLOW_DIGEST)) p_ptr->slow_digest = TRUE;
4131 if (have_flag(flgs, TR_REGEN)) p_ptr->regenerate = TRUE;
4132 if (have_flag(flgs, TR_TELEPATHY)) p_ptr->telepathy = TRUE;
4133 if (have_flag(flgs, TR_ESP_ANIMAL)) p_ptr->esp_animal = TRUE;
4134 if (have_flag(flgs, TR_ESP_UNDEAD)) p_ptr->esp_undead = TRUE;
4135 if (have_flag(flgs, TR_ESP_DEMON)) p_ptr->esp_demon = TRUE;
4136 if (have_flag(flgs, TR_ESP_ORC)) p_ptr->esp_orc = TRUE;
4137 if (have_flag(flgs, TR_ESP_TROLL)) p_ptr->esp_troll = TRUE;
4138 if (have_flag(flgs, TR_ESP_GIANT)) p_ptr->esp_giant = TRUE;
4139 if (have_flag(flgs, TR_ESP_DRAGON)) p_ptr->esp_dragon = TRUE;
4140 if (have_flag(flgs, TR_ESP_HUMAN)) p_ptr->esp_human = TRUE;
4141 if (have_flag(flgs, TR_ESP_EVIL)) p_ptr->esp_evil = TRUE;
4142 if (have_flag(flgs, TR_ESP_GOOD)) p_ptr->esp_good = TRUE;
4143 if (have_flag(flgs, TR_ESP_NONLIVING)) p_ptr->esp_nonliving = TRUE;
4144 if (have_flag(flgs, TR_ESP_UNIQUE)) p_ptr->esp_unique = TRUE;
4146 if (have_flag(flgs, TR_SEE_INVIS)) p_ptr->see_inv = TRUE;
4147 if (have_flag(flgs, TR_LEVITATION)) p_ptr->levitation = TRUE;
4148 if (have_flag(flgs, TR_FREE_ACT)) p_ptr->free_act = TRUE;
4149 if (have_flag(flgs, TR_HOLD_LIFE)) p_ptr->hold_life = TRUE;
4150 if (have_flag(flgs, TR_WARNING)){
4151 if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription),'$')))
4152 p_ptr->warning = TRUE;
4155 if (have_flag(flgs, TR_TELEPORT))
4157 if (object_is_cursed(o_ptr)) p_ptr->cursed |= TRC_TELEPORT;
4160 cptr insc = quark_str(o_ptr->inscription);
4162 if (o_ptr->inscription && my_strchr(insc, '.'))
4165 * {.} will stop random teleportation.
4170 /* Controlled random teleportation */
4171 p_ptr->cursed |= TRC_TELEPORT_SELF;
4176 /* Immunity flags */
4177 if (have_flag(flgs, TR_IM_FIRE)) p_ptr->immune_fire = TRUE;
4178 if (have_flag(flgs, TR_IM_ACID)) p_ptr->immune_acid = TRUE;
4179 if (have_flag(flgs, TR_IM_COLD)) p_ptr->immune_cold = TRUE;
4180 if (have_flag(flgs, TR_IM_ELEC)) p_ptr->immune_elec = TRUE;
4182 /* Resistance flags */
4183 if (have_flag(flgs, TR_RES_ACID)) p_ptr->resist_acid = TRUE;
4184 if (have_flag(flgs, TR_RES_ELEC)) p_ptr->resist_elec = TRUE;
4185 if (have_flag(flgs, TR_RES_FIRE)) p_ptr->resist_fire = TRUE;
4186 if (have_flag(flgs, TR_RES_COLD)) p_ptr->resist_cold = TRUE;
4187 if (have_flag(flgs, TR_RES_POIS)) p_ptr->resist_pois = TRUE;
4188 if (have_flag(flgs, TR_RES_FEAR)) p_ptr->resist_fear = TRUE;
4189 if (have_flag(flgs, TR_RES_CONF)) p_ptr->resist_conf = TRUE;
4190 if (have_flag(flgs, TR_RES_SOUND)) p_ptr->resist_sound = TRUE;
4191 if (have_flag(flgs, TR_RES_LITE)) p_ptr->resist_lite = TRUE;
4192 if (have_flag(flgs, TR_RES_DARK)) p_ptr->resist_dark = TRUE;
4193 if (have_flag(flgs, TR_RES_CHAOS)) p_ptr->resist_chaos = TRUE;
4194 if (have_flag(flgs, TR_RES_DISEN)) p_ptr->resist_disen = TRUE;
4195 if (have_flag(flgs, TR_RES_SHARDS)) p_ptr->resist_shard = TRUE;
4196 if (have_flag(flgs, TR_RES_NEXUS)) p_ptr->resist_nexus = TRUE;
4197 if (have_flag(flgs, TR_RES_BLIND)) p_ptr->resist_blind = TRUE;
4198 if (have_flag(flgs, TR_RES_NETHER)) p_ptr->resist_neth = TRUE;
4200 if (have_flag(flgs, TR_REFLECT)) p_ptr->reflect = TRUE;
4201 if (have_flag(flgs, TR_SH_FIRE)) p_ptr->sh_fire = TRUE;
4202 if (have_flag(flgs, TR_SH_ELEC)) p_ptr->sh_elec = TRUE;
4203 if (have_flag(flgs, TR_SH_COLD)) p_ptr->sh_cold = TRUE;
4204 if (have_flag(flgs, TR_NO_MAGIC)) p_ptr->anti_magic = TRUE;
4205 if (have_flag(flgs, TR_NO_TELE)) p_ptr->anti_tele = TRUE;
4208 if (have_flag(flgs, TR_SUST_STR)) p_ptr->sustain_str = TRUE;
4209 if (have_flag(flgs, TR_SUST_INT)) p_ptr->sustain_int = TRUE;
4210 if (have_flag(flgs, TR_SUST_WIS)) p_ptr->sustain_wis = TRUE;
4211 if (have_flag(flgs, TR_SUST_DEX)) p_ptr->sustain_dex = TRUE;
4212 if (have_flag(flgs, TR_SUST_CON)) p_ptr->sustain_con = TRUE;
4213 if (have_flag(flgs, TR_SUST_CHR)) p_ptr->sustain_chr = TRUE;
4215 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
4216 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
4217 if (o_ptr->name2 == EGO_RING_RES_TIME) p_ptr->resist_time = TRUE;
4218 if (o_ptr->name2 == EGO_RING_THROW) p_ptr->mighty_throw = TRUE;
4219 if (have_flag(flgs, TR_EASY_SPELL)) p_ptr->easy_spell = TRUE;
4220 if (o_ptr->name2 == EGO_AMU_FOOL) p_ptr->heavy_spell = TRUE;
4221 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
4223 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
4225 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4227 p_ptr->to_m_chance += 10;
4231 p_ptr->to_m_chance += 3;
4235 if (o_ptr->tval == TV_CAPTURE) continue;
4237 /* Modify the base armor class */
4238 p_ptr->ac += o_ptr->ac;
4240 /* The base armor class is always known */
4241 p_ptr->dis_ac += o_ptr->ac;
4243 /* Apply the bonuses to armor class */
4244 p_ptr->to_a += o_ptr->to_a;
4246 /* Apply the mental bonuses to armor class, if known */
4247 if (object_is_known(o_ptr)) p_ptr->dis_to_a += o_ptr->to_a;
4249 if (o_ptr->curse_flags & TRC_LOW_MELEE)
4251 int slot = i - INVEN_RARM;
4254 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4256 p_ptr->to_h[slot] -= 15;
4257 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 15;
4261 p_ptr->to_h[slot] -= 5;
4262 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 5;
4267 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4269 p_ptr->to_h_b -= 15;
4270 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 15;
4275 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 5;
4280 if (o_ptr->curse_flags & TRC_LOW_AC)
4282 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4285 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 30;
4290 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 10;
4294 /* Hack -- do not apply "weapon" bonuses */
4295 if (i == INVEN_RARM && buki_motteruka(i)) continue;
4296 if (i == INVEN_LARM && buki_motteruka(i)) continue;
4298 /* Hack -- do not apply "bow" bonuses */
4299 if (i == INVEN_BOW) continue;
4301 bonus_to_h = o_ptr->to_h;
4302 bonus_to_d = o_ptr->to_d;
4304 if (p_ptr->pclass == CLASS_NINJA)
4306 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h+1)/2;
4307 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d+1)/2;
4310 /* To Bow and Natural attack */
4312 /* Apply the bonuses to hit/damage */
4313 p_ptr->to_h_b += bonus_to_h;
4314 p_ptr->to_h_m += bonus_to_h;
4315 p_ptr->to_d_m += bonus_to_d;
4317 /* Apply the mental bonuses tp hit/damage, if known */
4318 if (object_is_known(o_ptr)) p_ptr->dis_to_h_b += bonus_to_h;
4321 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !p_ptr->ryoute)
4323 /* Apply the bonuses to hit/damage */
4324 p_ptr->to_h[i-INVEN_RIGHT] += bonus_to_h;
4325 p_ptr->to_d[i-INVEN_RIGHT] += bonus_to_d;
4327 /* Apply the mental bonuses tp hit/damage, if known */
4328 if (object_is_known(o_ptr))
4330 p_ptr->dis_to_h[i-INVEN_RIGHT] += bonus_to_h;
4331 p_ptr->dis_to_d[i-INVEN_RIGHT] += bonus_to_d;
4334 else if (p_ptr->migite && p_ptr->hidarite)
4336 /* Apply the bonuses to hit/damage */
4337 p_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4338 p_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4339 p_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4340 p_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4342 /* Apply the mental bonuses tp hit/damage, if known */
4343 if (object_is_known(o_ptr))
4345 p_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4346 p_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4347 p_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4348 p_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4353 /* Apply the bonuses to hit/damage */
4354 p_ptr->to_h[default_hand] += bonus_to_h;
4355 p_ptr->to_d[default_hand] += bonus_to_d;
4357 /* Apply the mental bonuses to hit/damage, if known */
4358 if (object_is_known(o_ptr))
4360 p_ptr->dis_to_h[default_hand] += bonus_to_h;
4361 p_ptr->dis_to_d[default_hand] += bonus_to_d;
4366 if (old_mighty_throw != p_ptr->mighty_throw)
4368 /* Redraw average damege display of Shuriken */
4369 p_ptr->window |= PW_INVEN;
4372 if (p_ptr->cursed & TRC_TELEPORT) p_ptr->cursed &= ~(TRC_TELEPORT_SELF);
4374 /* Monks get extra ac for armour _not worn_ */
4375 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor())
4377 if (!(inventory[INVEN_BODY].k_idx))
4379 p_ptr->to_a += (p_ptr->lev * 3) / 2;
4380 p_ptr->dis_to_a += (p_ptr->lev * 3) / 2;
4382 if (!(inventory[INVEN_OUTER].k_idx) && (p_ptr->lev > 15))
4384 p_ptr->to_a += ((p_ptr->lev - 13) / 3);
4385 p_ptr->dis_to_a += ((p_ptr->lev - 13) / 3);
4387 if (!(inventory[INVEN_LARM].k_idx) && (p_ptr->lev > 10))
4389 p_ptr->to_a += ((p_ptr->lev - 8) / 3);
4390 p_ptr->dis_to_a += ((p_ptr->lev - 8) / 3);
4392 if (!(inventory[INVEN_HEAD].k_idx) && (p_ptr->lev > 4))
4394 p_ptr->to_a += (p_ptr->lev - 2) / 3;
4395 p_ptr->dis_to_a += (p_ptr->lev -2) / 3;
4397 if (!(inventory[INVEN_HANDS].k_idx))
4399 p_ptr->to_a += (p_ptr->lev / 2);
4400 p_ptr->dis_to_a += (p_ptr->lev / 2);
4402 if (!(inventory[INVEN_FEET].k_idx))
4404 p_ptr->to_a += (p_ptr->lev / 3);
4405 p_ptr->dis_to_a += (p_ptr->lev / 3);
4407 if (p_ptr->special_defense & KAMAE_BYAKKO)
4409 p_ptr->stat_add[A_STR] += 2;
4410 p_ptr->stat_add[A_DEX] += 2;
4411 p_ptr->stat_add[A_CON] -= 3;
4413 else if (p_ptr->special_defense & KAMAE_SEIRYU)
4416 else if (p_ptr->special_defense & KAMAE_GENBU)
4418 p_ptr->stat_add[A_INT] -= 1;
4419 p_ptr->stat_add[A_WIS] -= 1;
4420 p_ptr->stat_add[A_DEX] -= 2;
4421 p_ptr->stat_add[A_CON] += 3;
4423 else if (p_ptr->special_defense & KAMAE_SUZAKU)
4425 p_ptr->stat_add[A_STR] -= 2;
4426 p_ptr->stat_add[A_INT] += 1;
4427 p_ptr->stat_add[A_WIS] += 1;
4428 p_ptr->stat_add[A_DEX] += 2;
4429 p_ptr->stat_add[A_CON] -= 2;
4433 if (p_ptr->special_defense & KATA_KOUKIJIN)
4435 for (i = 0; i < 6; i++)
4436 p_ptr->stat_add[i] += 5;
4438 p_ptr->dis_to_a -= 50;
4441 /* Hack -- aura of fire also provides light */
4442 if (p_ptr->sh_fire) p_ptr->lite = TRUE;
4444 /* Golems also get an intrinsic AC bonus */
4445 if (prace_is_(RACE_GOLEM) || prace_is_(RACE_ANDROID))
4447 p_ptr->to_a += 10 + (p_ptr->lev * 2 / 5);
4448 p_ptr->dis_to_a += 10 + (p_ptr->lev * 2 / 5);
4452 if (p_ptr->realm1 == REALM_HEX)
4454 if (hex_spelling_any()) p_ptr->skill_stl -= (1 + p_ptr->magic_num2[0]);
4455 if (hex_spelling(HEX_DETECT_EVIL)) p_ptr->esp_evil = TRUE;
4456 if (hex_spelling(HEX_XTRA_MIGHT)) p_ptr->stat_add[A_STR] += 4;
4457 if (hex_spelling(HEX_BUILDING))
4459 p_ptr->stat_add[A_STR] += 4;
4460 p_ptr->stat_add[A_DEX] += 4;
4461 p_ptr->stat_add[A_CON] += 4;
4463 if (hex_spelling(HEX_DEMON_AURA))
4465 p_ptr->sh_fire = TRUE;
4466 p_ptr->regenerate = TRUE;
4468 if (hex_spelling(HEX_ICE_ARMOR))
4470 p_ptr->sh_cold = TRUE;
4472 p_ptr->dis_to_a += 30;
4474 if (hex_spelling(HEX_SHOCK_CLOAK))
4476 p_ptr->sh_elec = TRUE;
4479 for (i = INVEN_RARM; i <= INVEN_FEET; i++)
4482 o_ptr = &inventory[i];
4483 if (!o_ptr->k_idx) continue;
4484 if (!object_is_armour(o_ptr)) continue;
4485 if (!object_is_cursed(o_ptr)) continue;
4487 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
4488 if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
4490 p_ptr->dis_to_a += ac;
4494 /* Calculate stats */
4495 for (i = 0; i < 6; i++)
4499 /* Extract the new "stat_use" value for the stat */
4500 top = modify_stat_value(p_ptr->stat_max[i], p_ptr->stat_add[i]);
4502 /* Notice changes */
4503 if (p_ptr->stat_top[i] != top)
4505 /* Save the new value */
4506 p_ptr->stat_top[i] = top;
4508 /* Redisplay the stats later */
4509 p_ptr->redraw |= (PR_STATS);
4512 p_ptr->window |= (PW_PLAYER);
4516 /* Extract the new "stat_use" value for the stat */
4517 use = modify_stat_value(p_ptr->stat_cur[i], p_ptr->stat_add[i]);
4519 if ((i == A_CHR) && (p_ptr->muta3 & MUT3_ILL_NORM))
4521 /* 10 to 18/90 charisma, guaranteed, based on level */
4522 if (use < 8 + 2 * p_ptr->lev)
4524 use = 8 + 2 * p_ptr->lev;
4528 /* Notice changes */
4529 if (p_ptr->stat_use[i] != use)
4531 /* Save the new value */
4532 p_ptr->stat_use[i] = use;
4534 /* Redisplay the stats later */
4535 p_ptr->redraw |= (PR_STATS);
4538 p_ptr->window |= (PW_PLAYER);
4542 /* Values: 3, 4, ..., 17 */
4543 if (use <= 18) ind = (use - 3);
4545 /* Ranges: 18/00-18/09, ..., 18/210-18/219 */
4546 else if (use <= 18+219) ind = (15 + (use - 18) / 10);
4548 /* Range: 18/220+ */
4551 /* Notice changes */
4552 if (p_ptr->stat_ind[i] != ind)
4554 /* Save the new index */
4555 p_ptr->stat_ind[i] = ind;
4557 /* Change in CON affects Hitpoints */
4560 p_ptr->update |= (PU_HP);
4563 /* Change in INT may affect Mana/Spells */
4564 else if (i == A_INT)
4566 if (mp_ptr->spell_stat == A_INT)
4568 p_ptr->update |= (PU_MANA | PU_SPELLS);
4572 /* Change in WIS may affect Mana/Spells */
4573 else if (i == A_WIS)
4575 if (mp_ptr->spell_stat == A_WIS)
4577 p_ptr->update |= (PU_MANA | PU_SPELLS);
4581 /* Change in WIS may affect Mana/Spells */
4582 else if (i == A_CHR)
4584 if (mp_ptr->spell_stat == A_CHR)
4586 p_ptr->update |= (PU_MANA | PU_SPELLS);
4591 p_ptr->window |= (PW_PLAYER);
4596 /* Apply temporary "stun" */
4597 if (p_ptr->stun > 50)
4599 p_ptr->to_h[0] -= 20;
4600 p_ptr->to_h[1] -= 20;
4601 p_ptr->to_h_b -= 20;
4602 p_ptr->to_h_m -= 20;
4603 p_ptr->dis_to_h[0] -= 20;
4604 p_ptr->dis_to_h[1] -= 20;
4605 p_ptr->dis_to_h_b -= 20;
4606 p_ptr->to_d[0] -= 20;
4607 p_ptr->to_d[1] -= 20;
4608 p_ptr->to_d_m -= 20;
4609 p_ptr->dis_to_d[0] -= 20;
4610 p_ptr->dis_to_d[1] -= 20;
4612 else if (p_ptr->stun)
4614 p_ptr->to_h[0] -= 5;
4615 p_ptr->to_h[1] -= 5;
4618 p_ptr->dis_to_h[0] -= 5;
4619 p_ptr->dis_to_h[1] -= 5;
4620 p_ptr->dis_to_h_b -= 5;
4621 p_ptr->to_d[0] -= 5;
4622 p_ptr->to_d[1] -= 5;
4624 p_ptr->dis_to_d[0] -= 5;
4625 p_ptr->dis_to_d[1] -= 5;
4629 if (p_ptr->wraith_form)
4631 p_ptr->reflect = TRUE;
4632 p_ptr->pass_wall = TRUE;
4635 if (p_ptr->kabenuke)
4637 p_ptr->pass_wall = TRUE;
4640 /* Temporary blessing */
4644 p_ptr->dis_to_a += 5;
4645 p_ptr->to_h[0] += 10;
4646 p_ptr->to_h[1] += 10;
4647 p_ptr->to_h_b += 10;
4648 p_ptr->to_h_m += 10;
4649 p_ptr->dis_to_h[0] += 10;
4650 p_ptr->dis_to_h[1] += 10;
4651 p_ptr->dis_to_h_b += 10;
4654 if (p_ptr->magicdef)
4656 p_ptr->resist_blind = TRUE;
4657 p_ptr->resist_conf = TRUE;
4658 p_ptr->reflect = TRUE;
4659 p_ptr->free_act = TRUE;
4660 p_ptr->levitation = TRUE;
4663 /* Temporary "Hero" */
4666 p_ptr->to_h[0] += 12;
4667 p_ptr->to_h[1] += 12;
4668 p_ptr->to_h_b += 12;
4669 p_ptr->to_h_m += 12;
4670 p_ptr->dis_to_h[0] += 12;
4671 p_ptr->dis_to_h[1] += 12;
4672 p_ptr->dis_to_h_b += 12;
4675 /* Temporary "Beserk" */
4678 p_ptr->to_h[0] += 12;
4679 p_ptr->to_h[1] += 12;
4680 p_ptr->to_h_b -= 12;
4681 p_ptr->to_h_m += 12;
4682 p_ptr->to_d[0] += 3+(p_ptr->lev/5);
4683 p_ptr->to_d[1] += 3+(p_ptr->lev/5);
4684 p_ptr->to_d_m += 3+(p_ptr->lev/5);
4685 p_ptr->dis_to_h[0] += 12;
4686 p_ptr->dis_to_h[1] += 12;
4687 p_ptr->dis_to_h_b -= 12;
4688 p_ptr->dis_to_d[0] += 3+(p_ptr->lev/5);
4689 p_ptr->dis_to_d[1] += 3+(p_ptr->lev/5);
4691 p_ptr->dis_to_a -= 10;
4692 p_ptr->skill_stl -= 7;
4693 p_ptr->skill_dev -= 20;
4694 p_ptr->skill_sav -= 30;
4695 p_ptr->skill_srh -= 15;
4696 p_ptr->skill_fos -= 15;
4697 p_ptr->skill_tht -= 20;
4698 p_ptr->skill_dig += 30;
4701 /* Temporary "fast" */
4707 /* Temporary "slow" */
4713 /* Temporary "telepathy" */
4716 p_ptr->telepathy = TRUE;
4719 if (p_ptr->ele_immune)
4721 if (p_ptr->special_defense & DEFENSE_ACID)
4722 p_ptr->immune_acid = TRUE;
4723 else if (p_ptr->special_defense & DEFENSE_ELEC)
4724 p_ptr->immune_elec = TRUE;
4725 else if (p_ptr->special_defense & DEFENSE_FIRE)
4726 p_ptr->immune_fire = TRUE;
4727 else if (p_ptr->special_defense & DEFENSE_COLD)
4728 p_ptr->immune_cold = TRUE;
4731 /* Temporary see invisible */
4732 if (p_ptr->tim_invis)
4734 p_ptr->see_inv = TRUE;
4737 /* Temporary infravision boost */
4738 if (p_ptr->tim_infra)
4740 p_ptr->see_infra+=3;
4743 /* Temporary regeneration boost */
4744 if (p_ptr->tim_regen)
4746 p_ptr->regenerate = TRUE;
4749 /* Temporary levitation */
4750 if (p_ptr->tim_levitation)
4752 p_ptr->levitation = TRUE;
4755 /* Temporary reflection */
4756 if (p_ptr->tim_reflect)
4758 p_ptr->reflect = TRUE;
4761 /* Hack -- Hero/Shero -> Res fear */
4762 if (IS_HERO() || p_ptr->shero)
4764 p_ptr->resist_fear = TRUE;
4768 /* Hack -- Telepathy Change */
4769 if (p_ptr->telepathy != old_telepathy)
4771 p_ptr->update |= (PU_MONSTERS);
4774 if ((p_ptr->esp_animal != old_esp_animal) ||
4775 (p_ptr->esp_undead != old_esp_undead) ||
4776 (p_ptr->esp_demon != old_esp_demon) ||
4777 (p_ptr->esp_orc != old_esp_orc) ||
4778 (p_ptr->esp_troll != old_esp_troll) ||
4779 (p_ptr->esp_giant != old_esp_giant) ||
4780 (p_ptr->esp_dragon != old_esp_dragon) ||
4781 (p_ptr->esp_human != old_esp_human) ||
4782 (p_ptr->esp_evil != old_esp_evil) ||
4783 (p_ptr->esp_good != old_esp_good) ||
4784 (p_ptr->esp_nonliving != old_esp_nonliving) ||
4785 (p_ptr->esp_unique != old_esp_unique))
4787 p_ptr->update |= (PU_MONSTERS);
4790 /* Hack -- See Invis Change */
4791 if (p_ptr->see_inv != old_see_inv)
4793 p_ptr->update |= (PU_MONSTERS);
4796 /* Bloating slows the player down (a little) */
4797 if (p_ptr->food >= PY_FOOD_MAX) new_speed -= 10;
4799 if (p_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10;
4801 if ((p_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) ||
4802 (p_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM)))
4804 p_ptr->to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
4805 p_ptr->dis_to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
4808 if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
4810 int penalty1, penalty2;
4811 penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_RARM].weight) / 8);
4812 penalty2 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_LARM].weight) / 8);
4813 if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN))
4815 penalty1 = penalty1 / 2 - 5;
4816 penalty2 = penalty2 / 2 - 5;
4819 p_ptr->dis_to_a += 10;
4823 if (penalty1 > 0) penalty1 /= 2;
4824 if (penalty2 > 0) penalty2 /= 2;
4826 else if ((inventory[INVEN_LARM].tval == TV_SWORD) && ((inventory[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (inventory[INVEN_LARM].sval == SV_WAKIZASHI)))
4828 penalty1 = MAX(0, penalty1 - 10);
4829 penalty2 = MAX(0, penalty2 - 10);
4831 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
4833 penalty1 = MIN(0, penalty1);
4834 penalty2 = MIN(0, penalty2);
4836 p_ptr->dis_to_a += 10;
4840 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
4842 if ((inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
4845 if (inventory[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
4846 if (inventory[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
4847 p_ptr->to_h[0] -= penalty1;
4848 p_ptr->to_h[1] -= penalty2;
4849 p_ptr->dis_to_h[0] -= penalty1;
4850 p_ptr->dis_to_h[1] -= penalty2;
4853 /* Extract the current weight (in tenth pounds) */
4854 j = p_ptr->total_weight;
4858 /* Extract the "weight limit" (in tenth pounds) */
4859 i = (int)weight_limit();
4863 monster_type *riding_m_ptr = &m_list[p_ptr->riding];
4864 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
4865 int speed = riding_m_ptr->mspeed;
4867 if (riding_m_ptr->mspeed > 110)
4869 new_speed = 110 + (s16b)((speed - 110) * (p_ptr->skill_exp[GINOU_RIDING] * 3 + p_ptr->lev * 160L - 10000L) / (22000L));
4870 if (new_speed < 110) new_speed = 110;
4876 new_speed += (p_ptr->skill_exp[GINOU_RIDING] + p_ptr->lev *160L)/3200;
4877 if (MON_FAST(riding_m_ptr)) new_speed += 10;
4878 if (MON_SLOW(riding_m_ptr)) new_speed -= 10;
4879 riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
4880 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE;
4882 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) p_ptr->pass_wall = FALSE;
4883 if (riding_r_ptr->flags2 & RF2_KILL_WALL) p_ptr->kill_wall = TRUE;
4885 if (p_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED) j += (p_ptr->wt * 3 * (RIDING_EXP_SKILLED - p_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
4887 /* Extract the "weight limit" */
4888 i = 1500 + riding_r_ptr->level * 25;
4891 /* XXX XXX XXX Apply "encumbrance" from weight */
4892 if (j > i) new_speed -= ((j - i) / (i / 5));
4894 /* Searching slows the player down */
4895 if (p_ptr->action == ACTION_SEARCH) new_speed -= 10;
4897 /* Actual Modifier Bonuses (Un-inflate stat bonuses) */
4898 p_ptr->to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4899 p_ptr->to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4900 p_ptr->to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4901 p_ptr->to_d_m += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4902 p_ptr->to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4903 p_ptr->to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4904 p_ptr->to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4905 p_ptr->to_h_m += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4906 p_ptr->to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4907 p_ptr->to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4908 p_ptr->to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4909 p_ptr->to_h_m += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4911 /* Displayed Modifier Bonuses (Un-inflate stat bonuses) */
4912 p_ptr->dis_to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4913 p_ptr->dis_to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4914 p_ptr->dis_to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4915 p_ptr->dis_to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4916 p_ptr->dis_to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4917 p_ptr->dis_to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4918 p_ptr->dis_to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4919 p_ptr->dis_to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4920 p_ptr->dis_to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4923 /* Obtain the "hold" value */
4924 hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
4927 /* Examine the "current bow" */
4928 o_ptr = &inventory[INVEN_BOW];
4931 /* Assume not heavy */
4932 p_ptr->heavy_shoot = FALSE;
4934 /* It is hard to carholdry a heavy bow */
4935 if (hold < o_ptr->weight / 10)
4937 /* Hard to wield a heavy bow */
4938 p_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
4939 p_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
4942 p_ptr->heavy_shoot = TRUE;
4946 /* Compute "extra shots" if needed */
4949 /* Analyze the launcher */
4950 switch (o_ptr->sval)
4954 p_ptr->tval_ammo = TV_SHOT;
4962 p_ptr->tval_ammo = TV_ARROW;
4969 p_ptr->tval_ammo = TV_BOLT;
4974 p_ptr->tval_ammo = TV_NO_AMMO;
4979 /* Apply special flags */
4980 if (o_ptr->k_idx && !p_ptr->heavy_shoot)
4983 p_ptr->num_fire += (extra_shots * 100);
4985 /* Hack -- Rangers love Bows */
4986 if ((p_ptr->pclass == CLASS_RANGER) &&
4987 (p_ptr->tval_ammo == TV_ARROW))
4989 p_ptr->num_fire += (p_ptr->lev * 4);
4992 if ((p_ptr->pclass == CLASS_CAVALRY) &&
4993 (p_ptr->tval_ammo == TV_ARROW))
4995 p_ptr->num_fire += (p_ptr->lev * 3);
4998 if (p_ptr->pclass == CLASS_ARCHER)
5000 if (p_ptr->tval_ammo == TV_ARROW)
5001 p_ptr->num_fire += ((p_ptr->lev * 5)+50);
5002 else if ((p_ptr->tval_ammo == TV_BOLT) || (p_ptr->tval_ammo == TV_SHOT))
5003 p_ptr->num_fire += (p_ptr->lev * 4);
5007 * Addendum -- also "Reward" high level warriors,
5008 * with _any_ missile weapon -- TY
5010 if (p_ptr->pclass == CLASS_WARRIOR &&
5011 (p_ptr->tval_ammo <= TV_BOLT) &&
5012 (p_ptr->tval_ammo >= TV_SHOT))
5014 p_ptr->num_fire += (p_ptr->lev * 2);
5016 if ((p_ptr->pclass == CLASS_ROGUE) &&
5017 (p_ptr->tval_ammo == TV_SHOT))
5019 p_ptr->num_fire += (p_ptr->lev * 4);
5022 /* Snipers love Cross bows */
5023 if ((p_ptr->pclass == CLASS_SNIPER) &&
5024 (p_ptr->tval_ammo == TV_BOLT))
5026 p_ptr->to_h_b += (10 + (p_ptr->lev / 5));
5027 p_ptr->dis_to_h_b += (10 + (p_ptr->lev / 5));
5035 for(i = 0 ; i < 2 ; i++)
5037 /* Examine the "main weapon" */
5038 o_ptr = &inventory[INVEN_RARM+i];
5040 object_flags(o_ptr, flgs);
5042 /* Assume not heavy */
5043 p_ptr->heavy_wield[i] = FALSE;
5044 p_ptr->icky_wield[i] = FALSE;
5045 p_ptr->riding_wield[i] = FALSE;
5047 if (!buki_motteruka(INVEN_RARM+i)) {p_ptr->num_blow[i]=1;continue;}
5048 /* It is hard to hold a heavy weapon */
5049 if (hold < o_ptr->weight / 10)
5051 /* Hard to wield a heavy weapon */
5052 p_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
5053 p_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
5056 p_ptr->heavy_wield[i] = TRUE;
5058 else if (p_ptr->ryoute && (hold < o_ptr->weight/5)) omoi = TRUE;
5060 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
5063 p_ptr->dis_to_a += 5;
5066 /* Normal weapons */
5067 if (o_ptr->k_idx && !p_ptr->heavy_wield[i])
5069 int str_index, dex_index;
5071 int num = 0, wgt = 0, mul = 0, div = 0;
5073 /* Analyze the class */
5074 switch (p_ptr->pclass)
5078 num = 6; wgt = 70; mul = 5; break;
5081 case CLASS_BERSERKER:
5082 num = 6; wgt = 70; mul = 7; break;
5086 case CLASS_HIGH_MAGE:
5087 case CLASS_BLUE_MAGE:
5088 num = 3; wgt = 100; mul = 2; break;
5090 /* Priest, Mindcrafter, Magic-Eater */
5092 case CLASS_MAGIC_EATER:
5093 case CLASS_MINDCRAFTER:
5094 num = 5; wgt = 100; mul = 3; break;
5098 num = 5; wgt = 40; mul = 3; break;
5102 num = 5; wgt = 70; mul = 4; break;
5107 num = 5; wgt = 70; mul = 4; break;
5111 num = 5; wgt = 150; mul = 5; break;
5114 case CLASS_WARRIOR_MAGE:
5115 case CLASS_RED_MAGE:
5116 num = 5; wgt = 70; mul = 3; break;
5119 case CLASS_CHAOS_WARRIOR:
5120 num = 5; wgt = 70; mul = 4; break;
5124 num = 5; wgt = 60; mul = 3; break;
5128 num = 4; wgt = 100; mul = 3; break;
5131 case CLASS_IMITATOR:
5132 num = 5; wgt = 70; mul = 4; break;
5135 case CLASS_BEASTMASTER:
5136 num = 5; wgt = 70; mul = 3; break;
5140 if ((p_ptr->riding) && (have_flag(flgs, TR_RIDING))) {num = 5; wgt = 70; mul = 4;}
5141 else {num = 5; wgt = 100; mul = 3;}
5145 case CLASS_SORCERER:
5146 num = 1; wgt = 1; mul = 1; break;
5148 /* Archer, Bard, Sniper */
5152 num = 4; wgt = 70; mul = 2; break;
5155 case CLASS_FORCETRAINER:
5156 num = 4; wgt = 60; mul = 2; break;
5159 case CLASS_MIRROR_MASTER:
5160 num = 3; wgt = 100; mul = 3; break;
5164 num = 4; wgt = 20; mul = 1; break;
5167 /* Hex - extra mights gives +1 bonus to max blows */
5168 if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING)) { num++; wgt /= 2; mul += 2; }
5170 /* Enforce a minimum "weight" (tenth pounds) */
5171 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
5173 /* Access the strength vs weight */
5174 str_index = (adj_str_blow[p_ptr->stat_ind[A_STR]] * mul / div);
5176 if (p_ptr->ryoute && !omoi) str_index++;
5177 if (p_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index-1);
5180 if (str_index > 11) str_index = 11;
5182 /* Index by dexterity */
5183 dex_index = (adj_dex_blow[p_ptr->stat_ind[A_DEX]]);
5186 if (dex_index > 11) dex_index = 11;
5188 /* Use the blows table */
5189 p_ptr->num_blow[i] = blows_table[str_index][dex_index];
5192 if (p_ptr->num_blow[i] > num) p_ptr->num_blow[i] = num;
5194 /* Add in the "bonus blows" */
5195 p_ptr->num_blow[i] += extra_blows[i];
5198 if (p_ptr->pclass == CLASS_WARRIOR) p_ptr->num_blow[i] += (p_ptr->lev / 40);
5199 else if (p_ptr->pclass == CLASS_BERSERKER)
5201 p_ptr->num_blow[i] += (p_ptr->lev / 23);
5203 else if ((p_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (p_ptr->stat_ind[A_DEX] >= 30)) p_ptr->num_blow[i] ++;
5205 if (p_ptr->special_defense & KATA_FUUJIN) p_ptr->num_blow[i] -= 1;
5207 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) p_ptr->num_blow[i] = 1;
5210 /* Require at least one blow */
5211 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
5213 /* Boost digging skill by weapon weight */
5214 p_ptr->skill_dig += (o_ptr->weight / 10);
5218 /* Priest weapon penalty for non-blessed edged weapons */
5219 if ((p_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
5220 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
5222 /* Reduce the real bonuses */
5223 p_ptr->to_h[i] -= 2;
5224 p_ptr->to_d[i] -= 2;
5226 /* Reduce the mental bonuses */
5227 p_ptr->dis_to_h[i] -= 2;
5228 p_ptr->dis_to_d[i] -= 2;
5231 p_ptr->icky_wield[i] = TRUE;
5233 else if (p_ptr->pclass == CLASS_BERSERKER)
5235 p_ptr->to_h[i] += p_ptr->lev/5;
5236 p_ptr->to_d[i] += p_ptr->lev/6;
5237 p_ptr->dis_to_h[i] += p_ptr->lev/5;
5238 p_ptr->dis_to_d[i] += p_ptr->lev/6;
5239 if (((i == 0) && !p_ptr->hidarite) || p_ptr->ryoute)
5241 p_ptr->to_h[i] += p_ptr->lev/5;
5242 p_ptr->to_d[i] += p_ptr->lev/6;
5243 p_ptr->dis_to_h[i] += p_ptr->lev/5;
5244 p_ptr->dis_to_d[i] += p_ptr->lev/6;
5247 else if (p_ptr->pclass == CLASS_SORCERER)
5249 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
5251 /* Reduce the real bonuses */
5252 p_ptr->to_h[i] -= 200;
5253 p_ptr->to_d[i] -= 200;
5255 /* Reduce the mental bonuses */
5256 p_ptr->dis_to_h[i] -= 200;
5257 p_ptr->dis_to_d[i] -= 200;
5260 p_ptr->icky_wield[i] = TRUE;
5264 /* Reduce the real bonuses */
5265 p_ptr->to_h[i] -= 30;
5266 p_ptr->to_d[i] -= 10;
5268 /* Reduce the mental bonuses */
5269 p_ptr->dis_to_h[i] -= 30;
5270 p_ptr->dis_to_d[i] -= 10;
5274 if (p_ptr->realm1 == REALM_HEX)
5276 if (object_is_cursed(o_ptr))
5278 if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
5279 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_h[i] += 7; p_ptr->dis_to_h[i] += 7; }
5280 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_h[i] += 13; p_ptr->dis_to_h[i] += 13; }
5281 if (o_ptr->curse_flags & (TRC_TY_CURSE)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
5282 if (hex_spelling(HEX_RUNESWORD))
5284 if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_d[i] += 5; p_ptr->dis_to_d[i] += 5; }
5285 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_d[i] += 7; p_ptr->dis_to_d[i] += 7; }
5286 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_d[i] += 13; p_ptr->dis_to_d[i] += 13; }
5292 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
5294 p_ptr->to_h[i] +=15;
5295 p_ptr->dis_to_h[i] +=15;
5296 p_ptr->to_dd[i] += 2;
5298 else if (!(have_flag(flgs, TR_RIDING)))
5301 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
5307 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
5309 if (penalty < 30) penalty = 30;
5311 p_ptr->to_h[i] -= penalty;
5312 p_ptr->dis_to_h[i] -= penalty;
5315 p_ptr->riding_wield[i] = TRUE;
5324 p_ptr->riding_ryoute = FALSE;
5326 if (p_ptr->ryoute || (empty_hands(FALSE) == EMPTY_HAND_NONE)) p_ptr->riding_ryoute = TRUE;
5327 else if (p_ptr->pet_extra_flags & PF_RYOUTE)
5329 switch (p_ptr->pclass)
5332 case CLASS_FORCETRAINER:
5333 case CLASS_BERSERKER:
5334 if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
5335 p_ptr->riding_ryoute = TRUE;
5340 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
5342 if (p_ptr->tval_ammo != TV_ARROW) penalty = 5;
5346 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
5348 if (penalty < 30) penalty = 30;
5350 if (p_ptr->tval_ammo == TV_BOLT) penalty *= 2;
5351 p_ptr->to_h_b -= penalty;
5352 p_ptr->dis_to_h_b -= penalty;
5355 /* Different calculation for monks with empty hands */
5356 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) &&
5357 (empty_hands_status & EMPTY_HAND_RARM) && !p_ptr->hidarite)
5359 int blow_base = p_ptr->lev + adj_dex_blow[p_ptr->stat_ind[A_DEX]];
5360 p_ptr->num_blow[0] = 0;
5362 if (p_ptr->pclass == CLASS_FORCETRAINER)
5364 if (blow_base > 18) p_ptr->num_blow[0]++;
5365 if (blow_base > 31) p_ptr->num_blow[0]++;
5366 if (blow_base > 44) p_ptr->num_blow[0]++;
5367 if (blow_base > 58) p_ptr->num_blow[0]++;
5368 if (p_ptr->magic_num1[0])
5370 p_ptr->to_d[0] += (p_ptr->magic_num1[0]/5);
5371 p_ptr->dis_to_d[0] += (p_ptr->magic_num1[0]/5);
5376 if (blow_base > 12) p_ptr->num_blow[0]++;
5377 if (blow_base > 22) p_ptr->num_blow[0]++;
5378 if (blow_base > 31) p_ptr->num_blow[0]++;
5379 if (blow_base > 39) p_ptr->num_blow[0]++;
5380 if (blow_base > 46) p_ptr->num_blow[0]++;
5381 if (blow_base > 53) p_ptr->num_blow[0]++;
5382 if (blow_base > 59) p_ptr->num_blow[0]++;
5385 if (heavy_armor() && (p_ptr->pclass != CLASS_BERSERKER))
5386 p_ptr->num_blow[0] /= 2;
5389 p_ptr->to_h[0] += (p_ptr->lev / 3);
5390 p_ptr->dis_to_h[0] += (p_ptr->lev / 3);
5392 p_ptr->to_d[0] += (p_ptr->lev / 6);
5393 p_ptr->dis_to_d[0] += (p_ptr->lev / 6);
5396 if (p_ptr->special_defense & KAMAE_BYAKKO)
5399 p_ptr->dis_to_a -= 40;
5402 else if (p_ptr->special_defense & KAMAE_SEIRYU)
5405 p_ptr->dis_to_a -= 50;
5406 p_ptr->resist_acid = TRUE;
5407 p_ptr->resist_fire = TRUE;
5408 p_ptr->resist_elec = TRUE;
5409 p_ptr->resist_cold = TRUE;
5410 p_ptr->resist_pois = TRUE;
5411 p_ptr->sh_fire = TRUE;
5412 p_ptr->sh_elec = TRUE;
5413 p_ptr->sh_cold = TRUE;
5414 p_ptr->levitation = TRUE;
5416 else if (p_ptr->special_defense & KAMAE_GENBU)
5418 p_ptr->to_a += (p_ptr->lev*p_ptr->lev)/50;
5419 p_ptr->dis_to_a += (p_ptr->lev*p_ptr->lev)/50;
5420 p_ptr->reflect = TRUE;
5421 p_ptr->num_blow[0] -= 2;
5422 if ((p_ptr->pclass == CLASS_MONK) && (p_ptr->lev > 42)) p_ptr->num_blow[0]--;
5423 if (p_ptr->num_blow[0] < 0) p_ptr->num_blow[0] = 0;
5425 else if (p_ptr->special_defense & KAMAE_SUZAKU)
5427 p_ptr->to_h[0] -= (p_ptr->lev / 3);
5428 p_ptr->to_d[0] -= (p_ptr->lev / 6);
5430 p_ptr->dis_to_h[0] -= (p_ptr->lev / 3);
5431 p_ptr->dis_to_d[0] -= (p_ptr->lev / 6);
5432 p_ptr->num_blow[0] /= 2;
5433 p_ptr->levitation = TRUE;
5436 p_ptr->num_blow[0] += 1+extra_blows[0];
5439 if (p_ptr->riding) p_ptr->levitation = riding_levitation;
5441 monk_armour_aux = FALSE;
5445 monk_armour_aux = TRUE;
5448 for (i = 0; i < 2; i++)
5450 if (buki_motteruka(INVEN_RARM+i))
5452 int tval = inventory[INVEN_RARM+i].tval - TV_WEAPON_BEGIN;
5453 int sval = inventory[INVEN_RARM+i].sval;
5455 p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
5456 p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
5457 if ((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER))
5459 if (!s_info[p_ptr->pclass].w_max[tval][sval])
5461 p_ptr->to_h[i] -= 40;
5462 p_ptr->dis_to_h[i] -= 40;
5463 p_ptr->icky_wield[i] = TRUE;
5466 else if (p_ptr->pclass == CLASS_NINJA)
5468 if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (inventory[INVEN_LARM-i].tval == TV_SHIELD))
5470 p_ptr->to_h[i] -= 40;
5471 p_ptr->dis_to_h[i] -= 40;
5472 p_ptr->icky_wield[i] = TRUE;
5473 p_ptr->num_blow[i] /= 2;
5474 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
5478 if (inventory[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000;
5482 /* Maximum speed is (+99). (internally it's 110 + 99) */
5483 /* Temporary lightspeed forces to be maximum speed */
5484 if ((p_ptr->lightspeed && !p_ptr->riding) || (new_speed > 209))
5489 /* Minimum speed is (-99). (internally it's 110 - 99) */
5490 if (new_speed < 11) new_speed = 11;
5492 /* Display the speed (if needed) */
5493 if (p_ptr->pspeed != (byte)new_speed)
5495 p_ptr->pspeed = (byte)new_speed;
5496 p_ptr->redraw |= (PR_SPEED);
5501 if (p_ptr->to_a > (0 - p_ptr->ac))
5502 p_ptr->to_a = 0 - p_ptr->ac;
5503 if (p_ptr->dis_to_a > (0 - p_ptr->dis_ac))
5504 p_ptr->dis_to_a = 0 - p_ptr->dis_ac;
5507 /* Redraw armor (if needed) */
5508 if ((p_ptr->dis_ac != old_dis_ac) || (p_ptr->dis_to_a != old_dis_to_a))
5511 p_ptr->redraw |= (PR_ARMOR);
5514 p_ptr->window |= (PW_PLAYER);
5518 if (p_ptr->ryoute && !omoi)
5520 int bonus_to_h=0, bonus_to_d=0;
5521 bonus_to_d = ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128)/2;
5522 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);
5524 p_ptr->to_h[default_hand] += MAX(bonus_to_h,1);
5525 p_ptr->dis_to_h[default_hand] += MAX(bonus_to_h,1);
5526 p_ptr->to_d[default_hand] += MAX(bonus_to_d,1);
5527 p_ptr->dis_to_d[default_hand] += MAX(bonus_to_d,1);
5530 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))) p_ptr->ryoute = FALSE;
5532 /* Affect Skill -- stealth (bonus one) */
5533 p_ptr->skill_stl += 1;
5535 if (IS_TIM_STEALTH()) p_ptr->skill_stl += 99;
5537 /* Affect Skill -- disarming (DEX and INT) */
5538 p_ptr->skill_dis += adj_dex_dis[p_ptr->stat_ind[A_DEX]];
5539 p_ptr->skill_dis += adj_int_dis[p_ptr->stat_ind[A_INT]];
5541 /* Affect Skill -- magic devices (INT) */
5542 p_ptr->skill_dev += adj_int_dev[p_ptr->stat_ind[A_INT]];
5544 /* Affect Skill -- saving throw (WIS) */
5545 p_ptr->skill_sav += adj_wis_sav[p_ptr->stat_ind[A_WIS]];
5547 /* Affect Skill -- digging (STR) */
5548 p_ptr->skill_dig += adj_str_dig[p_ptr->stat_ind[A_STR]];
5550 /* Affect Skill -- disarming (Level, by Class) */
5551 p_ptr->skill_dis += ((cp_ptr->x_dis * p_ptr->lev / 10) + (ap_ptr->a_dis * p_ptr->lev / 50));
5553 /* Affect Skill -- magic devices (Level, by Class) */
5554 p_ptr->skill_dev += ((cp_ptr->x_dev * p_ptr->lev / 10) + (ap_ptr->a_dev * p_ptr->lev / 50));
5556 /* Affect Skill -- saving throw (Level, by Class) */
5557 p_ptr->skill_sav += ((cp_ptr->x_sav * p_ptr->lev / 10) + (ap_ptr->a_sav * p_ptr->lev / 50));
5559 /* Affect Skill -- stealth (Level, by Class) */
5560 p_ptr->skill_stl += (cp_ptr->x_stl * p_ptr->lev / 10);
5562 /* Affect Skill -- search ability (Level, by Class) */
5563 p_ptr->skill_srh += (cp_ptr->x_srh * p_ptr->lev / 10);
5565 /* Affect Skill -- search frequency (Level, by Class) */
5566 p_ptr->skill_fos += (cp_ptr->x_fos * p_ptr->lev / 10);
5568 /* Affect Skill -- combat (normal) (Level, by Class) */
5569 p_ptr->skill_thn += ((cp_ptr->x_thn * p_ptr->lev / 10) + (ap_ptr->a_thn * p_ptr->lev / 50));
5571 /* Affect Skill -- combat (shooting) (Level, by Class) */
5572 p_ptr->skill_thb += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5574 /* Affect Skill -- combat (throwing) (Level, by Class) */
5575 p_ptr->skill_tht += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5578 if ((prace_is_(RACE_S_FAIRY)) && (p_ptr->pseikaku != SEIKAKU_SEXY) && (p_ptr->cursed & TRC_AGGRAVATE))
5580 p_ptr->cursed &= ~(TRC_AGGRAVATE);
5581 p_ptr->skill_stl = MIN(p_ptr->skill_stl - 3, (p_ptr->skill_stl + 2) / 2);
5584 /* Limit Skill -- stealth from 0 to 30 */
5585 if (p_ptr->skill_stl > 30) p_ptr->skill_stl = 30;
5586 if (p_ptr->skill_stl < 0) p_ptr->skill_stl = 0;
5588 /* Limit Skill -- digging from 1 up */
5589 if (p_ptr->skill_dig < 1) p_ptr->skill_dig = 1;
5591 if (p_ptr->anti_magic && (p_ptr->skill_sav < (90 + p_ptr->lev))) p_ptr->skill_sav = 90 + p_ptr->lev;
5593 if (p_ptr->tsubureru) p_ptr->skill_sav = 10;
5595 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;
5597 if (down_saving) p_ptr->skill_sav /= 2;
5599 /* Hack -- Each elemental immunity includes resistance */
5600 if (p_ptr->immune_acid) p_ptr->resist_acid = TRUE;
5601 if (p_ptr->immune_elec) p_ptr->resist_elec = TRUE;
5602 if (p_ptr->immune_fire) p_ptr->resist_fire = TRUE;
5603 if (p_ptr->immune_cold) p_ptr->resist_cold = TRUE;
5605 /* Determine player alignment */
5606 for (i = 0, j = 0; i < 8; i++)
5608 switch (p_ptr->vir_types[i])
5611 p_ptr->align += p_ptr->virtues[i] * 2;
5621 p_ptr->align -= p_ptr->virtues[i];
5624 p_ptr->align += p_ptr->virtues[i];
5629 for (i = 0; i < j; i++)
5631 if (p_ptr->align > 0)
5633 p_ptr->align -= p_ptr->virtues[neutral[i]] / 2;
5634 if (p_ptr->align < 0) p_ptr->align = 0;
5636 else if (p_ptr->align < 0)
5638 p_ptr->align += p_ptr->virtues[neutral[i]] / 2;
5639 if (p_ptr->align > 0) p_ptr->align = 0;
5643 /* Hack -- handle "xtra" mode */
5644 if (character_xtra) return;
5646 /* Take note when "heavy bow" changes */
5647 if (p_ptr->old_heavy_shoot != p_ptr->heavy_shoot)
5650 if (p_ptr->heavy_shoot)
5653 msg_print("¤³¤ó¤Ê½Å¤¤µÝ¤òÁõÈ÷¤·¤Æ¤¤¤ë¤Î¤ÏÂçÊѤÀ¡£");
5655 msg_print("You have trouble wielding such a heavy bow.");
5659 else if (inventory[INVEN_BOW].k_idx)
5662 msg_print("¤³¤ÎµÝ¤Ê¤éÁõÈ÷¤·¤Æ¤¤¤Æ¤â¿É¤¯¤Ê¤¤¡£");
5664 msg_print("You have no trouble wielding your bow.");
5671 msg_print("½Å¤¤µÝ¤òÁõÈ÷¤«¤é¤Ï¤º¤·¤ÆÂΤ¬³Ú¤Ë¤Ê¤Ã¤¿¡£");
5673 msg_print("You feel relieved to put down your heavy bow.");
5679 p_ptr->old_heavy_shoot = p_ptr->heavy_shoot;
5682 for (i = 0 ; i < 2 ; i++)
5684 /* Take note when "heavy weapon" changes */
5685 if (p_ptr->old_heavy_wield[i] != p_ptr->heavy_wield[i])
5688 if (p_ptr->heavy_wield[i])
5691 msg_print("¤³¤ó¤Ê½Å¤¤Éð´ï¤òÁõÈ÷¤·¤Æ¤¤¤ë¤Î¤ÏÂçÊѤÀ¡£");
5693 msg_print("You have trouble wielding such a heavy weapon.");
5697 else if (buki_motteruka(INVEN_RARM+i))
5700 msg_print("¤³¤ì¤Ê¤éÁõÈ÷¤·¤Æ¤¤¤Æ¤â¿É¤¯¤Ê¤¤¡£");
5702 msg_print("You have no trouble wielding your weapon.");
5706 else if (p_ptr->heavy_wield[1-i])
5709 msg_print("¤Þ¤ÀÉð´ï¤¬½Å¤¤¡£");
5711 msg_print("You have still trouble wielding a heavy weapon.");
5718 msg_print("½Å¤¤Éð´ï¤òÁõÈ÷¤«¤é¤Ï¤º¤·¤ÆÂΤ¬³Ú¤Ë¤Ê¤Ã¤¿¡£");
5720 msg_print("You feel relieved to put down your heavy weapon.");
5726 p_ptr->old_heavy_wield[i] = p_ptr->heavy_wield[i];
5729 /* Take note when "heavy weapon" changes */
5730 if (p_ptr->old_riding_wield[i] != p_ptr->riding_wield[i])
5733 if (p_ptr->riding_wield[i])
5736 msg_print("¤³¤ÎÉð´ï¤Ï¾èÇÏÃæ¤Ë»È¤¦¤Ë¤Ï¤à¤«¤Ê¤¤¤è¤¦¤À¡£");
5738 msg_print("This weapon is not suitable for use while riding.");
5742 else if (!p_ptr->riding)
5745 msg_print("¤³¤ÎÉð´ï¤ÏÅÌÊâ¤Ç»È¤¤¤ä¤¹¤¤¡£");
5747 msg_print("This weapon was not suitable for use while riding.");
5751 else if (buki_motteruka(INVEN_RARM+i))
5754 msg_print("¤³¤ì¤Ê¤é¾èÇÏÃæ¤Ë¤Ô¤Ã¤¿¤ê¤À¡£");
5756 msg_print("This weapon is suitable for use while riding.");
5761 p_ptr->old_riding_wield[i] = p_ptr->riding_wield[i];
5764 /* Take note when "illegal weapon" changes */
5765 if (p_ptr->old_icky_wield[i] != p_ptr->icky_wield[i])
5768 if (p_ptr->icky_wield[i])
5771 msg_print("º£¤ÎÁõÈ÷¤Ï¤É¤¦¤â¼«Ê¬¤Ë¤Õ¤µ¤ï¤·¤¯¤Ê¤¤µ¤¤¬¤¹¤ë¡£");
5773 msg_print("You do not feel comfortable with your weapon.");
5777 chg_virtue(V_FAITH, -1);
5780 else if (buki_motteruka(INVEN_RARM+i))
5783 msg_print("º£¤ÎÁõÈ÷¤Ï¼«Ê¬¤Ë¤Õ¤µ¤ï¤·¤¤µ¤¤¬¤¹¤ë¡£");
5785 msg_print("You feel comfortable with your weapon.");
5792 msg_print("ÁõÈ÷¤ò¤Ï¤º¤·¤¿¤é¿ïʬ¤Èµ¤¤¬³Ú¤Ë¤Ê¤Ã¤¿¡£");
5794 msg_print("You feel more comfortable after removing your weapon.");
5800 p_ptr->old_icky_wield[i] = p_ptr->icky_wield[i];
5804 if (p_ptr->riding && (p_ptr->old_riding_ryoute != p_ptr->riding_ryoute))
5807 if (p_ptr->riding_ryoute)
5810 msg_format("%sÇϤòÁà¤ì¤Ê¤¤¡£", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "ξ¼ê¤¬¤Õ¤µ¤¬¤Ã¤Æ¤¤¤Æ" : "");
5812 msg_print("You are using both hand for fighting, and you can't control a riding pet.");
5818 msg_format("%sÇϤòÁà¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "¼ê¤¬¶õ¤¤¤Æ" : "");
5820 msg_print("You began to control riding pet with one hand.");
5824 p_ptr->old_riding_ryoute = p_ptr->riding_ryoute;
5827 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (monk_armour_aux != monk_notify_aux))
5832 msg_print("ÁõÈ÷¤¬½Å¤¯¤Æ¥Ð¥é¥ó¥¹¤ò¼è¤ì¤Ê¤¤¡£");
5834 msg_print("The weight of your armor disrupts your balance.");
5839 chg_virtue(V_HARMONY, -1);
5844 msg_print("¥Ð¥é¥ó¥¹¤¬¤È¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£");
5846 msg_print("You regain your balance.");
5849 monk_notify_aux = monk_armour_aux;
5852 for (i = 0; i < INVEN_PACK; i++)
5855 if ((inventory[i].tval == TV_SORCERY_BOOK) && (inventory[i].sval == 2)) have_dd_s = TRUE;
5856 if ((inventory[i].tval == TV_TRUMP_BOOK) && (inventory[i].sval == 1)) have_dd_t = TRUE;
5858 if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE;
5859 if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE;
5861 for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
5865 /* Acquire object */
5866 o_ptr = &o_list[this_o_idx];
5868 /* Acquire next object */
5869 next_o_idx = o_ptr->next_o_idx;
5872 if ((o_ptr->tval == TV_SORCERY_BOOK) && (o_ptr->sval == 3)) have_dd_s = TRUE;
5873 if ((o_ptr->tval == TV_TRUMP_BOOK) && (o_ptr->sval == 1)) have_dd_t = TRUE;
5875 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
5876 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
5879 if (p_ptr->pass_wall && !p_ptr->kill_wall) p_ptr->no_flowed = TRUE;
5881 if (have_dd_s && ((p_ptr->realm1 == REALM_SORCERY) || (p_ptr->realm2 == REALM_SORCERY) || (p_ptr->pclass == CLASS_SORCERER)))
5883 const magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY-1][SPELL_DD_S];
5884 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5887 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)))
5889 const magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP-1][SPELL_DD_T];
5890 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5893 if (have_sw && ((p_ptr->realm1 == REALM_NATURE) || (p_ptr->realm2 == REALM_NATURE) || (p_ptr->pclass == CLASS_SORCERER)))
5895 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE-1][SPELL_SW];
5896 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5899 if (have_kabe && ((p_ptr->realm1 == REALM_CRAFT) || (p_ptr->realm2 == REALM_CRAFT) || (p_ptr->pclass == CLASS_SORCERER)))
5901 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT-1][SPELL_KABE];
5902 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5909 * Handle "p_ptr->notice"
5911 void notice_stuff(void)
5914 if (!p_ptr->notice) return;
5917 /* Actually do auto-destroy */
5918 if (p_ptr->notice & (PN_AUTODESTROY))
5920 p_ptr->notice &= ~(PN_AUTODESTROY);
5921 autopick_delayed_alter();
5924 /* Combine the pack */
5925 if (p_ptr->notice & (PN_COMBINE))
5927 p_ptr->notice &= ~(PN_COMBINE);
5931 /* Reorder the pack */
5932 if (p_ptr->notice & (PN_REORDER))
5934 p_ptr->notice &= ~(PN_REORDER);
5941 * Handle "p_ptr->update"
5943 void update_stuff(void)
5946 if (!p_ptr->update) return;
5949 if (p_ptr->update & (PU_BONUS))
5951 p_ptr->update &= ~(PU_BONUS);
5955 if (p_ptr->update & (PU_TORCH))
5957 p_ptr->update &= ~(PU_TORCH);
5961 if (p_ptr->update & (PU_HP))
5963 p_ptr->update &= ~(PU_HP);
5967 if (p_ptr->update & (PU_MANA))
5969 p_ptr->update &= ~(PU_MANA);
5973 if (p_ptr->update & (PU_SPELLS))
5975 p_ptr->update &= ~(PU_SPELLS);
5980 /* Character is not ready yet, no screen updates */
5981 if (!character_generated) return;
5984 /* Character is in "icky" mode, no screen updates */
5985 if (character_icky) return;
5988 if (p_ptr->update & (PU_UN_LITE))
5990 p_ptr->update &= ~(PU_UN_LITE);
5994 if (p_ptr->update & (PU_UN_VIEW))
5996 p_ptr->update &= ~(PU_UN_VIEW);
6000 if (p_ptr->update & (PU_VIEW))
6002 p_ptr->update &= ~(PU_VIEW);
6006 if (p_ptr->update & (PU_LITE))
6008 p_ptr->update &= ~(PU_LITE);
6013 if (p_ptr->update & (PU_FLOW))
6015 p_ptr->update &= ~(PU_FLOW);
6019 if (p_ptr->update & (PU_DISTANCE))
6021 p_ptr->update &= ~(PU_DISTANCE);
6023 /* Still need to call update_monsters(FALSE) after update_mon_lite() */
6024 /* p_ptr->update &= ~(PU_MONSTERS); */
6026 update_monsters(TRUE);
6029 if (p_ptr->update & (PU_MON_LITE))
6031 p_ptr->update &= ~(PU_MON_LITE);
6036 * Mega-Hack -- Delayed visual update
6037 * Only used if update_view(), update_lite() or update_mon_lite() was called
6039 if (p_ptr->update & (PU_DELAY_VIS))
6041 p_ptr->update &= ~(PU_DELAY_VIS);
6042 delayed_visual_update();
6045 if (p_ptr->update & (PU_MONSTERS))
6047 p_ptr->update &= ~(PU_MONSTERS);
6048 update_monsters(FALSE);
6054 * Handle "p_ptr->redraw"
6056 void redraw_stuff(void)
6059 if (!p_ptr->redraw) return;
6062 /* Character is not ready yet, no screen updates */
6063 if (!character_generated) return;
6066 /* Character is in "icky" mode, no screen updates */
6067 if (character_icky) return;
6071 /* Hack -- clear the screen */
6072 if (p_ptr->redraw & (PR_WIPE))
6074 p_ptr->redraw &= ~(PR_WIPE);
6080 if (p_ptr->redraw & (PR_MAP))
6082 p_ptr->redraw &= ~(PR_MAP);
6087 if (p_ptr->redraw & (PR_BASIC))
6089 p_ptr->redraw &= ~(PR_BASIC);
6090 p_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
6091 p_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
6092 p_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
6093 p_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
6099 if (p_ptr->redraw & (PR_EQUIPPY))
6101 p_ptr->redraw &= ~(PR_EQUIPPY);
6102 print_equippy(); /* To draw / delete equippy chars */
6105 if (p_ptr->redraw & (PR_MISC))
6107 p_ptr->redraw &= ~(PR_MISC);
6108 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
6109 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
6113 if (p_ptr->redraw & (PR_TITLE))
6115 p_ptr->redraw &= ~(PR_TITLE);
6119 if (p_ptr->redraw & (PR_LEV))
6121 p_ptr->redraw &= ~(PR_LEV);
6125 if (p_ptr->redraw & (PR_EXP))
6127 p_ptr->redraw &= ~(PR_EXP);
6131 if (p_ptr->redraw & (PR_STATS))
6133 p_ptr->redraw &= ~(PR_STATS);
6142 if (p_ptr->redraw & (PR_STATUS))
6144 p_ptr->redraw &= ~(PR_STATUS);
6148 if (p_ptr->redraw & (PR_ARMOR))
6150 p_ptr->redraw &= ~(PR_ARMOR);
6154 if (p_ptr->redraw & (PR_HP))
6156 p_ptr->redraw &= ~(PR_HP);
6160 if (p_ptr->redraw & (PR_MANA))
6162 p_ptr->redraw &= ~(PR_MANA);
6166 if (p_ptr->redraw & (PR_GOLD))
6168 p_ptr->redraw &= ~(PR_GOLD);
6172 if (p_ptr->redraw & (PR_DEPTH))
6174 p_ptr->redraw &= ~(PR_DEPTH);
6178 if (p_ptr->redraw & (PR_HEALTH))
6180 p_ptr->redraw &= ~(PR_HEALTH);
6181 health_redraw(FALSE);
6184 if (p_ptr->redraw & (PR_UHEALTH))
6186 p_ptr->redraw &= ~(PR_UHEALTH);
6187 health_redraw(TRUE);
6191 if (p_ptr->redraw & (PR_EXTRA))
6193 p_ptr->redraw &= ~(PR_EXTRA);
6194 p_ptr->redraw &= ~(PR_CUT | PR_STUN);
6195 p_ptr->redraw &= ~(PR_HUNGER);
6196 p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
6200 if (p_ptr->redraw & (PR_CUT))
6202 p_ptr->redraw &= ~(PR_CUT);
6206 if (p_ptr->redraw & (PR_STUN))
6208 p_ptr->redraw &= ~(PR_STUN);
6212 if (p_ptr->redraw & (PR_HUNGER))
6214 p_ptr->redraw &= ~(PR_HUNGER);
6218 if (p_ptr->redraw & (PR_STATE))
6220 p_ptr->redraw &= ~(PR_STATE);
6224 if (p_ptr->redraw & (PR_SPEED))
6226 p_ptr->redraw &= ~(PR_SPEED);
6230 if (p_ptr->pclass == CLASS_IMITATOR)
6232 if (p_ptr->redraw & (PR_IMITATION))
6234 p_ptr->redraw &= ~(PR_IMITATION);
6238 else if (p_ptr->redraw & (PR_STUDY))
6240 p_ptr->redraw &= ~(PR_STUDY);
6247 * Handle "p_ptr->window"
6249 void window_stuff(void)
6257 if (!p_ptr->window) return;
6260 for (j = 0; j < 8; j++)
6262 /* Save usable flags */
6263 if (angband_term[j]) mask |= window_flag[j];
6266 /* Apply usable flags */
6267 p_ptr->window &= mask;
6270 if (!p_ptr->window) return;
6273 /* Display inventory */
6274 if (p_ptr->window & (PW_INVEN))
6276 p_ptr->window &= ~(PW_INVEN);
6280 /* Display equipment */
6281 if (p_ptr->window & (PW_EQUIP))
6283 p_ptr->window &= ~(PW_EQUIP);
6287 /* Display spell list */
6288 if (p_ptr->window & (PW_SPELL))
6290 p_ptr->window &= ~(PW_SPELL);
6294 /* Display player */
6295 if (p_ptr->window & (PW_PLAYER))
6297 p_ptr->window &= ~(PW_PLAYER);
6301 /* Display monster list */
6302 if (p_ptr->window & (PW_MONSTER_LIST))
6304 p_ptr->window &= ~(PW_MONSTER_LIST);
6308 /* Display overhead view */
6309 if (p_ptr->window & (PW_MESSAGE))
6311 p_ptr->window &= ~(PW_MESSAGE);
6315 /* Display overhead view */
6316 if (p_ptr->window & (PW_OVERHEAD))
6318 p_ptr->window &= ~(PW_OVERHEAD);
6322 /* Display overhead view */
6323 if (p_ptr->window & (PW_DUNGEON))
6325 p_ptr->window &= ~(PW_DUNGEON);
6329 /* Display monster recall */
6330 if (p_ptr->window & (PW_MONSTER))
6332 p_ptr->window &= ~(PW_MONSTER);
6336 /* Display object recall */
6337 if (p_ptr->window & (PW_OBJECT))
6339 p_ptr->window &= ~(PW_OBJECT);
6346 * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
6348 void handle_stuff(void)
6351 if (p_ptr->update) update_stuff();
6354 if (p_ptr->redraw) redraw_stuff();
6357 if (p_ptr->window) window_stuff();
6361 s16b empty_hands(bool riding_control)
6363 s16b status = EMPTY_HAND_NONE;
6365 if (!inventory[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
6366 if (!inventory[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
6368 if (riding_control && (status != EMPTY_HAND_NONE) && p_ptr->riding && !(p_ptr->pet_extra_flags & PF_RYOUTE))
6370 if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
6371 else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
6378 bool heavy_armor(void)
6380 u16b monk_arm_wgt = 0;
6382 if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE;
6384 /* Weight the armor */
6385 if(inventory[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_RARM].weight;
6386 if(inventory[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_LARM].weight;
6387 monk_arm_wgt += inventory[INVEN_BODY].weight;
6388 monk_arm_wgt += inventory[INVEN_HEAD].weight;
6389 monk_arm_wgt += inventory[INVEN_OUTER].weight;
6390 monk_arm_wgt += inventory[INVEN_HANDS].weight;
6391 monk_arm_wgt += inventory[INVEN_FEET].weight;
6393 return (monk_arm_wgt > (100 + (p_ptr->lev * 4)));