3 * @brief 雑多なその他の処理1 / misc code
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
7 * This software may be copied and distributed for educational, research, and\n
8 * not for profit purposes provided that this copyright and statement are\n
9 * included in all such copies.\n
10 * 2014 Deskull rearranged comment for Doxygen.
16 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
18 * @param out_val 出力先文字列ポインタ
21 void cnv_stat(int val, char *out_val)
26 int bonus = (val - 18);
30 sprintf(out_val, "18/%3s", "***");
32 else if (bonus >= 100)
34 sprintf(out_val, "18/%03d", bonus);
38 sprintf(out_val, " 18/%02d", bonus);
45 sprintf(out_val, " %2d", val);
50 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
51 * Modify a stat value by a "modifier", return new value
57 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
58 * Or even: 18/13, 18/23, 18/33, ..., 18/220
59 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
60 * Or even: 18/13, 18/03, 18, 17, ..., 3
63 s16b modify_stat_value(int value, int amount)
70 /* Apply each point */
71 for (i = 0; i < amount; i++)
73 /* One point at a time */
74 if (value < 18) value++;
76 /* Ten "points" at a time */
84 /* Apply each point */
85 for (i = 0; i < (0 - amount); i++)
87 /* Ten points at a time */
88 if (value >= 18+10) value -= 10;
90 /* Hack -- prevent weirdness */
91 else if (value > 18) value = 18;
93 /* One point at a time */
94 else if (value > 3) value--;
98 /* Return new value */
105 * @brief 画面左の能力値表示を行うために指定位置から13キャラ分を空白消去後指定のメッセージを明るい青で描画する /
106 * Print character info at given row, column in a 13 char field
112 static void prt_field(cptr info, int row, int col)
114 /* Dump 13 spaces to clear */
115 c_put_str(TERM_WHITE, " ", row, col);
117 /* Dump the info itself */
118 c_put_str(TERM_L_BLUE, info, row, col);
123 * @brief ゲーム時間が日中かどうかを返す /
124 * Whether daytime or not
125 * @param 日中ならばTRUE、夜ならばFALSE
127 bool is_daytime(void)
129 s32b len = TURNS_PER_TICK * TOWN_DAWN;
130 if ((turn % len) < (len / 2))
137 * @brief 現在の日数、時刻を返す /
138 * Extract day, hour, min
139 * @param day 日数を返すための参照ポインタ
140 * @param hour 時数を返すための参照ポインタ
141 * @param min 分数を返すための参照ポインタ
143 void extract_day_hour_min(int *day, int *hour, int *min)
145 const s32b A_DAY = TURNS_PER_TICK * TOWN_DAWN;
146 s32b turn_in_today = (turn + A_DAY / 4) % A_DAY;
148 switch (p_ptr->start_race)
154 *day = (turn - A_DAY * 3 / 4) / A_DAY + 1;
157 *day = (turn + A_DAY / 4) / A_DAY + 1;
160 *hour = (24 * turn_in_today / A_DAY) % 24;
161 *min = (1440 * turn_in_today / A_DAY) % 60;
165 * @brief ゲーム時刻を表示する /
173 /* Dump 13 spaces to clear */
174 c_put_str(TERM_WHITE, " ", ROW_DAY, COL_DAY);
176 extract_day_hour_min(&day, &hour, &min);
178 /* Dump the info itself */
179 if (day < 1000) c_put_str(TERM_WHITE, format(_("%2d日目", "Day%3d"), day), ROW_DAY, COL_DAY);
180 else c_put_str(TERM_WHITE, _("***日目", "Day***"), ROW_DAY, COL_DAY);
182 c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
186 * @brief 現在のマップ名を返す /
187 * @return マップ名の文字列参照ポインタ
191 if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)
192 && (quest[p_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
193 return _("クエスト", "Quest");
194 else if (p_ptr->wild_mode)
195 return _("地上", "Surface");
196 else if (p_ptr->inside_arena)
197 return _("アリーナ", "Arena");
198 else if (p_ptr->inside_battle)
199 return _("闘技場", "Monster Arena");
200 else if (!dun_level && p_ptr->town_num)
201 return town[p_ptr->town_num].name;
203 return d_name+d_info[dungeon_type].name;
207 * @brief 現在のマップ名を描画する / Print dungeon
210 static void prt_dungeon(void)
215 /* Dump 13 spaces to clear */
216 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
218 dungeon_name = map_name();
220 col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
221 if (col < 0) col = 0;
223 /* Dump the info itself */
224 c_put_str(TERM_L_UMBER, format("%s",dungeon_name),
230 * @brief プレイヤー能力値を描画する / Print character stat in given row, column
231 * @param stat 描画するステータスのID
234 static void prt_stat(int stat)
238 /* Display "injured" stat */
239 if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
241 put_str(stat_names_reduced[stat], ROW_STAT + stat, 0);
242 cnv_stat(p_ptr->stat_use[stat], tmp);
243 c_put_str(TERM_YELLOW, tmp, ROW_STAT + stat, COL_STAT + 6);
246 /* Display "healthy" stat */
249 put_str(stat_names[stat], ROW_STAT + stat, 0);
250 cnv_stat(p_ptr->stat_use[stat], tmp);
251 c_put_str(TERM_L_GREEN, tmp, ROW_STAT + stat, COL_STAT + 6);
254 /* Indicate natural maximum */
255 if (p_ptr->stat_max[stat] == p_ptr->stat_max_max[stat])
258 /* 日本語にかぶらないように表示位置を変更 */
259 put_str("!", ROW_STAT + stat, 5);
261 put_str("!", ROW_STAT + stat, 3);
269 * 画面下部に表示する状態表示定義ID / Data structure for status bar
271 #define BAR_TSUYOSHI 0 /*!< 下部ステータス表示: オクレ兄さん状態 */
272 #define BAR_HALLUCINATION 1 /*!< 下部ステータス表示: 幻覚 */
273 #define BAR_BLINDNESS 2 /*!< 下部ステータス表示: 盲目 */
274 #define BAR_PARALYZE 3 /*!< 下部ステータス表示: 麻痺 */
275 #define BAR_CONFUSE 4 /*!< 下部ステータス表示: 混乱 */
276 #define BAR_POISONED 5 /*!< 下部ステータス表示: 毒 */
277 #define BAR_AFRAID 6 /*!< 下部ステータス表示: 恐怖 */
278 #define BAR_LEVITATE 7 /*!< 下部ステータス表示: 浮遊 */
279 #define BAR_REFLECTION 8 /*!< 下部ステータス表示: 反射 */
280 #define BAR_PASSWALL 9 /*!< 下部ステータス表示: 壁抜け */
281 #define BAR_WRAITH 10 /*!< 下部ステータス表示: 幽体化 */
282 #define BAR_PROTEVIL 11 /*!< 下部ステータス表示: 対邪悪結界 */
283 #define BAR_KAWARIMI 12 /*!< 下部ステータス表示: 変わり身 */
284 #define BAR_MAGICDEFENSE 13 /*!< 下部ステータス表示: 魔法の鎧 */
285 #define BAR_EXPAND 14 /*!< 下部ステータス表示: 横伸び */
286 #define BAR_STONESKIN 15 /*!< 下部ステータス表示: 石肌化 */
287 #define BAR_MULTISHADOW 16 /*!< 下部ステータス表示: 影分身 */
288 #define BAR_REGMAGIC 17 /*!< 下部ステータス表示: 魔法防御 */
289 #define BAR_ULTIMATE 18 /*!< 下部ステータス表示: 究極の耐性 */
290 #define BAR_INVULN 19 /*!< 下部ステータス表示: 無敵化 */
291 #define BAR_IMMACID 20 /*!< 下部ステータス表示: 酸免疫 */
292 #define BAR_RESACID 21 /*!< 下部ステータス表示: 酸耐性 */
293 #define BAR_IMMELEC 22 /*!< 下部ステータス表示: 電撃免疫 */
294 #define BAR_RESELEC 23 /*!< 下部ステータス表示: 電撃耐性 */
295 #define BAR_IMMFIRE 24 /*!< 下部ステータス表示: 火炎免疫 */
296 #define BAR_RESFIRE 25 /*!< 下部ステータス表示: 火炎耐性 */
297 #define BAR_IMMCOLD 26 /*!< 下部ステータス表示: 冷気免疫 */
298 #define BAR_RESCOLD 27 /*!< 下部ステータス表示: 冷気耐性 */
299 #define BAR_RESPOIS 28 /*!< 下部ステータス表示: 毒耐性 */
300 #define BAR_RESNETH 29 /*!< 下部ステータス表示: 地獄耐性 */
301 #define BAR_RESTIME 30 /*!< 下部ステータス表示: 時間逆転耐性 */
302 #define BAR_DUSTROBE 31 /*!< 下部ステータス表示: 破片オーラ */
303 #define BAR_SHFIRE 32 /*!< 下部ステータス表示: 火炎オーラ */
304 #define BAR_TOUKI 33 /*!< 下部ステータス表示: 闘気 */
305 #define BAR_SHHOLY 34 /*!< 下部ステータス表示: 聖なるオーラ */
306 #define BAR_EYEEYE 35 /*!< 下部ステータス表示: 目には目を */
307 #define BAR_BLESSED 36 /*!< 下部ステータス表示: 祝福 */
308 #define BAR_HEROISM 37 /*!< 下部ステータス表示: 士気高揚 */
309 #define BAR_BERSERK 38 /*!< 下部ステータス表示: 狂戦士化 */
310 #define BAR_ATTKFIRE 39 /*!< 下部ステータス表示: 焼棄スレイ */
311 #define BAR_ATTKCOLD 40 /*!< 下部ステータス表示: 冷凍スレイ */
312 #define BAR_ATTKELEC 41 /*!< 下部ステータス表示: 電撃スレイ */
313 #define BAR_ATTKACID 42 /*!< 下部ステータス表示: 溶解スレイ */
314 #define BAR_ATTKPOIS 43 /*!< 下部ステータス表示: 毒殺スレイ */
315 #define BAR_ATTKCONF 44 /*!< 下部ステータス表示: 混乱打撃 */
316 #define BAR_SENSEUNSEEN 45 /*!< 下部ステータス表示: 透明視 */
317 #define BAR_TELEPATHY 46 /*!< 下部ステータス表示: テレパシー */
318 #define BAR_REGENERATION 47 /*!< 下部ステータス表示: 急回復 */
319 #define BAR_INFRAVISION 48 /*!< 下部ステータス表示: 赤外線視力 */
320 #define BAR_STEALTH 49 /*!< 下部ステータス表示: 隠密 */
321 #define BAR_SUPERSTEALTH 50 /*!< 下部ステータス表示: 超隠密 */
322 #define BAR_RECALL 51 /*!< 下部ステータス表示: 帰還待ち */
323 #define BAR_ALTER 52 /*!< 下部ステータス表示: 現実変容待ち */
324 #define BAR_SHCOLD 53 /*!< 下部ステータス表示: 冷気オーラ */
325 #define BAR_SHELEC 54 /*!< 下部ステータス表示: 電撃オーラ */
326 #define BAR_SHSHADOW 55 /*!< 下部ステータス表示: 影のオーラ */
327 #define BAR_MIGHT 56 /*!< 下部ステータス表示: 腕力強化 */
328 #define BAR_BUILD 57 /*!< 下部ステータス表示: 肉体強化 */
329 #define BAR_ANTIMULTI 58 /*!< 下部ステータス表示: 反増殖 */
330 #define BAR_ANTITELE 59 /*!< 下部ステータス表示: 反テレポート */
331 #define BAR_ANTIMAGIC 60 /*!< 下部ステータス表示: 反魔法 */
332 #define BAR_PATIENCE 61 /*!< 下部ステータス表示: 我慢 */
333 #define BAR_REVENGE 62 /*!< 下部ステータス表示: 宣告 */
334 #define BAR_RUNESWORD 63 /*!< 下部ステータス表示: 魔剣化 */
335 #define BAR_VAMPILIC 64 /*!< 下部ステータス表示: 吸血 */
336 #define BAR_CURE 65 /*!< 下部ステータス表示: 回復 */
337 #define BAR_ESP_EVIL 66 /*!< 下部ステータス表示: 邪悪感知 */
346 {TERM_YELLOW, "つ", "つよし"},
347 {TERM_VIOLET, "幻", "幻覚"},
348 {TERM_L_DARK, "盲", "盲目"},
349 {TERM_RED, "痺", "麻痺"},
350 {TERM_VIOLET, "乱", "混乱"},
351 {TERM_GREEN, "毒", "毒"},
352 {TERM_BLUE, "恐", "恐怖"},
353 {TERM_L_BLUE, "浮", "浮遊"},
354 {TERM_SLATE, "反", "反射"},
355 {TERM_SLATE, "壁", "壁抜け"},
356 {TERM_L_DARK, "幽", "幽体"},
357 {TERM_SLATE, "邪", "防邪"},
358 {TERM_VIOLET, "変", "変わり身"},
359 {TERM_YELLOW, "魔", "魔法鎧"},
360 {TERM_L_UMBER, "伸", "伸び"},
361 {TERM_WHITE, "石", "石肌"},
362 {TERM_L_BLUE, "分", "分身"},
363 {TERM_SLATE, "防", "魔法防御"},
364 {TERM_YELLOW, "究", "究極"},
365 {TERM_YELLOW, "無", "無敵"},
366 {TERM_L_GREEN, "酸", "酸免疫"},
367 {TERM_GREEN, "酸", "耐酸"},
368 {TERM_L_BLUE, "電", "電免疫"},
369 {TERM_BLUE, "電", "耐電"},
370 {TERM_L_RED, "火", "火免疫"},
371 {TERM_RED, "火", "耐火"},
372 {TERM_WHITE, "冷", "冷免疫"},
373 {TERM_SLATE, "冷", "耐冷"},
374 {TERM_GREEN, "毒", "耐毒"},
375 {TERM_L_DARK, "獄", "耐地獄"},
376 {TERM_L_BLUE, "時", "耐時間"},
377 {TERM_L_DARK, "鏡", "鏡オーラ"},
378 {TERM_L_RED, "オ", "火オーラ"},
379 {TERM_WHITE, "闘", "闘気"},
380 {TERM_WHITE, "聖", "聖オーラ"},
381 {TERM_VIOLET, "目", "目には目"},
382 {TERM_WHITE, "祝", "祝福"},
383 {TERM_WHITE, "勇", "勇"},
384 {TERM_RED, "狂", "狂乱"},
385 {TERM_L_RED, "火", "魔剣火"},
386 {TERM_WHITE, "冷", "魔剣冷"},
387 {TERM_L_BLUE, "電", "魔剣電"},
388 {TERM_SLATE, "酸", "魔剣酸"},
389 {TERM_L_GREEN, "毒", "魔剣毒"},
390 {TERM_RED, "乱", "混乱打撃"},
391 {TERM_L_BLUE, "視", "透明視"},
392 {TERM_ORANGE, "テ", "テレパシ"},
393 {TERM_L_BLUE, "回", "回復"},
394 {TERM_L_RED, "赤", "赤外"},
395 {TERM_UMBER, "隠", "隠密"},
396 {TERM_YELLOW, "隠", "超隠密"},
397 {TERM_WHITE, "帰", "帰還"},
398 {TERM_WHITE, "現", "現実変容"},
400 {TERM_WHITE, "オ", "氷オーラ"},
401 {TERM_BLUE, "オ", "電オーラ"},
402 {TERM_L_DARK, "オ", "影オーラ"},
403 {TERM_YELLOW, "腕", "腕力強化"},
404 {TERM_RED, "肉", "肉体強化"},
405 {TERM_L_DARK, "殖", "反増殖"},
406 {TERM_ORANGE, "テ", "反テレポ"},
407 {TERM_RED, "魔", "反魔法"},
408 {TERM_SLATE, "我", "我慢"},
409 {TERM_SLATE, "宣", "宣告"},
410 {TERM_L_DARK, "剣", "魔剣化"},
411 {TERM_RED, "吸", "吸血打撃"},
412 {TERM_WHITE, "回", "回復"},
413 {TERM_L_DARK, "感", "邪悪感知"},
418 {TERM_YELLOW, "Ts", "Tsuyoshi"},
419 {TERM_VIOLET, "Ha", "Halluc"},
420 {TERM_L_DARK, "Bl", "Blind"},
421 {TERM_RED, "Pa", "Paralyzed"},
422 {TERM_VIOLET, "Cf", "Confused"},
423 {TERM_GREEN, "Po", "Poisoned"},
424 {TERM_BLUE, "Af", "Afraid"},
425 {TERM_L_BLUE, "Lv", "Levit"},
426 {TERM_SLATE, "Rf", "Reflect"},
427 {TERM_SLATE, "Pw", "PassWall"},
428 {TERM_L_DARK, "Wr", "Wraith"},
429 {TERM_SLATE, "Ev", "PrtEvl"},
430 {TERM_VIOLET, "Kw", "Kawarimi"},
431 {TERM_YELLOW, "Md", "MgcArm"},
432 {TERM_L_UMBER, "Eh", "Expand"},
433 {TERM_WHITE, "Ss", "StnSkn"},
434 {TERM_L_BLUE, "Ms", "MltShdw"},
435 {TERM_SLATE, "Rm", "ResMag"},
436 {TERM_YELLOW, "Ul", "Ultima"},
437 {TERM_YELLOW, "Iv", "Invuln"},
438 {TERM_L_GREEN, "IAc", "ImmAcid"},
439 {TERM_GREEN, "Ac", "Acid"},
440 {TERM_L_BLUE, "IEl", "ImmElec"},
441 {TERM_BLUE, "El", "Elec"},
442 {TERM_L_RED, "IFi", "ImmFire"},
443 {TERM_RED, "Fi", "Fire"},
444 {TERM_WHITE, "ICo", "ImmCold"},
445 {TERM_SLATE, "Co", "Cold"},
446 {TERM_GREEN, "Po", "Pois"},
447 {TERM_L_DARK, "Nt", "Nthr"},
448 {TERM_L_BLUE, "Ti", "Time"},
449 {TERM_L_DARK, "Mr", "Mirr"},
450 {TERM_L_RED, "SFi", "SFire"},
451 {TERM_WHITE, "Fo", "Force"},
452 {TERM_WHITE, "Ho", "Holy"},
453 {TERM_VIOLET, "Ee", "EyeEye"},
454 {TERM_WHITE, "Bs", "Bless"},
455 {TERM_WHITE, "He", "Hero"},
456 {TERM_RED, "Br", "Berserk"},
457 {TERM_L_RED, "BFi", "BFire"},
458 {TERM_WHITE, "BCo", "BCold"},
459 {TERM_L_BLUE, "BEl", "BElec"},
460 {TERM_SLATE, "BAc", "BAcid"},
461 {TERM_L_GREEN, "BPo", "BPois"},
462 {TERM_RED, "TCf", "TchCnf"},
463 {TERM_L_BLUE, "Se", "SInv"},
464 {TERM_ORANGE, "Te", "Telepa"},
465 {TERM_L_BLUE, "Rg", "Regen"},
466 {TERM_L_RED, "If", "Infr"},
467 {TERM_UMBER, "Sl", "Stealth"},
468 {TERM_YELLOW, "Stlt", "Stealth"},
469 {TERM_WHITE, "Rc", "Recall"},
470 {TERM_WHITE, "Al", "Alter"},
472 {TERM_WHITE, "SCo", "SCold"},
473 {TERM_BLUE, "SEl", "SElec"},
474 {TERM_L_DARK, "SSh", "SShadow"},
475 {TERM_YELLOW, "EMi", "ExMight"},
476 {TERM_RED, "Bu", "BuildUp"},
477 {TERM_L_DARK, "AMl", "AntiMulti"},
478 {TERM_ORANGE, "AT", "AntiTele"},
479 {TERM_RED, "AM", "AntiMagic"},
480 {TERM_SLATE, "Pa", "Patience"},
481 {TERM_SLATE, "Rv", "Revenge"},
482 {TERM_L_DARK, "Rs", "RuneSword"},
483 {TERM_RED, "Vm", "Vampiric"},
484 {TERM_WHITE, "Cu", "Cure"},
485 {TERM_L_DARK, "ET", "EvilTele"},
491 * @brief 32ビット変数配列の指定位置のビットフラグを1にする。
492 * @param FLG フラグ位置(ビット)
495 #define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
498 * @brief 32ビット変数配列の指定位置のビットフラグが1かどうかを返す。
499 * @param FLG フラグ位置(ビット)
502 #define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
506 * @briefs 下部に状態表示を行う / Show status bar
509 static void prt_status(void)
512 int wid, hgt, row_statbar, max_col_statbar;
513 int i, col = 0, num = 0;
516 Term_get_size(&wid, &hgt);
517 row_statbar = hgt + ROW_STATBAR;
518 max_col_statbar = wid + MAX_COL_STATBAR;
520 Term_erase(0, row_statbar, max_col_statbar);
522 bar_flags[0] = bar_flags[1] = bar_flags[2] = 0L;
525 if (p_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
528 if (p_ptr->image) ADD_FLG(BAR_HALLUCINATION);
531 if (p_ptr->blind) ADD_FLG(BAR_BLINDNESS);
534 if (p_ptr->paralyzed) ADD_FLG(BAR_PARALYZE);
537 if (p_ptr->confused) ADD_FLG(BAR_CONFUSE);
540 if (p_ptr->poisoned) ADD_FLG(BAR_POISONED);
542 /* Times see-invisible */
543 if (p_ptr->tim_invis) ADD_FLG(BAR_SENSEUNSEEN);
546 if (IS_TIM_ESP()) ADD_FLG(BAR_TELEPATHY);
548 /* Timed regenerate */
549 if (p_ptr->tim_regen) ADD_FLG(BAR_REGENERATION);
551 /* Timed infra-vision */
552 if (p_ptr->tim_infra) ADD_FLG(BAR_INFRAVISION);
554 /* Protection from evil */
555 if (p_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
557 /* Invulnerability */
558 if (IS_INVULN()) ADD_FLG(BAR_INVULN);
561 if (p_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
564 if (p_ptr->kabenuke) ADD_FLG(BAR_PASSWALL);
566 if (p_ptr->tim_reflect) ADD_FLG(BAR_REFLECTION);
569 if (IS_HERO()) ADD_FLG(BAR_HEROISM);
571 /* Super Heroism / berserk */
572 if (p_ptr->shero) ADD_FLG(BAR_BERSERK);
575 if (IS_BLESSED()) ADD_FLG(BAR_BLESSED);
578 if (p_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);
580 if (p_ptr->tsubureru) ADD_FLG(BAR_EXPAND);
582 if (p_ptr->shield) ADD_FLG(BAR_STONESKIN);
584 if (p_ptr->special_defense & NINJA_KAWARIMI) ADD_FLG(BAR_KAWARIMI);
587 if (p_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
588 if (IS_OPPOSE_ACID()) ADD_FLG(BAR_RESACID);
590 /* Oppose Lightning */
591 if (p_ptr->special_defense & DEFENSE_ELEC) ADD_FLG(BAR_IMMELEC);
592 if (IS_OPPOSE_ELEC()) ADD_FLG(BAR_RESELEC);
595 if (p_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
596 if (IS_OPPOSE_FIRE()) ADD_FLG(BAR_RESFIRE);
599 if (p_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
600 if (IS_OPPOSE_COLD()) ADD_FLG(BAR_RESCOLD);
603 if (IS_OPPOSE_POIS()) ADD_FLG(BAR_RESPOIS);
606 if (p_ptr->word_recall) ADD_FLG(BAR_RECALL);
609 if (p_ptr->alter_reality) ADD_FLG(BAR_ALTER);
612 if (p_ptr->afraid) ADD_FLG(BAR_AFRAID);
615 if (p_ptr->tim_res_time) ADD_FLG(BAR_RESTIME);
617 if (p_ptr->multishadow) ADD_FLG(BAR_MULTISHADOW);
619 /* Confusing Hands */
620 if (p_ptr->special_attack & ATTACK_CONFUSE) ADD_FLG(BAR_ATTKCONF);
622 if (p_ptr->resist_magic) ADD_FLG(BAR_REGMAGIC);
624 /* Ultimate-resistance */
625 if (p_ptr->ult_res) ADD_FLG(BAR_ULTIMATE);
628 if (p_ptr->tim_levitation) ADD_FLG(BAR_LEVITATE);
630 if (p_ptr->tim_res_nether) ADD_FLG(BAR_RESNETH);
632 if (p_ptr->dustrobe) ADD_FLG(BAR_DUSTROBE);
635 if (p_ptr->special_attack & ATTACK_FIRE) ADD_FLG(BAR_ATTKFIRE);
636 if (p_ptr->special_attack & ATTACK_COLD) ADD_FLG(BAR_ATTKCOLD);
637 if (p_ptr->special_attack & ATTACK_ELEC) ADD_FLG(BAR_ATTKELEC);
638 if (p_ptr->special_attack & ATTACK_ACID) ADD_FLG(BAR_ATTKACID);
639 if (p_ptr->special_attack & ATTACK_POIS) ADD_FLG(BAR_ATTKPOIS);
640 if (p_ptr->special_defense & NINJA_S_STEALTH) ADD_FLG(BAR_SUPERSTEALTH);
642 if (p_ptr->tim_sh_fire) ADD_FLG(BAR_SHFIRE);
645 if (IS_TIM_STEALTH()) ADD_FLG(BAR_STEALTH);
647 if (p_ptr->tim_sh_touki) ADD_FLG(BAR_TOUKI);
650 if (p_ptr->tim_sh_holy) ADD_FLG(BAR_SHHOLY);
652 /* An Eye for an Eye */
653 if (p_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
656 if (p_ptr->realm1 == REALM_HEX)
658 if (hex_spelling(HEX_BLESS)) ADD_FLG(BAR_BLESSED);
659 if (hex_spelling(HEX_DEMON_AURA)) { ADD_FLG(BAR_SHFIRE); ADD_FLG(BAR_REGENERATION); }
660 if (hex_spelling(HEX_XTRA_MIGHT)) ADD_FLG(BAR_MIGHT);
661 if (hex_spelling(HEX_DETECT_EVIL)) ADD_FLG(BAR_ESP_EVIL);
662 if (hex_spelling(HEX_ICE_ARMOR)) ADD_FLG(BAR_SHCOLD);
663 if (hex_spelling(HEX_RUNESWORD)) ADD_FLG(BAR_RUNESWORD);
664 if (hex_spelling(HEX_BUILDING)) ADD_FLG(BAR_BUILD);
665 if (hex_spelling(HEX_ANTI_TELE)) ADD_FLG(BAR_ANTITELE);
666 if (hex_spelling(HEX_SHOCK_CLOAK)) ADD_FLG(BAR_SHELEC);
667 if (hex_spelling(HEX_SHADOW_CLOAK)) ADD_FLG(BAR_SHSHADOW);
668 if (hex_spelling(HEX_CONFUSION)) ADD_FLG(BAR_ATTKCONF);
669 if (hex_spelling(HEX_EYE_FOR_EYE)) ADD_FLG(BAR_EYEEYE);
670 if (hex_spelling(HEX_ANTI_MULTI)) ADD_FLG(BAR_ANTIMULTI);
671 if (hex_spelling(HEX_VAMP_BLADE)) ADD_FLG(BAR_VAMPILIC);
672 if (hex_spelling(HEX_ANTI_MAGIC)) ADD_FLG(BAR_ANTIMAGIC);
673 if (hex_spelling(HEX_CURE_LIGHT) ||
674 hex_spelling(HEX_CURE_SERIOUS) ||
675 hex_spelling(HEX_CURE_CRITICAL)) ADD_FLG(BAR_CURE);
677 if (p_ptr->magic_num2[2])
679 if (p_ptr->magic_num2[1] == 1) ADD_FLG(BAR_PATIENCE);
680 if (p_ptr->magic_num2[1] == 2) ADD_FLG(BAR_REVENGE);
684 /* Calcurate length */
685 for (i = 0; bar[i].sstr; i++)
689 col += strlen(bar[i].lstr) + 1;
694 /* If there are not excess spaces for long strings, use short one */
695 if (col - 1 > max_col_statbar)
700 for (i = 0; bar[i].sstr; i++)
704 col += strlen(bar[i].sstr);
708 /* If there are excess spaces for short string, use more */
709 if (col - 1 <= max_col_statbar - (num-1))
717 /* Centering display column */
718 col = (max_col_statbar - col) / 2;
720 /* Display status bar */
721 for (i = 0; bar[i].sstr; i++)
726 if (space == 2) str = bar[i].lstr;
727 else str = bar[i].sstr;
729 c_put_str(bar[i].attr, str, row_statbar, col);
731 if (space > 0) col++;
732 if (col > max_col_statbar) break;
739 * @briefs プレイヤーの称号を表示する / Prints "title", including "wizard" or "winner" as needed.
742 static void prt_title(void)
760 else if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
762 if (p_ptr->arena_number > MAX_ARENA_MONS + 2)
785 my_strcpy(str, player_title[p_ptr->pclass][(p_ptr->lev - 1) / 5], sizeof(str));
789 prt_field(p, ROW_TITLE, COL_TITLE);
794 * @briefs プレイヤーのレベルを表示する / Prints level
797 static void prt_level(void)
801 sprintf(tmp, _("%5d", "%6d"), p_ptr->lev);
803 if (p_ptr->lev >= p_ptr->max_plv)
806 put_str("レベル ", ROW_LEVEL, 0);
807 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 7);
809 put_str("LEVEL ", ROW_LEVEL, 0);
810 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 6);
817 put_str("xレベル", ROW_LEVEL, 0);
818 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 7);
820 put_str("Level ", ROW_LEVEL, 0);
821 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 6);
829 * @briefs プレイヤーの経験値を表示する / Display the experience
832 static void prt_exp(void)
836 if ((!exp_need)||(p_ptr->prace == RACE_ANDROID))
838 (void)sprintf(out_val, _("%7ld", "%8ld"), (long)p_ptr->exp);
842 if (p_ptr->lev >= PY_MAX_LEVEL)
844 (void)sprintf(out_val, "********");
849 (void)sprintf(out_val, "%7ld", (long)(player_exp [p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp);
851 (void)sprintf(out_val, "%8ld", (long)(player_exp [p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp);
856 if (p_ptr->exp >= p_ptr->max_exp)
859 if (p_ptr->prace == RACE_ANDROID) put_str("強化 ", ROW_EXP, 0);
860 else put_str("経験 ", ROW_EXP, 0);
861 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 5);
863 if (p_ptr->prace == RACE_ANDROID) put_str("Cst ", ROW_EXP, 0);
864 else put_str("EXP ", ROW_EXP, 0);
865 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 4);
872 put_str("x経験", ROW_EXP, 0);
873 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 5);
875 put_str("Exp ", ROW_EXP, 0);
876 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 4);
883 * @briefs プレイヤーの所持金を表示する / Prints current gold
886 static void prt_gold(void)
889 put_str(_("$ ", "AU "), ROW_GOLD, COL_GOLD);
890 sprintf(tmp, "%9ld", (long)p_ptr->au);
891 c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
896 * @briefs プレイヤーのACを表示する / Prints current AC
899 static void prt_ac(void)
904 /* AC の表示方式を変更している */
905 put_str(" AC( )", ROW_AC, COL_AC);
906 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
907 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 6);
909 put_str("Cur AC ", ROW_AC, COL_AC);
910 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
911 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 7);
918 * @briefs プレイヤーのHPを表示する / Prints Cur/Max hit points
921 static void prt_hp(void)
923 /* ヒットポイントの表示方法を変更 */
929 /* put_str(" HP・MP", ROW_HPMP, COL_HPMP); */
931 put_str("HP", ROW_CURHP, COL_CURHP);
934 sprintf(tmp, "%4ld", (long int)p_ptr->chp);
936 if (p_ptr->chp >= p_ptr->mhp)
938 color = TERM_L_GREEN;
940 else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
949 c_put_str(color, tmp, ROW_CURHP, COL_CURHP+3);
952 put_str( "/", ROW_CURHP, COL_CURHP + 7 );
955 sprintf(tmp, "%4ld", (long int)p_ptr->mhp);
956 color = TERM_L_GREEN;
958 c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
963 * @briefs プレイヤーのMPを表示する / 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(" MP / 最大", ROW_MAXSP, COL_MAXSP); */
978 put_str(_("MP", "SP"), ROW_CURSP, COL_CURSP);
981 sprintf(tmp, "%4ld", (long int)p_ptr->csp);
983 if (p_ptr->csp >= p_ptr->msp)
985 color = TERM_L_GREEN;
987 else if (p_ptr->csp > (p_ptr->msp * mana_warn) / 10)
996 c_put_str(color, tmp, ROW_CURSP, COL_CURSP+3);
999 put_str( "/", ROW_CURSP, COL_CURSP + 7 );
1002 sprintf(tmp, "%4ld", (long int)p_ptr->msp);
1003 color = TERM_L_GREEN;
1005 c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
1010 * @briefs 現在のフロアの深さを表示する / Prints depth in stat area
1013 static void prt_depth(void)
1016 int wid, hgt, row_depth, col_depth;
1017 byte attr = TERM_WHITE;
1019 Term_get_size(&wid, &hgt);
1020 col_depth = wid + COL_DEPTH;
1021 row_depth = hgt + ROW_DEPTH;
1025 strcpy(depths, _("地上", "Surf."));
1027 else if (p_ptr->inside_quest && !dungeon_type)
1029 strcpy(depths, _("地上", "Quest"));
1033 if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), dun_level * 50);
1034 else (void)sprintf(depths, _("%d 階", "Lev %d"), dun_level);
1036 /* Get color of level based on feeling -JSV- */
1037 switch (p_ptr->feeling)
1039 case 0: attr = TERM_SLATE; break; /* Unknown */
1040 case 1: attr = TERM_L_BLUE; break; /* Special */
1041 case 2: attr = TERM_VIOLET; break; /* Horrible visions */
1042 case 3: attr = TERM_RED; break; /* Very dangerous */
1043 case 4: attr = TERM_L_RED; break; /* Very bad feeling */
1044 case 5: attr = TERM_ORANGE; break; /* Bad feeling */
1045 case 6: attr = TERM_YELLOW; break; /* Nervous */
1046 case 7: attr = TERM_L_UMBER; break; /* Luck is turning */
1047 case 8: attr = TERM_L_WHITE; break; /* Don't like */
1048 case 9: attr = TERM_WHITE; break; /* Reasonably safe */
1049 case 10: attr = TERM_WHITE; break; /* Boring place */
1053 /* Right-Adjust the "depth", and clear old values */
1054 c_prt(attr, format("%7s", depths), row_depth, col_depth);
1059 * @briefs プレイヤーの空腹状態を表示する / Prints status of hunger
1062 static void prt_hunger(void)
1064 if(p_ptr->wizard && p_ptr->inside_arena) return;
1066 /* Fainting / Starving */
1067 if (p_ptr->food < PY_FOOD_FAINT)
1069 c_put_str(TERM_RED, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1073 else if (p_ptr->food < PY_FOOD_WEAK)
1075 c_put_str(TERM_ORANGE, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
1079 else if (p_ptr->food < PY_FOOD_ALERT)
1081 c_put_str(TERM_YELLOW, _("空腹 ", "Hungry"), ROW_HUNGRY, COL_HUNGRY);
1085 else if (p_ptr->food < PY_FOOD_FULL)
1087 c_put_str(TERM_L_GREEN, " ", ROW_HUNGRY, COL_HUNGRY);
1091 else if (p_ptr->food < PY_FOOD_MAX)
1093 c_put_str(TERM_L_GREEN, _("満腹 ", "Full "), ROW_HUNGRY, COL_HUNGRY);
1099 c_put_str(TERM_GREEN, _("食過ぎ", "Gorged"), ROW_HUNGRY, COL_HUNGRY);
1105 * @briefs プレイヤーの行動状態を表示する / Prints Searching, Resting, Paralysis, or 'count' status
1108 * Display is always exactly 10 characters wide (see below)
1109 * This function was a major bottleneck when resting, so a lot of
1110 * the text formatting code was optimized in place below.
1112 static void prt_state(void)
1114 byte attr = TERM_WHITE;
1121 if (command_rep > 999)
1123 (void)sprintf(text, "%2d00", command_rep / 100);
1127 (void)sprintf(text, " %2d", command_rep);
1134 switch(p_ptr->action)
1138 strcpy(text, _("探索", "Sear"));
1145 /* Start with "Rest" */
1146 strcpy(text, _(" ", " "));
1148 /* Extensive (timed) rest */
1149 if (resting >= 1000)
1154 text[1] = '0' + (i % 10);
1155 text[0] = '0' + (i / 10);
1158 /* Long (timed) rest */
1159 else if (resting >= 100)
1162 text[3] = '0' + (i % 10);
1164 text[2] = '0' + (i % 10);
1165 text[1] = '0' + (i / 10);
1168 /* Medium (timed) rest */
1169 else if (resting >= 10)
1172 text[3] = '0' + (i % 10);
1173 text[2] = '0' + (i / 10);
1176 /* Short (timed) rest */
1177 else if (resting > 0)
1180 text[3] = '0' + (i);
1183 /* Rest until healed */
1184 else if (resting == -1)
1186 text[0] = text[1] = text[2] = text[3] = '*';
1189 /* Rest until done */
1190 else if (resting == -2)
1192 text[0] = text[1] = text[2] = text[3] = '&';
1198 strcpy(text, _("学習", "lear"));
1199 if (new_mane) attr = TERM_L_RED;
1204 strcpy(text, _("釣り", "fish"));
1210 for (i = 0; i < MAX_KAMAE; i++)
1211 if (p_ptr->special_defense & (KAMAE_GENBU << i)) break;
1214 case 0: attr = TERM_GREEN;break;
1215 case 1: attr = TERM_WHITE;break;
1216 case 2: attr = TERM_L_BLUE;break;
1217 case 3: attr = TERM_L_RED;break;
1219 strcpy(text, kamae_shurui[i].desc);
1225 for (i = 0; i < MAX_KATA; i++)
1226 if (p_ptr->special_defense & (KATA_IAI << i)) break;
1227 strcpy(text, kata_shurui[i].desc);
1232 strcpy(text, _("歌 ", "Sing"));
1235 case ACTION_HAYAGAKE:
1237 strcpy(text, _("速駆", "Fast"));
1242 strcpy(text, _("詠唱", "Spel"));
1253 /* Display the info (or blanks) */
1254 c_put_str(attr, format("%5.5s",text), ROW_STATE, COL_STATE);
1259 * @briefs プレイヤーの行動速度を表示する / Prints the speed of a character. -CJS-
1262 static void prt_speed(void)
1264 int i = p_ptr->pspeed;
1265 bool is_fast = IS_FAST();
1267 byte attr = TERM_WHITE;
1269 int wid, hgt, row_speed, col_speed;
1271 Term_get_size(&wid, &hgt);
1272 col_speed = wid + COL_SPEED;
1273 row_speed = hgt + ROW_SPEED;
1275 /* Hack -- Visually "undo" the Search Mode Slowdown */
1276 if (p_ptr->action == ACTION_SEARCH && !p_ptr->lightspeed) i += 10;
1283 monster_type *m_ptr = &m_list[p_ptr->riding];
1284 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1285 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1286 else attr = TERM_GREEN;
1288 else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
1289 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1290 else attr = TERM_L_GREEN;
1292 sprintf(buf, "%s(+%d)", (p_ptr->riding ? "乗馬" : "加速"), (i - 110));
1294 sprintf(buf, "Fast(+%d)", (i - 110));
1304 monster_type *m_ptr = &m_list[p_ptr->riding];
1305 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1306 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1307 else attr = TERM_RED;
1309 else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
1310 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1311 else attr = TERM_L_UMBER;
1313 sprintf(buf, "%s(-%d)", (p_ptr->riding ? "乗馬" : "減速"), (110 - i));
1315 sprintf(buf, "Slow(-%d)", (110 - i));
1318 else if (p_ptr->riding)
1321 strcpy(buf, _("乗馬中", "Riding"));
1324 /* Display the speed */
1325 c_put_str(attr, format("%-9s", buf), row_speed, col_speed);
1330 * @briefs プレイヤーの呪文学習可能状態を表示する
1333 static void prt_study(void)
1335 int wid, hgt, row_study, col_study;
1337 Term_get_size(&wid, &hgt);
1338 col_study = wid + COL_STUDY;
1339 row_study = hgt + ROW_STUDY;
1341 if (p_ptr->new_spells)
1343 put_str(_("学習", "Stud"), row_study, col_study);
1347 put_str(" ", row_study, col_study);
1353 * @briefs プレイヤーのものまね可能状態を表示する
1356 static void prt_imitation(void)
1358 int wid, hgt, row_study, col_study;
1360 Term_get_size(&wid, &hgt);
1361 col_study = wid + COL_STUDY;
1362 row_study = hgt + ROW_STUDY;
1364 if (p_ptr->pclass == CLASS_IMITATOR)
1366 if (p_ptr->mane_num)
1369 if (new_mane) attr = TERM_L_RED;
1370 else attr = TERM_WHITE;
1371 c_put_str(attr, _("まね", "Imit"), row_study, col_study);
1375 put_str(" ", row_study, col_study);
1381 * @briefs プレイヤーの負傷状態を表示する
1384 static void prt_cut(void)
1390 c_put_str(TERM_L_RED, _("致命傷 ", "Mortal wound"), ROW_CUT, COL_CUT);
1394 c_put_str(TERM_RED, _("ひどい深手 ", "Deep gash "), ROW_CUT, COL_CUT);
1398 c_put_str(TERM_RED, _("重傷 ", "Severe cut "), ROW_CUT, COL_CUT);
1402 c_put_str(TERM_ORANGE, _("大変な傷 ", "Nasty cut "), ROW_CUT, COL_CUT);
1406 c_put_str(TERM_ORANGE, _("ひどい傷 ", "Bad cut "), ROW_CUT, COL_CUT);
1410 c_put_str(TERM_YELLOW, _("軽傷 ", "Light cut "), ROW_CUT, COL_CUT);
1414 c_put_str(TERM_YELLOW, _("かすり傷 ", "Graze "), ROW_CUT, COL_CUT);
1418 put_str(" ", ROW_CUT, COL_CUT);
1424 * @briefs プレイヤーの朦朧状態を表示する
1427 static void prt_stun(void)
1429 int s = p_ptr->stun;
1433 c_put_str(TERM_RED, _("意識不明瞭 ", "Knocked out "), ROW_STUN, COL_STUN);
1437 c_put_str(TERM_ORANGE, _("ひどく朦朧 ", "Heavy stun "), ROW_STUN, COL_STUN);
1441 c_put_str(TERM_ORANGE, _("朦朧 ", "Stun "), ROW_STUN, COL_STUN);
1445 put_str(" ", ROW_STUN, COL_STUN);
1452 * @briefs モンスターの体力ゲージを表示する
1453 * @param riding TRUEならば騎乗中のモンスターの体力、FALSEならターゲットモンスターの体力を表示する。表示位置は固定。
1457 * Redraw the "monster health bar" -DRS-
1458 * Rather extensive modifications by -BEN-
1460 * The "monster health bar" provides visual feedback on the "health"
1461 * of the monster currently being "tracked". There are several ways
1462 * to "track" a monster, including targetting it, attacking it, and
1463 * affecting it (and nobody else) with a ranged attack.
1465 * Display the monster health bar (affectionately known as the
1466 * "health-o-meter"). Clear health bar if nothing is being tracked.
1467 * Auto-track current target monster when bored. Note that the
1468 * health-bar stops tracking any monster that "disappears".
1471 static void health_redraw(bool riding)
1475 monster_type *m_ptr;
1479 health_who = p_ptr->riding;
1480 row = ROW_RIDING_INFO;
1481 col = COL_RIDING_INFO;
1485 health_who = p_ptr->health_who;
1490 m_ptr = &m_list[health_who];
1492 if (p_ptr->wizard && p_ptr->inside_battle)
1497 Term_putstr(col - 2, row, 12, TERM_WHITE, " / ");
1498 Term_putstr(col - 2, row + 1, 12, TERM_WHITE, " / ");
1499 Term_putstr(col - 2, row + 2, 12, TERM_WHITE, " / ");
1500 Term_putstr(col - 2, row + 3, 12, TERM_WHITE, " / ");
1504 Term_putstr(col - 2, row, 2, r_info[m_list[1].r_idx].x_attr, format("%c", r_info[m_list[1].r_idx].x_char));
1505 Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", m_list[1].hp));
1506 Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", m_list[1].max_maxhp));
1511 Term_putstr(col - 2, row + 1, 2, r_info[m_list[2].r_idx].x_attr, format("%c", r_info[m_list[2].r_idx].x_char));
1512 Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", m_list[2].hp));
1513 Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", m_list[2].max_maxhp));
1518 Term_putstr(col - 2, row + 2, 2, r_info[m_list[3].r_idx].x_attr, format("%c", r_info[m_list[3].r_idx].x_char));
1519 Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", m_list[3].hp));
1520 Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", m_list[3].max_maxhp));
1525 Term_putstr(col - 2, row + 3, 2, r_info[m_list[4].r_idx].x_attr, format("%c", r_info[m_list[4].r_idx].x_char));
1526 Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", m_list[4].hp));
1527 Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", m_list[4].max_maxhp));
1536 /* Erase the health bar */
1537 Term_erase(col, row, 12);
1540 /* Tracking an unseen monster */
1541 else if (!m_ptr->ml)
1543 /* Indicate that the monster health is "unknown" */
1544 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1547 /* Tracking a hallucinatory monster */
1548 else if (p_ptr->image)
1550 /* Indicate that the monster health is "unknown" */
1551 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1554 /* Tracking a dead monster (???) */
1555 else if (m_ptr->hp < 0)
1557 /* Indicate that the monster health is "unknown" */
1558 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1561 /* Tracking a visible monster */
1564 /* Extract the "percent" of health */
1565 int pct = 100L * m_ptr->hp / m_ptr->maxhp;
1566 int pct2 = 100L * m_ptr->hp / m_ptr->max_maxhp;
1568 /* Convert percent into "health" */
1569 int len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1571 /* Default to almost dead */
1572 byte attr = TERM_RED;
1575 if (MON_INVULNER(m_ptr)) attr = TERM_WHITE;
1578 else if (MON_CSLEEP(m_ptr)) attr = TERM_BLUE;
1581 else if (MON_MONFEAR(m_ptr)) attr = TERM_VIOLET;
1584 else if (pct >= 100) attr = TERM_L_GREEN;
1586 /* Somewhat Wounded */
1587 else if (pct >= 60) attr = TERM_YELLOW;
1590 else if (pct >= 25) attr = TERM_ORANGE;
1593 else if (pct >= 10) attr = TERM_L_RED;
1595 /* Default to "unknown" */
1596 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1598 /* Dump the current "health" (use '*' symbols) */
1599 Term_putstr(col + 1, row, len, attr, "**********");
1607 * @briefs プレイヤーのステータスを一括表示する(左側部分) / Display basic info (mostly left of map)
1610 static void prt_frame_basic(void)
1614 /* Race and Class */
1615 if (p_ptr->mimic_form)
1616 prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
1620 my_strcpy(str, rp_ptr->title, sizeof(str));
1621 prt_field(str, ROW_RACE, COL_RACE);
1623 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
1624 /* prt_field(ap_ptr->title, ROW_SEIKAKU, COL_SEIKAKU); */
1630 /* Level/Experience */
1635 for (i = 0; i < 6; i++) prt_stat(i);
1653 health_redraw(FALSE);
1654 health_redraw(TRUE);
1659 * @briefs プレイヤーのステータスを一括表示する(下部分) / Display extra info (mostly below map)
1662 static void prt_frame_extra(void)
1687 * @briefs サブウィンドウに所持品一覧を表示する / Hack -- display inventory in sub-windows
1690 static void fix_inven(void)
1695 for (j = 0; j < 8; j++)
1700 if (!angband_term[j]) continue;
1702 /* No relevant flags */
1703 if (!(window_flag[j] & (PW_INVEN))) continue;
1706 Term_activate(angband_term[j]);
1708 /* Display inventory */
1721 * @briefs モンスターの現在数を一行で表現する / Print monster info in line
1724 * @param m_ptr 思い出を表示するモンスター情報の参照ポインタ
1725 * @param n_same モンスターの数の現在数
1729 * nnn : number or unique(U) or wanted unique(W)
1730 * X : symbol of monster
1731 * LV : monster lv if known
1732 * name: name of monster
1736 static void print_monster_line(int x, int y, monster_type* m_ptr, int n_same){
1739 int r_idx = m_ptr->ap_r_idx;
1740 monster_race* r_ptr = &r_info[r_idx];
1744 //Number of 'U'nique
1745 if(r_ptr->flags1&RF1_UNIQUE){//unique
1746 bool is_kubi = FALSE;
1747 for(i=0;i<MAX_KUBI;i++){
1748 if(kubi_r_idx[i] == r_idx){
1753 Term_addstr(-1, TERM_WHITE, is_kubi?" W":" U");
1755 sprintf(buf, "%3d", n_same);
1756 Term_addstr(-1, TERM_WHITE, buf);
1759 Term_addstr(-1, TERM_WHITE, " ");
1760 //Term_add_bigch(r_ptr->d_attr, r_ptr->d_char);
1761 //Term_addstr(-1, TERM_WHITE, "/");
1762 Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
1764 if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
1765 sprintf(buf, " %2d", r_ptr->level);
1769 Term_addstr(-1, TERM_WHITE, buf);
1771 sprintf(buf, " %s ", r_name+r_ptr->name);
1772 Term_addstr(-1, TERM_WHITE, buf);
1774 //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
1778 * @briefs モンスターの出現リストを表示する / Print monster info in line
1781 * @param max_lines 最大何行描画するか
1783 void print_monster_list(int x, int y, int max_lines){
1785 monster_type* last_mons = NULL;
1786 monster_type* m_ptr = NULL;
1790 for(i=0;i<temp_n;i++){
1791 cave_type* c_ptr = &cave[temp_y[i]][temp_x[i]];
1792 if(!c_ptr->m_idx || !m_list[c_ptr->m_idx].ml)continue;//no mons or cannot look
1793 m_ptr = &m_list[c_ptr->m_idx];
1794 if(is_pet(m_ptr))continue;//pet
1795 if(!m_ptr->r_idx)continue;//dead?
1798 int r_idx = m_ptr->ap_r_idx;
1799 monster_race* r_ptr = &r_info[r_idx];
1800 cptr name = (r_name + r_ptr->name);
1801 cptr ename = (r_name + r_ptr->name);
1802 //ミミック類や「それ」等は、一覧に出てはいけない
1803 if(r_ptr->flags1&RF1_CHAR_CLEAR)continue;
1804 if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue;
1806 if((strcmp(name, "生ける虚無『ヌル』")==0)||
1807 (strcmp(ename, "Null the Living Void")==0))continue;
1808 //"金無垢の指輪"は、一覧に出てはいけない
1809 if((strcmp(name, "金無垢の指輪")==0)||
1810 (strcmp(ename, "Plain Gold Ring")==0))continue;
1814 //ソート済みなので同じモンスターは連続する.これを利用して同じモンスターをカウント,まとめて表示する.
1815 if(!last_mons){//先頭モンスター
1821 if(last_mons->ap_r_idx == m_ptr->ap_r_idx){
1823 continue;//表示処理を次に回す
1825 //print last mons info
1826 print_monster_line(x, line++, last_mons, n_same);
1829 if(line-y-1==max_lines){//残り1行
1833 if(line-y-1==max_lines && i!=temp_n){
1834 Term_gotoxy(x, line);
1835 Term_addstr(-1, TERM_WHITE, "-- and more --");
1837 if(last_mons)print_monster_line(x, line++, last_mons, n_same);
1842 * @briefs 出現中モンスターのリストをサブウィンドウに表示する / Hack -- display monster list in sub-windows
1845 static void fix_monster_list(void)
1851 for (j = 0; j < 8; j++)
1856 if (!angband_term[j]) continue;
1858 /* No relevant flags */
1859 if (!(window_flag[j] & (PW_MONSTER_LIST))) continue;
1862 Term_activate(angband_term[j]);
1863 Term_get_size(&w, &h);
1867 target_set_prepare_look();//モンスター一覧を生成,ソート
1868 print_monster_list(0, 0, h);
1881 * @briefs 現在の装備品をサブウィンドウに表示する /
1882 * Hack -- display equipment in sub-windows
1885 static void fix_equip(void)
1890 for (j = 0; j < 8; j++)
1895 if (!angband_term[j]) continue;
1897 /* No relevant flags */
1898 if (!(window_flag[j] & (PW_EQUIP))) continue;
1901 Term_activate(angband_term[j]);
1903 /* Display equipment */
1916 * @briefs 現在の習得済魔法をサブウィンドウに表示する /
1917 * Hack -- display spells in sub-windows
1920 static void fix_spell(void)
1925 for (j = 0; j < 8; j++)
1930 if (!angband_term[j]) continue;
1932 /* No relevant flags */
1933 if (!(window_flag[j] & (PW_SPELL))) continue;
1936 Term_activate(angband_term[j]);
1938 /* Display spell list */
1939 display_spell_list();
1951 * @briefs 現在のプレイヤーステータスをサブウィンドウに表示する /
1952 * Hack -- display character in sub-windows
1955 static void fix_player(void)
1960 for (j = 0; j < 8; j++)
1965 if (!angband_term[j]) continue;
1967 /* No relevant flags */
1968 if (!(window_flag[j] & (PW_PLAYER))) continue;
1971 Term_activate(angband_term[j]);
1975 /* Display player */
1987 * @briefs ゲームメッセージ履歴をサブウィンドウに表示する /
1988 * Hack -- display recent messages in sub-windows
1989 * XXX XXX XXX Adjust for width and split messages
1992 static void fix_message(void)
1999 for (j = 0; j < 8; j++)
2004 if (!angband_term[j]) continue;
2006 /* No relevant flags */
2007 if (!(window_flag[j] & (PW_MESSAGE))) continue;
2010 Term_activate(angband_term[j]);
2013 Term_get_size(&w, &h);
2016 for (i = 0; i < h; i++)
2018 /* Dump the message on the appropriate line */
2019 Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
2022 Term_locate(&x, &y);
2024 /* Clear to end of line */
2025 Term_erase(x, y, 255);
2038 * @briefs 簡易マップをサブウィンドウに表示する /
2039 * Hack -- display overhead view in sub-windows
2040 * XXX XXX XXX Adjust for width and split messages
2043 * Note that the "player" symbol does NOT appear on the map.
2045 static void fix_overhead(void)
2052 for (j = 0; j < 8; j++)
2058 if (!angband_term[j]) continue;
2060 /* No relevant flags */
2061 if (!(window_flag[j] & (PW_OVERHEAD))) continue;
2064 Term_activate(angband_term[j]);
2066 /* Full map in too small window is useless */
2067 Term_get_size(&wid, &hgt);
2068 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2)
2071 display_map(&cy, &cx);
2084 * @briefs ダンジョンの地形をサブウィンドウに表示する /
2085 * Hack -- display dungeon view in sub-windows
2088 static void fix_dungeon(void)
2093 for (j = 0; j < 8; j++)
2098 if (!angband_term[j]) continue;
2100 /* No relevant flags */
2101 if (!(window_flag[j] & (PW_DUNGEON))) continue;
2104 Term_activate(angband_term[j]);
2106 /* Redraw dungeon view */
2119 * @briefs モンスターの思い出をサブウィンドウに表示する /
2120 * Hack -- display dungeon view in sub-windows
2123 static void fix_monster(void)
2128 for (j = 0; j < 8; j++)
2133 if (!angband_term[j]) continue;
2135 /* No relevant flags */
2136 if (!(window_flag[j] & (PW_MONSTER))) continue;
2139 Term_activate(angband_term[j]);
2141 /* Display monster race info */
2142 if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
2154 * @briefs ベースアイテム情報をサブウィンドウに表示する /
2155 * Hack -- display object recall in sub-windows
2158 static void fix_object(void)
2163 for (j = 0; j < 8; j++)
2168 if (!angband_term[j]) continue;
2170 /* No relevant flags */
2171 if (!(window_flag[j] & (PW_OBJECT))) continue;
2174 Term_activate(angband_term[j]);
2176 /* Display monster race info */
2177 if (p_ptr->object_kind_idx) display_koff(p_ptr->object_kind_idx);
2190 * @briefs プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
2191 * Calculate number of spells player should have, and forget,
2192 * or remember, spells until that number is properly reflected.
2195 * Note that this function induces various "status" messages,
2196 * which must be bypasses until the character is created.
2198 static void calc_spells(void)
2200 int i, j, k, levels;
2202 int num_boukyaku = 0;
2204 const magic_type *s_ptr;
2211 /* Hack -- must be literate */
2212 if (!mp_ptr->spell_book) return;
2214 /* Hack -- wait for creation */
2215 if (!character_generated) return;
2217 /* Hack -- handle "xtra" mode */
2218 if (character_xtra) return;
2220 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
2222 p_ptr->new_spells = 0;
2226 p = spell_category_name(mp_ptr->spell_book);
2228 /* Determine the number of spells allowed */
2229 levels = p_ptr->lev - mp_ptr->spell_first + 1;
2231 /* Hack -- no negative spells */
2232 if (levels < 0) levels = 0;
2234 /* Extract total allowed spells */
2235 num_allowed = (adj_mag_study[p_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
2237 if ((p_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
2241 if (p_ptr->pclass == CLASS_SAMURAI)
2245 else if (p_ptr->realm2 == REALM_NONE)
2247 num_allowed = (num_allowed+1)/2;
2248 if (num_allowed>(32+bonus)) num_allowed = 32+bonus;
2250 else if ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))
2252 if (num_allowed>(96+bonus)) num_allowed = 96+bonus;
2256 if (num_allowed>(80+bonus)) num_allowed = 80+bonus;
2259 /* Count the number of spells we know */
2260 for (j = 0; j < 64; j++)
2262 /* Count known spells */
2264 (p_ptr->spell_forgotten1 & (1L << j)) :
2265 (p_ptr->spell_forgotten2 & (1L << (j - 32))))
2271 /* See how many spells we must forget or may learn */
2272 p_ptr->new_spells = num_allowed + p_ptr->add_spells + num_boukyaku - p_ptr->learned_spells;
2274 /* Forget spells which are too hard */
2275 for (i = 63; i >= 0; i--)
2277 /* Efficiency -- all done */
2278 if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
2280 /* Access the spell */
2281 j = p_ptr->spell_order[i];
2283 /* Skip non-spells */
2284 if (j >= 99) continue;
2288 if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2))
2291 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j];
2293 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32];
2296 s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2298 s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32];
2300 /* Skip spells we are allowed to know */
2301 if (s_ptr->slevel <= p_ptr->lev) continue;
2305 (p_ptr->spell_learned1 & (1L << j)) :
2306 (p_ptr->spell_learned2 & (1L << (j - 32))))
2308 /* Mark as forgotten */
2311 p_ptr->spell_forgotten1 |= (1L << j);
2312 which = p_ptr->realm1;
2316 p_ptr->spell_forgotten2 |= (1L << (j - 32));
2317 which = p_ptr->realm2;
2320 /* No longer known */
2323 p_ptr->spell_learned1 &= ~(1L << j);
2324 which = p_ptr->realm1;
2328 p_ptr->spell_learned2 &= ~(1L << (j - 32));
2329 which = p_ptr->realm2;
2334 msg_format("%sの%sを忘れてしまった。",
2335 do_spell(which, j%32, SPELL_NAME), p );
2337 msg_format("You have forgotten the %s of %s.", p,
2338 do_spell(which, j%32, SPELL_NAME));
2342 /* One more can be learned */
2343 p_ptr->new_spells++;
2348 /* Forget spells if we know too many spells */
2349 for (i = 63; i >= 0; i--)
2351 /* Stop when possible */
2352 if (p_ptr->new_spells >= 0) break;
2354 /* Efficiency -- all done */
2355 if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
2357 /* Get the (i+1)th spell learned */
2358 j = p_ptr->spell_order[i];
2360 /* Skip unknown spells */
2361 if (j >= 99) continue;
2363 /* Forget it (if learned) */
2365 (p_ptr->spell_learned1 & (1L << j)) :
2366 (p_ptr->spell_learned2 & (1L << (j - 32))))
2368 /* Mark as forgotten */
2371 p_ptr->spell_forgotten1 |= (1L << j);
2372 which = p_ptr->realm1;
2376 p_ptr->spell_forgotten2 |= (1L << (j - 32));
2377 which = p_ptr->realm2;
2380 /* No longer known */
2383 p_ptr->spell_learned1 &= ~(1L << j);
2384 which = p_ptr->realm1;
2388 p_ptr->spell_learned2 &= ~(1L << (j - 32));
2389 which = p_ptr->realm2;
2394 msg_format("%sの%sを忘れてしまった。",
2395 do_spell(which, j%32, SPELL_NAME), p );
2397 msg_format("You have forgotten the %s of %s.", p,
2398 do_spell(which, j%32, SPELL_NAME));
2402 /* One more can be learned */
2403 p_ptr->new_spells++;
2408 /* Check for spells to remember */
2409 for (i = 0; i < 64; i++)
2411 /* None left to remember */
2412 if (p_ptr->new_spells <= 0) break;
2414 /* Efficiency -- all done */
2415 if (!p_ptr->spell_forgotten1 && !p_ptr->spell_forgotten2) break;
2417 /* Get the next spell we learned */
2418 j = p_ptr->spell_order[i];
2420 /* Skip unknown spells */
2423 /* Access the spell */
2424 if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2))
2427 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j];
2429 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32];
2432 s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2434 s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32];
2436 /* Skip spells we cannot remember */
2437 if (s_ptr->slevel > p_ptr->lev) continue;
2439 /* First set of spells */
2441 (p_ptr->spell_forgotten1 & (1L << j)) :
2442 (p_ptr->spell_forgotten2 & (1L << (j - 32))))
2444 /* No longer forgotten */
2447 p_ptr->spell_forgotten1 &= ~(1L << j);
2448 which = p_ptr->realm1;
2452 p_ptr->spell_forgotten2 &= ~(1L << (j - 32));
2453 which = p_ptr->realm2;
2456 /* Known once more */
2459 p_ptr->spell_learned1 |= (1L << j);
2460 which = p_ptr->realm1;
2464 p_ptr->spell_learned2 |= (1L << (j - 32));
2465 which = p_ptr->realm2;
2470 msg_format("%sの%sを思い出した。",
2471 do_spell(which, j%32, SPELL_NAME), p );
2473 msg_format("You have remembered the %s of %s.",
2474 p, do_spell(which, j%32, SPELL_NAME));
2478 /* One less can be learned */
2479 p_ptr->new_spells--;
2485 if (p_ptr->realm2 == REALM_NONE)
2487 /* Count spells that can be learned */
2488 for (j = 0; j < 32; j++)
2490 if (!is_magic(p_ptr->realm1)) s_ptr = &technic_info[p_ptr->realm1-MIN_TECHNIC][j];
2491 else s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2493 /* Skip spells we cannot remember */
2494 if (s_ptr->slevel > p_ptr->lev) continue;
2496 /* Skip spells we already know */
2497 if (p_ptr->spell_learned1 & (1L << j))
2506 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;
2509 if (p_ptr->new_spells < 0) p_ptr->new_spells = 0;
2511 /* Spell count changed */
2512 if (p_ptr->old_spells != p_ptr->new_spells)
2514 /* Message if needed */
2515 if (p_ptr->new_spells)
2519 if( p_ptr->new_spells < 10 ){
2520 msg_format("あと %d つの%sを学べる。", p_ptr->new_spells, p);
2522 msg_format("あと %d 個の%sを学べる。", p_ptr->new_spells, p);
2525 msg_format("You can learn %d more %s%s.",
2526 p_ptr->new_spells, p,
2527 (p_ptr->new_spells != 1) ? "s" : "");
2532 /* Save the new_spells value */
2533 p_ptr->old_spells = p_ptr->new_spells;
2535 /* Redraw Study Status */
2536 p_ptr->redraw |= (PR_STUDY);
2538 /* Redraw object recall */
2539 p_ptr->window |= (PW_OBJECT);
2544 * @briefs プレイヤーの最大MPを計算する /
2545 * Calculate maximum mana. You do not need to know any spells.
2546 * Note that mana is lowered by heavy (or inappropriate) armor.
2549 * This function induces status messages.
2551 static void calc_mana(void)
2553 int msp, levels, cur_wgt, max_wgt;
2558 /* Hack -- Must be literate */
2559 if (!mp_ptr->spell_book) return;
2561 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
2562 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
2563 (p_ptr->pclass == CLASS_BLUE_MAGE))
2565 levels = p_ptr->lev;
2569 if(mp_ptr->spell_first > p_ptr->lev)
2574 /* Display mana later */
2575 p_ptr->redraw |= (PR_MANA);
2579 /* Extract "effective" player level */
2580 levels = (p_ptr->lev - mp_ptr->spell_first) + 1;
2583 if (p_ptr->pclass == CLASS_SAMURAI)
2585 msp = (adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
2586 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
2590 /* Extract total mana */
2591 msp = adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] * (levels+3) / 4;
2593 /* Hack -- usually add one mana */
2596 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
2598 if (msp && (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp/2;
2600 /* Hack: High mages have a 25% mana bonus */
2601 if (msp && (p_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
2603 if (msp && (p_ptr->pclass == CLASS_SORCERER)) msp += msp*(25+p_ptr->lev)/100;
2606 /* Only mages are affected */
2607 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
2609 u32b flgs[TR_FLAG_SIZE];
2611 /* Assume player is not encumbered by gloves */
2612 p_ptr->cumber_glove = FALSE;
2614 /* Get the gloves */
2615 o_ptr = &inventory[INVEN_HANDS];
2617 /* Examine the gloves */
2618 object_flags(o_ptr, flgs);
2620 /* Normal gloves hurt mage-type spells */
2622 !(have_flag(flgs, TR_FREE_ACT)) &&
2623 !(have_flag(flgs, TR_DEC_MANA)) &&
2624 !(have_flag(flgs, TR_EASY_SPELL)) &&
2625 !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) &&
2626 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
2629 p_ptr->cumber_glove = TRUE;
2632 msp = (3 * msp) / 4;
2637 /* Assume player not encumbered by armor */
2638 p_ptr->cumber_armor = FALSE;
2640 /* Weigh the armor */
2642 if(inventory[INVEN_RARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
2643 if(inventory[INVEN_LARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
2644 cur_wgt += inventory[INVEN_BODY].weight;
2645 cur_wgt += inventory[INVEN_HEAD].weight;
2646 cur_wgt += inventory[INVEN_OUTER].weight;
2647 cur_wgt += inventory[INVEN_HANDS].weight;
2648 cur_wgt += inventory[INVEN_FEET].weight;
2650 /* Subtract a percentage of maximum mana. */
2651 switch (p_ptr->pclass)
2653 /* For these classes, mana is halved if armour
2654 * is 30 pounds over their weight limit. */
2656 case CLASS_HIGH_MAGE:
2657 case CLASS_BLUE_MAGE:
2659 case CLASS_FORCETRAINER:
2660 case CLASS_SORCERER:
2662 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
2663 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
2667 /* Mana halved if armour is 40 pounds over weight limit. */
2672 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight*2/3;
2673 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight*2/3;
2677 case CLASS_MINDCRAFTER:
2678 case CLASS_BEASTMASTER:
2679 case CLASS_MIRROR_MASTER:
2681 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/2;
2682 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/2;
2686 /* Mana halved if armour is 50 pounds over weight limit. */
2689 case CLASS_RED_MAGE:
2690 case CLASS_WARRIOR_MAGE:
2692 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/3;
2693 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/3;
2697 /* Mana halved if armour is 60 pounds over weight limit. */
2699 case CLASS_CHAOS_WARRIOR:
2701 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/5;
2702 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/5;
2706 /* For new classes created, but not yet added to this formula. */
2713 /* Determine the weight allowance */
2714 max_wgt = mp_ptr->spell_weight;
2716 /* Heavy armor penalizes mana by a percentage. -LM- */
2717 if ((cur_wgt - max_wgt) > 0)
2720 p_ptr->cumber_armor = TRUE;
2722 /* Subtract a percentage of maximum mana. */
2723 switch (p_ptr->pclass)
2725 /* For these classes, mana is halved if armour
2726 * is 30 pounds over their weight limit. */
2728 case CLASS_HIGH_MAGE:
2729 case CLASS_BLUE_MAGE:
2731 msp -= msp * (cur_wgt - max_wgt) / 600;
2735 /* Mana halved if armour is 40 pounds over weight limit. */
2737 case CLASS_MINDCRAFTER:
2738 case CLASS_BEASTMASTER:
2740 case CLASS_FORCETRAINER:
2742 case CLASS_MIRROR_MASTER:
2744 msp -= msp * (cur_wgt - max_wgt) / 800;
2748 case CLASS_SORCERER:
2750 msp -= msp * (cur_wgt - max_wgt) / 900;
2754 /* Mana halved if armour is 50 pounds over weight limit. */
2758 case CLASS_RED_MAGE:
2760 msp -= msp * (cur_wgt - max_wgt) / 1000;
2764 /* Mana halved if armour is 60 pounds over weight limit. */
2766 case CLASS_CHAOS_WARRIOR:
2767 case CLASS_WARRIOR_MAGE:
2769 msp -= msp * (cur_wgt - max_wgt) / 1200;
2775 p_ptr->cumber_armor = FALSE;
2779 /* For new classes created, but not yet added to this formula. */
2782 msp -= msp * (cur_wgt - max_wgt) / 800;
2788 /* Mana can never be negative */
2789 if (msp < 0) msp = 0;
2792 /* Maximum mana has changed */
2793 if (p_ptr->msp != msp)
2795 /* Enforce maximum */
2796 if ((p_ptr->csp >= msp) && (p_ptr->pclass != CLASS_SAMURAI))
2799 p_ptr->csp_frac = 0;
2803 /* レベルアップの時は上昇量を表示する */
2804 if ((level_up == 1) && (msp > p_ptr->msp))
2806 msg_format("最大マジック・ポイントが %d 増加した!",
2807 (msp - p_ptr->msp));
2813 /* Display mana later */
2814 p_ptr->redraw |= (PR_MANA);
2817 p_ptr->window |= (PW_PLAYER);
2818 p_ptr->window |= (PW_SPELL);
2822 /* Hack -- handle "xtra" mode */
2823 if (character_xtra) return;
2825 /* Take note when "glove state" changes */
2826 if (p_ptr->old_cumber_glove != p_ptr->cumber_glove)
2829 if (p_ptr->cumber_glove)
2831 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
2835 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
2839 p_ptr->old_cumber_glove = p_ptr->cumber_glove;
2843 /* Take note when "armor state" changes */
2844 if (p_ptr->old_cumber_armor != p_ptr->cumber_armor)
2847 if (p_ptr->cumber_armor)
2849 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
2853 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
2857 p_ptr->old_cumber_armor = p_ptr->cumber_armor;
2864 * @briefs プレイヤーの最大HPを計算する /
2865 * Calculate the players (maximal) hit points
2866 * Adjust current hitpoints if necessary
2870 static void calc_hitpoints(void)
2875 /* Un-inflate "half-hitpoint bonus per level" value */
2876 bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128) * p_ptr->lev / 4;
2878 /* Calculate hitpoints */
2879 mhp = p_ptr->player_hp[p_ptr->lev - 1];
2881 if (p_ptr->mimic_form)
2883 if (p_ptr->pclass == CLASS_SORCERER)
2884 tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
2886 tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
2887 mhp = mhp * tmp_hitdie / p_ptr->hitdie;
2890 if (p_ptr->pclass == CLASS_SORCERER)
2892 if (p_ptr->lev < 30)
2893 mhp = (mhp * (45+p_ptr->lev) / 100);
2895 mhp = (mhp * 75 / 100);
2896 bonus = (bonus * 65 / 100);
2901 if (p_ptr->pclass == CLASS_BERSERKER)
2903 mhp = mhp*(110+(((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 110))/100;
2906 /* Always have at least one hitpoint per level */
2907 if (mhp < p_ptr->lev + 1) mhp = p_ptr->lev + 1;
2909 /* Factor in the hero / superhero settings */
2910 if (IS_HERO()) mhp += 10;
2911 if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
2912 if (p_ptr->tsuyoshi) mhp += 50;
2914 /* Factor in the hex spell settings */
2915 if (hex_spelling(HEX_XTRA_MIGHT)) mhp += 15;
2916 if (hex_spelling(HEX_BUILDING)) mhp += 60;
2918 /* New maximum hitpoints */
2919 if (p_ptr->mhp != mhp)
2921 /* Enforce maximum */
2922 if (p_ptr->chp >= mhp)
2925 p_ptr->chp_frac = 0;
2929 /* レベルアップの時は上昇量を表示する */
2930 if ((level_up == 1) && (mhp > p_ptr->mhp))
2932 msg_format("最大ヒット・ポイントが %d 増加した!",
2933 (mhp - p_ptr->mhp) );
2936 /* Save the new max-hitpoints */
2939 /* Display hitpoints (later) */
2940 p_ptr->redraw |= (PR_HP);
2943 p_ptr->window |= (PW_PLAYER);
2948 * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius"
2951 * SWD: Experimental modification: multiple light sources have additive effect.
2953 static void calc_torch(void)
2957 u32b flgs[TR_FLAG_SIZE];
2959 /* Assume no light */
2960 p_ptr->cur_lite = 0;
2962 /* Loop through all wielded items */
2963 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2965 o_ptr = &inventory[i];
2966 /* Skip empty slots */
2967 if (!o_ptr->k_idx) continue;
2969 if (o_ptr->name2 == EGO_LITE_SHINE) p_ptr->cur_lite++;
2972 if (o_ptr->name2 != EGO_LITE_DARKNESS)
2974 if (o_ptr->tval == TV_LITE)
2976 if((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue;
2977 if((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue;
2981 /* Extract the flags */
2982 object_flags(o_ptr, flgs);
2984 /* calc the lite_radius */
2987 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
2988 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
2989 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
2990 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
2991 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
2992 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
2993 p_ptr->cur_lite += rad;
2996 /* max radius is 14 (was 5) without rewriting other code -- */
2997 /* see cave.c:update_lite() and defines.h:LITE_MAX */
2998 if (d_info[dungeon_type].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
2999 p_ptr->cur_lite = 1;
3002 * check if the player doesn't have light radius,
3003 * but does weakly glow as an intrinsic.
3005 if (p_ptr->cur_lite <= 0 && p_ptr->lite) p_ptr->cur_lite++;
3007 if (p_ptr->cur_lite > 14) p_ptr->cur_lite = 14;
3008 if (p_ptr->cur_lite < 0) p_ptr->cur_lite = 0;
3010 /* end experimental mods */
3012 /* Notice changes in the "lite radius" */
3013 if (p_ptr->old_lite != p_ptr->cur_lite)
3016 /* Hack -- PU_MON_LITE for monsters' darkness */
3017 p_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
3019 /* Remember the old lite */
3020 p_ptr->old_lite = p_ptr->cur_lite;
3022 if ((p_ptr->cur_lite > 0) && (p_ptr->special_defense & NINJA_S_STEALTH))
3023 set_superstealth(FALSE);
3029 * @brief プレイヤーの所持重量制限を計算する /
3030 * Computes current weight limit.
3033 u32b weight_limit(void)
3037 /* Weight limit based only on strength */
3038 i = (u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
3039 if (p_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
3041 /* Return the result */
3046 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
3047 * @param i 判定する手のID(右手:0 左手:1)
3048 * @return 持っているならばTRUE
3050 bool buki_motteruka(int i)
3052 return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE);
3056 * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
3057 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
3058 * @return 重すぎるならばTRUE
3060 bool is_heavy_shoot(object_type *o_ptr)
3062 int hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
3063 /* It is hard to carholdry a heavy bow */
3064 return (hold < o_ptr->weight / 10);
3068 * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す /
3069 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
3070 * @return 対応する矢/弾薬のベースアイテムID
3072 int bow_tval_ammo(object_type *o_ptr)
3074 /* Analyze the launcher */
3075 switch (o_ptr->sval)
3104 * @brief 装備中の射撃武器の威力倍率を返す /
3105 * calcurate the fire rate of target object
3106 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
3107 * @return 射撃倍率の値(100で1.00倍)
3109 s16b calc_num_fire(object_type *o_ptr)
3111 int extra_shots = 0;
3114 int tval_ammo = bow_tval_ammo(o_ptr);
3116 u32b flgs[TR_FLAG_SIZE];
3118 /* Scan the usable inventory */
3119 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3121 q_ptr = &inventory[i];
3123 /* Skip non-objects */
3124 if (!q_ptr->k_idx) continue;
3126 /* Do not apply current equip */
3127 if (i == INVEN_BOW) continue;
3129 /* Extract the item flags */
3130 object_flags(q_ptr, flgs);
3133 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
3136 object_flags(o_ptr, flgs);
3137 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
3139 if (o_ptr->k_idx && !is_heavy_shoot(o_ptr))
3143 num += (extra_shots * 100);
3145 /* Hack -- Rangers love Bows */
3146 if ((p_ptr->pclass == CLASS_RANGER) &&
3147 (tval_ammo == TV_ARROW))
3149 num += (p_ptr->lev * 4);
3152 if ((p_ptr->pclass == CLASS_CAVALRY) &&
3153 (tval_ammo == TV_ARROW))
3155 num += (p_ptr->lev * 3);
3158 if (p_ptr->pclass == CLASS_ARCHER)
3160 if (tval_ammo == TV_ARROW)
3161 num += ((p_ptr->lev * 5)+50);
3162 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
3163 num += (p_ptr->lev * 4);
3167 * Addendum -- also "Reward" high level warriors,
3168 * with _any_ missile weapon -- TY
3170 if (p_ptr->pclass == CLASS_WARRIOR &&
3171 (tval_ammo <= TV_BOLT) &&
3172 (tval_ammo >= TV_SHOT))
3174 num += (p_ptr->lev * 2);
3176 if ((p_ptr->pclass == CLASS_ROGUE) &&
3177 (tval_ammo == TV_SHOT))
3179 num += (p_ptr->lev * 4);
3186 * @brief プレイヤーの全ステータスを更新する /
3187 * Calculate the players current "state", taking into account
3188 * not only race/class intrinsics, but also objects being worn
3189 * and temporary spell effects.
3193 * See also calc_mana() and calc_hitpoints().
3195 * Take note of the new "speed code", in particular, a very strong
3196 * player will start slowing down as soon as he reaches 150 pounds,
3197 * but not until he reaches 450 pounds will he be half as fast as
3198 * a normal kobold. This both hurts and helps the player, hurts
3199 * because in the old days a player could just avoid 300 pounds,
3200 * and helps because now carrying 300 pounds is not very painful.
3202 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
3203 * damage, since that would affect non-combat things. These values
3204 * are actually added in later, at the appropriate place.
3206 * This function induces various "status" messages.
3209 void calc_bonuses(void)
3211 int i, j, hold, neutral[2];
3213 int default_hand = 0;
3214 int empty_hands_status = empty_hands(TRUE);
3217 u32b flgs[TR_FLAG_SIZE];
3219 bool yoiyami = FALSE;
3220 bool down_saving = FALSE;
3222 bool have_dd_s = FALSE, have_dd_t = FALSE;
3224 bool have_sw = FALSE, have_kabe = FALSE;
3225 bool easy_2weapon = FALSE;
3226 bool riding_levitation = FALSE;
3227 s16b this_o_idx, next_o_idx = 0;
3228 const player_race *tmp_rp_ptr;
3230 /* Save the old vision stuff */
3231 bool old_telepathy = p_ptr->telepathy;
3232 bool old_esp_animal = p_ptr->esp_animal;
3233 bool old_esp_undead = p_ptr->esp_undead;
3234 bool old_esp_demon = p_ptr->esp_demon;
3235 bool old_esp_orc = p_ptr->esp_orc;
3236 bool old_esp_troll = p_ptr->esp_troll;
3237 bool old_esp_giant = p_ptr->esp_giant;
3238 bool old_esp_dragon = p_ptr->esp_dragon;
3239 bool old_esp_human = p_ptr->esp_human;
3240 bool old_esp_evil = p_ptr->esp_evil;
3241 bool old_esp_good = p_ptr->esp_good;
3242 bool old_esp_nonliving = p_ptr->esp_nonliving;
3243 bool old_esp_unique = p_ptr->esp_unique;
3244 bool old_see_inv = p_ptr->see_inv;
3245 bool old_mighty_throw = p_ptr->mighty_throw;
3247 /* Save the old armor class */
3248 bool old_dis_ac = p_ptr->dis_ac;
3249 bool old_dis_to_a = p_ptr->dis_to_a;
3252 /* Clear extra blows/shots */
3253 extra_blows[0] = extra_blows[1] = 0;
3255 /* Clear the stat modifiers */
3256 for (i = 0; i < 6; i++) p_ptr->stat_add[i] = 0;
3259 /* Clear the Displayed/Real armor class */
3260 p_ptr->dis_ac = p_ptr->ac = 0;
3262 /* Clear the Displayed/Real Bonuses */
3263 p_ptr->dis_to_h[0] = p_ptr->to_h[0] = 0;
3264 p_ptr->dis_to_h[1] = p_ptr->to_h[1] = 0;
3265 p_ptr->dis_to_d[0] = p_ptr->to_d[0] = 0;
3266 p_ptr->dis_to_d[1] = p_ptr->to_d[1] = 0;
3267 p_ptr->dis_to_h_b = p_ptr->to_h_b = 0;
3268 p_ptr->dis_to_a = p_ptr->to_a = 0;
3272 p_ptr->to_m_chance = 0;
3274 /* Clear the Extra Dice Bonuses */
3275 p_ptr->to_dd[0] = p_ptr->to_ds[0] = 0;
3276 p_ptr->to_dd[1] = p_ptr->to_ds[1] = 0;
3278 /* Start with "normal" speed */
3281 /* Start with a single blow per turn */
3282 p_ptr->num_blow[0] = 1;
3283 p_ptr->num_blow[1] = 1;
3285 /* Start with a single shot per turn */
3286 p_ptr->num_fire = 100;
3288 /* Reset the "xtra" tval */
3289 p_ptr->tval_xtra = 0;
3291 /* Reset the "ammo" tval */
3292 p_ptr->tval_ammo = 0;
3294 /* Clear all the flags */
3296 p_ptr->bless_blade = FALSE;
3297 p_ptr->xtra_might = FALSE;
3298 p_ptr->impact[0] = FALSE;
3299 p_ptr->impact[1] = FALSE;
3300 p_ptr->pass_wall = FALSE;
3301 p_ptr->kill_wall = FALSE;
3302 p_ptr->dec_mana = FALSE;
3303 p_ptr->easy_spell = FALSE;
3304 p_ptr->heavy_spell = FALSE;
3305 p_ptr->see_inv = FALSE;
3306 p_ptr->free_act = FALSE;
3307 p_ptr->slow_digest = FALSE;
3308 p_ptr->regenerate = FALSE;
3309 p_ptr->can_swim = FALSE;
3310 p_ptr->levitation = FALSE;
3311 p_ptr->hold_exp = FALSE;
3312 p_ptr->telepathy = FALSE;
3313 p_ptr->esp_animal = FALSE;
3314 p_ptr->esp_undead = FALSE;
3315 p_ptr->esp_demon = FALSE;
3316 p_ptr->esp_orc = FALSE;
3317 p_ptr->esp_troll = FALSE;
3318 p_ptr->esp_giant = FALSE;
3319 p_ptr->esp_dragon = FALSE;
3320 p_ptr->esp_human = FALSE;
3321 p_ptr->esp_evil = FALSE;
3322 p_ptr->esp_good = FALSE;
3323 p_ptr->esp_nonliving = FALSE;
3324 p_ptr->esp_unique = FALSE;
3325 p_ptr->lite = FALSE;
3326 p_ptr->sustain_str = FALSE;
3327 p_ptr->sustain_int = FALSE;
3328 p_ptr->sustain_wis = FALSE;
3329 p_ptr->sustain_con = FALSE;
3330 p_ptr->sustain_dex = FALSE;
3331 p_ptr->sustain_chr = FALSE;
3332 p_ptr->resist_acid = FALSE;
3333 p_ptr->resist_elec = FALSE;
3334 p_ptr->resist_fire = FALSE;
3335 p_ptr->resist_cold = FALSE;
3336 p_ptr->resist_pois = FALSE;
3337 p_ptr->resist_conf = FALSE;
3338 p_ptr->resist_sound = FALSE;
3339 p_ptr->resist_lite = FALSE;
3340 p_ptr->resist_dark = FALSE;
3341 p_ptr->resist_chaos = FALSE;
3342 p_ptr->resist_disen = FALSE;
3343 p_ptr->resist_shard = FALSE;
3344 p_ptr->resist_nexus = FALSE;
3345 p_ptr->resist_blind = FALSE;
3346 p_ptr->resist_neth = FALSE;
3347 p_ptr->resist_time = FALSE;
3348 p_ptr->resist_fear = FALSE;
3349 p_ptr->reflect = FALSE;
3350 p_ptr->sh_fire = FALSE;
3351 p_ptr->sh_elec = FALSE;
3352 p_ptr->sh_cold = FALSE;
3353 p_ptr->anti_magic = FALSE;
3354 p_ptr->anti_tele = FALSE;
3355 p_ptr->warning = FALSE;
3356 p_ptr->mighty_throw = FALSE;
3357 p_ptr->see_nocto = FALSE;
3359 p_ptr->immune_acid = FALSE;
3360 p_ptr->immune_elec = FALSE;
3361 p_ptr->immune_fire = FALSE;
3362 p_ptr->immune_cold = FALSE;
3364 p_ptr->ryoute = FALSE;
3365 p_ptr->migite = FALSE;
3366 p_ptr->hidarite = FALSE;
3367 p_ptr->no_flowed = FALSE;
3369 p_ptr->align = friend_align;
3371 if (p_ptr->mimic_form) tmp_rp_ptr = &mimic_info[p_ptr->mimic_form];
3372 else tmp_rp_ptr = &race_info[p_ptr->prace];
3374 /* Base infravision (purely racial) */
3375 p_ptr->see_infra = tmp_rp_ptr->infra;
3377 /* Base skill -- disarming */
3378 p_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis;
3380 /* Base skill -- magic devices */
3381 p_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
3383 /* Base skill -- saving throw */
3384 p_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav;
3386 /* Base skill -- stealth */
3387 p_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl;
3389 /* Base skill -- searching ability */
3390 p_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh;
3392 /* Base skill -- searching frequency */
3393 p_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos;
3395 /* Base skill -- combat (normal) */
3396 p_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn;
3398 /* Base skill -- combat (shooting) */
3399 p_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3401 /* Base skill -- combat (throwing) */
3402 p_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3404 /* Base skill -- digging */
3405 p_ptr->skill_dig = 0;
3407 if (buki_motteruka(INVEN_RARM)) p_ptr->migite = TRUE;
3408 if (buki_motteruka(INVEN_LARM))
3410 p_ptr->hidarite = TRUE;
3411 if (!p_ptr->migite) default_hand = 1;
3414 if (CAN_TWO_HANDS_WIELDING())
3416 if (p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) &&
3417 object_allow_two_hands_wielding(&inventory[INVEN_RARM]))
3419 p_ptr->ryoute = TRUE;
3421 else if (p_ptr->hidarite && (empty_hands(FALSE) == EMPTY_HAND_RARM) &&
3422 object_allow_two_hands_wielding(&inventory[INVEN_LARM]))
3424 p_ptr->ryoute = TRUE;
3428 switch (p_ptr->pclass)
3431 case CLASS_FORCETRAINER:
3432 case CLASS_BERSERKER:
3433 if (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3435 p_ptr->migite = TRUE;
3436 p_ptr->ryoute = TRUE;
3443 if (!p_ptr->migite && !p_ptr->hidarite)
3445 if (empty_hands_status & EMPTY_HAND_RARM) p_ptr->migite = TRUE;
3446 else if (empty_hands_status == EMPTY_HAND_LARM)
3448 p_ptr->hidarite = TRUE;
3453 if (p_ptr->special_defense & KAMAE_MASK)
3455 if (!(empty_hands_status & EMPTY_HAND_RARM))
3457 set_action(ACTION_NONE);
3461 switch (p_ptr->pclass)
3464 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3465 if (p_ptr->lev > 44) p_ptr->regenerate = TRUE;
3468 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3470 case CLASS_CHAOS_WARRIOR:
3471 if (p_ptr->lev > 29) p_ptr->resist_chaos = TRUE;
3472 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3474 case CLASS_MINDCRAFTER:
3475 if (p_ptr->lev > 9) p_ptr->resist_fear = TRUE;
3476 if (p_ptr->lev > 19) p_ptr->sustain_wis = TRUE;
3477 if (p_ptr->lev > 29) p_ptr->resist_conf = TRUE;
3478 if (p_ptr->lev > 39) p_ptr->telepathy = TRUE;
3481 case CLASS_FORCETRAINER:
3482 /* Unencumbered Monks become faster every 10 levels */
3483 if (!(heavy_armor()))
3485 if (!(prace_is_(RACE_KLACKON) ||
3486 prace_is_(RACE_SPRITE) ||
3487 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3488 new_speed += (p_ptr->lev) / 10;
3490 /* Free action if unencumbered at level 25 */
3491 if (p_ptr->lev > 24)
3492 p_ptr->free_act = TRUE;
3495 case CLASS_SORCERER:
3497 p_ptr->dis_to_a -= 50;
3500 p_ptr->resist_sound = TRUE;
3503 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3505 case CLASS_BERSERKER:
3507 p_ptr->sustain_str = TRUE;
3508 p_ptr->sustain_dex = TRUE;
3509 p_ptr->sustain_con = TRUE;
3510 p_ptr->regenerate = TRUE;
3511 p_ptr->free_act = TRUE;
3513 if (p_ptr->lev > 29) new_speed++;
3514 if (p_ptr->lev > 39) new_speed++;
3515 if (p_ptr->lev > 44) new_speed++;
3516 if (p_ptr->lev > 49) new_speed++;
3517 p_ptr->to_a += 10+p_ptr->lev/2;
3518 p_ptr->dis_to_a += 10+p_ptr->lev/2;
3519 p_ptr->skill_dig += (100+p_ptr->lev*8);
3520 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3521 p_ptr->redraw |= PR_STATUS;
3523 case CLASS_MIRROR_MASTER:
3524 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3527 /* Unencumbered Ninjas become faster every 10 levels */
3530 new_speed -= (p_ptr->lev) / 10;
3531 p_ptr->skill_stl -= (p_ptr->lev)/10;
3533 else if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
3534 (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
3537 if (!(prace_is_(RACE_KLACKON) ||
3538 prace_is_(RACE_SPRITE) ||
3539 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3540 new_speed += (p_ptr->lev) / 10;
3541 p_ptr->skill_stl += (p_ptr->lev)/10;
3543 /* Free action if unencumbered at level 25 */
3544 if (p_ptr->lev > 24)
3545 p_ptr->free_act = TRUE;
3547 if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
3548 (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
3550 p_ptr->to_a += p_ptr->lev/2+5;
3551 p_ptr->dis_to_a += p_ptr->lev/2+5;
3553 p_ptr->slow_digest = TRUE;
3554 p_ptr->resist_fear = TRUE;
3555 if (p_ptr->lev > 19) p_ptr->resist_pois = TRUE;
3556 if (p_ptr->lev > 24) p_ptr->sustain_dex = TRUE;
3557 if (p_ptr->lev > 29) p_ptr->see_inv = TRUE;
3558 if (p_ptr->lev > 44)
3560 p_ptr->oppose_pois = 1;
3561 p_ptr->redraw |= PR_STATUS;
3563 p_ptr->see_nocto = TRUE;
3568 if (p_ptr->mimic_form)
3570 switch (p_ptr->mimic_form)
3573 p_ptr->hold_exp = TRUE;
3574 p_ptr->resist_chaos = TRUE;
3575 p_ptr->resist_neth = TRUE;
3576 p_ptr->resist_fire = TRUE;
3577 p_ptr->oppose_fire = 1;
3578 p_ptr->see_inv=TRUE;
3580 p_ptr->redraw |= PR_STATUS;
3582 p_ptr->dis_to_a += 10;
3583 p_ptr->align -= 200;
3585 case MIMIC_DEMON_LORD:
3586 p_ptr->hold_exp = TRUE;
3587 p_ptr->resist_chaos = TRUE;
3588 p_ptr->resist_neth = TRUE;
3589 p_ptr->immune_fire = TRUE;
3590 p_ptr->resist_acid = TRUE;
3591 p_ptr->resist_fire = TRUE;
3592 p_ptr->resist_cold = TRUE;
3593 p_ptr->resist_elec = TRUE;
3594 p_ptr->resist_pois = TRUE;
3595 p_ptr->resist_conf = TRUE;
3596 p_ptr->resist_disen = TRUE;
3597 p_ptr->resist_nexus = TRUE;
3598 p_ptr->resist_fear = TRUE;
3599 p_ptr->sh_fire = TRUE;
3600 p_ptr->see_inv = TRUE;
3601 p_ptr->telepathy = TRUE;
3602 p_ptr->levitation = TRUE;
3603 p_ptr->kill_wall = TRUE;
3606 p_ptr->dis_to_a += 20;
3607 p_ptr->align -= 200;
3610 p_ptr->resist_dark = TRUE;
3611 p_ptr->hold_exp = TRUE;
3612 p_ptr->resist_neth = TRUE;
3613 p_ptr->resist_cold = TRUE;
3614 p_ptr->resist_pois = TRUE;
3615 p_ptr->see_inv = TRUE;
3618 p_ptr->dis_to_a += 10;
3619 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3625 switch (p_ptr->prace)
3628 p_ptr->resist_lite = TRUE;
3631 p_ptr->hold_exp = TRUE;
3634 p_ptr->free_act = TRUE;
3637 p_ptr->resist_blind = TRUE;
3640 p_ptr->resist_dark = TRUE;
3642 case RACE_HALF_TROLL:
3643 p_ptr->sustain_str = TRUE;
3645 if (p_ptr->lev > 14)
3647 /* High level trolls heal fast... */
3648 p_ptr->regenerate = TRUE;
3650 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_BERSERKER)
3652 p_ptr->slow_digest = TRUE;
3653 /* Let's not make Regeneration
3654 * a disadvantage for the poor warriors who can
3655 * never learn a spell that satisfies hunger (actually
3656 * neither can rogues, but half-trolls are not
3657 * supposed to play rogues) */
3662 p_ptr->sustain_con = TRUE;
3663 p_ptr->regenerate = TRUE; /* Amberites heal fast... */
3666 p_ptr->resist_lite = TRUE;
3667 p_ptr->see_inv = TRUE;
3669 case RACE_BARBARIAN:
3670 p_ptr->resist_fear = TRUE;
3672 case RACE_HALF_OGRE:
3673 p_ptr->resist_dark = TRUE;
3674 p_ptr->sustain_str = TRUE;
3676 case RACE_HALF_GIANT:
3677 p_ptr->sustain_str = TRUE;
3678 p_ptr->resist_shard = TRUE;
3680 case RACE_HALF_TITAN:
3681 p_ptr->resist_chaos = TRUE;
3684 p_ptr->resist_sound = TRUE;
3687 p_ptr->resist_acid = TRUE;
3688 if (p_ptr->lev > 19) p_ptr->immune_acid = TRUE;
3691 p_ptr->resist_conf = TRUE;
3692 p_ptr->resist_acid = TRUE;
3694 /* Klackons become faster */
3695 new_speed += (p_ptr->lev) / 10;
3698 p_ptr->resist_pois = TRUE;
3701 p_ptr->resist_disen = TRUE;
3702 p_ptr->resist_dark = TRUE;
3705 p_ptr->resist_dark = TRUE;
3706 if (p_ptr->lev > 19) p_ptr->see_inv = TRUE;
3708 case RACE_DRACONIAN:
3709 p_ptr->levitation = TRUE;
3710 if (p_ptr->lev > 4) p_ptr->resist_fire = TRUE;
3711 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3712 if (p_ptr->lev > 14) p_ptr->resist_acid = TRUE;
3713 if (p_ptr->lev > 19) p_ptr->resist_elec = TRUE;
3714 if (p_ptr->lev > 34) p_ptr->resist_pois = TRUE;
3716 case RACE_MIND_FLAYER:
3717 p_ptr->sustain_int = TRUE;
3718 p_ptr->sustain_wis = TRUE;
3719 if (p_ptr->lev > 14) p_ptr->see_inv = TRUE;
3720 if (p_ptr->lev > 29) p_ptr->telepathy = TRUE;
3723 p_ptr->resist_fire = TRUE;
3724 if (p_ptr->lev > 9) p_ptr->see_inv = TRUE;
3727 p_ptr->slow_digest = TRUE;
3728 p_ptr->free_act = TRUE;
3729 p_ptr->see_inv = TRUE;
3730 p_ptr->resist_pois = TRUE;
3731 if (p_ptr->lev > 34) p_ptr->hold_exp = TRUE;
3734 p_ptr->resist_shard = TRUE;
3735 p_ptr->hold_exp = TRUE;
3736 p_ptr->see_inv = TRUE;
3737 p_ptr->resist_pois = TRUE;
3738 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3741 p_ptr->resist_neth = TRUE;
3742 p_ptr->hold_exp = TRUE;
3743 p_ptr->see_inv = TRUE;
3744 p_ptr->resist_pois = TRUE;
3745 p_ptr->slow_digest = TRUE;
3746 if (p_ptr->lev > 4) p_ptr->resist_cold = TRUE;
3749 p_ptr->resist_dark = TRUE;
3750 p_ptr->hold_exp = TRUE;
3751 p_ptr->resist_neth = TRUE;
3752 p_ptr->resist_cold = TRUE;
3753 p_ptr->resist_pois = TRUE;
3754 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3757 p_ptr->levitation = TRUE;
3758 p_ptr->free_act = TRUE;
3759 p_ptr->resist_neth = TRUE;
3760 p_ptr->hold_exp = TRUE;
3761 p_ptr->see_inv = TRUE;
3762 p_ptr->resist_pois = TRUE;
3763 p_ptr->slow_digest = TRUE;
3764 p_ptr->resist_cold = TRUE;
3765 p_ptr->pass_wall = TRUE;
3766 if (p_ptr->lev > 34) p_ptr->telepathy = TRUE;
3769 p_ptr->levitation = TRUE;
3770 p_ptr->resist_lite = TRUE;
3772 /* Sprites become faster */
3773 new_speed += (p_ptr->lev) / 10;
3776 p_ptr->resist_conf = TRUE;
3777 p_ptr->resist_sound = TRUE;
3780 /* Ents dig like maniacs, but only with their hands. */
3781 if (!inventory[INVEN_RARM].k_idx)
3782 p_ptr->skill_dig += p_ptr->lev * 10;
3783 /* Ents get tougher and stronger as they age, but lose dexterity. */
3784 if (p_ptr->lev > 25) p_ptr->stat_add[A_STR]++;
3785 if (p_ptr->lev > 40) p_ptr->stat_add[A_STR]++;
3786 if (p_ptr->lev > 45) p_ptr->stat_add[A_STR]++;
3788 if (p_ptr->lev > 25) p_ptr->stat_add[A_DEX]--;
3789 if (p_ptr->lev > 40) p_ptr->stat_add[A_DEX]--;
3790 if (p_ptr->lev > 45) p_ptr->stat_add[A_DEX]--;
3792 if (p_ptr->lev > 25) p_ptr->stat_add[A_CON]++;
3793 if (p_ptr->lev > 40) p_ptr->stat_add[A_CON]++;
3794 if (p_ptr->lev > 45) p_ptr->stat_add[A_CON]++;
3797 p_ptr->levitation = TRUE;
3798 p_ptr->see_inv = TRUE;
3799 p_ptr->align += 200;
3802 p_ptr->resist_fire = TRUE;
3803 p_ptr->resist_neth = TRUE;
3804 p_ptr->hold_exp = TRUE;
3805 if (p_ptr->lev > 9) p_ptr->see_inv = TRUE;
3806 if (p_ptr->lev > 44)
3808 p_ptr->oppose_fire = 1;
3809 p_ptr->redraw |= PR_STATUS;
3811 p_ptr->align -= 200;
3814 p_ptr->sustain_con = TRUE;
3817 p_ptr->levitation = TRUE;
3820 p_ptr->resist_conf = TRUE;
3823 p_ptr->slow_digest = TRUE;
3824 p_ptr->free_act = TRUE;
3825 p_ptr->resist_pois = TRUE;
3826 p_ptr->hold_exp = TRUE;
3834 if (p_ptr->ult_res || (p_ptr->special_defense & KATA_MUSOU))
3836 p_ptr->see_inv = TRUE;
3837 p_ptr->free_act = TRUE;
3838 p_ptr->slow_digest = TRUE;
3839 p_ptr->regenerate = TRUE;
3840 p_ptr->levitation = TRUE;
3841 p_ptr->hold_exp = TRUE;
3842 p_ptr->telepathy = TRUE;
3844 p_ptr->sustain_str = TRUE;
3845 p_ptr->sustain_int = TRUE;
3846 p_ptr->sustain_wis = TRUE;
3847 p_ptr->sustain_con = TRUE;
3848 p_ptr->sustain_dex = TRUE;
3849 p_ptr->sustain_chr = TRUE;
3850 p_ptr->resist_acid = TRUE;
3851 p_ptr->resist_elec = TRUE;
3852 p_ptr->resist_fire = TRUE;
3853 p_ptr->resist_cold = TRUE;
3854 p_ptr->resist_pois = TRUE;
3855 p_ptr->resist_conf = TRUE;
3856 p_ptr->resist_sound = TRUE;
3857 p_ptr->resist_lite = TRUE;
3858 p_ptr->resist_dark = TRUE;
3859 p_ptr->resist_chaos = TRUE;
3860 p_ptr->resist_disen = TRUE;
3861 p_ptr->resist_shard = TRUE;
3862 p_ptr->resist_nexus = TRUE;
3863 p_ptr->resist_blind = TRUE;
3864 p_ptr->resist_neth = TRUE;
3865 p_ptr->resist_fear = TRUE;
3866 p_ptr->reflect = TRUE;
3867 p_ptr->sh_fire = TRUE;
3868 p_ptr->sh_elec = TRUE;
3869 p_ptr->sh_cold = TRUE;
3871 p_ptr->dis_to_a += 100;
3873 /* Temporary shield */
3874 else if (p_ptr->tsubureru || p_ptr->shield || p_ptr->magicdef)
3877 p_ptr->dis_to_a += 50;
3880 if (p_ptr->tim_res_nether)
3882 p_ptr->resist_neth = TRUE;
3884 if (p_ptr->tim_sh_fire)
3886 p_ptr->sh_fire = TRUE;
3888 if (p_ptr->tim_res_time)
3890 p_ptr->resist_time = TRUE;
3894 if (p_ptr->pseikaku == SEIKAKU_SEXY) p_ptr->cursed |= (TRC_AGGRAVATE);
3895 if (p_ptr->pseikaku == SEIKAKU_NAMAKE) p_ptr->to_m_chance += 10;
3896 if (p_ptr->pseikaku == SEIKAKU_KIREMONO) p_ptr->to_m_chance -= 3;
3897 if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) p_ptr->to_m_chance++;
3900 if (p_ptr->pseikaku == SEIKAKU_LUCKY) p_ptr->muta3 |= MUT3_GOOD_LUCK;
3902 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
3904 p_ptr->resist_blind = TRUE;
3905 p_ptr->resist_conf = TRUE;
3906 p_ptr->hold_exp = TRUE;
3907 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3909 if ((p_ptr->prace != RACE_KLACKON) && (p_ptr->prace != RACE_SPRITE))
3910 /* Munchkin become faster */
3911 new_speed += (p_ptr->lev) / 10 + 5;
3914 if (music_singing(MUSIC_WALL))
3916 p_ptr->kill_wall = TRUE;
3919 /* Hack -- apply racial/class stat maxes */
3920 /* Apply the racial modifiers */
3921 for (i = 0; i < 6; i++)
3923 /* Modify the stats for "race" */
3924 p_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
3928 /* I'm adding the mutations here for the lack of a better place... */
3931 /* Hyper Strength */
3932 if (p_ptr->muta3 & MUT3_HYPER_STR)
3934 p_ptr->stat_add[A_STR] += 4;
3938 if (p_ptr->muta3 & MUT3_PUNY)
3940 p_ptr->stat_add[A_STR] -= 4;
3943 /* Living computer */
3944 if (p_ptr->muta3 & MUT3_HYPER_INT)
3946 p_ptr->stat_add[A_INT] += 4;
3947 p_ptr->stat_add[A_WIS] += 4;
3951 if (p_ptr->muta3 & MUT3_MORONIC)
3953 p_ptr->stat_add[A_INT] -= 4;
3954 p_ptr->stat_add[A_WIS] -= 4;
3957 if (p_ptr->muta3 & MUT3_RESILIENT)
3959 p_ptr->stat_add[A_CON] += 4;
3962 if (p_ptr->muta3 & MUT3_XTRA_FAT)
3964 p_ptr->stat_add[A_CON] += 2;
3968 if (p_ptr->muta3 & MUT3_ALBINO)
3970 p_ptr->stat_add[A_CON] -= 4;
3973 if (p_ptr->muta3 & MUT3_FLESH_ROT)
3975 p_ptr->stat_add[A_CON] -= 2;
3976 p_ptr->stat_add[A_CHR] -= 1;
3977 p_ptr->regenerate = FALSE;
3978 /* Cancel innate regeneration */
3981 if (p_ptr->muta3 & MUT3_SILLY_VOI)
3983 p_ptr->stat_add[A_CHR] -= 4;
3986 if (p_ptr->muta3 & MUT3_BLANK_FAC)
3988 p_ptr->stat_add[A_CHR] -= 1;
3991 if (p_ptr->muta3 & MUT3_XTRA_EYES)
3993 p_ptr->skill_fos += 15;
3994 p_ptr->skill_srh += 15;
3997 if (p_ptr->muta3 & MUT3_MAGIC_RES)
3999 p_ptr->skill_sav += (15 + (p_ptr->lev / 5));
4002 if (p_ptr->muta3 & MUT3_XTRA_NOIS)
4004 p_ptr->skill_stl -= 3;
4007 if (p_ptr->muta3 & MUT3_INFRAVIS)
4009 p_ptr->see_infra += 3;
4012 if (p_ptr->muta3 & MUT3_XTRA_LEGS)
4017 if (p_ptr->muta3 & MUT3_SHORT_LEG)
4022 if (p_ptr->muta3 & MUT3_ELEC_TOUC)
4024 p_ptr->sh_elec = TRUE;
4027 if (p_ptr->muta3 & MUT3_FIRE_BODY)
4029 p_ptr->sh_fire = TRUE;
4033 if (p_ptr->muta3 & MUT3_WART_SKIN)
4035 p_ptr->stat_add[A_CHR] -= 2;
4037 p_ptr->dis_to_a += 5;
4040 if (p_ptr->muta3 & MUT3_SCALES)
4042 p_ptr->stat_add[A_CHR] -= 1;
4044 p_ptr->dis_to_a += 10;
4047 if (p_ptr->muta3 & MUT3_IRON_SKIN)
4049 p_ptr->stat_add[A_DEX] -= 1;
4051 p_ptr->dis_to_a += 25;
4054 if (p_ptr->muta3 & MUT3_WINGS)
4056 p_ptr->levitation = TRUE;
4059 if (p_ptr->muta3 & MUT3_FEARLESS)
4061 p_ptr->resist_fear = TRUE;
4064 if (p_ptr->muta3 & MUT3_REGEN)
4066 p_ptr->regenerate = TRUE;
4069 if (p_ptr->muta3 & MUT3_ESP)
4071 p_ptr->telepathy = TRUE;
4074 if (p_ptr->muta3 & MUT3_LIMBER)
4076 p_ptr->stat_add[A_DEX] += 3;
4079 if (p_ptr->muta3 & MUT3_ARTHRITIS)
4081 p_ptr->stat_add[A_DEX] -= 3;
4084 if (p_ptr->muta3 & MUT3_MOTION)
4086 p_ptr->free_act = TRUE;
4087 p_ptr->skill_stl += 1;
4090 if (p_ptr->muta3 & MUT3_ILL_NORM)
4092 p_ptr->stat_add[A_CHR] = 0;
4096 if (p_ptr->tsuyoshi)
4098 p_ptr->stat_add[A_STR] += 4;
4099 p_ptr->stat_add[A_CON] += 4;
4102 /* Scan the usable inventory */
4103 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4105 int bonus_to_h, bonus_to_d;
4106 o_ptr = &inventory[i];
4108 /* Skip non-objects */
4109 if (!o_ptr->k_idx) continue;
4111 /* Extract the item flags */
4112 object_flags(o_ptr, flgs);
4114 p_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
4115 if (o_ptr->name1 == ART_CHAINSWORD) p_ptr->cursed |= TRC_CHAINSWORD;
4118 if (have_flag(flgs, TR_STR)) p_ptr->stat_add[A_STR] += o_ptr->pval;
4119 if (have_flag(flgs, TR_INT)) p_ptr->stat_add[A_INT] += o_ptr->pval;
4120 if (have_flag(flgs, TR_WIS)) p_ptr->stat_add[A_WIS] += o_ptr->pval;
4121 if (have_flag(flgs, TR_DEX)) p_ptr->stat_add[A_DEX] += o_ptr->pval;
4122 if (have_flag(flgs, TR_CON)) p_ptr->stat_add[A_CON] += o_ptr->pval;
4123 if (have_flag(flgs, TR_CHR)) p_ptr->stat_add[A_CHR] += o_ptr->pval;
4125 if (have_flag(flgs, TR_MAGIC_MASTERY)) p_ptr->skill_dev += 8*o_ptr->pval;
4127 /* Affect stealth */
4128 if (have_flag(flgs, TR_STEALTH)) p_ptr->skill_stl += o_ptr->pval;
4130 /* Affect searching ability (factor of five) */
4131 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_srh += (o_ptr->pval * 5);
4133 /* Affect searching frequency (factor of five) */
4134 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_fos += (o_ptr->pval * 5);
4136 /* Affect infravision */
4137 if (have_flag(flgs, TR_INFRA)) p_ptr->see_infra += o_ptr->pval;
4139 /* Affect digging (factor of 20) */
4140 if (have_flag(flgs, TR_TUNNEL)) p_ptr->skill_dig += (o_ptr->pval * 20);
4143 if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval;
4146 if (have_flag(flgs, TR_BLOWS))
4148 if((i == INVEN_RARM || i == INVEN_RIGHT) && !p_ptr->ryoute) extra_blows[0] += o_ptr->pval;
4149 else if((i == INVEN_LARM || i == INVEN_LEFT) && !p_ptr->ryoute) extra_blows[1] += o_ptr->pval;
4150 else {extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval;}
4153 /* Hack -- cause earthquakes */
4154 if (have_flag(flgs, TR_IMPACT)) p_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
4157 if (have_flag(flgs, TR_AGGRAVATE)) p_ptr->cursed |= TRC_AGGRAVATE;
4158 if (have_flag(flgs, TR_DRAIN_EXP)) p_ptr->cursed |= TRC_DRAIN_EXP;
4159 if (have_flag(flgs, TR_TY_CURSE)) p_ptr->cursed |= TRC_TY_CURSE;
4160 if (have_flag(flgs, TR_ADD_L_CURSE)) p_ptr->cursed |= TRC_ADD_L_CURSE;
4161 if (have_flag(flgs, TR_ADD_H_CURSE)) p_ptr->cursed |= TRC_ADD_H_CURSE;
4162 if (have_flag(flgs, TR_DRAIN_HP)) p_ptr->cursed |= TRC_DRAIN_HP;
4163 if (have_flag(flgs, TR_DRAIN_MANA)) p_ptr->cursed |= TRC_DRAIN_MANA;
4164 if (have_flag(flgs, TR_CALL_ANIMAL)) p_ptr->cursed |= TRC_CALL_ANIMAL;
4165 if (have_flag(flgs, TR_CALL_DEMON)) p_ptr->cursed |= TRC_CALL_DEMON;
4166 if (have_flag(flgs, TR_CALL_DRAGON)) p_ptr->cursed |= TRC_CALL_DRAGON;
4167 if (have_flag(flgs, TR_CALL_UNDEAD)) p_ptr->cursed |= TRC_CALL_UNDEAD;
4168 if (have_flag(flgs, TR_COWARDICE)) p_ptr->cursed |= TRC_COWARDICE;
4169 if (have_flag(flgs, TR_LOW_MELEE)) p_ptr->cursed |= TRC_LOW_MELEE;
4170 if (have_flag(flgs, TR_LOW_AC)) p_ptr->cursed |= TRC_LOW_AC;
4171 if (have_flag(flgs, TR_LOW_MAGIC)) p_ptr->cursed |= TRC_LOW_MAGIC;
4172 if (have_flag(flgs, TR_FAST_DIGEST)) p_ptr->cursed |= TRC_FAST_DIGEST;
4173 if (have_flag(flgs, TR_SLOW_REGEN)) p_ptr->cursed |= TRC_SLOW_REGEN;
4174 if (have_flag(flgs, TR_DEC_MANA)) p_ptr->dec_mana = TRUE;
4175 if (have_flag(flgs, TR_BLESSED)) p_ptr->bless_blade = TRUE;
4176 if (have_flag(flgs, TR_XTRA_MIGHT)) p_ptr->xtra_might = TRUE;
4177 if (have_flag(flgs, TR_SLOW_DIGEST)) p_ptr->slow_digest = TRUE;
4178 if (have_flag(flgs, TR_REGEN)) p_ptr->regenerate = TRUE;
4179 if (have_flag(flgs, TR_TELEPATHY)) p_ptr->telepathy = TRUE;
4180 if (have_flag(flgs, TR_ESP_ANIMAL)) p_ptr->esp_animal = TRUE;
4181 if (have_flag(flgs, TR_ESP_UNDEAD)) p_ptr->esp_undead = TRUE;
4182 if (have_flag(flgs, TR_ESP_DEMON)) p_ptr->esp_demon = TRUE;
4183 if (have_flag(flgs, TR_ESP_ORC)) p_ptr->esp_orc = TRUE;
4184 if (have_flag(flgs, TR_ESP_TROLL)) p_ptr->esp_troll = TRUE;
4185 if (have_flag(flgs, TR_ESP_GIANT)) p_ptr->esp_giant = TRUE;
4186 if (have_flag(flgs, TR_ESP_DRAGON)) p_ptr->esp_dragon = TRUE;
4187 if (have_flag(flgs, TR_ESP_HUMAN)) p_ptr->esp_human = TRUE;
4188 if (have_flag(flgs, TR_ESP_EVIL)) p_ptr->esp_evil = TRUE;
4189 if (have_flag(flgs, TR_ESP_GOOD)) p_ptr->esp_good = TRUE;
4190 if (have_flag(flgs, TR_ESP_NONLIVING)) p_ptr->esp_nonliving = TRUE;
4191 if (have_flag(flgs, TR_ESP_UNIQUE)) p_ptr->esp_unique = TRUE;
4193 if (have_flag(flgs, TR_SEE_INVIS)) p_ptr->see_inv = TRUE;
4194 if (have_flag(flgs, TR_LEVITATION)) p_ptr->levitation = TRUE;
4195 if (have_flag(flgs, TR_FREE_ACT)) p_ptr->free_act = TRUE;
4196 if (have_flag(flgs, TR_HOLD_EXP)) p_ptr->hold_exp = TRUE;
4197 if (have_flag(flgs, TR_WARNING)){
4198 if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription),'$')))
4199 p_ptr->warning = TRUE;
4202 if (have_flag(flgs, TR_TELEPORT))
4204 if (object_is_cursed(o_ptr)) p_ptr->cursed |= TRC_TELEPORT;
4207 cptr insc = quark_str(o_ptr->inscription);
4209 if (o_ptr->inscription && my_strchr(insc, '.'))
4212 * {.} will stop random teleportation.
4217 /* Controlled random teleportation */
4218 p_ptr->cursed |= TRC_TELEPORT_SELF;
4223 /* Immunity flags */
4224 if (have_flag(flgs, TR_IM_FIRE)) p_ptr->immune_fire = TRUE;
4225 if (have_flag(flgs, TR_IM_ACID)) p_ptr->immune_acid = TRUE;
4226 if (have_flag(flgs, TR_IM_COLD)) p_ptr->immune_cold = TRUE;
4227 if (have_flag(flgs, TR_IM_ELEC)) p_ptr->immune_elec = TRUE;
4229 /* Resistance flags */
4230 if (have_flag(flgs, TR_RES_ACID)) p_ptr->resist_acid = TRUE;
4231 if (have_flag(flgs, TR_RES_ELEC)) p_ptr->resist_elec = TRUE;
4232 if (have_flag(flgs, TR_RES_FIRE)) p_ptr->resist_fire = TRUE;
4233 if (have_flag(flgs, TR_RES_COLD)) p_ptr->resist_cold = TRUE;
4234 if (have_flag(flgs, TR_RES_POIS)) p_ptr->resist_pois = TRUE;
4235 if (have_flag(flgs, TR_RES_FEAR)) p_ptr->resist_fear = TRUE;
4236 if (have_flag(flgs, TR_RES_CONF)) p_ptr->resist_conf = TRUE;
4237 if (have_flag(flgs, TR_RES_SOUND)) p_ptr->resist_sound = TRUE;
4238 if (have_flag(flgs, TR_RES_LITE)) p_ptr->resist_lite = TRUE;
4239 if (have_flag(flgs, TR_RES_DARK)) p_ptr->resist_dark = TRUE;
4240 if (have_flag(flgs, TR_RES_CHAOS)) p_ptr->resist_chaos = TRUE;
4241 if (have_flag(flgs, TR_RES_DISEN)) p_ptr->resist_disen = TRUE;
4242 if (have_flag(flgs, TR_RES_SHARDS)) p_ptr->resist_shard = TRUE;
4243 if (have_flag(flgs, TR_RES_NEXUS)) p_ptr->resist_nexus = TRUE;
4244 if (have_flag(flgs, TR_RES_BLIND)) p_ptr->resist_blind = TRUE;
4245 if (have_flag(flgs, TR_RES_NETHER)) p_ptr->resist_neth = TRUE;
4247 if (have_flag(flgs, TR_REFLECT)) p_ptr->reflect = TRUE;
4248 if (have_flag(flgs, TR_SH_FIRE)) p_ptr->sh_fire = TRUE;
4249 if (have_flag(flgs, TR_SH_ELEC)) p_ptr->sh_elec = TRUE;
4250 if (have_flag(flgs, TR_SH_COLD)) p_ptr->sh_cold = TRUE;
4251 if (have_flag(flgs, TR_NO_MAGIC)) p_ptr->anti_magic = TRUE;
4252 if (have_flag(flgs, TR_NO_TELE)) p_ptr->anti_tele = TRUE;
4255 if (have_flag(flgs, TR_SUST_STR)) p_ptr->sustain_str = TRUE;
4256 if (have_flag(flgs, TR_SUST_INT)) p_ptr->sustain_int = TRUE;
4257 if (have_flag(flgs, TR_SUST_WIS)) p_ptr->sustain_wis = TRUE;
4258 if (have_flag(flgs, TR_SUST_DEX)) p_ptr->sustain_dex = TRUE;
4259 if (have_flag(flgs, TR_SUST_CON)) p_ptr->sustain_con = TRUE;
4260 if (have_flag(flgs, TR_SUST_CHR)) p_ptr->sustain_chr = TRUE;
4262 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
4263 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
4264 if (o_ptr->name2 == EGO_RING_RES_TIME) p_ptr->resist_time = TRUE;
4265 if (o_ptr->name2 == EGO_RING_THROW) p_ptr->mighty_throw = TRUE;
4266 if (have_flag(flgs, TR_EASY_SPELL)) p_ptr->easy_spell = TRUE;
4267 if (o_ptr->name2 == EGO_AMU_FOOL) p_ptr->heavy_spell = TRUE;
4268 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
4270 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
4272 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4274 p_ptr->to_m_chance += 10;
4278 p_ptr->to_m_chance += 3;
4282 if (o_ptr->tval == TV_CAPTURE) continue;
4284 /* Modify the base armor class */
4285 p_ptr->ac += o_ptr->ac;
4287 /* The base armor class is always known */
4288 p_ptr->dis_ac += o_ptr->ac;
4290 /* Apply the bonuses to armor class */
4291 p_ptr->to_a += o_ptr->to_a;
4293 /* Apply the mental bonuses to armor class, if known */
4294 if (object_is_known(o_ptr)) p_ptr->dis_to_a += o_ptr->to_a;
4296 if (o_ptr->curse_flags & TRC_LOW_MELEE)
4298 int slot = i - INVEN_RARM;
4301 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4303 p_ptr->to_h[slot] -= 15;
4304 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 15;
4308 p_ptr->to_h[slot] -= 5;
4309 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 5;
4314 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4316 p_ptr->to_h_b -= 15;
4317 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 15;
4322 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 5;
4327 if (o_ptr->curse_flags & TRC_LOW_AC)
4329 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4332 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 30;
4337 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 10;
4341 /* Hack -- do not apply "weapon" bonuses */
4342 if (i == INVEN_RARM && buki_motteruka(i)) continue;
4343 if (i == INVEN_LARM && buki_motteruka(i)) continue;
4345 /* Hack -- do not apply "bow" bonuses */
4346 if (i == INVEN_BOW) continue;
4348 bonus_to_h = o_ptr->to_h;
4349 bonus_to_d = o_ptr->to_d;
4351 if (p_ptr->pclass == CLASS_NINJA)
4353 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h+1)/2;
4354 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d+1)/2;
4357 /* To Bow and Natural attack */
4359 /* Apply the bonuses to hit/damage */
4360 p_ptr->to_h_b += bonus_to_h;
4361 p_ptr->to_h_m += bonus_to_h;
4362 p_ptr->to_d_m += bonus_to_d;
4364 /* Apply the mental bonuses tp hit/damage, if known */
4365 if (object_is_known(o_ptr)) p_ptr->dis_to_h_b += bonus_to_h;
4368 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !p_ptr->ryoute)
4370 /* Apply the bonuses to hit/damage */
4371 p_ptr->to_h[i-INVEN_RIGHT] += bonus_to_h;
4372 p_ptr->to_d[i-INVEN_RIGHT] += bonus_to_d;
4374 /* Apply the mental bonuses tp hit/damage, if known */
4375 if (object_is_known(o_ptr))
4377 p_ptr->dis_to_h[i-INVEN_RIGHT] += bonus_to_h;
4378 p_ptr->dis_to_d[i-INVEN_RIGHT] += bonus_to_d;
4381 else if (p_ptr->migite && p_ptr->hidarite)
4383 /* Apply the bonuses to hit/damage */
4384 p_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4385 p_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4386 p_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4387 p_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4389 /* Apply the mental bonuses tp hit/damage, if known */
4390 if (object_is_known(o_ptr))
4392 p_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4393 p_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4394 p_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4395 p_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4400 /* Apply the bonuses to hit/damage */
4401 p_ptr->to_h[default_hand] += bonus_to_h;
4402 p_ptr->to_d[default_hand] += bonus_to_d;
4404 /* Apply the mental bonuses to hit/damage, if known */
4405 if (object_is_known(o_ptr))
4407 p_ptr->dis_to_h[default_hand] += bonus_to_h;
4408 p_ptr->dis_to_d[default_hand] += bonus_to_d;
4413 if (old_mighty_throw != p_ptr->mighty_throw)
4415 /* Redraw average damege display of Shuriken */
4416 p_ptr->window |= PW_INVEN;
4419 if (p_ptr->cursed & TRC_TELEPORT) p_ptr->cursed &= ~(TRC_TELEPORT_SELF);
4421 /* Monks get extra ac for armour _not worn_ */
4422 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor())
4424 if (!(inventory[INVEN_BODY].k_idx))
4426 p_ptr->to_a += (p_ptr->lev * 3) / 2;
4427 p_ptr->dis_to_a += (p_ptr->lev * 3) / 2;
4429 if (!(inventory[INVEN_OUTER].k_idx) && (p_ptr->lev > 15))
4431 p_ptr->to_a += ((p_ptr->lev - 13) / 3);
4432 p_ptr->dis_to_a += ((p_ptr->lev - 13) / 3);
4434 if (!(inventory[INVEN_LARM].k_idx) && (p_ptr->lev > 10))
4436 p_ptr->to_a += ((p_ptr->lev - 8) / 3);
4437 p_ptr->dis_to_a += ((p_ptr->lev - 8) / 3);
4439 if (!(inventory[INVEN_HEAD].k_idx) && (p_ptr->lev > 4))
4441 p_ptr->to_a += (p_ptr->lev - 2) / 3;
4442 p_ptr->dis_to_a += (p_ptr->lev -2) / 3;
4444 if (!(inventory[INVEN_HANDS].k_idx))
4446 p_ptr->to_a += (p_ptr->lev / 2);
4447 p_ptr->dis_to_a += (p_ptr->lev / 2);
4449 if (!(inventory[INVEN_FEET].k_idx))
4451 p_ptr->to_a += (p_ptr->lev / 3);
4452 p_ptr->dis_to_a += (p_ptr->lev / 3);
4454 if (p_ptr->special_defense & KAMAE_BYAKKO)
4456 p_ptr->stat_add[A_STR] += 2;
4457 p_ptr->stat_add[A_DEX] += 2;
4458 p_ptr->stat_add[A_CON] -= 3;
4460 else if (p_ptr->special_defense & KAMAE_SEIRYU)
4463 else if (p_ptr->special_defense & KAMAE_GENBU)
4465 p_ptr->stat_add[A_INT] -= 1;
4466 p_ptr->stat_add[A_WIS] -= 1;
4467 p_ptr->stat_add[A_DEX] -= 2;
4468 p_ptr->stat_add[A_CON] += 3;
4470 else if (p_ptr->special_defense & KAMAE_SUZAKU)
4472 p_ptr->stat_add[A_STR] -= 2;
4473 p_ptr->stat_add[A_INT] += 1;
4474 p_ptr->stat_add[A_WIS] += 1;
4475 p_ptr->stat_add[A_DEX] += 2;
4476 p_ptr->stat_add[A_CON] -= 2;
4480 if (p_ptr->special_defense & KATA_KOUKIJIN)
4482 for (i = 0; i < 6; i++)
4483 p_ptr->stat_add[i] += 5;
4485 p_ptr->dis_to_a -= 50;
4488 /* Hack -- aura of fire also provides light */
4489 if (p_ptr->sh_fire) p_ptr->lite = TRUE;
4491 /* Golems also get an intrinsic AC bonus */
4492 if (prace_is_(RACE_GOLEM) || prace_is_(RACE_ANDROID))
4494 p_ptr->to_a += 10 + (p_ptr->lev * 2 / 5);
4495 p_ptr->dis_to_a += 10 + (p_ptr->lev * 2 / 5);
4499 if (p_ptr->realm1 == REALM_HEX)
4501 if (hex_spelling_any()) p_ptr->skill_stl -= (1 + p_ptr->magic_num2[0]);
4502 if (hex_spelling(HEX_DETECT_EVIL)) p_ptr->esp_evil = TRUE;
4503 if (hex_spelling(HEX_XTRA_MIGHT)) p_ptr->stat_add[A_STR] += 4;
4504 if (hex_spelling(HEX_BUILDING))
4506 p_ptr->stat_add[A_STR] += 4;
4507 p_ptr->stat_add[A_DEX] += 4;
4508 p_ptr->stat_add[A_CON] += 4;
4510 if (hex_spelling(HEX_DEMON_AURA))
4512 p_ptr->sh_fire = TRUE;
4513 p_ptr->regenerate = TRUE;
4515 if (hex_spelling(HEX_ICE_ARMOR))
4517 p_ptr->sh_cold = TRUE;
4519 p_ptr->dis_to_a += 30;
4521 if (hex_spelling(HEX_SHOCK_CLOAK))
4523 p_ptr->sh_elec = TRUE;
4526 for (i = INVEN_RARM; i <= INVEN_FEET; i++)
4529 o_ptr = &inventory[i];
4530 if (!o_ptr->k_idx) continue;
4531 if (!object_is_armour(o_ptr)) continue;
4532 if (!object_is_cursed(o_ptr)) continue;
4534 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
4535 if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
4537 p_ptr->dis_to_a += ac;
4541 /* Calculate stats */
4542 for (i = 0; i < 6; i++)
4546 /* Extract the new "stat_use" value for the stat */
4547 top = modify_stat_value(p_ptr->stat_max[i], p_ptr->stat_add[i]);
4549 /* Notice changes */
4550 if (p_ptr->stat_top[i] != top)
4552 /* Save the new value */
4553 p_ptr->stat_top[i] = top;
4555 /* Redisplay the stats later */
4556 p_ptr->redraw |= (PR_STATS);
4559 p_ptr->window |= (PW_PLAYER);
4563 /* Extract the new "stat_use" value for the stat */
4564 use = modify_stat_value(p_ptr->stat_cur[i], p_ptr->stat_add[i]);
4566 if ((i == A_CHR) && (p_ptr->muta3 & MUT3_ILL_NORM))
4568 /* 10 to 18/90 charisma, guaranteed, based on level */
4569 if (use < 8 + 2 * p_ptr->lev)
4571 use = 8 + 2 * p_ptr->lev;
4575 /* Notice changes */
4576 if (p_ptr->stat_use[i] != use)
4578 /* Save the new value */
4579 p_ptr->stat_use[i] = use;
4581 /* Redisplay the stats later */
4582 p_ptr->redraw |= (PR_STATS);
4585 p_ptr->window |= (PW_PLAYER);
4589 /* Values: 3, 4, ..., 17 */
4590 if (use <= 18) ind = (use - 3);
4592 /* Ranges: 18/00-18/09, ..., 18/210-18/219 */
4593 else if (use <= 18+219) ind = (15 + (use - 18) / 10);
4595 /* Range: 18/220+ */
4598 /* Notice changes */
4599 if (p_ptr->stat_ind[i] != ind)
4601 /* Save the new index */
4602 p_ptr->stat_ind[i] = ind;
4604 /* Change in CON affects Hitpoints */
4607 p_ptr->update |= (PU_HP);
4610 /* Change in INT may affect Mana/Spells */
4611 else if (i == A_INT)
4613 if (mp_ptr->spell_stat == A_INT)
4615 p_ptr->update |= (PU_MANA | PU_SPELLS);
4619 /* Change in WIS may affect Mana/Spells */
4620 else if (i == A_WIS)
4622 if (mp_ptr->spell_stat == A_WIS)
4624 p_ptr->update |= (PU_MANA | PU_SPELLS);
4628 /* Change in WIS may affect Mana/Spells */
4629 else if (i == A_CHR)
4631 if (mp_ptr->spell_stat == A_CHR)
4633 p_ptr->update |= (PU_MANA | PU_SPELLS);
4638 p_ptr->window |= (PW_PLAYER);
4643 /* Apply temporary "stun" */
4644 if (p_ptr->stun > 50)
4646 p_ptr->to_h[0] -= 20;
4647 p_ptr->to_h[1] -= 20;
4648 p_ptr->to_h_b -= 20;
4649 p_ptr->to_h_m -= 20;
4650 p_ptr->dis_to_h[0] -= 20;
4651 p_ptr->dis_to_h[1] -= 20;
4652 p_ptr->dis_to_h_b -= 20;
4653 p_ptr->to_d[0] -= 20;
4654 p_ptr->to_d[1] -= 20;
4655 p_ptr->to_d_m -= 20;
4656 p_ptr->dis_to_d[0] -= 20;
4657 p_ptr->dis_to_d[1] -= 20;
4659 else if (p_ptr->stun)
4661 p_ptr->to_h[0] -= 5;
4662 p_ptr->to_h[1] -= 5;
4665 p_ptr->dis_to_h[0] -= 5;
4666 p_ptr->dis_to_h[1] -= 5;
4667 p_ptr->dis_to_h_b -= 5;
4668 p_ptr->to_d[0] -= 5;
4669 p_ptr->to_d[1] -= 5;
4671 p_ptr->dis_to_d[0] -= 5;
4672 p_ptr->dis_to_d[1] -= 5;
4676 if (p_ptr->wraith_form)
4678 p_ptr->reflect = TRUE;
4679 p_ptr->pass_wall = TRUE;
4682 if (p_ptr->kabenuke)
4684 p_ptr->pass_wall = TRUE;
4687 /* Temporary blessing */
4691 p_ptr->dis_to_a += 5;
4692 p_ptr->to_h[0] += 10;
4693 p_ptr->to_h[1] += 10;
4694 p_ptr->to_h_b += 10;
4695 p_ptr->to_h_m += 10;
4696 p_ptr->dis_to_h[0] += 10;
4697 p_ptr->dis_to_h[1] += 10;
4698 p_ptr->dis_to_h_b += 10;
4701 if (p_ptr->magicdef)
4703 p_ptr->resist_blind = TRUE;
4704 p_ptr->resist_conf = TRUE;
4705 p_ptr->reflect = TRUE;
4706 p_ptr->free_act = TRUE;
4707 p_ptr->levitation = TRUE;
4710 /* Temporary "Hero" */
4713 p_ptr->to_h[0] += 12;
4714 p_ptr->to_h[1] += 12;
4715 p_ptr->to_h_b += 12;
4716 p_ptr->to_h_m += 12;
4717 p_ptr->dis_to_h[0] += 12;
4718 p_ptr->dis_to_h[1] += 12;
4719 p_ptr->dis_to_h_b += 12;
4722 /* Temporary "Beserk" */
4725 p_ptr->to_h[0] += 12;
4726 p_ptr->to_h[1] += 12;
4727 p_ptr->to_h_b -= 12;
4728 p_ptr->to_h_m += 12;
4729 p_ptr->to_d[0] += 3+(p_ptr->lev/5);
4730 p_ptr->to_d[1] += 3+(p_ptr->lev/5);
4731 p_ptr->to_d_m += 3+(p_ptr->lev/5);
4732 p_ptr->dis_to_h[0] += 12;
4733 p_ptr->dis_to_h[1] += 12;
4734 p_ptr->dis_to_h_b -= 12;
4735 p_ptr->dis_to_d[0] += 3+(p_ptr->lev/5);
4736 p_ptr->dis_to_d[1] += 3+(p_ptr->lev/5);
4738 p_ptr->dis_to_a -= 10;
4739 p_ptr->skill_stl -= 7;
4740 p_ptr->skill_dev -= 20;
4741 p_ptr->skill_sav -= 30;
4742 p_ptr->skill_srh -= 15;
4743 p_ptr->skill_fos -= 15;
4744 p_ptr->skill_tht -= 20;
4745 p_ptr->skill_dig += 30;
4748 /* Temporary "fast" */
4754 /* Temporary "slow" */
4760 /* Temporary "telepathy" */
4763 p_ptr->telepathy = TRUE;
4766 if (p_ptr->ele_immune)
4768 if (p_ptr->special_defense & DEFENSE_ACID)
4769 p_ptr->immune_acid = TRUE;
4770 else if (p_ptr->special_defense & DEFENSE_ELEC)
4771 p_ptr->immune_elec = TRUE;
4772 else if (p_ptr->special_defense & DEFENSE_FIRE)
4773 p_ptr->immune_fire = TRUE;
4774 else if (p_ptr->special_defense & DEFENSE_COLD)
4775 p_ptr->immune_cold = TRUE;
4778 /* Temporary see invisible */
4779 if (p_ptr->tim_invis)
4781 p_ptr->see_inv = TRUE;
4784 /* Temporary infravision boost */
4785 if (p_ptr->tim_infra)
4787 p_ptr->see_infra+=3;
4790 /* Temporary regeneration boost */
4791 if (p_ptr->tim_regen)
4793 p_ptr->regenerate = TRUE;
4796 /* Temporary levitation */
4797 if (p_ptr->tim_levitation)
4799 p_ptr->levitation = TRUE;
4802 /* Temporary reflection */
4803 if (p_ptr->tim_reflect)
4805 p_ptr->reflect = TRUE;
4808 /* Hack -- Hero/Shero -> Res fear */
4809 if (IS_HERO() || p_ptr->shero)
4811 p_ptr->resist_fear = TRUE;
4815 /* Hack -- Telepathy Change */
4816 if (p_ptr->telepathy != old_telepathy)
4818 p_ptr->update |= (PU_MONSTERS);
4821 if ((p_ptr->esp_animal != old_esp_animal) ||
4822 (p_ptr->esp_undead != old_esp_undead) ||
4823 (p_ptr->esp_demon != old_esp_demon) ||
4824 (p_ptr->esp_orc != old_esp_orc) ||
4825 (p_ptr->esp_troll != old_esp_troll) ||
4826 (p_ptr->esp_giant != old_esp_giant) ||
4827 (p_ptr->esp_dragon != old_esp_dragon) ||
4828 (p_ptr->esp_human != old_esp_human) ||
4829 (p_ptr->esp_evil != old_esp_evil) ||
4830 (p_ptr->esp_good != old_esp_good) ||
4831 (p_ptr->esp_nonliving != old_esp_nonliving) ||
4832 (p_ptr->esp_unique != old_esp_unique))
4834 p_ptr->update |= (PU_MONSTERS);
4837 /* Hack -- See Invis Change */
4838 if (p_ptr->see_inv != old_see_inv)
4840 p_ptr->update |= (PU_MONSTERS);
4843 /* Bloating slows the player down (a little) */
4844 if (p_ptr->food >= PY_FOOD_MAX) new_speed -= 10;
4846 if (p_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10;
4848 if ((p_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) ||
4849 (p_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM)))
4851 p_ptr->to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
4852 p_ptr->dis_to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
4855 if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
4857 int penalty1, penalty2;
4858 penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_RARM].weight) / 8);
4859 penalty2 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_LARM].weight) / 8);
4860 if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN))
4862 penalty1 = penalty1 / 2 - 5;
4863 penalty2 = penalty2 / 2 - 5;
4866 p_ptr->dis_to_a += 10;
4870 if (penalty1 > 0) penalty1 /= 2;
4871 if (penalty2 > 0) penalty2 /= 2;
4873 else if ((inventory[INVEN_LARM].tval == TV_SWORD) && ((inventory[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (inventory[INVEN_LARM].sval == SV_WAKIZASHI)))
4875 penalty1 = MAX(0, penalty1 - 10);
4876 penalty2 = MAX(0, penalty2 - 10);
4878 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
4880 penalty1 = MIN(0, penalty1);
4881 penalty2 = MIN(0, penalty2);
4883 p_ptr->dis_to_a += 10;
4887 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
4889 if ((inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
4892 if (inventory[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
4893 if (inventory[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
4894 p_ptr->to_h[0] -= penalty1;
4895 p_ptr->to_h[1] -= penalty2;
4896 p_ptr->dis_to_h[0] -= penalty1;
4897 p_ptr->dis_to_h[1] -= penalty2;
4900 /* Extract the current weight (in tenth pounds) */
4901 j = p_ptr->total_weight;
4905 /* Extract the "weight limit" (in tenth pounds) */
4906 i = (int)weight_limit();
4910 monster_type *riding_m_ptr = &m_list[p_ptr->riding];
4911 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
4912 int speed = riding_m_ptr->mspeed;
4914 if (riding_m_ptr->mspeed > 110)
4916 new_speed = 110 + (s16b)((speed - 110) * (p_ptr->skill_exp[GINOU_RIDING] * 3 + p_ptr->lev * 160L - 10000L) / (22000L));
4917 if (new_speed < 110) new_speed = 110;
4923 new_speed += (p_ptr->skill_exp[GINOU_RIDING] + p_ptr->lev *160L)/3200;
4924 if (MON_FAST(riding_m_ptr)) new_speed += 10;
4925 if (MON_SLOW(riding_m_ptr)) new_speed -= 10;
4926 riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
4927 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE;
4929 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) p_ptr->pass_wall = FALSE;
4930 if (riding_r_ptr->flags2 & RF2_KILL_WALL) p_ptr->kill_wall = TRUE;
4932 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;
4934 /* Extract the "weight limit" */
4935 i = 1500 + riding_r_ptr->level * 25;
4938 /* XXX XXX XXX Apply "encumbrance" from weight */
4939 if (j > i) new_speed -= ((j - i) / (i / 5));
4941 /* Searching slows the player down */
4942 if (p_ptr->action == ACTION_SEARCH) new_speed -= 10;
4944 /* Actual Modifier Bonuses (Un-inflate stat bonuses) */
4945 p_ptr->to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4946 p_ptr->to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4947 p_ptr->to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4948 p_ptr->to_d_m += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4949 p_ptr->to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4950 p_ptr->to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4951 p_ptr->to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4952 p_ptr->to_h_m += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4953 p_ptr->to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4954 p_ptr->to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4955 p_ptr->to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4956 p_ptr->to_h_m += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4958 /* Displayed Modifier Bonuses (Un-inflate stat bonuses) */
4959 p_ptr->dis_to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4960 p_ptr->dis_to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4961 p_ptr->dis_to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4962 p_ptr->dis_to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4963 p_ptr->dis_to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4964 p_ptr->dis_to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4965 p_ptr->dis_to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4966 p_ptr->dis_to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4967 p_ptr->dis_to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4970 /* Obtain the "hold" value */
4971 hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
4974 /* Examine the "current bow" */
4975 o_ptr = &inventory[INVEN_BOW];
4977 /* It is hard to carholdry a heavy bow */
4978 p_ptr->heavy_shoot = is_heavy_shoot(o_ptr);
4979 if (p_ptr->heavy_shoot)
4981 /* Hard to wield a heavy bow */
4982 p_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
4983 p_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
4986 /* Compute "extra shots" if needed */
4989 p_ptr->tval_ammo = bow_tval_ammo(o_ptr);
4991 /* Apply special flags */
4992 if (o_ptr->k_idx && !p_ptr->heavy_shoot)
4995 p_ptr->num_fire = calc_num_fire(o_ptr);
4997 /* Snipers love Cross bows */
4998 if ((p_ptr->pclass == CLASS_SNIPER) &&
4999 (p_ptr->tval_ammo == TV_BOLT))
5001 p_ptr->to_h_b += (10 + (p_ptr->lev / 5));
5002 p_ptr->dis_to_h_b += (10 + (p_ptr->lev / 5));
5010 for(i = 0 ; i < 2 ; i++)
5012 /* Examine the "main weapon" */
5013 o_ptr = &inventory[INVEN_RARM+i];
5015 object_flags(o_ptr, flgs);
5017 /* Assume not heavy */
5018 p_ptr->heavy_wield[i] = FALSE;
5019 p_ptr->icky_wield[i] = FALSE;
5020 p_ptr->riding_wield[i] = FALSE;
5022 if (!buki_motteruka(INVEN_RARM+i)) {p_ptr->num_blow[i]=1;continue;}
5023 /* It is hard to hold a heavy weapon */
5024 if (hold < o_ptr->weight / 10)
5026 /* Hard to wield a heavy weapon */
5027 p_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
5028 p_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
5031 p_ptr->heavy_wield[i] = TRUE;
5033 else if (p_ptr->ryoute && (hold < o_ptr->weight/5)) omoi = TRUE;
5035 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
5038 p_ptr->dis_to_a += 5;
5041 /* Normal weapons */
5042 if (o_ptr->k_idx && !p_ptr->heavy_wield[i])
5044 int str_index, dex_index;
5046 int num = 0, wgt = 0, mul = 0, div = 0;
5048 /* Analyze the class */
5049 switch (p_ptr->pclass)
5053 num = 6; wgt = 70; mul = 5; break;
5056 case CLASS_BERSERKER:
5057 num = 6; wgt = 70; mul = 7; break;
5061 case CLASS_HIGH_MAGE:
5062 case CLASS_BLUE_MAGE:
5063 num = 3; wgt = 100; mul = 2; break;
5065 /* Priest, Mindcrafter, Magic-Eater */
5067 case CLASS_MAGIC_EATER:
5068 case CLASS_MINDCRAFTER:
5069 num = 5; wgt = 100; mul = 3; break;
5073 num = 5; wgt = 40; mul = 3; break;
5077 num = 5; wgt = 70; mul = 4; break;
5082 num = 5; wgt = 70; mul = 4; break;
5086 num = 5; wgt = 150; mul = 5; break;
5089 case CLASS_WARRIOR_MAGE:
5090 case CLASS_RED_MAGE:
5091 num = 5; wgt = 70; mul = 3; break;
5094 case CLASS_CHAOS_WARRIOR:
5095 num = 5; wgt = 70; mul = 4; break;
5099 num = 5; wgt = 60; mul = 3; break;
5103 num = 4; wgt = 100; mul = 3; break;
5106 case CLASS_IMITATOR:
5107 num = 5; wgt = 70; mul = 4; break;
5110 case CLASS_BEASTMASTER:
5111 num = 5; wgt = 70; mul = 3; break;
5115 if ((p_ptr->riding) && (have_flag(flgs, TR_RIDING))) {num = 5; wgt = 70; mul = 4;}
5116 else {num = 5; wgt = 100; mul = 3;}
5120 case CLASS_SORCERER:
5121 num = 1; wgt = 1; mul = 1; break;
5123 /* Archer, Bard, Sniper */
5127 num = 4; wgt = 70; mul = 2; break;
5130 case CLASS_FORCETRAINER:
5131 num = 4; wgt = 60; mul = 2; break;
5134 case CLASS_MIRROR_MASTER:
5135 num = 3; wgt = 100; mul = 3; break;
5139 num = 4; wgt = 20; mul = 1; break;
5142 /* Hex - extra mights gives +1 bonus to max blows */
5143 if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING)) { num++; wgt /= 2; mul += 2; }
5145 /* Enforce a minimum "weight" (tenth pounds) */
5146 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
5148 /* Access the strength vs weight */
5149 str_index = (adj_str_blow[p_ptr->stat_ind[A_STR]] * mul / div);
5151 if (p_ptr->ryoute && !omoi) str_index++;
5152 if (p_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index-1);
5155 if (str_index > 11) str_index = 11;
5157 /* Index by dexterity */
5158 dex_index = (adj_dex_blow[p_ptr->stat_ind[A_DEX]]);
5161 if (dex_index > 11) dex_index = 11;
5163 /* Use the blows table */
5164 p_ptr->num_blow[i] = blows_table[str_index][dex_index];
5167 if (p_ptr->num_blow[i] > num) p_ptr->num_blow[i] = num;
5169 /* Add in the "bonus blows" */
5170 p_ptr->num_blow[i] += extra_blows[i];
5173 if (p_ptr->pclass == CLASS_WARRIOR) p_ptr->num_blow[i] += (p_ptr->lev / 40);
5174 else if (p_ptr->pclass == CLASS_BERSERKER)
5176 p_ptr->num_blow[i] += (p_ptr->lev / 23);
5178 else if ((p_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (p_ptr->stat_ind[A_DEX] >= 30)) p_ptr->num_blow[i] ++;
5180 if (p_ptr->special_defense & KATA_FUUJIN) p_ptr->num_blow[i] -= 1;
5182 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) p_ptr->num_blow[i] = 1;
5185 /* Require at least one blow */
5186 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
5188 /* Boost digging skill by weapon weight */
5189 p_ptr->skill_dig += (o_ptr->weight / 10);
5193 /* Priest weapon penalty for non-blessed edged weapons */
5194 if ((p_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
5195 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
5197 /* Reduce the real bonuses */
5198 p_ptr->to_h[i] -= 2;
5199 p_ptr->to_d[i] -= 2;
5201 /* Reduce the mental bonuses */
5202 p_ptr->dis_to_h[i] -= 2;
5203 p_ptr->dis_to_d[i] -= 2;
5206 p_ptr->icky_wield[i] = TRUE;
5208 else if (p_ptr->pclass == CLASS_BERSERKER)
5210 p_ptr->to_h[i] += p_ptr->lev/5;
5211 p_ptr->to_d[i] += p_ptr->lev/6;
5212 p_ptr->dis_to_h[i] += p_ptr->lev/5;
5213 p_ptr->dis_to_d[i] += p_ptr->lev/6;
5214 if (((i == 0) && !p_ptr->hidarite) || p_ptr->ryoute)
5216 p_ptr->to_h[i] += p_ptr->lev/5;
5217 p_ptr->to_d[i] += p_ptr->lev/6;
5218 p_ptr->dis_to_h[i] += p_ptr->lev/5;
5219 p_ptr->dis_to_d[i] += p_ptr->lev/6;
5222 else if (p_ptr->pclass == CLASS_SORCERER)
5224 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
5226 /* Reduce the real bonuses */
5227 p_ptr->to_h[i] -= 200;
5228 p_ptr->to_d[i] -= 200;
5230 /* Reduce the mental bonuses */
5231 p_ptr->dis_to_h[i] -= 200;
5232 p_ptr->dis_to_d[i] -= 200;
5235 p_ptr->icky_wield[i] = TRUE;
5239 /* Reduce the real bonuses */
5240 p_ptr->to_h[i] -= 30;
5241 p_ptr->to_d[i] -= 10;
5243 /* Reduce the mental bonuses */
5244 p_ptr->dis_to_h[i] -= 30;
5245 p_ptr->dis_to_d[i] -= 10;
5249 if (p_ptr->realm1 == REALM_HEX)
5251 if (object_is_cursed(o_ptr))
5253 if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
5254 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_h[i] += 7; p_ptr->dis_to_h[i] += 7; }
5255 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_h[i] += 13; p_ptr->dis_to_h[i] += 13; }
5256 if (o_ptr->curse_flags & (TRC_TY_CURSE)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
5257 if (hex_spelling(HEX_RUNESWORD))
5259 if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_d[i] += 5; p_ptr->dis_to_d[i] += 5; }
5260 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_d[i] += 7; p_ptr->dis_to_d[i] += 7; }
5261 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_d[i] += 13; p_ptr->dis_to_d[i] += 13; }
5267 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
5269 p_ptr->to_h[i] +=15;
5270 p_ptr->dis_to_h[i] +=15;
5271 p_ptr->to_dd[i] += 2;
5273 else if (!(have_flag(flgs, TR_RIDING)))
5276 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
5282 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
5284 if (penalty < 30) penalty = 30;
5286 p_ptr->to_h[i] -= penalty;
5287 p_ptr->dis_to_h[i] -= penalty;
5290 p_ptr->riding_wield[i] = TRUE;
5299 p_ptr->riding_ryoute = FALSE;
5301 if (p_ptr->ryoute || (empty_hands(FALSE) == EMPTY_HAND_NONE)) p_ptr->riding_ryoute = TRUE;
5302 else if (p_ptr->pet_extra_flags & PF_RYOUTE)
5304 switch (p_ptr->pclass)
5307 case CLASS_FORCETRAINER:
5308 case CLASS_BERSERKER:
5309 if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
5310 p_ptr->riding_ryoute = TRUE;
5315 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
5317 if (p_ptr->tval_ammo != TV_ARROW) penalty = 5;
5321 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
5323 if (penalty < 30) penalty = 30;
5325 if (p_ptr->tval_ammo == TV_BOLT) penalty *= 2;
5326 p_ptr->to_h_b -= penalty;
5327 p_ptr->dis_to_h_b -= penalty;
5330 /* Different calculation for monks with empty hands */
5331 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) &&
5332 (empty_hands_status & EMPTY_HAND_RARM) && !p_ptr->hidarite)
5334 int blow_base = p_ptr->lev + adj_dex_blow[p_ptr->stat_ind[A_DEX]];
5335 p_ptr->num_blow[0] = 0;
5337 if (p_ptr->pclass == CLASS_FORCETRAINER)
5339 if (blow_base > 18) p_ptr->num_blow[0]++;
5340 if (blow_base > 31) p_ptr->num_blow[0]++;
5341 if (blow_base > 44) p_ptr->num_blow[0]++;
5342 if (blow_base > 58) p_ptr->num_blow[0]++;
5343 if (p_ptr->magic_num1[0])
5345 p_ptr->to_d[0] += (p_ptr->magic_num1[0]/5);
5346 p_ptr->dis_to_d[0] += (p_ptr->magic_num1[0]/5);
5351 if (blow_base > 12) p_ptr->num_blow[0]++;
5352 if (blow_base > 22) p_ptr->num_blow[0]++;
5353 if (blow_base > 31) p_ptr->num_blow[0]++;
5354 if (blow_base > 39) p_ptr->num_blow[0]++;
5355 if (blow_base > 46) p_ptr->num_blow[0]++;
5356 if (blow_base > 53) p_ptr->num_blow[0]++;
5357 if (blow_base > 59) p_ptr->num_blow[0]++;
5360 if (heavy_armor() && (p_ptr->pclass != CLASS_BERSERKER))
5361 p_ptr->num_blow[0] /= 2;
5364 p_ptr->to_h[0] += (p_ptr->lev / 3);
5365 p_ptr->dis_to_h[0] += (p_ptr->lev / 3);
5367 p_ptr->to_d[0] += (p_ptr->lev / 6);
5368 p_ptr->dis_to_d[0] += (p_ptr->lev / 6);
5371 if (p_ptr->special_defense & KAMAE_BYAKKO)
5374 p_ptr->dis_to_a -= 40;
5377 else if (p_ptr->special_defense & KAMAE_SEIRYU)
5380 p_ptr->dis_to_a -= 50;
5381 p_ptr->resist_acid = TRUE;
5382 p_ptr->resist_fire = TRUE;
5383 p_ptr->resist_elec = TRUE;
5384 p_ptr->resist_cold = TRUE;
5385 p_ptr->resist_pois = TRUE;
5386 p_ptr->sh_fire = TRUE;
5387 p_ptr->sh_elec = TRUE;
5388 p_ptr->sh_cold = TRUE;
5389 p_ptr->levitation = TRUE;
5391 else if (p_ptr->special_defense & KAMAE_GENBU)
5393 p_ptr->to_a += (p_ptr->lev*p_ptr->lev)/50;
5394 p_ptr->dis_to_a += (p_ptr->lev*p_ptr->lev)/50;
5395 p_ptr->reflect = TRUE;
5396 p_ptr->num_blow[0] -= 2;
5397 if ((p_ptr->pclass == CLASS_MONK) && (p_ptr->lev > 42)) p_ptr->num_blow[0]--;
5398 if (p_ptr->num_blow[0] < 0) p_ptr->num_blow[0] = 0;
5400 else if (p_ptr->special_defense & KAMAE_SUZAKU)
5402 p_ptr->to_h[0] -= (p_ptr->lev / 3);
5403 p_ptr->to_d[0] -= (p_ptr->lev / 6);
5405 p_ptr->dis_to_h[0] -= (p_ptr->lev / 3);
5406 p_ptr->dis_to_d[0] -= (p_ptr->lev / 6);
5407 p_ptr->num_blow[0] /= 2;
5408 p_ptr->levitation = TRUE;
5411 p_ptr->num_blow[0] += 1+extra_blows[0];
5414 if (p_ptr->riding) p_ptr->levitation = riding_levitation;
5416 monk_armour_aux = FALSE;
5420 monk_armour_aux = TRUE;
5423 for (i = 0; i < 2; i++)
5425 if (buki_motteruka(INVEN_RARM+i))
5427 int tval = inventory[INVEN_RARM+i].tval - TV_WEAPON_BEGIN;
5428 int sval = inventory[INVEN_RARM+i].sval;
5430 p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
5431 p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
5432 if ((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER))
5434 if (!s_info[p_ptr->pclass].w_max[tval][sval])
5436 p_ptr->to_h[i] -= 40;
5437 p_ptr->dis_to_h[i] -= 40;
5438 p_ptr->icky_wield[i] = TRUE;
5441 else if (p_ptr->pclass == CLASS_NINJA)
5443 if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (inventory[INVEN_LARM-i].tval == TV_SHIELD))
5445 p_ptr->to_h[i] -= 40;
5446 p_ptr->dis_to_h[i] -= 40;
5447 p_ptr->icky_wield[i] = TRUE;
5448 p_ptr->num_blow[i] /= 2;
5449 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
5453 if (inventory[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000;
5457 /* Maximum speed is (+99). (internally it's 110 + 99) */
5458 /* Temporary lightspeed forces to be maximum speed */
5459 if ((p_ptr->lightspeed && !p_ptr->riding) || (new_speed > 209))
5464 /* Minimum speed is (-99). (internally it's 110 - 99) */
5465 if (new_speed < 11) new_speed = 11;
5467 /* Display the speed (if needed) */
5468 if (p_ptr->pspeed != (byte)new_speed)
5470 p_ptr->pspeed = (byte)new_speed;
5471 p_ptr->redraw |= (PR_SPEED);
5476 if (p_ptr->to_a > (0 - p_ptr->ac))
5477 p_ptr->to_a = 0 - p_ptr->ac;
5478 if (p_ptr->dis_to_a > (0 - p_ptr->dis_ac))
5479 p_ptr->dis_to_a = 0 - p_ptr->dis_ac;
5482 /* Redraw armor (if needed) */
5483 if ((p_ptr->dis_ac != old_dis_ac) || (p_ptr->dis_to_a != old_dis_to_a))
5486 p_ptr->redraw |= (PR_ARMOR);
5489 p_ptr->window |= (PW_PLAYER);
5493 if (p_ptr->ryoute && !omoi)
5495 int bonus_to_h=0, bonus_to_d=0;
5496 bonus_to_d = ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128)/2;
5497 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);
5499 p_ptr->to_h[default_hand] += MAX(bonus_to_h,1);
5500 p_ptr->dis_to_h[default_hand] += MAX(bonus_to_h,1);
5501 p_ptr->to_d[default_hand] += MAX(bonus_to_d,1);
5502 p_ptr->dis_to_d[default_hand] += MAX(bonus_to_d,1);
5505 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;
5507 /* Affect Skill -- stealth (bonus one) */
5508 p_ptr->skill_stl += 1;
5510 if (IS_TIM_STEALTH()) p_ptr->skill_stl += 99;
5512 /* Affect Skill -- disarming (DEX and INT) */
5513 p_ptr->skill_dis += adj_dex_dis[p_ptr->stat_ind[A_DEX]];
5514 p_ptr->skill_dis += adj_int_dis[p_ptr->stat_ind[A_INT]];
5516 /* Affect Skill -- magic devices (INT) */
5517 p_ptr->skill_dev += adj_int_dev[p_ptr->stat_ind[A_INT]];
5519 /* Affect Skill -- saving throw (WIS) */
5520 p_ptr->skill_sav += adj_wis_sav[p_ptr->stat_ind[A_WIS]];
5522 /* Affect Skill -- digging (STR) */
5523 p_ptr->skill_dig += adj_str_dig[p_ptr->stat_ind[A_STR]];
5525 /* Affect Skill -- disarming (Level, by Class) */
5526 p_ptr->skill_dis += ((cp_ptr->x_dis * p_ptr->lev / 10) + (ap_ptr->a_dis * p_ptr->lev / 50));
5528 /* Affect Skill -- magic devices (Level, by Class) */
5529 p_ptr->skill_dev += ((cp_ptr->x_dev * p_ptr->lev / 10) + (ap_ptr->a_dev * p_ptr->lev / 50));
5531 /* Affect Skill -- saving throw (Level, by Class) */
5532 p_ptr->skill_sav += ((cp_ptr->x_sav * p_ptr->lev / 10) + (ap_ptr->a_sav * p_ptr->lev / 50));
5534 /* Affect Skill -- stealth (Level, by Class) */
5535 p_ptr->skill_stl += (cp_ptr->x_stl * p_ptr->lev / 10);
5537 /* Affect Skill -- search ability (Level, by Class) */
5538 p_ptr->skill_srh += (cp_ptr->x_srh * p_ptr->lev / 10);
5540 /* Affect Skill -- search frequency (Level, by Class) */
5541 p_ptr->skill_fos += (cp_ptr->x_fos * p_ptr->lev / 10);
5543 /* Affect Skill -- combat (normal) (Level, by Class) */
5544 p_ptr->skill_thn += ((cp_ptr->x_thn * p_ptr->lev / 10) + (ap_ptr->a_thn * p_ptr->lev / 50));
5546 /* Affect Skill -- combat (shooting) (Level, by Class) */
5547 p_ptr->skill_thb += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5549 /* Affect Skill -- combat (throwing) (Level, by Class) */
5550 p_ptr->skill_tht += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5553 if ((prace_is_(RACE_S_FAIRY)) && (p_ptr->pseikaku != SEIKAKU_SEXY) && (p_ptr->cursed & TRC_AGGRAVATE))
5555 p_ptr->cursed &= ~(TRC_AGGRAVATE);
5556 p_ptr->skill_stl = MIN(p_ptr->skill_stl - 3, (p_ptr->skill_stl + 2) / 2);
5559 /* Limit Skill -- stealth from 0 to 30 */
5560 if (p_ptr->skill_stl > 30) p_ptr->skill_stl = 30;
5561 if (p_ptr->skill_stl < 0) p_ptr->skill_stl = 0;
5563 /* Limit Skill -- digging from 1 up */
5564 if (p_ptr->skill_dig < 1) p_ptr->skill_dig = 1;
5566 if (p_ptr->anti_magic && (p_ptr->skill_sav < (90 + p_ptr->lev))) p_ptr->skill_sav = 90 + p_ptr->lev;
5568 if (p_ptr->tsubureru) p_ptr->skill_sav = 10;
5570 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;
5572 if (down_saving) p_ptr->skill_sav /= 2;
5574 /* Hack -- Each elemental immunity includes resistance */
5575 if (p_ptr->immune_acid) p_ptr->resist_acid = TRUE;
5576 if (p_ptr->immune_elec) p_ptr->resist_elec = TRUE;
5577 if (p_ptr->immune_fire) p_ptr->resist_fire = TRUE;
5578 if (p_ptr->immune_cold) p_ptr->resist_cold = TRUE;
5580 /* Determine player alignment */
5581 for (i = 0, j = 0; i < 8; i++)
5583 switch (p_ptr->vir_types[i])
5586 p_ptr->align += p_ptr->virtues[i] * 2;
5596 p_ptr->align -= p_ptr->virtues[i];
5599 p_ptr->align += p_ptr->virtues[i];
5604 for (i = 0; i < j; i++)
5606 if (p_ptr->align > 0)
5608 p_ptr->align -= p_ptr->virtues[neutral[i]] / 2;
5609 if (p_ptr->align < 0) p_ptr->align = 0;
5611 else if (p_ptr->align < 0)
5613 p_ptr->align += p_ptr->virtues[neutral[i]] / 2;
5614 if (p_ptr->align > 0) p_ptr->align = 0;
5618 /* Hack -- handle "xtra" mode */
5619 if (character_xtra) return;
5621 /* Take note when "heavy bow" changes */
5622 if (p_ptr->old_heavy_shoot != p_ptr->heavy_shoot)
5625 if (p_ptr->heavy_shoot)
5627 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
5629 else if (inventory[INVEN_BOW].k_idx)
5631 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
5635 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
5639 p_ptr->old_heavy_shoot = p_ptr->heavy_shoot;
5642 for (i = 0 ; i < 2 ; i++)
5644 /* Take note when "heavy weapon" changes */
5645 if (p_ptr->old_heavy_wield[i] != p_ptr->heavy_wield[i])
5648 if (p_ptr->heavy_wield[i])
5650 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
5652 else if (buki_motteruka(INVEN_RARM+i))
5654 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
5656 else if (p_ptr->heavy_wield[1-i])
5658 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
5662 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
5666 p_ptr->old_heavy_wield[i] = p_ptr->heavy_wield[i];
5669 /* Take note when "heavy weapon" changes */
5670 if (p_ptr->old_riding_wield[i] != p_ptr->riding_wield[i])
5673 if (p_ptr->riding_wield[i])
5675 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
5677 else if (!p_ptr->riding)
5679 msg_print(_("この武器は徒歩で使いやすい。", "This weapon was not suitable for use while riding."));
5681 else if (buki_motteruka(INVEN_RARM+i))
5683 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
5686 p_ptr->old_riding_wield[i] = p_ptr->riding_wield[i];
5689 /* Take note when "illegal weapon" changes */
5690 if (p_ptr->old_icky_wield[i] != p_ptr->icky_wield[i])
5693 if (p_ptr->icky_wield[i])
5695 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
5698 chg_virtue(V_FAITH, -1);
5701 else if (buki_motteruka(INVEN_RARM+i))
5703 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
5707 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
5711 p_ptr->old_icky_wield[i] = p_ptr->icky_wield[i];
5715 if (p_ptr->riding && (p_ptr->old_riding_ryoute != p_ptr->riding_ryoute))
5718 if (p_ptr->riding_ryoute)
5721 msg_format("%s馬を操れない。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
5723 msg_print("You are using both hand for fighting, and you can't control a riding pet.");
5729 msg_format("%s馬を操れるようになった。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
5731 msg_print("You began to control riding pet with one hand.");
5735 p_ptr->old_riding_ryoute = p_ptr->riding_ryoute;
5738 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (monk_armour_aux != monk_notify_aux))
5742 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
5745 chg_virtue(V_HARMONY, -1);
5750 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
5753 monk_notify_aux = monk_armour_aux;
5756 for (i = 0; i < INVEN_PACK; i++)
5759 if ((inventory[i].tval == TV_SORCERY_BOOK) && (inventory[i].sval == 2)) have_dd_s = TRUE;
5760 if ((inventory[i].tval == TV_TRUMP_BOOK) && (inventory[i].sval == 1)) have_dd_t = TRUE;
5762 if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE;
5763 if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE;
5765 for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
5769 /* Acquire object */
5770 o_ptr = &o_list[this_o_idx];
5772 /* Acquire next object */
5773 next_o_idx = o_ptr->next_o_idx;
5776 if ((o_ptr->tval == TV_SORCERY_BOOK) && (o_ptr->sval == 3)) have_dd_s = TRUE;
5777 if ((o_ptr->tval == TV_TRUMP_BOOK) && (o_ptr->sval == 1)) have_dd_t = TRUE;
5779 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
5780 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
5783 if (p_ptr->pass_wall && !p_ptr->kill_wall) p_ptr->no_flowed = TRUE;
5785 if (have_dd_s && ((p_ptr->realm1 == REALM_SORCERY) || (p_ptr->realm2 == REALM_SORCERY) || (p_ptr->pclass == CLASS_SORCERER)))
5787 const magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY-1][SPELL_DD_S];
5788 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5791 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)))
5793 const magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP-1][SPELL_DD_T];
5794 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5797 if (have_sw && ((p_ptr->realm1 == REALM_NATURE) || (p_ptr->realm2 == REALM_NATURE) || (p_ptr->pclass == CLASS_SORCERER)))
5799 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE-1][SPELL_SW];
5800 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5803 if (have_kabe && ((p_ptr->realm1 == REALM_CRAFT) || (p_ptr->realm2 == REALM_CRAFT) || (p_ptr->pclass == CLASS_SORCERER)))
5805 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT-1][SPELL_KABE];
5806 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5813 * @brief p_ptr->notice の状態に応じた更新をまとめて行う / Handle "p_ptr->notice"
5815 * @details 行う更新処理の対象はアイテムの自動破壊/アイテムの結合/アイテムの並び替え。
5817 void notice_stuff(void)
5820 if (!p_ptr->notice) return;
5823 /* Actually do auto-destroy */
5824 if (p_ptr->notice & (PN_AUTODESTROY))
5826 p_ptr->notice &= ~(PN_AUTODESTROY);
5827 autopick_delayed_alter();
5830 /* Combine the pack */
5831 if (p_ptr->notice & (PN_COMBINE))
5833 p_ptr->notice &= ~(PN_COMBINE);
5837 /* Reorder the pack */
5838 if (p_ptr->notice & (PN_REORDER))
5840 p_ptr->notice &= ~(PN_REORDER);
5847 * Handle "p_ptr->update"
5849 void update_stuff(void)
5852 if (!p_ptr->update) return;
5855 if (p_ptr->update & (PU_BONUS))
5857 p_ptr->update &= ~(PU_BONUS);
5861 if (p_ptr->update & (PU_TORCH))
5863 p_ptr->update &= ~(PU_TORCH);
5867 if (p_ptr->update & (PU_HP))
5869 p_ptr->update &= ~(PU_HP);
5873 if (p_ptr->update & (PU_MANA))
5875 p_ptr->update &= ~(PU_MANA);
5879 if (p_ptr->update & (PU_SPELLS))
5881 p_ptr->update &= ~(PU_SPELLS);
5886 /* Character is not ready yet, no screen updates */
5887 if (!character_generated) return;
5890 /* Character is in "icky" mode, no screen updates */
5891 if (character_icky) return;
5894 if (p_ptr->update & (PU_UN_LITE))
5896 p_ptr->update &= ~(PU_UN_LITE);
5900 if (p_ptr->update & (PU_UN_VIEW))
5902 p_ptr->update &= ~(PU_UN_VIEW);
5906 if (p_ptr->update & (PU_VIEW))
5908 p_ptr->update &= ~(PU_VIEW);
5912 if (p_ptr->update & (PU_LITE))
5914 p_ptr->update &= ~(PU_LITE);
5919 if (p_ptr->update & (PU_FLOW))
5921 p_ptr->update &= ~(PU_FLOW);
5925 if (p_ptr->update & (PU_DISTANCE))
5927 p_ptr->update &= ~(PU_DISTANCE);
5929 /* Still need to call update_monsters(FALSE) after update_mon_lite() */
5930 /* p_ptr->update &= ~(PU_MONSTERS); */
5932 update_monsters(TRUE);
5935 if (p_ptr->update & (PU_MON_LITE))
5937 p_ptr->update &= ~(PU_MON_LITE);
5942 * Mega-Hack -- Delayed visual update
5943 * Only used if update_view(), update_lite() or update_mon_lite() was called
5945 if (p_ptr->update & (PU_DELAY_VIS))
5947 p_ptr->update &= ~(PU_DELAY_VIS);
5948 delayed_visual_update();
5951 if (p_ptr->update & (PU_MONSTERS))
5953 p_ptr->update &= ~(PU_MONSTERS);
5954 update_monsters(FALSE);
5960 * Handle "p_ptr->redraw"
5962 void redraw_stuff(void)
5965 if (!p_ptr->redraw) return;
5968 /* Character is not ready yet, no screen updates */
5969 if (!character_generated) return;
5972 /* Character is in "icky" mode, no screen updates */
5973 if (character_icky) return;
5977 /* Hack -- clear the screen */
5978 if (p_ptr->redraw & (PR_WIPE))
5980 p_ptr->redraw &= ~(PR_WIPE);
5986 if (p_ptr->redraw & (PR_MAP))
5988 p_ptr->redraw &= ~(PR_MAP);
5993 if (p_ptr->redraw & (PR_BASIC))
5995 p_ptr->redraw &= ~(PR_BASIC);
5996 p_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
5997 p_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
5998 p_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
5999 p_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
6005 if (p_ptr->redraw & (PR_EQUIPPY))
6007 p_ptr->redraw &= ~(PR_EQUIPPY);
6008 print_equippy(); /* To draw / delete equippy chars */
6011 if (p_ptr->redraw & (PR_MISC))
6013 p_ptr->redraw &= ~(PR_MISC);
6014 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
6015 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
6019 if (p_ptr->redraw & (PR_TITLE))
6021 p_ptr->redraw &= ~(PR_TITLE);
6025 if (p_ptr->redraw & (PR_LEV))
6027 p_ptr->redraw &= ~(PR_LEV);
6031 if (p_ptr->redraw & (PR_EXP))
6033 p_ptr->redraw &= ~(PR_EXP);
6037 if (p_ptr->redraw & (PR_STATS))
6039 p_ptr->redraw &= ~(PR_STATS);
6048 if (p_ptr->redraw & (PR_STATUS))
6050 p_ptr->redraw &= ~(PR_STATUS);
6054 if (p_ptr->redraw & (PR_ARMOR))
6056 p_ptr->redraw &= ~(PR_ARMOR);
6060 if (p_ptr->redraw & (PR_HP))
6062 p_ptr->redraw &= ~(PR_HP);
6066 if (p_ptr->redraw & (PR_MANA))
6068 p_ptr->redraw &= ~(PR_MANA);
6072 if (p_ptr->redraw & (PR_GOLD))
6074 p_ptr->redraw &= ~(PR_GOLD);
6078 if (p_ptr->redraw & (PR_DEPTH))
6080 p_ptr->redraw &= ~(PR_DEPTH);
6084 if (p_ptr->redraw & (PR_HEALTH))
6086 p_ptr->redraw &= ~(PR_HEALTH);
6087 health_redraw(FALSE);
6090 if (p_ptr->redraw & (PR_UHEALTH))
6092 p_ptr->redraw &= ~(PR_UHEALTH);
6093 health_redraw(TRUE);
6097 if (p_ptr->redraw & (PR_EXTRA))
6099 p_ptr->redraw &= ~(PR_EXTRA);
6100 p_ptr->redraw &= ~(PR_CUT | PR_STUN);
6101 p_ptr->redraw &= ~(PR_HUNGER);
6102 p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
6106 if (p_ptr->redraw & (PR_CUT))
6108 p_ptr->redraw &= ~(PR_CUT);
6112 if (p_ptr->redraw & (PR_STUN))
6114 p_ptr->redraw &= ~(PR_STUN);
6118 if (p_ptr->redraw & (PR_HUNGER))
6120 p_ptr->redraw &= ~(PR_HUNGER);
6124 if (p_ptr->redraw & (PR_STATE))
6126 p_ptr->redraw &= ~(PR_STATE);
6130 if (p_ptr->redraw & (PR_SPEED))
6132 p_ptr->redraw &= ~(PR_SPEED);
6136 if (p_ptr->pclass == CLASS_IMITATOR)
6138 if (p_ptr->redraw & (PR_IMITATION))
6140 p_ptr->redraw &= ~(PR_IMITATION);
6144 else if (p_ptr->redraw & (PR_STUDY))
6146 p_ptr->redraw &= ~(PR_STUDY);
6153 * Handle "p_ptr->window"
6155 void window_stuff(void)
6163 if (!p_ptr->window) return;
6166 for (j = 0; j < 8; j++)
6168 /* Save usable flags */
6169 if (angband_term[j]) mask |= window_flag[j];
6172 /* Apply usable flags */
6173 p_ptr->window &= mask;
6176 if (!p_ptr->window) return;
6179 /* Display inventory */
6180 if (p_ptr->window & (PW_INVEN))
6182 p_ptr->window &= ~(PW_INVEN);
6186 /* Display equipment */
6187 if (p_ptr->window & (PW_EQUIP))
6189 p_ptr->window &= ~(PW_EQUIP);
6193 /* Display spell list */
6194 if (p_ptr->window & (PW_SPELL))
6196 p_ptr->window &= ~(PW_SPELL);
6200 /* Display player */
6201 if (p_ptr->window & (PW_PLAYER))
6203 p_ptr->window &= ~(PW_PLAYER);
6207 /* Display monster list */
6208 if (p_ptr->window & (PW_MONSTER_LIST))
6210 p_ptr->window &= ~(PW_MONSTER_LIST);
6214 /* Display overhead view */
6215 if (p_ptr->window & (PW_MESSAGE))
6217 p_ptr->window &= ~(PW_MESSAGE);
6221 /* Display overhead view */
6222 if (p_ptr->window & (PW_OVERHEAD))
6224 p_ptr->window &= ~(PW_OVERHEAD);
6228 /* Display overhead view */
6229 if (p_ptr->window & (PW_DUNGEON))
6231 p_ptr->window &= ~(PW_DUNGEON);
6235 /* Display monster recall */
6236 if (p_ptr->window & (PW_MONSTER))
6238 p_ptr->window &= ~(PW_MONSTER);
6242 /* Display object recall */
6243 if (p_ptr->window & (PW_OBJECT))
6245 p_ptr->window &= ~(PW_OBJECT);
6252 * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
6254 void handle_stuff(void)
6257 if (p_ptr->update) update_stuff();
6260 if (p_ptr->redraw) redraw_stuff();
6263 if (p_ptr->window) window_stuff();
6267 s16b empty_hands(bool riding_control)
6269 s16b status = EMPTY_HAND_NONE;
6271 if (!inventory[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
6272 if (!inventory[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
6274 if (riding_control && (status != EMPTY_HAND_NONE) && p_ptr->riding && !(p_ptr->pet_extra_flags & PF_RYOUTE))
6276 if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
6277 else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
6284 bool heavy_armor(void)
6286 u16b monk_arm_wgt = 0;
6288 if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE;
6290 /* Weight the armor */
6291 if(inventory[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_RARM].weight;
6292 if(inventory[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_LARM].weight;
6293 monk_arm_wgt += inventory[INVEN_BODY].weight;
6294 monk_arm_wgt += inventory[INVEN_HEAD].weight;
6295 monk_arm_wgt += inventory[INVEN_OUTER].weight;
6296 monk_arm_wgt += inventory[INVEN_HANDS].weight;
6297 monk_arm_wgt += inventory[INVEN_FEET].weight;
6299 return (monk_arm_wgt > (100 + (p_ptr->lev * 4)));
6302 void update_playtime(void)
6304 /* Check if the game has started */
6305 if (start_time != 0)
6307 u32b tmp = time(NULL);
6308 playtime += (tmp - start_time);