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 * @param 下部に状態表示を行う / 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 * @param プレイヤーの称号を表示する / 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 * @param プレイヤーのレベルを表示する / 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 * @param プレイヤーの経験値を表示する / 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 * @param プレイヤーの所持金を表示する / 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 * @param プレイヤーの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 * @param プレイヤーの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 * @param プレイヤーの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 * @param 現在のフロアの深さを表示する / 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 * @param プレイヤーの空腹状態を表示する / 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 * @param プレイヤーの行動状態を表示する / 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 * @param プレイヤーの行動速度を表示する / 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 * @param プレイヤーの呪文学習可能状態を表示する
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 * @param プレイヤーのものまね可能状態を表示する
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 * @param プレイヤーの負傷状態を表示する
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 * @param プレイヤーの朦朧状態を表示する
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 * @param モンスターの体力ゲージを表示する
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 * @param プレイヤーのステータスを一括表示する(左側部分) / 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 * @param プレイヤーのステータスを一括表示する(下部分) / Display extra info (mostly below map)
1662 static void prt_frame_extra(void)
1687 * @param サブウィンドウに所持品一覧を表示する / 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);
3030 * Computes current weight limit.
3032 u32b weight_limit(void)
3036 /* Weight limit based only on strength */
3037 i = (u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
3038 if (p_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
3040 /* Return the result */
3045 bool buki_motteruka(int i)
3047 return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE);
3050 bool is_heavy_shoot(object_type *o_ptr)
3052 int hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
3053 /* It is hard to carholdry a heavy bow */
3054 return (hold < o_ptr->weight / 10);
3057 int bow_tval_ammo(object_type *o_ptr)
3059 /* Analyze the launcher */
3060 switch (o_ptr->sval)
3088 /* calcurate the fire rate of target object */
3089 s16b calc_num_fire(object_type *o_ptr)
3091 int extra_shots = 0;
3094 int tval_ammo = bow_tval_ammo(o_ptr);
3096 u32b flgs[TR_FLAG_SIZE];
3098 /* Scan the usable inventory */
3099 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3101 q_ptr = &inventory[i];
3103 /* Skip non-objects */
3104 if (!q_ptr->k_idx) continue;
3106 /* Do not apply current equip */
3107 if (i == INVEN_BOW) continue;
3109 /* Extract the item flags */
3110 object_flags(q_ptr, flgs);
3113 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
3116 object_flags(o_ptr, flgs);
3117 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
3119 if (o_ptr->k_idx && !is_heavy_shoot(o_ptr))
3123 num += (extra_shots * 100);
3125 /* Hack -- Rangers love Bows */
3126 if ((p_ptr->pclass == CLASS_RANGER) &&
3127 (tval_ammo == TV_ARROW))
3129 num += (p_ptr->lev * 4);
3132 if ((p_ptr->pclass == CLASS_CAVALRY) &&
3133 (tval_ammo == TV_ARROW))
3135 num += (p_ptr->lev * 3);
3138 if (p_ptr->pclass == CLASS_ARCHER)
3140 if (tval_ammo == TV_ARROW)
3141 num += ((p_ptr->lev * 5)+50);
3142 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
3143 num += (p_ptr->lev * 4);
3147 * Addendum -- also "Reward" high level warriors,
3148 * with _any_ missile weapon -- TY
3150 if (p_ptr->pclass == CLASS_WARRIOR &&
3151 (tval_ammo <= TV_BOLT) &&
3152 (tval_ammo >= TV_SHOT))
3154 num += (p_ptr->lev * 2);
3156 if ((p_ptr->pclass == CLASS_ROGUE) &&
3157 (tval_ammo == TV_SHOT))
3159 num += (p_ptr->lev * 4);
3166 * Calculate the players current "state", taking into account
3167 * not only race/class intrinsics, but also objects being worn
3168 * and temporary spell effects.
3170 * See also calc_mana() and calc_hitpoints().
3172 * Take note of the new "speed code", in particular, a very strong
3173 * player will start slowing down as soon as he reaches 150 pounds,
3174 * but not until he reaches 450 pounds will he be half as fast as
3175 * a normal kobold. This both hurts and helps the player, hurts
3176 * because in the old days a player could just avoid 300 pounds,
3177 * and helps because now carrying 300 pounds is not very painful.
3179 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
3180 * damage, since that would affect non-combat things. These values
3181 * are actually added in later, at the appropriate place.
3183 * This function induces various "status" messages.
3185 void calc_bonuses(void)
3187 int i, j, hold, neutral[2];
3189 int default_hand = 0;
3190 int empty_hands_status = empty_hands(TRUE);
3193 u32b flgs[TR_FLAG_SIZE];
3195 bool yoiyami = FALSE;
3196 bool down_saving = FALSE;
3198 bool have_dd_s = FALSE, have_dd_t = FALSE;
3200 bool have_sw = FALSE, have_kabe = FALSE;
3201 bool easy_2weapon = FALSE;
3202 bool riding_levitation = FALSE;
3203 s16b this_o_idx, next_o_idx = 0;
3204 const player_race *tmp_rp_ptr;
3206 /* Save the old vision stuff */
3207 bool old_telepathy = p_ptr->telepathy;
3208 bool old_esp_animal = p_ptr->esp_animal;
3209 bool old_esp_undead = p_ptr->esp_undead;
3210 bool old_esp_demon = p_ptr->esp_demon;
3211 bool old_esp_orc = p_ptr->esp_orc;
3212 bool old_esp_troll = p_ptr->esp_troll;
3213 bool old_esp_giant = p_ptr->esp_giant;
3214 bool old_esp_dragon = p_ptr->esp_dragon;
3215 bool old_esp_human = p_ptr->esp_human;
3216 bool old_esp_evil = p_ptr->esp_evil;
3217 bool old_esp_good = p_ptr->esp_good;
3218 bool old_esp_nonliving = p_ptr->esp_nonliving;
3219 bool old_esp_unique = p_ptr->esp_unique;
3220 bool old_see_inv = p_ptr->see_inv;
3221 bool old_mighty_throw = p_ptr->mighty_throw;
3223 /* Save the old armor class */
3224 bool old_dis_ac = p_ptr->dis_ac;
3225 bool old_dis_to_a = p_ptr->dis_to_a;
3228 /* Clear extra blows/shots */
3229 extra_blows[0] = extra_blows[1] = 0;
3231 /* Clear the stat modifiers */
3232 for (i = 0; i < 6; i++) p_ptr->stat_add[i] = 0;
3235 /* Clear the Displayed/Real armor class */
3236 p_ptr->dis_ac = p_ptr->ac = 0;
3238 /* Clear the Displayed/Real Bonuses */
3239 p_ptr->dis_to_h[0] = p_ptr->to_h[0] = 0;
3240 p_ptr->dis_to_h[1] = p_ptr->to_h[1] = 0;
3241 p_ptr->dis_to_d[0] = p_ptr->to_d[0] = 0;
3242 p_ptr->dis_to_d[1] = p_ptr->to_d[1] = 0;
3243 p_ptr->dis_to_h_b = p_ptr->to_h_b = 0;
3244 p_ptr->dis_to_a = p_ptr->to_a = 0;
3248 p_ptr->to_m_chance = 0;
3250 /* Clear the Extra Dice Bonuses */
3251 p_ptr->to_dd[0] = p_ptr->to_ds[0] = 0;
3252 p_ptr->to_dd[1] = p_ptr->to_ds[1] = 0;
3254 /* Start with "normal" speed */
3257 /* Start with a single blow per turn */
3258 p_ptr->num_blow[0] = 1;
3259 p_ptr->num_blow[1] = 1;
3261 /* Start with a single shot per turn */
3262 p_ptr->num_fire = 100;
3264 /* Reset the "xtra" tval */
3265 p_ptr->tval_xtra = 0;
3267 /* Reset the "ammo" tval */
3268 p_ptr->tval_ammo = 0;
3270 /* Clear all the flags */
3272 p_ptr->bless_blade = FALSE;
3273 p_ptr->xtra_might = FALSE;
3274 p_ptr->impact[0] = FALSE;
3275 p_ptr->impact[1] = FALSE;
3276 p_ptr->pass_wall = FALSE;
3277 p_ptr->kill_wall = FALSE;
3278 p_ptr->dec_mana = FALSE;
3279 p_ptr->easy_spell = FALSE;
3280 p_ptr->heavy_spell = FALSE;
3281 p_ptr->see_inv = FALSE;
3282 p_ptr->free_act = FALSE;
3283 p_ptr->slow_digest = FALSE;
3284 p_ptr->regenerate = FALSE;
3285 p_ptr->can_swim = FALSE;
3286 p_ptr->levitation = FALSE;
3287 p_ptr->hold_exp = FALSE;
3288 p_ptr->telepathy = FALSE;
3289 p_ptr->esp_animal = FALSE;
3290 p_ptr->esp_undead = FALSE;
3291 p_ptr->esp_demon = FALSE;
3292 p_ptr->esp_orc = FALSE;
3293 p_ptr->esp_troll = FALSE;
3294 p_ptr->esp_giant = FALSE;
3295 p_ptr->esp_dragon = FALSE;
3296 p_ptr->esp_human = FALSE;
3297 p_ptr->esp_evil = FALSE;
3298 p_ptr->esp_good = FALSE;
3299 p_ptr->esp_nonliving = FALSE;
3300 p_ptr->esp_unique = FALSE;
3301 p_ptr->lite = FALSE;
3302 p_ptr->sustain_str = FALSE;
3303 p_ptr->sustain_int = FALSE;
3304 p_ptr->sustain_wis = FALSE;
3305 p_ptr->sustain_con = FALSE;
3306 p_ptr->sustain_dex = FALSE;
3307 p_ptr->sustain_chr = FALSE;
3308 p_ptr->resist_acid = FALSE;
3309 p_ptr->resist_elec = FALSE;
3310 p_ptr->resist_fire = FALSE;
3311 p_ptr->resist_cold = FALSE;
3312 p_ptr->resist_pois = FALSE;
3313 p_ptr->resist_conf = FALSE;
3314 p_ptr->resist_sound = FALSE;
3315 p_ptr->resist_lite = FALSE;
3316 p_ptr->resist_dark = FALSE;
3317 p_ptr->resist_chaos = FALSE;
3318 p_ptr->resist_disen = FALSE;
3319 p_ptr->resist_shard = FALSE;
3320 p_ptr->resist_nexus = FALSE;
3321 p_ptr->resist_blind = FALSE;
3322 p_ptr->resist_neth = FALSE;
3323 p_ptr->resist_time = FALSE;
3324 p_ptr->resist_fear = FALSE;
3325 p_ptr->reflect = FALSE;
3326 p_ptr->sh_fire = FALSE;
3327 p_ptr->sh_elec = FALSE;
3328 p_ptr->sh_cold = FALSE;
3329 p_ptr->anti_magic = FALSE;
3330 p_ptr->anti_tele = FALSE;
3331 p_ptr->warning = FALSE;
3332 p_ptr->mighty_throw = FALSE;
3333 p_ptr->see_nocto = FALSE;
3335 p_ptr->immune_acid = FALSE;
3336 p_ptr->immune_elec = FALSE;
3337 p_ptr->immune_fire = FALSE;
3338 p_ptr->immune_cold = FALSE;
3340 p_ptr->ryoute = FALSE;
3341 p_ptr->migite = FALSE;
3342 p_ptr->hidarite = FALSE;
3343 p_ptr->no_flowed = FALSE;
3345 p_ptr->align = friend_align;
3347 if (p_ptr->mimic_form) tmp_rp_ptr = &mimic_info[p_ptr->mimic_form];
3348 else tmp_rp_ptr = &race_info[p_ptr->prace];
3350 /* Base infravision (purely racial) */
3351 p_ptr->see_infra = tmp_rp_ptr->infra;
3353 /* Base skill -- disarming */
3354 p_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis;
3356 /* Base skill -- magic devices */
3357 p_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
3359 /* Base skill -- saving throw */
3360 p_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav;
3362 /* Base skill -- stealth */
3363 p_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl;
3365 /* Base skill -- searching ability */
3366 p_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh;
3368 /* Base skill -- searching frequency */
3369 p_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos;
3371 /* Base skill -- combat (normal) */
3372 p_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn;
3374 /* Base skill -- combat (shooting) */
3375 p_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3377 /* Base skill -- combat (throwing) */
3378 p_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3380 /* Base skill -- digging */
3381 p_ptr->skill_dig = 0;
3383 if (buki_motteruka(INVEN_RARM)) p_ptr->migite = TRUE;
3384 if (buki_motteruka(INVEN_LARM))
3386 p_ptr->hidarite = TRUE;
3387 if (!p_ptr->migite) default_hand = 1;
3390 if (CAN_TWO_HANDS_WIELDING())
3392 if (p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) &&
3393 object_allow_two_hands_wielding(&inventory[INVEN_RARM]))
3395 p_ptr->ryoute = TRUE;
3397 else if (p_ptr->hidarite && (empty_hands(FALSE) == EMPTY_HAND_RARM) &&
3398 object_allow_two_hands_wielding(&inventory[INVEN_LARM]))
3400 p_ptr->ryoute = TRUE;
3404 switch (p_ptr->pclass)
3407 case CLASS_FORCETRAINER:
3408 case CLASS_BERSERKER:
3409 if (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3411 p_ptr->migite = TRUE;
3412 p_ptr->ryoute = TRUE;
3419 if (!p_ptr->migite && !p_ptr->hidarite)
3421 if (empty_hands_status & EMPTY_HAND_RARM) p_ptr->migite = TRUE;
3422 else if (empty_hands_status == EMPTY_HAND_LARM)
3424 p_ptr->hidarite = TRUE;
3429 if (p_ptr->special_defense & KAMAE_MASK)
3431 if (!(empty_hands_status & EMPTY_HAND_RARM))
3433 set_action(ACTION_NONE);
3437 switch (p_ptr->pclass)
3440 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3441 if (p_ptr->lev > 44) p_ptr->regenerate = TRUE;
3444 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3446 case CLASS_CHAOS_WARRIOR:
3447 if (p_ptr->lev > 29) p_ptr->resist_chaos = TRUE;
3448 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3450 case CLASS_MINDCRAFTER:
3451 if (p_ptr->lev > 9) p_ptr->resist_fear = TRUE;
3452 if (p_ptr->lev > 19) p_ptr->sustain_wis = TRUE;
3453 if (p_ptr->lev > 29) p_ptr->resist_conf = TRUE;
3454 if (p_ptr->lev > 39) p_ptr->telepathy = TRUE;
3457 case CLASS_FORCETRAINER:
3458 /* Unencumbered Monks become faster every 10 levels */
3459 if (!(heavy_armor()))
3461 if (!(prace_is_(RACE_KLACKON) ||
3462 prace_is_(RACE_SPRITE) ||
3463 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3464 new_speed += (p_ptr->lev) / 10;
3466 /* Free action if unencumbered at level 25 */
3467 if (p_ptr->lev > 24)
3468 p_ptr->free_act = TRUE;
3471 case CLASS_SORCERER:
3473 p_ptr->dis_to_a -= 50;
3476 p_ptr->resist_sound = TRUE;
3479 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3481 case CLASS_BERSERKER:
3483 p_ptr->sustain_str = TRUE;
3484 p_ptr->sustain_dex = TRUE;
3485 p_ptr->sustain_con = TRUE;
3486 p_ptr->regenerate = TRUE;
3487 p_ptr->free_act = TRUE;
3489 if (p_ptr->lev > 29) new_speed++;
3490 if (p_ptr->lev > 39) new_speed++;
3491 if (p_ptr->lev > 44) new_speed++;
3492 if (p_ptr->lev > 49) new_speed++;
3493 p_ptr->to_a += 10+p_ptr->lev/2;
3494 p_ptr->dis_to_a += 10+p_ptr->lev/2;
3495 p_ptr->skill_dig += (100+p_ptr->lev*8);
3496 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3497 p_ptr->redraw |= PR_STATUS;
3499 case CLASS_MIRROR_MASTER:
3500 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3503 /* Unencumbered Ninjas become faster every 10 levels */
3506 new_speed -= (p_ptr->lev) / 10;
3507 p_ptr->skill_stl -= (p_ptr->lev)/10;
3509 else if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
3510 (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
3513 if (!(prace_is_(RACE_KLACKON) ||
3514 prace_is_(RACE_SPRITE) ||
3515 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3516 new_speed += (p_ptr->lev) / 10;
3517 p_ptr->skill_stl += (p_ptr->lev)/10;
3519 /* Free action if unencumbered at level 25 */
3520 if (p_ptr->lev > 24)
3521 p_ptr->free_act = TRUE;
3523 if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
3524 (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
3526 p_ptr->to_a += p_ptr->lev/2+5;
3527 p_ptr->dis_to_a += p_ptr->lev/2+5;
3529 p_ptr->slow_digest = TRUE;
3530 p_ptr->resist_fear = TRUE;
3531 if (p_ptr->lev > 19) p_ptr->resist_pois = TRUE;
3532 if (p_ptr->lev > 24) p_ptr->sustain_dex = TRUE;
3533 if (p_ptr->lev > 29) p_ptr->see_inv = TRUE;
3534 if (p_ptr->lev > 44)
3536 p_ptr->oppose_pois = 1;
3537 p_ptr->redraw |= PR_STATUS;
3539 p_ptr->see_nocto = TRUE;
3544 if (p_ptr->mimic_form)
3546 switch (p_ptr->mimic_form)
3549 p_ptr->hold_exp = TRUE;
3550 p_ptr->resist_chaos = TRUE;
3551 p_ptr->resist_neth = TRUE;
3552 p_ptr->resist_fire = TRUE;
3553 p_ptr->oppose_fire = 1;
3554 p_ptr->see_inv=TRUE;
3556 p_ptr->redraw |= PR_STATUS;
3558 p_ptr->dis_to_a += 10;
3559 p_ptr->align -= 200;
3561 case MIMIC_DEMON_LORD:
3562 p_ptr->hold_exp = TRUE;
3563 p_ptr->resist_chaos = TRUE;
3564 p_ptr->resist_neth = TRUE;
3565 p_ptr->immune_fire = TRUE;
3566 p_ptr->resist_acid = TRUE;
3567 p_ptr->resist_fire = TRUE;
3568 p_ptr->resist_cold = TRUE;
3569 p_ptr->resist_elec = TRUE;
3570 p_ptr->resist_pois = TRUE;
3571 p_ptr->resist_conf = TRUE;
3572 p_ptr->resist_disen = TRUE;
3573 p_ptr->resist_nexus = TRUE;
3574 p_ptr->resist_fear = TRUE;
3575 p_ptr->sh_fire = TRUE;
3576 p_ptr->see_inv = TRUE;
3577 p_ptr->telepathy = TRUE;
3578 p_ptr->levitation = TRUE;
3579 p_ptr->kill_wall = TRUE;
3582 p_ptr->dis_to_a += 20;
3583 p_ptr->align -= 200;
3586 p_ptr->resist_dark = TRUE;
3587 p_ptr->hold_exp = TRUE;
3588 p_ptr->resist_neth = TRUE;
3589 p_ptr->resist_cold = TRUE;
3590 p_ptr->resist_pois = TRUE;
3591 p_ptr->see_inv = TRUE;
3594 p_ptr->dis_to_a += 10;
3595 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3601 switch (p_ptr->prace)
3604 p_ptr->resist_lite = TRUE;
3607 p_ptr->hold_exp = TRUE;
3610 p_ptr->free_act = TRUE;
3613 p_ptr->resist_blind = TRUE;
3616 p_ptr->resist_dark = TRUE;
3618 case RACE_HALF_TROLL:
3619 p_ptr->sustain_str = TRUE;
3621 if (p_ptr->lev > 14)
3623 /* High level trolls heal fast... */
3624 p_ptr->regenerate = TRUE;
3626 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_BERSERKER)
3628 p_ptr->slow_digest = TRUE;
3629 /* Let's not make Regeneration
3630 * a disadvantage for the poor warriors who can
3631 * never learn a spell that satisfies hunger (actually
3632 * neither can rogues, but half-trolls are not
3633 * supposed to play rogues) */
3638 p_ptr->sustain_con = TRUE;
3639 p_ptr->regenerate = TRUE; /* Amberites heal fast... */
3642 p_ptr->resist_lite = TRUE;
3643 p_ptr->see_inv = TRUE;
3645 case RACE_BARBARIAN:
3646 p_ptr->resist_fear = TRUE;
3648 case RACE_HALF_OGRE:
3649 p_ptr->resist_dark = TRUE;
3650 p_ptr->sustain_str = TRUE;
3652 case RACE_HALF_GIANT:
3653 p_ptr->sustain_str = TRUE;
3654 p_ptr->resist_shard = TRUE;
3656 case RACE_HALF_TITAN:
3657 p_ptr->resist_chaos = TRUE;
3660 p_ptr->resist_sound = TRUE;
3663 p_ptr->resist_acid = TRUE;
3664 if (p_ptr->lev > 19) p_ptr->immune_acid = TRUE;
3667 p_ptr->resist_conf = TRUE;
3668 p_ptr->resist_acid = TRUE;
3670 /* Klackons become faster */
3671 new_speed += (p_ptr->lev) / 10;
3674 p_ptr->resist_pois = TRUE;
3677 p_ptr->resist_disen = TRUE;
3678 p_ptr->resist_dark = TRUE;
3681 p_ptr->resist_dark = TRUE;
3682 if (p_ptr->lev > 19) p_ptr->see_inv = TRUE;
3684 case RACE_DRACONIAN:
3685 p_ptr->levitation = TRUE;
3686 if (p_ptr->lev > 4) p_ptr->resist_fire = TRUE;
3687 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3688 if (p_ptr->lev > 14) p_ptr->resist_acid = TRUE;
3689 if (p_ptr->lev > 19) p_ptr->resist_elec = TRUE;
3690 if (p_ptr->lev > 34) p_ptr->resist_pois = TRUE;
3692 case RACE_MIND_FLAYER:
3693 p_ptr->sustain_int = TRUE;
3694 p_ptr->sustain_wis = TRUE;
3695 if (p_ptr->lev > 14) p_ptr->see_inv = TRUE;
3696 if (p_ptr->lev > 29) p_ptr->telepathy = TRUE;
3699 p_ptr->resist_fire = TRUE;
3700 if (p_ptr->lev > 9) p_ptr->see_inv = TRUE;
3703 p_ptr->slow_digest = TRUE;
3704 p_ptr->free_act = TRUE;
3705 p_ptr->see_inv = TRUE;
3706 p_ptr->resist_pois = TRUE;
3707 if (p_ptr->lev > 34) p_ptr->hold_exp = TRUE;
3710 p_ptr->resist_shard = TRUE;
3711 p_ptr->hold_exp = TRUE;
3712 p_ptr->see_inv = TRUE;
3713 p_ptr->resist_pois = TRUE;
3714 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3717 p_ptr->resist_neth = TRUE;
3718 p_ptr->hold_exp = TRUE;
3719 p_ptr->see_inv = TRUE;
3720 p_ptr->resist_pois = TRUE;
3721 p_ptr->slow_digest = TRUE;
3722 if (p_ptr->lev > 4) p_ptr->resist_cold = TRUE;
3725 p_ptr->resist_dark = TRUE;
3726 p_ptr->hold_exp = TRUE;
3727 p_ptr->resist_neth = TRUE;
3728 p_ptr->resist_cold = TRUE;
3729 p_ptr->resist_pois = TRUE;
3730 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3733 p_ptr->levitation = TRUE;
3734 p_ptr->free_act = TRUE;
3735 p_ptr->resist_neth = TRUE;
3736 p_ptr->hold_exp = TRUE;
3737 p_ptr->see_inv = TRUE;
3738 p_ptr->resist_pois = TRUE;
3739 p_ptr->slow_digest = TRUE;
3740 p_ptr->resist_cold = TRUE;
3741 p_ptr->pass_wall = TRUE;
3742 if (p_ptr->lev > 34) p_ptr->telepathy = TRUE;
3745 p_ptr->levitation = TRUE;
3746 p_ptr->resist_lite = TRUE;
3748 /* Sprites become faster */
3749 new_speed += (p_ptr->lev) / 10;
3752 p_ptr->resist_conf = TRUE;
3753 p_ptr->resist_sound = TRUE;
3756 /* Ents dig like maniacs, but only with their hands. */
3757 if (!inventory[INVEN_RARM].k_idx)
3758 p_ptr->skill_dig += p_ptr->lev * 10;
3759 /* Ents get tougher and stronger as they age, but lose dexterity. */
3760 if (p_ptr->lev > 25) p_ptr->stat_add[A_STR]++;
3761 if (p_ptr->lev > 40) p_ptr->stat_add[A_STR]++;
3762 if (p_ptr->lev > 45) p_ptr->stat_add[A_STR]++;
3764 if (p_ptr->lev > 25) p_ptr->stat_add[A_DEX]--;
3765 if (p_ptr->lev > 40) p_ptr->stat_add[A_DEX]--;
3766 if (p_ptr->lev > 45) p_ptr->stat_add[A_DEX]--;
3768 if (p_ptr->lev > 25) p_ptr->stat_add[A_CON]++;
3769 if (p_ptr->lev > 40) p_ptr->stat_add[A_CON]++;
3770 if (p_ptr->lev > 45) p_ptr->stat_add[A_CON]++;
3773 p_ptr->levitation = TRUE;
3774 p_ptr->see_inv = TRUE;
3775 p_ptr->align += 200;
3778 p_ptr->resist_fire = TRUE;
3779 p_ptr->resist_neth = TRUE;
3780 p_ptr->hold_exp = TRUE;
3781 if (p_ptr->lev > 9) p_ptr->see_inv = TRUE;
3782 if (p_ptr->lev > 44)
3784 p_ptr->oppose_fire = 1;
3785 p_ptr->redraw |= PR_STATUS;
3787 p_ptr->align -= 200;
3790 p_ptr->sustain_con = TRUE;
3793 p_ptr->levitation = TRUE;
3796 p_ptr->resist_conf = TRUE;
3799 p_ptr->slow_digest = TRUE;
3800 p_ptr->free_act = TRUE;
3801 p_ptr->resist_pois = TRUE;
3802 p_ptr->hold_exp = TRUE;
3810 if (p_ptr->ult_res || (p_ptr->special_defense & KATA_MUSOU))
3812 p_ptr->see_inv = TRUE;
3813 p_ptr->free_act = TRUE;
3814 p_ptr->slow_digest = TRUE;
3815 p_ptr->regenerate = TRUE;
3816 p_ptr->levitation = TRUE;
3817 p_ptr->hold_exp = TRUE;
3818 p_ptr->telepathy = TRUE;
3820 p_ptr->sustain_str = TRUE;
3821 p_ptr->sustain_int = TRUE;
3822 p_ptr->sustain_wis = TRUE;
3823 p_ptr->sustain_con = TRUE;
3824 p_ptr->sustain_dex = TRUE;
3825 p_ptr->sustain_chr = TRUE;
3826 p_ptr->resist_acid = TRUE;
3827 p_ptr->resist_elec = TRUE;
3828 p_ptr->resist_fire = TRUE;
3829 p_ptr->resist_cold = TRUE;
3830 p_ptr->resist_pois = TRUE;
3831 p_ptr->resist_conf = TRUE;
3832 p_ptr->resist_sound = TRUE;
3833 p_ptr->resist_lite = TRUE;
3834 p_ptr->resist_dark = TRUE;
3835 p_ptr->resist_chaos = TRUE;
3836 p_ptr->resist_disen = TRUE;
3837 p_ptr->resist_shard = TRUE;
3838 p_ptr->resist_nexus = TRUE;
3839 p_ptr->resist_blind = TRUE;
3840 p_ptr->resist_neth = TRUE;
3841 p_ptr->resist_fear = TRUE;
3842 p_ptr->reflect = TRUE;
3843 p_ptr->sh_fire = TRUE;
3844 p_ptr->sh_elec = TRUE;
3845 p_ptr->sh_cold = TRUE;
3847 p_ptr->dis_to_a += 100;
3849 /* Temporary shield */
3850 else if (p_ptr->tsubureru || p_ptr->shield || p_ptr->magicdef)
3853 p_ptr->dis_to_a += 50;
3856 if (p_ptr->tim_res_nether)
3858 p_ptr->resist_neth = TRUE;
3860 if (p_ptr->tim_sh_fire)
3862 p_ptr->sh_fire = TRUE;
3864 if (p_ptr->tim_res_time)
3866 p_ptr->resist_time = TRUE;
3870 if (p_ptr->pseikaku == SEIKAKU_SEXY) p_ptr->cursed |= (TRC_AGGRAVATE);
3871 if (p_ptr->pseikaku == SEIKAKU_NAMAKE) p_ptr->to_m_chance += 10;
3872 if (p_ptr->pseikaku == SEIKAKU_KIREMONO) p_ptr->to_m_chance -= 3;
3873 if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) p_ptr->to_m_chance++;
3876 if (p_ptr->pseikaku == SEIKAKU_LUCKY) p_ptr->muta3 |= MUT3_GOOD_LUCK;
3878 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
3880 p_ptr->resist_blind = TRUE;
3881 p_ptr->resist_conf = TRUE;
3882 p_ptr->hold_exp = TRUE;
3883 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3885 if ((p_ptr->prace != RACE_KLACKON) && (p_ptr->prace != RACE_SPRITE))
3886 /* Munchkin become faster */
3887 new_speed += (p_ptr->lev) / 10 + 5;
3890 if (music_singing(MUSIC_WALL))
3892 p_ptr->kill_wall = TRUE;
3895 /* Hack -- apply racial/class stat maxes */
3896 /* Apply the racial modifiers */
3897 for (i = 0; i < 6; i++)
3899 /* Modify the stats for "race" */
3900 p_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
3904 /* I'm adding the mutations here for the lack of a better place... */
3907 /* Hyper Strength */
3908 if (p_ptr->muta3 & MUT3_HYPER_STR)
3910 p_ptr->stat_add[A_STR] += 4;
3914 if (p_ptr->muta3 & MUT3_PUNY)
3916 p_ptr->stat_add[A_STR] -= 4;
3919 /* Living computer */
3920 if (p_ptr->muta3 & MUT3_HYPER_INT)
3922 p_ptr->stat_add[A_INT] += 4;
3923 p_ptr->stat_add[A_WIS] += 4;
3927 if (p_ptr->muta3 & MUT3_MORONIC)
3929 p_ptr->stat_add[A_INT] -= 4;
3930 p_ptr->stat_add[A_WIS] -= 4;
3933 if (p_ptr->muta3 & MUT3_RESILIENT)
3935 p_ptr->stat_add[A_CON] += 4;
3938 if (p_ptr->muta3 & MUT3_XTRA_FAT)
3940 p_ptr->stat_add[A_CON] += 2;
3944 if (p_ptr->muta3 & MUT3_ALBINO)
3946 p_ptr->stat_add[A_CON] -= 4;
3949 if (p_ptr->muta3 & MUT3_FLESH_ROT)
3951 p_ptr->stat_add[A_CON] -= 2;
3952 p_ptr->stat_add[A_CHR] -= 1;
3953 p_ptr->regenerate = FALSE;
3954 /* Cancel innate regeneration */
3957 if (p_ptr->muta3 & MUT3_SILLY_VOI)
3959 p_ptr->stat_add[A_CHR] -= 4;
3962 if (p_ptr->muta3 & MUT3_BLANK_FAC)
3964 p_ptr->stat_add[A_CHR] -= 1;
3967 if (p_ptr->muta3 & MUT3_XTRA_EYES)
3969 p_ptr->skill_fos += 15;
3970 p_ptr->skill_srh += 15;
3973 if (p_ptr->muta3 & MUT3_MAGIC_RES)
3975 p_ptr->skill_sav += (15 + (p_ptr->lev / 5));
3978 if (p_ptr->muta3 & MUT3_XTRA_NOIS)
3980 p_ptr->skill_stl -= 3;
3983 if (p_ptr->muta3 & MUT3_INFRAVIS)
3985 p_ptr->see_infra += 3;
3988 if (p_ptr->muta3 & MUT3_XTRA_LEGS)
3993 if (p_ptr->muta3 & MUT3_SHORT_LEG)
3998 if (p_ptr->muta3 & MUT3_ELEC_TOUC)
4000 p_ptr->sh_elec = TRUE;
4003 if (p_ptr->muta3 & MUT3_FIRE_BODY)
4005 p_ptr->sh_fire = TRUE;
4009 if (p_ptr->muta3 & MUT3_WART_SKIN)
4011 p_ptr->stat_add[A_CHR] -= 2;
4013 p_ptr->dis_to_a += 5;
4016 if (p_ptr->muta3 & MUT3_SCALES)
4018 p_ptr->stat_add[A_CHR] -= 1;
4020 p_ptr->dis_to_a += 10;
4023 if (p_ptr->muta3 & MUT3_IRON_SKIN)
4025 p_ptr->stat_add[A_DEX] -= 1;
4027 p_ptr->dis_to_a += 25;
4030 if (p_ptr->muta3 & MUT3_WINGS)
4032 p_ptr->levitation = TRUE;
4035 if (p_ptr->muta3 & MUT3_FEARLESS)
4037 p_ptr->resist_fear = TRUE;
4040 if (p_ptr->muta3 & MUT3_REGEN)
4042 p_ptr->regenerate = TRUE;
4045 if (p_ptr->muta3 & MUT3_ESP)
4047 p_ptr->telepathy = TRUE;
4050 if (p_ptr->muta3 & MUT3_LIMBER)
4052 p_ptr->stat_add[A_DEX] += 3;
4055 if (p_ptr->muta3 & MUT3_ARTHRITIS)
4057 p_ptr->stat_add[A_DEX] -= 3;
4060 if (p_ptr->muta3 & MUT3_MOTION)
4062 p_ptr->free_act = TRUE;
4063 p_ptr->skill_stl += 1;
4066 if (p_ptr->muta3 & MUT3_ILL_NORM)
4068 p_ptr->stat_add[A_CHR] = 0;
4072 if (p_ptr->tsuyoshi)
4074 p_ptr->stat_add[A_STR] += 4;
4075 p_ptr->stat_add[A_CON] += 4;
4078 /* Scan the usable inventory */
4079 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
4081 int bonus_to_h, bonus_to_d;
4082 o_ptr = &inventory[i];
4084 /* Skip non-objects */
4085 if (!o_ptr->k_idx) continue;
4087 /* Extract the item flags */
4088 object_flags(o_ptr, flgs);
4090 p_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
4091 if (o_ptr->name1 == ART_CHAINSWORD) p_ptr->cursed |= TRC_CHAINSWORD;
4094 if (have_flag(flgs, TR_STR)) p_ptr->stat_add[A_STR] += o_ptr->pval;
4095 if (have_flag(flgs, TR_INT)) p_ptr->stat_add[A_INT] += o_ptr->pval;
4096 if (have_flag(flgs, TR_WIS)) p_ptr->stat_add[A_WIS] += o_ptr->pval;
4097 if (have_flag(flgs, TR_DEX)) p_ptr->stat_add[A_DEX] += o_ptr->pval;
4098 if (have_flag(flgs, TR_CON)) p_ptr->stat_add[A_CON] += o_ptr->pval;
4099 if (have_flag(flgs, TR_CHR)) p_ptr->stat_add[A_CHR] += o_ptr->pval;
4101 if (have_flag(flgs, TR_MAGIC_MASTERY)) p_ptr->skill_dev += 8*o_ptr->pval;
4103 /* Affect stealth */
4104 if (have_flag(flgs, TR_STEALTH)) p_ptr->skill_stl += o_ptr->pval;
4106 /* Affect searching ability (factor of five) */
4107 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_srh += (o_ptr->pval * 5);
4109 /* Affect searching frequency (factor of five) */
4110 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_fos += (o_ptr->pval * 5);
4112 /* Affect infravision */
4113 if (have_flag(flgs, TR_INFRA)) p_ptr->see_infra += o_ptr->pval;
4115 /* Affect digging (factor of 20) */
4116 if (have_flag(flgs, TR_TUNNEL)) p_ptr->skill_dig += (o_ptr->pval * 20);
4119 if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval;
4122 if (have_flag(flgs, TR_BLOWS))
4124 if((i == INVEN_RARM || i == INVEN_RIGHT) && !p_ptr->ryoute) extra_blows[0] += o_ptr->pval;
4125 else if((i == INVEN_LARM || i == INVEN_LEFT) && !p_ptr->ryoute) extra_blows[1] += o_ptr->pval;
4126 else {extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval;}
4129 /* Hack -- cause earthquakes */
4130 if (have_flag(flgs, TR_IMPACT)) p_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
4133 if (have_flag(flgs, TR_AGGRAVATE)) p_ptr->cursed |= TRC_AGGRAVATE;
4134 if (have_flag(flgs, TR_DRAIN_EXP)) p_ptr->cursed |= TRC_DRAIN_EXP;
4135 if (have_flag(flgs, TR_TY_CURSE)) p_ptr->cursed |= TRC_TY_CURSE;
4136 if (have_flag(flgs, TR_ADD_L_CURSE)) p_ptr->cursed |= TRC_ADD_L_CURSE;
4137 if (have_flag(flgs, TR_ADD_H_CURSE)) p_ptr->cursed |= TRC_ADD_H_CURSE;
4138 if (have_flag(flgs, TR_DRAIN_HP)) p_ptr->cursed |= TRC_DRAIN_HP;
4139 if (have_flag(flgs, TR_DRAIN_MANA)) p_ptr->cursed |= TRC_DRAIN_MANA;
4140 if (have_flag(flgs, TR_CALL_ANIMAL)) p_ptr->cursed |= TRC_CALL_ANIMAL;
4141 if (have_flag(flgs, TR_CALL_DEMON)) p_ptr->cursed |= TRC_CALL_DEMON;
4142 if (have_flag(flgs, TR_CALL_DRAGON)) p_ptr->cursed |= TRC_CALL_DRAGON;
4143 if (have_flag(flgs, TR_CALL_UNDEAD)) p_ptr->cursed |= TRC_CALL_UNDEAD;
4144 if (have_flag(flgs, TR_COWARDICE)) p_ptr->cursed |= TRC_COWARDICE;
4145 if (have_flag(flgs, TR_LOW_MELEE)) p_ptr->cursed |= TRC_LOW_MELEE;
4146 if (have_flag(flgs, TR_LOW_AC)) p_ptr->cursed |= TRC_LOW_AC;
4147 if (have_flag(flgs, TR_LOW_MAGIC)) p_ptr->cursed |= TRC_LOW_MAGIC;
4148 if (have_flag(flgs, TR_FAST_DIGEST)) p_ptr->cursed |= TRC_FAST_DIGEST;
4149 if (have_flag(flgs, TR_SLOW_REGEN)) p_ptr->cursed |= TRC_SLOW_REGEN;
4150 if (have_flag(flgs, TR_DEC_MANA)) p_ptr->dec_mana = TRUE;
4151 if (have_flag(flgs, TR_BLESSED)) p_ptr->bless_blade = TRUE;
4152 if (have_flag(flgs, TR_XTRA_MIGHT)) p_ptr->xtra_might = TRUE;
4153 if (have_flag(flgs, TR_SLOW_DIGEST)) p_ptr->slow_digest = TRUE;
4154 if (have_flag(flgs, TR_REGEN)) p_ptr->regenerate = TRUE;
4155 if (have_flag(flgs, TR_TELEPATHY)) p_ptr->telepathy = TRUE;
4156 if (have_flag(flgs, TR_ESP_ANIMAL)) p_ptr->esp_animal = TRUE;
4157 if (have_flag(flgs, TR_ESP_UNDEAD)) p_ptr->esp_undead = TRUE;
4158 if (have_flag(flgs, TR_ESP_DEMON)) p_ptr->esp_demon = TRUE;
4159 if (have_flag(flgs, TR_ESP_ORC)) p_ptr->esp_orc = TRUE;
4160 if (have_flag(flgs, TR_ESP_TROLL)) p_ptr->esp_troll = TRUE;
4161 if (have_flag(flgs, TR_ESP_GIANT)) p_ptr->esp_giant = TRUE;
4162 if (have_flag(flgs, TR_ESP_DRAGON)) p_ptr->esp_dragon = TRUE;
4163 if (have_flag(flgs, TR_ESP_HUMAN)) p_ptr->esp_human = TRUE;
4164 if (have_flag(flgs, TR_ESP_EVIL)) p_ptr->esp_evil = TRUE;
4165 if (have_flag(flgs, TR_ESP_GOOD)) p_ptr->esp_good = TRUE;
4166 if (have_flag(flgs, TR_ESP_NONLIVING)) p_ptr->esp_nonliving = TRUE;
4167 if (have_flag(flgs, TR_ESP_UNIQUE)) p_ptr->esp_unique = TRUE;
4169 if (have_flag(flgs, TR_SEE_INVIS)) p_ptr->see_inv = TRUE;
4170 if (have_flag(flgs, TR_LEVITATION)) p_ptr->levitation = TRUE;
4171 if (have_flag(flgs, TR_FREE_ACT)) p_ptr->free_act = TRUE;
4172 if (have_flag(flgs, TR_HOLD_EXP)) p_ptr->hold_exp = TRUE;
4173 if (have_flag(flgs, TR_WARNING)){
4174 if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription),'$')))
4175 p_ptr->warning = TRUE;
4178 if (have_flag(flgs, TR_TELEPORT))
4180 if (object_is_cursed(o_ptr)) p_ptr->cursed |= TRC_TELEPORT;
4183 cptr insc = quark_str(o_ptr->inscription);
4185 if (o_ptr->inscription && my_strchr(insc, '.'))
4188 * {.} will stop random teleportation.
4193 /* Controlled random teleportation */
4194 p_ptr->cursed |= TRC_TELEPORT_SELF;
4199 /* Immunity flags */
4200 if (have_flag(flgs, TR_IM_FIRE)) p_ptr->immune_fire = TRUE;
4201 if (have_flag(flgs, TR_IM_ACID)) p_ptr->immune_acid = TRUE;
4202 if (have_flag(flgs, TR_IM_COLD)) p_ptr->immune_cold = TRUE;
4203 if (have_flag(flgs, TR_IM_ELEC)) p_ptr->immune_elec = TRUE;
4205 /* Resistance flags */
4206 if (have_flag(flgs, TR_RES_ACID)) p_ptr->resist_acid = TRUE;
4207 if (have_flag(flgs, TR_RES_ELEC)) p_ptr->resist_elec = TRUE;
4208 if (have_flag(flgs, TR_RES_FIRE)) p_ptr->resist_fire = TRUE;
4209 if (have_flag(flgs, TR_RES_COLD)) p_ptr->resist_cold = TRUE;
4210 if (have_flag(flgs, TR_RES_POIS)) p_ptr->resist_pois = TRUE;
4211 if (have_flag(flgs, TR_RES_FEAR)) p_ptr->resist_fear = TRUE;
4212 if (have_flag(flgs, TR_RES_CONF)) p_ptr->resist_conf = TRUE;
4213 if (have_flag(flgs, TR_RES_SOUND)) p_ptr->resist_sound = TRUE;
4214 if (have_flag(flgs, TR_RES_LITE)) p_ptr->resist_lite = TRUE;
4215 if (have_flag(flgs, TR_RES_DARK)) p_ptr->resist_dark = TRUE;
4216 if (have_flag(flgs, TR_RES_CHAOS)) p_ptr->resist_chaos = TRUE;
4217 if (have_flag(flgs, TR_RES_DISEN)) p_ptr->resist_disen = TRUE;
4218 if (have_flag(flgs, TR_RES_SHARDS)) p_ptr->resist_shard = TRUE;
4219 if (have_flag(flgs, TR_RES_NEXUS)) p_ptr->resist_nexus = TRUE;
4220 if (have_flag(flgs, TR_RES_BLIND)) p_ptr->resist_blind = TRUE;
4221 if (have_flag(flgs, TR_RES_NETHER)) p_ptr->resist_neth = TRUE;
4223 if (have_flag(flgs, TR_REFLECT)) p_ptr->reflect = TRUE;
4224 if (have_flag(flgs, TR_SH_FIRE)) p_ptr->sh_fire = TRUE;
4225 if (have_flag(flgs, TR_SH_ELEC)) p_ptr->sh_elec = TRUE;
4226 if (have_flag(flgs, TR_SH_COLD)) p_ptr->sh_cold = TRUE;
4227 if (have_flag(flgs, TR_NO_MAGIC)) p_ptr->anti_magic = TRUE;
4228 if (have_flag(flgs, TR_NO_TELE)) p_ptr->anti_tele = TRUE;
4231 if (have_flag(flgs, TR_SUST_STR)) p_ptr->sustain_str = TRUE;
4232 if (have_flag(flgs, TR_SUST_INT)) p_ptr->sustain_int = TRUE;
4233 if (have_flag(flgs, TR_SUST_WIS)) p_ptr->sustain_wis = TRUE;
4234 if (have_flag(flgs, TR_SUST_DEX)) p_ptr->sustain_dex = TRUE;
4235 if (have_flag(flgs, TR_SUST_CON)) p_ptr->sustain_con = TRUE;
4236 if (have_flag(flgs, TR_SUST_CHR)) p_ptr->sustain_chr = TRUE;
4238 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
4239 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
4240 if (o_ptr->name2 == EGO_RING_RES_TIME) p_ptr->resist_time = TRUE;
4241 if (o_ptr->name2 == EGO_RING_THROW) p_ptr->mighty_throw = TRUE;
4242 if (have_flag(flgs, TR_EASY_SPELL)) p_ptr->easy_spell = TRUE;
4243 if (o_ptr->name2 == EGO_AMU_FOOL) p_ptr->heavy_spell = TRUE;
4244 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
4246 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
4248 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4250 p_ptr->to_m_chance += 10;
4254 p_ptr->to_m_chance += 3;
4258 if (o_ptr->tval == TV_CAPTURE) continue;
4260 /* Modify the base armor class */
4261 p_ptr->ac += o_ptr->ac;
4263 /* The base armor class is always known */
4264 p_ptr->dis_ac += o_ptr->ac;
4266 /* Apply the bonuses to armor class */
4267 p_ptr->to_a += o_ptr->to_a;
4269 /* Apply the mental bonuses to armor class, if known */
4270 if (object_is_known(o_ptr)) p_ptr->dis_to_a += o_ptr->to_a;
4272 if (o_ptr->curse_flags & TRC_LOW_MELEE)
4274 int slot = i - INVEN_RARM;
4277 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4279 p_ptr->to_h[slot] -= 15;
4280 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 15;
4284 p_ptr->to_h[slot] -= 5;
4285 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 5;
4290 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4292 p_ptr->to_h_b -= 15;
4293 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 15;
4298 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 5;
4303 if (o_ptr->curse_flags & TRC_LOW_AC)
4305 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4308 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 30;
4313 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 10;
4317 /* Hack -- do not apply "weapon" bonuses */
4318 if (i == INVEN_RARM && buki_motteruka(i)) continue;
4319 if (i == INVEN_LARM && buki_motteruka(i)) continue;
4321 /* Hack -- do not apply "bow" bonuses */
4322 if (i == INVEN_BOW) continue;
4324 bonus_to_h = o_ptr->to_h;
4325 bonus_to_d = o_ptr->to_d;
4327 if (p_ptr->pclass == CLASS_NINJA)
4329 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h+1)/2;
4330 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d+1)/2;
4333 /* To Bow and Natural attack */
4335 /* Apply the bonuses to hit/damage */
4336 p_ptr->to_h_b += bonus_to_h;
4337 p_ptr->to_h_m += bonus_to_h;
4338 p_ptr->to_d_m += bonus_to_d;
4340 /* Apply the mental bonuses tp hit/damage, if known */
4341 if (object_is_known(o_ptr)) p_ptr->dis_to_h_b += bonus_to_h;
4344 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !p_ptr->ryoute)
4346 /* Apply the bonuses to hit/damage */
4347 p_ptr->to_h[i-INVEN_RIGHT] += bonus_to_h;
4348 p_ptr->to_d[i-INVEN_RIGHT] += bonus_to_d;
4350 /* Apply the mental bonuses tp hit/damage, if known */
4351 if (object_is_known(o_ptr))
4353 p_ptr->dis_to_h[i-INVEN_RIGHT] += bonus_to_h;
4354 p_ptr->dis_to_d[i-INVEN_RIGHT] += bonus_to_d;
4357 else if (p_ptr->migite && p_ptr->hidarite)
4359 /* Apply the bonuses to hit/damage */
4360 p_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4361 p_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4362 p_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4363 p_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4365 /* Apply the mental bonuses tp hit/damage, if known */
4366 if (object_is_known(o_ptr))
4368 p_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4369 p_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4370 p_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4371 p_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4376 /* Apply the bonuses to hit/damage */
4377 p_ptr->to_h[default_hand] += bonus_to_h;
4378 p_ptr->to_d[default_hand] += bonus_to_d;
4380 /* Apply the mental bonuses to hit/damage, if known */
4381 if (object_is_known(o_ptr))
4383 p_ptr->dis_to_h[default_hand] += bonus_to_h;
4384 p_ptr->dis_to_d[default_hand] += bonus_to_d;
4389 if (old_mighty_throw != p_ptr->mighty_throw)
4391 /* Redraw average damege display of Shuriken */
4392 p_ptr->window |= PW_INVEN;
4395 if (p_ptr->cursed & TRC_TELEPORT) p_ptr->cursed &= ~(TRC_TELEPORT_SELF);
4397 /* Monks get extra ac for armour _not worn_ */
4398 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor())
4400 if (!(inventory[INVEN_BODY].k_idx))
4402 p_ptr->to_a += (p_ptr->lev * 3) / 2;
4403 p_ptr->dis_to_a += (p_ptr->lev * 3) / 2;
4405 if (!(inventory[INVEN_OUTER].k_idx) && (p_ptr->lev > 15))
4407 p_ptr->to_a += ((p_ptr->lev - 13) / 3);
4408 p_ptr->dis_to_a += ((p_ptr->lev - 13) / 3);
4410 if (!(inventory[INVEN_LARM].k_idx) && (p_ptr->lev > 10))
4412 p_ptr->to_a += ((p_ptr->lev - 8) / 3);
4413 p_ptr->dis_to_a += ((p_ptr->lev - 8) / 3);
4415 if (!(inventory[INVEN_HEAD].k_idx) && (p_ptr->lev > 4))
4417 p_ptr->to_a += (p_ptr->lev - 2) / 3;
4418 p_ptr->dis_to_a += (p_ptr->lev -2) / 3;
4420 if (!(inventory[INVEN_HANDS].k_idx))
4422 p_ptr->to_a += (p_ptr->lev / 2);
4423 p_ptr->dis_to_a += (p_ptr->lev / 2);
4425 if (!(inventory[INVEN_FEET].k_idx))
4427 p_ptr->to_a += (p_ptr->lev / 3);
4428 p_ptr->dis_to_a += (p_ptr->lev / 3);
4430 if (p_ptr->special_defense & KAMAE_BYAKKO)
4432 p_ptr->stat_add[A_STR] += 2;
4433 p_ptr->stat_add[A_DEX] += 2;
4434 p_ptr->stat_add[A_CON] -= 3;
4436 else if (p_ptr->special_defense & KAMAE_SEIRYU)
4439 else if (p_ptr->special_defense & KAMAE_GENBU)
4441 p_ptr->stat_add[A_INT] -= 1;
4442 p_ptr->stat_add[A_WIS] -= 1;
4443 p_ptr->stat_add[A_DEX] -= 2;
4444 p_ptr->stat_add[A_CON] += 3;
4446 else if (p_ptr->special_defense & KAMAE_SUZAKU)
4448 p_ptr->stat_add[A_STR] -= 2;
4449 p_ptr->stat_add[A_INT] += 1;
4450 p_ptr->stat_add[A_WIS] += 1;
4451 p_ptr->stat_add[A_DEX] += 2;
4452 p_ptr->stat_add[A_CON] -= 2;
4456 if (p_ptr->special_defense & KATA_KOUKIJIN)
4458 for (i = 0; i < 6; i++)
4459 p_ptr->stat_add[i] += 5;
4461 p_ptr->dis_to_a -= 50;
4464 /* Hack -- aura of fire also provides light */
4465 if (p_ptr->sh_fire) p_ptr->lite = TRUE;
4467 /* Golems also get an intrinsic AC bonus */
4468 if (prace_is_(RACE_GOLEM) || prace_is_(RACE_ANDROID))
4470 p_ptr->to_a += 10 + (p_ptr->lev * 2 / 5);
4471 p_ptr->dis_to_a += 10 + (p_ptr->lev * 2 / 5);
4475 if (p_ptr->realm1 == REALM_HEX)
4477 if (hex_spelling_any()) p_ptr->skill_stl -= (1 + p_ptr->magic_num2[0]);
4478 if (hex_spelling(HEX_DETECT_EVIL)) p_ptr->esp_evil = TRUE;
4479 if (hex_spelling(HEX_XTRA_MIGHT)) p_ptr->stat_add[A_STR] += 4;
4480 if (hex_spelling(HEX_BUILDING))
4482 p_ptr->stat_add[A_STR] += 4;
4483 p_ptr->stat_add[A_DEX] += 4;
4484 p_ptr->stat_add[A_CON] += 4;
4486 if (hex_spelling(HEX_DEMON_AURA))
4488 p_ptr->sh_fire = TRUE;
4489 p_ptr->regenerate = TRUE;
4491 if (hex_spelling(HEX_ICE_ARMOR))
4493 p_ptr->sh_cold = TRUE;
4495 p_ptr->dis_to_a += 30;
4497 if (hex_spelling(HEX_SHOCK_CLOAK))
4499 p_ptr->sh_elec = TRUE;
4502 for (i = INVEN_RARM; i <= INVEN_FEET; i++)
4505 o_ptr = &inventory[i];
4506 if (!o_ptr->k_idx) continue;
4507 if (!object_is_armour(o_ptr)) continue;
4508 if (!object_is_cursed(o_ptr)) continue;
4510 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
4511 if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
4513 p_ptr->dis_to_a += ac;
4517 /* Calculate stats */
4518 for (i = 0; i < 6; i++)
4522 /* Extract the new "stat_use" value for the stat */
4523 top = modify_stat_value(p_ptr->stat_max[i], p_ptr->stat_add[i]);
4525 /* Notice changes */
4526 if (p_ptr->stat_top[i] != top)
4528 /* Save the new value */
4529 p_ptr->stat_top[i] = top;
4531 /* Redisplay the stats later */
4532 p_ptr->redraw |= (PR_STATS);
4535 p_ptr->window |= (PW_PLAYER);
4539 /* Extract the new "stat_use" value for the stat */
4540 use = modify_stat_value(p_ptr->stat_cur[i], p_ptr->stat_add[i]);
4542 if ((i == A_CHR) && (p_ptr->muta3 & MUT3_ILL_NORM))
4544 /* 10 to 18/90 charisma, guaranteed, based on level */
4545 if (use < 8 + 2 * p_ptr->lev)
4547 use = 8 + 2 * p_ptr->lev;
4551 /* Notice changes */
4552 if (p_ptr->stat_use[i] != use)
4554 /* Save the new value */
4555 p_ptr->stat_use[i] = use;
4557 /* Redisplay the stats later */
4558 p_ptr->redraw |= (PR_STATS);
4561 p_ptr->window |= (PW_PLAYER);
4565 /* Values: 3, 4, ..., 17 */
4566 if (use <= 18) ind = (use - 3);
4568 /* Ranges: 18/00-18/09, ..., 18/210-18/219 */
4569 else if (use <= 18+219) ind = (15 + (use - 18) / 10);
4571 /* Range: 18/220+ */
4574 /* Notice changes */
4575 if (p_ptr->stat_ind[i] != ind)
4577 /* Save the new index */
4578 p_ptr->stat_ind[i] = ind;
4580 /* Change in CON affects Hitpoints */
4583 p_ptr->update |= (PU_HP);
4586 /* Change in INT may affect Mana/Spells */
4587 else if (i == A_INT)
4589 if (mp_ptr->spell_stat == A_INT)
4591 p_ptr->update |= (PU_MANA | PU_SPELLS);
4595 /* Change in WIS may affect Mana/Spells */
4596 else if (i == A_WIS)
4598 if (mp_ptr->spell_stat == A_WIS)
4600 p_ptr->update |= (PU_MANA | PU_SPELLS);
4604 /* Change in WIS may affect Mana/Spells */
4605 else if (i == A_CHR)
4607 if (mp_ptr->spell_stat == A_CHR)
4609 p_ptr->update |= (PU_MANA | PU_SPELLS);
4614 p_ptr->window |= (PW_PLAYER);
4619 /* Apply temporary "stun" */
4620 if (p_ptr->stun > 50)
4622 p_ptr->to_h[0] -= 20;
4623 p_ptr->to_h[1] -= 20;
4624 p_ptr->to_h_b -= 20;
4625 p_ptr->to_h_m -= 20;
4626 p_ptr->dis_to_h[0] -= 20;
4627 p_ptr->dis_to_h[1] -= 20;
4628 p_ptr->dis_to_h_b -= 20;
4629 p_ptr->to_d[0] -= 20;
4630 p_ptr->to_d[1] -= 20;
4631 p_ptr->to_d_m -= 20;
4632 p_ptr->dis_to_d[0] -= 20;
4633 p_ptr->dis_to_d[1] -= 20;
4635 else if (p_ptr->stun)
4637 p_ptr->to_h[0] -= 5;
4638 p_ptr->to_h[1] -= 5;
4641 p_ptr->dis_to_h[0] -= 5;
4642 p_ptr->dis_to_h[1] -= 5;
4643 p_ptr->dis_to_h_b -= 5;
4644 p_ptr->to_d[0] -= 5;
4645 p_ptr->to_d[1] -= 5;
4647 p_ptr->dis_to_d[0] -= 5;
4648 p_ptr->dis_to_d[1] -= 5;
4652 if (p_ptr->wraith_form)
4654 p_ptr->reflect = TRUE;
4655 p_ptr->pass_wall = TRUE;
4658 if (p_ptr->kabenuke)
4660 p_ptr->pass_wall = TRUE;
4663 /* Temporary blessing */
4667 p_ptr->dis_to_a += 5;
4668 p_ptr->to_h[0] += 10;
4669 p_ptr->to_h[1] += 10;
4670 p_ptr->to_h_b += 10;
4671 p_ptr->to_h_m += 10;
4672 p_ptr->dis_to_h[0] += 10;
4673 p_ptr->dis_to_h[1] += 10;
4674 p_ptr->dis_to_h_b += 10;
4677 if (p_ptr->magicdef)
4679 p_ptr->resist_blind = TRUE;
4680 p_ptr->resist_conf = TRUE;
4681 p_ptr->reflect = TRUE;
4682 p_ptr->free_act = TRUE;
4683 p_ptr->levitation = TRUE;
4686 /* Temporary "Hero" */
4689 p_ptr->to_h[0] += 12;
4690 p_ptr->to_h[1] += 12;
4691 p_ptr->to_h_b += 12;
4692 p_ptr->to_h_m += 12;
4693 p_ptr->dis_to_h[0] += 12;
4694 p_ptr->dis_to_h[1] += 12;
4695 p_ptr->dis_to_h_b += 12;
4698 /* Temporary "Beserk" */
4701 p_ptr->to_h[0] += 12;
4702 p_ptr->to_h[1] += 12;
4703 p_ptr->to_h_b -= 12;
4704 p_ptr->to_h_m += 12;
4705 p_ptr->to_d[0] += 3+(p_ptr->lev/5);
4706 p_ptr->to_d[1] += 3+(p_ptr->lev/5);
4707 p_ptr->to_d_m += 3+(p_ptr->lev/5);
4708 p_ptr->dis_to_h[0] += 12;
4709 p_ptr->dis_to_h[1] += 12;
4710 p_ptr->dis_to_h_b -= 12;
4711 p_ptr->dis_to_d[0] += 3+(p_ptr->lev/5);
4712 p_ptr->dis_to_d[1] += 3+(p_ptr->lev/5);
4714 p_ptr->dis_to_a -= 10;
4715 p_ptr->skill_stl -= 7;
4716 p_ptr->skill_dev -= 20;
4717 p_ptr->skill_sav -= 30;
4718 p_ptr->skill_srh -= 15;
4719 p_ptr->skill_fos -= 15;
4720 p_ptr->skill_tht -= 20;
4721 p_ptr->skill_dig += 30;
4724 /* Temporary "fast" */
4730 /* Temporary "slow" */
4736 /* Temporary "telepathy" */
4739 p_ptr->telepathy = TRUE;
4742 if (p_ptr->ele_immune)
4744 if (p_ptr->special_defense & DEFENSE_ACID)
4745 p_ptr->immune_acid = TRUE;
4746 else if (p_ptr->special_defense & DEFENSE_ELEC)
4747 p_ptr->immune_elec = TRUE;
4748 else if (p_ptr->special_defense & DEFENSE_FIRE)
4749 p_ptr->immune_fire = TRUE;
4750 else if (p_ptr->special_defense & DEFENSE_COLD)
4751 p_ptr->immune_cold = TRUE;
4754 /* Temporary see invisible */
4755 if (p_ptr->tim_invis)
4757 p_ptr->see_inv = TRUE;
4760 /* Temporary infravision boost */
4761 if (p_ptr->tim_infra)
4763 p_ptr->see_infra+=3;
4766 /* Temporary regeneration boost */
4767 if (p_ptr->tim_regen)
4769 p_ptr->regenerate = TRUE;
4772 /* Temporary levitation */
4773 if (p_ptr->tim_levitation)
4775 p_ptr->levitation = TRUE;
4778 /* Temporary reflection */
4779 if (p_ptr->tim_reflect)
4781 p_ptr->reflect = TRUE;
4784 /* Hack -- Hero/Shero -> Res fear */
4785 if (IS_HERO() || p_ptr->shero)
4787 p_ptr->resist_fear = TRUE;
4791 /* Hack -- Telepathy Change */
4792 if (p_ptr->telepathy != old_telepathy)
4794 p_ptr->update |= (PU_MONSTERS);
4797 if ((p_ptr->esp_animal != old_esp_animal) ||
4798 (p_ptr->esp_undead != old_esp_undead) ||
4799 (p_ptr->esp_demon != old_esp_demon) ||
4800 (p_ptr->esp_orc != old_esp_orc) ||
4801 (p_ptr->esp_troll != old_esp_troll) ||
4802 (p_ptr->esp_giant != old_esp_giant) ||
4803 (p_ptr->esp_dragon != old_esp_dragon) ||
4804 (p_ptr->esp_human != old_esp_human) ||
4805 (p_ptr->esp_evil != old_esp_evil) ||
4806 (p_ptr->esp_good != old_esp_good) ||
4807 (p_ptr->esp_nonliving != old_esp_nonliving) ||
4808 (p_ptr->esp_unique != old_esp_unique))
4810 p_ptr->update |= (PU_MONSTERS);
4813 /* Hack -- See Invis Change */
4814 if (p_ptr->see_inv != old_see_inv)
4816 p_ptr->update |= (PU_MONSTERS);
4819 /* Bloating slows the player down (a little) */
4820 if (p_ptr->food >= PY_FOOD_MAX) new_speed -= 10;
4822 if (p_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10;
4824 if ((p_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) ||
4825 (p_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM)))
4827 p_ptr->to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
4828 p_ptr->dis_to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
4831 if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
4833 int penalty1, penalty2;
4834 penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_RARM].weight) / 8);
4835 penalty2 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_LARM].weight) / 8);
4836 if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN))
4838 penalty1 = penalty1 / 2 - 5;
4839 penalty2 = penalty2 / 2 - 5;
4842 p_ptr->dis_to_a += 10;
4846 if (penalty1 > 0) penalty1 /= 2;
4847 if (penalty2 > 0) penalty2 /= 2;
4849 else if ((inventory[INVEN_LARM].tval == TV_SWORD) && ((inventory[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (inventory[INVEN_LARM].sval == SV_WAKIZASHI)))
4851 penalty1 = MAX(0, penalty1 - 10);
4852 penalty2 = MAX(0, penalty2 - 10);
4854 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
4856 penalty1 = MIN(0, penalty1);
4857 penalty2 = MIN(0, penalty2);
4859 p_ptr->dis_to_a += 10;
4863 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
4865 if ((inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
4868 if (inventory[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
4869 if (inventory[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
4870 p_ptr->to_h[0] -= penalty1;
4871 p_ptr->to_h[1] -= penalty2;
4872 p_ptr->dis_to_h[0] -= penalty1;
4873 p_ptr->dis_to_h[1] -= penalty2;
4876 /* Extract the current weight (in tenth pounds) */
4877 j = p_ptr->total_weight;
4881 /* Extract the "weight limit" (in tenth pounds) */
4882 i = (int)weight_limit();
4886 monster_type *riding_m_ptr = &m_list[p_ptr->riding];
4887 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
4888 int speed = riding_m_ptr->mspeed;
4890 if (riding_m_ptr->mspeed > 110)
4892 new_speed = 110 + (s16b)((speed - 110) * (p_ptr->skill_exp[GINOU_RIDING] * 3 + p_ptr->lev * 160L - 10000L) / (22000L));
4893 if (new_speed < 110) new_speed = 110;
4899 new_speed += (p_ptr->skill_exp[GINOU_RIDING] + p_ptr->lev *160L)/3200;
4900 if (MON_FAST(riding_m_ptr)) new_speed += 10;
4901 if (MON_SLOW(riding_m_ptr)) new_speed -= 10;
4902 riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
4903 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE;
4905 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) p_ptr->pass_wall = FALSE;
4906 if (riding_r_ptr->flags2 & RF2_KILL_WALL) p_ptr->kill_wall = TRUE;
4908 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;
4910 /* Extract the "weight limit" */
4911 i = 1500 + riding_r_ptr->level * 25;
4914 /* XXX XXX XXX Apply "encumbrance" from weight */
4915 if (j > i) new_speed -= ((j - i) / (i / 5));
4917 /* Searching slows the player down */
4918 if (p_ptr->action == ACTION_SEARCH) new_speed -= 10;
4920 /* Actual Modifier Bonuses (Un-inflate stat bonuses) */
4921 p_ptr->to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4922 p_ptr->to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4923 p_ptr->to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4924 p_ptr->to_d_m += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4925 p_ptr->to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4926 p_ptr->to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4927 p_ptr->to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4928 p_ptr->to_h_m += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4929 p_ptr->to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4930 p_ptr->to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4931 p_ptr->to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4932 p_ptr->to_h_m += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4934 /* Displayed Modifier Bonuses (Un-inflate stat bonuses) */
4935 p_ptr->dis_to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4936 p_ptr->dis_to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4937 p_ptr->dis_to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4938 p_ptr->dis_to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4939 p_ptr->dis_to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4940 p_ptr->dis_to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4941 p_ptr->dis_to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4942 p_ptr->dis_to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4943 p_ptr->dis_to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4946 /* Obtain the "hold" value */
4947 hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
4950 /* Examine the "current bow" */
4951 o_ptr = &inventory[INVEN_BOW];
4953 /* It is hard to carholdry a heavy bow */
4954 p_ptr->heavy_shoot = is_heavy_shoot(o_ptr);
4955 if (p_ptr->heavy_shoot)
4957 /* Hard to wield a heavy bow */
4958 p_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
4959 p_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
4962 /* Compute "extra shots" if needed */
4965 p_ptr->tval_ammo = bow_tval_ammo(o_ptr);
4967 /* Apply special flags */
4968 if (o_ptr->k_idx && !p_ptr->heavy_shoot)
4971 p_ptr->num_fire = calc_num_fire(o_ptr);
4973 /* Snipers love Cross bows */
4974 if ((p_ptr->pclass == CLASS_SNIPER) &&
4975 (p_ptr->tval_ammo == TV_BOLT))
4977 p_ptr->to_h_b += (10 + (p_ptr->lev / 5));
4978 p_ptr->dis_to_h_b += (10 + (p_ptr->lev / 5));
4986 for(i = 0 ; i < 2 ; i++)
4988 /* Examine the "main weapon" */
4989 o_ptr = &inventory[INVEN_RARM+i];
4991 object_flags(o_ptr, flgs);
4993 /* Assume not heavy */
4994 p_ptr->heavy_wield[i] = FALSE;
4995 p_ptr->icky_wield[i] = FALSE;
4996 p_ptr->riding_wield[i] = FALSE;
4998 if (!buki_motteruka(INVEN_RARM+i)) {p_ptr->num_blow[i]=1;continue;}
4999 /* It is hard to hold a heavy weapon */
5000 if (hold < o_ptr->weight / 10)
5002 /* Hard to wield a heavy weapon */
5003 p_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
5004 p_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
5007 p_ptr->heavy_wield[i] = TRUE;
5009 else if (p_ptr->ryoute && (hold < o_ptr->weight/5)) omoi = TRUE;
5011 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
5014 p_ptr->dis_to_a += 5;
5017 /* Normal weapons */
5018 if (o_ptr->k_idx && !p_ptr->heavy_wield[i])
5020 int str_index, dex_index;
5022 int num = 0, wgt = 0, mul = 0, div = 0;
5024 /* Analyze the class */
5025 switch (p_ptr->pclass)
5029 num = 6; wgt = 70; mul = 5; break;
5032 case CLASS_BERSERKER:
5033 num = 6; wgt = 70; mul = 7; break;
5037 case CLASS_HIGH_MAGE:
5038 case CLASS_BLUE_MAGE:
5039 num = 3; wgt = 100; mul = 2; break;
5041 /* Priest, Mindcrafter, Magic-Eater */
5043 case CLASS_MAGIC_EATER:
5044 case CLASS_MINDCRAFTER:
5045 num = 5; wgt = 100; mul = 3; break;
5049 num = 5; wgt = 40; mul = 3; break;
5053 num = 5; wgt = 70; mul = 4; break;
5058 num = 5; wgt = 70; mul = 4; break;
5062 num = 5; wgt = 150; mul = 5; break;
5065 case CLASS_WARRIOR_MAGE:
5066 case CLASS_RED_MAGE:
5067 num = 5; wgt = 70; mul = 3; break;
5070 case CLASS_CHAOS_WARRIOR:
5071 num = 5; wgt = 70; mul = 4; break;
5075 num = 5; wgt = 60; mul = 3; break;
5079 num = 4; wgt = 100; mul = 3; break;
5082 case CLASS_IMITATOR:
5083 num = 5; wgt = 70; mul = 4; break;
5086 case CLASS_BEASTMASTER:
5087 num = 5; wgt = 70; mul = 3; break;
5091 if ((p_ptr->riding) && (have_flag(flgs, TR_RIDING))) {num = 5; wgt = 70; mul = 4;}
5092 else {num = 5; wgt = 100; mul = 3;}
5096 case CLASS_SORCERER:
5097 num = 1; wgt = 1; mul = 1; break;
5099 /* Archer, Bard, Sniper */
5103 num = 4; wgt = 70; mul = 2; break;
5106 case CLASS_FORCETRAINER:
5107 num = 4; wgt = 60; mul = 2; break;
5110 case CLASS_MIRROR_MASTER:
5111 num = 3; wgt = 100; mul = 3; break;
5115 num = 4; wgt = 20; mul = 1; break;
5118 /* Hex - extra mights gives +1 bonus to max blows */
5119 if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING)) { num++; wgt /= 2; mul += 2; }
5121 /* Enforce a minimum "weight" (tenth pounds) */
5122 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
5124 /* Access the strength vs weight */
5125 str_index = (adj_str_blow[p_ptr->stat_ind[A_STR]] * mul / div);
5127 if (p_ptr->ryoute && !omoi) str_index++;
5128 if (p_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index-1);
5131 if (str_index > 11) str_index = 11;
5133 /* Index by dexterity */
5134 dex_index = (adj_dex_blow[p_ptr->stat_ind[A_DEX]]);
5137 if (dex_index > 11) dex_index = 11;
5139 /* Use the blows table */
5140 p_ptr->num_blow[i] = blows_table[str_index][dex_index];
5143 if (p_ptr->num_blow[i] > num) p_ptr->num_blow[i] = num;
5145 /* Add in the "bonus blows" */
5146 p_ptr->num_blow[i] += extra_blows[i];
5149 if (p_ptr->pclass == CLASS_WARRIOR) p_ptr->num_blow[i] += (p_ptr->lev / 40);
5150 else if (p_ptr->pclass == CLASS_BERSERKER)
5152 p_ptr->num_blow[i] += (p_ptr->lev / 23);
5154 else if ((p_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (p_ptr->stat_ind[A_DEX] >= 30)) p_ptr->num_blow[i] ++;
5156 if (p_ptr->special_defense & KATA_FUUJIN) p_ptr->num_blow[i] -= 1;
5158 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) p_ptr->num_blow[i] = 1;
5161 /* Require at least one blow */
5162 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
5164 /* Boost digging skill by weapon weight */
5165 p_ptr->skill_dig += (o_ptr->weight / 10);
5169 /* Priest weapon penalty for non-blessed edged weapons */
5170 if ((p_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
5171 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
5173 /* Reduce the real bonuses */
5174 p_ptr->to_h[i] -= 2;
5175 p_ptr->to_d[i] -= 2;
5177 /* Reduce the mental bonuses */
5178 p_ptr->dis_to_h[i] -= 2;
5179 p_ptr->dis_to_d[i] -= 2;
5182 p_ptr->icky_wield[i] = TRUE;
5184 else if (p_ptr->pclass == CLASS_BERSERKER)
5186 p_ptr->to_h[i] += p_ptr->lev/5;
5187 p_ptr->to_d[i] += p_ptr->lev/6;
5188 p_ptr->dis_to_h[i] += p_ptr->lev/5;
5189 p_ptr->dis_to_d[i] += p_ptr->lev/6;
5190 if (((i == 0) && !p_ptr->hidarite) || p_ptr->ryoute)
5192 p_ptr->to_h[i] += p_ptr->lev/5;
5193 p_ptr->to_d[i] += p_ptr->lev/6;
5194 p_ptr->dis_to_h[i] += p_ptr->lev/5;
5195 p_ptr->dis_to_d[i] += p_ptr->lev/6;
5198 else if (p_ptr->pclass == CLASS_SORCERER)
5200 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
5202 /* Reduce the real bonuses */
5203 p_ptr->to_h[i] -= 200;
5204 p_ptr->to_d[i] -= 200;
5206 /* Reduce the mental bonuses */
5207 p_ptr->dis_to_h[i] -= 200;
5208 p_ptr->dis_to_d[i] -= 200;
5211 p_ptr->icky_wield[i] = TRUE;
5215 /* Reduce the real bonuses */
5216 p_ptr->to_h[i] -= 30;
5217 p_ptr->to_d[i] -= 10;
5219 /* Reduce the mental bonuses */
5220 p_ptr->dis_to_h[i] -= 30;
5221 p_ptr->dis_to_d[i] -= 10;
5225 if (p_ptr->realm1 == REALM_HEX)
5227 if (object_is_cursed(o_ptr))
5229 if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
5230 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_h[i] += 7; p_ptr->dis_to_h[i] += 7; }
5231 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_h[i] += 13; p_ptr->dis_to_h[i] += 13; }
5232 if (o_ptr->curse_flags & (TRC_TY_CURSE)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
5233 if (hex_spelling(HEX_RUNESWORD))
5235 if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_d[i] += 5; p_ptr->dis_to_d[i] += 5; }
5236 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_d[i] += 7; p_ptr->dis_to_d[i] += 7; }
5237 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_d[i] += 13; p_ptr->dis_to_d[i] += 13; }
5243 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
5245 p_ptr->to_h[i] +=15;
5246 p_ptr->dis_to_h[i] +=15;
5247 p_ptr->to_dd[i] += 2;
5249 else if (!(have_flag(flgs, TR_RIDING)))
5252 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
5258 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
5260 if (penalty < 30) penalty = 30;
5262 p_ptr->to_h[i] -= penalty;
5263 p_ptr->dis_to_h[i] -= penalty;
5266 p_ptr->riding_wield[i] = TRUE;
5275 p_ptr->riding_ryoute = FALSE;
5277 if (p_ptr->ryoute || (empty_hands(FALSE) == EMPTY_HAND_NONE)) p_ptr->riding_ryoute = TRUE;
5278 else if (p_ptr->pet_extra_flags & PF_RYOUTE)
5280 switch (p_ptr->pclass)
5283 case CLASS_FORCETRAINER:
5284 case CLASS_BERSERKER:
5285 if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
5286 p_ptr->riding_ryoute = TRUE;
5291 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
5293 if (p_ptr->tval_ammo != TV_ARROW) penalty = 5;
5297 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
5299 if (penalty < 30) penalty = 30;
5301 if (p_ptr->tval_ammo == TV_BOLT) penalty *= 2;
5302 p_ptr->to_h_b -= penalty;
5303 p_ptr->dis_to_h_b -= penalty;
5306 /* Different calculation for monks with empty hands */
5307 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) &&
5308 (empty_hands_status & EMPTY_HAND_RARM) && !p_ptr->hidarite)
5310 int blow_base = p_ptr->lev + adj_dex_blow[p_ptr->stat_ind[A_DEX]];
5311 p_ptr->num_blow[0] = 0;
5313 if (p_ptr->pclass == CLASS_FORCETRAINER)
5315 if (blow_base > 18) p_ptr->num_blow[0]++;
5316 if (blow_base > 31) p_ptr->num_blow[0]++;
5317 if (blow_base > 44) p_ptr->num_blow[0]++;
5318 if (blow_base > 58) p_ptr->num_blow[0]++;
5319 if (p_ptr->magic_num1[0])
5321 p_ptr->to_d[0] += (p_ptr->magic_num1[0]/5);
5322 p_ptr->dis_to_d[0] += (p_ptr->magic_num1[0]/5);
5327 if (blow_base > 12) p_ptr->num_blow[0]++;
5328 if (blow_base > 22) p_ptr->num_blow[0]++;
5329 if (blow_base > 31) p_ptr->num_blow[0]++;
5330 if (blow_base > 39) p_ptr->num_blow[0]++;
5331 if (blow_base > 46) p_ptr->num_blow[0]++;
5332 if (blow_base > 53) p_ptr->num_blow[0]++;
5333 if (blow_base > 59) p_ptr->num_blow[0]++;
5336 if (heavy_armor() && (p_ptr->pclass != CLASS_BERSERKER))
5337 p_ptr->num_blow[0] /= 2;
5340 p_ptr->to_h[0] += (p_ptr->lev / 3);
5341 p_ptr->dis_to_h[0] += (p_ptr->lev / 3);
5343 p_ptr->to_d[0] += (p_ptr->lev / 6);
5344 p_ptr->dis_to_d[0] += (p_ptr->lev / 6);
5347 if (p_ptr->special_defense & KAMAE_BYAKKO)
5350 p_ptr->dis_to_a -= 40;
5353 else if (p_ptr->special_defense & KAMAE_SEIRYU)
5356 p_ptr->dis_to_a -= 50;
5357 p_ptr->resist_acid = TRUE;
5358 p_ptr->resist_fire = TRUE;
5359 p_ptr->resist_elec = TRUE;
5360 p_ptr->resist_cold = TRUE;
5361 p_ptr->resist_pois = TRUE;
5362 p_ptr->sh_fire = TRUE;
5363 p_ptr->sh_elec = TRUE;
5364 p_ptr->sh_cold = TRUE;
5365 p_ptr->levitation = TRUE;
5367 else if (p_ptr->special_defense & KAMAE_GENBU)
5369 p_ptr->to_a += (p_ptr->lev*p_ptr->lev)/50;
5370 p_ptr->dis_to_a += (p_ptr->lev*p_ptr->lev)/50;
5371 p_ptr->reflect = TRUE;
5372 p_ptr->num_blow[0] -= 2;
5373 if ((p_ptr->pclass == CLASS_MONK) && (p_ptr->lev > 42)) p_ptr->num_blow[0]--;
5374 if (p_ptr->num_blow[0] < 0) p_ptr->num_blow[0] = 0;
5376 else if (p_ptr->special_defense & KAMAE_SUZAKU)
5378 p_ptr->to_h[0] -= (p_ptr->lev / 3);
5379 p_ptr->to_d[0] -= (p_ptr->lev / 6);
5381 p_ptr->dis_to_h[0] -= (p_ptr->lev / 3);
5382 p_ptr->dis_to_d[0] -= (p_ptr->lev / 6);
5383 p_ptr->num_blow[0] /= 2;
5384 p_ptr->levitation = TRUE;
5387 p_ptr->num_blow[0] += 1+extra_blows[0];
5390 if (p_ptr->riding) p_ptr->levitation = riding_levitation;
5392 monk_armour_aux = FALSE;
5396 monk_armour_aux = TRUE;
5399 for (i = 0; i < 2; i++)
5401 if (buki_motteruka(INVEN_RARM+i))
5403 int tval = inventory[INVEN_RARM+i].tval - TV_WEAPON_BEGIN;
5404 int sval = inventory[INVEN_RARM+i].sval;
5406 p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
5407 p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
5408 if ((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER))
5410 if (!s_info[p_ptr->pclass].w_max[tval][sval])
5412 p_ptr->to_h[i] -= 40;
5413 p_ptr->dis_to_h[i] -= 40;
5414 p_ptr->icky_wield[i] = TRUE;
5417 else if (p_ptr->pclass == CLASS_NINJA)
5419 if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (inventory[INVEN_LARM-i].tval == TV_SHIELD))
5421 p_ptr->to_h[i] -= 40;
5422 p_ptr->dis_to_h[i] -= 40;
5423 p_ptr->icky_wield[i] = TRUE;
5424 p_ptr->num_blow[i] /= 2;
5425 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
5429 if (inventory[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000;
5433 /* Maximum speed is (+99). (internally it's 110 + 99) */
5434 /* Temporary lightspeed forces to be maximum speed */
5435 if ((p_ptr->lightspeed && !p_ptr->riding) || (new_speed > 209))
5440 /* Minimum speed is (-99). (internally it's 110 - 99) */
5441 if (new_speed < 11) new_speed = 11;
5443 /* Display the speed (if needed) */
5444 if (p_ptr->pspeed != (byte)new_speed)
5446 p_ptr->pspeed = (byte)new_speed;
5447 p_ptr->redraw |= (PR_SPEED);
5452 if (p_ptr->to_a > (0 - p_ptr->ac))
5453 p_ptr->to_a = 0 - p_ptr->ac;
5454 if (p_ptr->dis_to_a > (0 - p_ptr->dis_ac))
5455 p_ptr->dis_to_a = 0 - p_ptr->dis_ac;
5458 /* Redraw armor (if needed) */
5459 if ((p_ptr->dis_ac != old_dis_ac) || (p_ptr->dis_to_a != old_dis_to_a))
5462 p_ptr->redraw |= (PR_ARMOR);
5465 p_ptr->window |= (PW_PLAYER);
5469 if (p_ptr->ryoute && !omoi)
5471 int bonus_to_h=0, bonus_to_d=0;
5472 bonus_to_d = ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128)/2;
5473 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);
5475 p_ptr->to_h[default_hand] += MAX(bonus_to_h,1);
5476 p_ptr->dis_to_h[default_hand] += MAX(bonus_to_h,1);
5477 p_ptr->to_d[default_hand] += MAX(bonus_to_d,1);
5478 p_ptr->dis_to_d[default_hand] += MAX(bonus_to_d,1);
5481 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;
5483 /* Affect Skill -- stealth (bonus one) */
5484 p_ptr->skill_stl += 1;
5486 if (IS_TIM_STEALTH()) p_ptr->skill_stl += 99;
5488 /* Affect Skill -- disarming (DEX and INT) */
5489 p_ptr->skill_dis += adj_dex_dis[p_ptr->stat_ind[A_DEX]];
5490 p_ptr->skill_dis += adj_int_dis[p_ptr->stat_ind[A_INT]];
5492 /* Affect Skill -- magic devices (INT) */
5493 p_ptr->skill_dev += adj_int_dev[p_ptr->stat_ind[A_INT]];
5495 /* Affect Skill -- saving throw (WIS) */
5496 p_ptr->skill_sav += adj_wis_sav[p_ptr->stat_ind[A_WIS]];
5498 /* Affect Skill -- digging (STR) */
5499 p_ptr->skill_dig += adj_str_dig[p_ptr->stat_ind[A_STR]];
5501 /* Affect Skill -- disarming (Level, by Class) */
5502 p_ptr->skill_dis += ((cp_ptr->x_dis * p_ptr->lev / 10) + (ap_ptr->a_dis * p_ptr->lev / 50));
5504 /* Affect Skill -- magic devices (Level, by Class) */
5505 p_ptr->skill_dev += ((cp_ptr->x_dev * p_ptr->lev / 10) + (ap_ptr->a_dev * p_ptr->lev / 50));
5507 /* Affect Skill -- saving throw (Level, by Class) */
5508 p_ptr->skill_sav += ((cp_ptr->x_sav * p_ptr->lev / 10) + (ap_ptr->a_sav * p_ptr->lev / 50));
5510 /* Affect Skill -- stealth (Level, by Class) */
5511 p_ptr->skill_stl += (cp_ptr->x_stl * p_ptr->lev / 10);
5513 /* Affect Skill -- search ability (Level, by Class) */
5514 p_ptr->skill_srh += (cp_ptr->x_srh * p_ptr->lev / 10);
5516 /* Affect Skill -- search frequency (Level, by Class) */
5517 p_ptr->skill_fos += (cp_ptr->x_fos * p_ptr->lev / 10);
5519 /* Affect Skill -- combat (normal) (Level, by Class) */
5520 p_ptr->skill_thn += ((cp_ptr->x_thn * p_ptr->lev / 10) + (ap_ptr->a_thn * p_ptr->lev / 50));
5522 /* Affect Skill -- combat (shooting) (Level, by Class) */
5523 p_ptr->skill_thb += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5525 /* Affect Skill -- combat (throwing) (Level, by Class) */
5526 p_ptr->skill_tht += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5529 if ((prace_is_(RACE_S_FAIRY)) && (p_ptr->pseikaku != SEIKAKU_SEXY) && (p_ptr->cursed & TRC_AGGRAVATE))
5531 p_ptr->cursed &= ~(TRC_AGGRAVATE);
5532 p_ptr->skill_stl = MIN(p_ptr->skill_stl - 3, (p_ptr->skill_stl + 2) / 2);
5535 /* Limit Skill -- stealth from 0 to 30 */
5536 if (p_ptr->skill_stl > 30) p_ptr->skill_stl = 30;
5537 if (p_ptr->skill_stl < 0) p_ptr->skill_stl = 0;
5539 /* Limit Skill -- digging from 1 up */
5540 if (p_ptr->skill_dig < 1) p_ptr->skill_dig = 1;
5542 if (p_ptr->anti_magic && (p_ptr->skill_sav < (90 + p_ptr->lev))) p_ptr->skill_sav = 90 + p_ptr->lev;
5544 if (p_ptr->tsubureru) p_ptr->skill_sav = 10;
5546 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;
5548 if (down_saving) p_ptr->skill_sav /= 2;
5550 /* Hack -- Each elemental immunity includes resistance */
5551 if (p_ptr->immune_acid) p_ptr->resist_acid = TRUE;
5552 if (p_ptr->immune_elec) p_ptr->resist_elec = TRUE;
5553 if (p_ptr->immune_fire) p_ptr->resist_fire = TRUE;
5554 if (p_ptr->immune_cold) p_ptr->resist_cold = TRUE;
5556 /* Determine player alignment */
5557 for (i = 0, j = 0; i < 8; i++)
5559 switch (p_ptr->vir_types[i])
5562 p_ptr->align += p_ptr->virtues[i] * 2;
5572 p_ptr->align -= p_ptr->virtues[i];
5575 p_ptr->align += p_ptr->virtues[i];
5580 for (i = 0; i < j; i++)
5582 if (p_ptr->align > 0)
5584 p_ptr->align -= p_ptr->virtues[neutral[i]] / 2;
5585 if (p_ptr->align < 0) p_ptr->align = 0;
5587 else if (p_ptr->align < 0)
5589 p_ptr->align += p_ptr->virtues[neutral[i]] / 2;
5590 if (p_ptr->align > 0) p_ptr->align = 0;
5594 /* Hack -- handle "xtra" mode */
5595 if (character_xtra) return;
5597 /* Take note when "heavy bow" changes */
5598 if (p_ptr->old_heavy_shoot != p_ptr->heavy_shoot)
5601 if (p_ptr->heavy_shoot)
5603 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
5605 else if (inventory[INVEN_BOW].k_idx)
5607 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
5611 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
5615 p_ptr->old_heavy_shoot = p_ptr->heavy_shoot;
5618 for (i = 0 ; i < 2 ; i++)
5620 /* Take note when "heavy weapon" changes */
5621 if (p_ptr->old_heavy_wield[i] != p_ptr->heavy_wield[i])
5624 if (p_ptr->heavy_wield[i])
5626 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
5628 else if (buki_motteruka(INVEN_RARM+i))
5630 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
5632 else if (p_ptr->heavy_wield[1-i])
5634 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
5638 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
5642 p_ptr->old_heavy_wield[i] = p_ptr->heavy_wield[i];
5645 /* Take note when "heavy weapon" changes */
5646 if (p_ptr->old_riding_wield[i] != p_ptr->riding_wield[i])
5649 if (p_ptr->riding_wield[i])
5651 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
5653 else if (!p_ptr->riding)
5655 msg_print(_("この武器は徒歩で使いやすい。", "This weapon was not suitable for use while riding."));
5657 else if (buki_motteruka(INVEN_RARM+i))
5659 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
5662 p_ptr->old_riding_wield[i] = p_ptr->riding_wield[i];
5665 /* Take note when "illegal weapon" changes */
5666 if (p_ptr->old_icky_wield[i] != p_ptr->icky_wield[i])
5669 if (p_ptr->icky_wield[i])
5671 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
5674 chg_virtue(V_FAITH, -1);
5677 else if (buki_motteruka(INVEN_RARM+i))
5679 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
5683 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
5687 p_ptr->old_icky_wield[i] = p_ptr->icky_wield[i];
5691 if (p_ptr->riding && (p_ptr->old_riding_ryoute != p_ptr->riding_ryoute))
5694 if (p_ptr->riding_ryoute)
5697 msg_format("%s馬を操れない。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
5699 msg_print("You are using both hand for fighting, and you can't control a riding pet.");
5705 msg_format("%s馬を操れるようになった。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
5707 msg_print("You began to control riding pet with one hand.");
5711 p_ptr->old_riding_ryoute = p_ptr->riding_ryoute;
5714 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (monk_armour_aux != monk_notify_aux))
5718 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
5721 chg_virtue(V_HARMONY, -1);
5726 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
5729 monk_notify_aux = monk_armour_aux;
5732 for (i = 0; i < INVEN_PACK; i++)
5735 if ((inventory[i].tval == TV_SORCERY_BOOK) && (inventory[i].sval == 2)) have_dd_s = TRUE;
5736 if ((inventory[i].tval == TV_TRUMP_BOOK) && (inventory[i].sval == 1)) have_dd_t = TRUE;
5738 if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE;
5739 if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE;
5741 for (this_o_idx = cave[py][px].o_idx; this_o_idx; this_o_idx = next_o_idx)
5745 /* Acquire object */
5746 o_ptr = &o_list[this_o_idx];
5748 /* Acquire next object */
5749 next_o_idx = o_ptr->next_o_idx;
5752 if ((o_ptr->tval == TV_SORCERY_BOOK) && (o_ptr->sval == 3)) have_dd_s = TRUE;
5753 if ((o_ptr->tval == TV_TRUMP_BOOK) && (o_ptr->sval == 1)) have_dd_t = TRUE;
5755 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
5756 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
5759 if (p_ptr->pass_wall && !p_ptr->kill_wall) p_ptr->no_flowed = TRUE;
5761 if (have_dd_s && ((p_ptr->realm1 == REALM_SORCERY) || (p_ptr->realm2 == REALM_SORCERY) || (p_ptr->pclass == CLASS_SORCERER)))
5763 const magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY-1][SPELL_DD_S];
5764 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5767 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)))
5769 const magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP-1][SPELL_DD_T];
5770 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5773 if (have_sw && ((p_ptr->realm1 == REALM_NATURE) || (p_ptr->realm2 == REALM_NATURE) || (p_ptr->pclass == CLASS_SORCERER)))
5775 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE-1][SPELL_SW];
5776 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5779 if (have_kabe && ((p_ptr->realm1 == REALM_CRAFT) || (p_ptr->realm2 == REALM_CRAFT) || (p_ptr->pclass == CLASS_SORCERER)))
5781 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT-1][SPELL_KABE];
5782 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5789 * Handle "p_ptr->notice"
5791 void notice_stuff(void)
5794 if (!p_ptr->notice) return;
5797 /* Actually do auto-destroy */
5798 if (p_ptr->notice & (PN_AUTODESTROY))
5800 p_ptr->notice &= ~(PN_AUTODESTROY);
5801 autopick_delayed_alter();
5804 /* Combine the pack */
5805 if (p_ptr->notice & (PN_COMBINE))
5807 p_ptr->notice &= ~(PN_COMBINE);
5811 /* Reorder the pack */
5812 if (p_ptr->notice & (PN_REORDER))
5814 p_ptr->notice &= ~(PN_REORDER);
5821 * Handle "p_ptr->update"
5823 void update_stuff(void)
5826 if (!p_ptr->update) return;
5829 if (p_ptr->update & (PU_BONUS))
5831 p_ptr->update &= ~(PU_BONUS);
5835 if (p_ptr->update & (PU_TORCH))
5837 p_ptr->update &= ~(PU_TORCH);
5841 if (p_ptr->update & (PU_HP))
5843 p_ptr->update &= ~(PU_HP);
5847 if (p_ptr->update & (PU_MANA))
5849 p_ptr->update &= ~(PU_MANA);
5853 if (p_ptr->update & (PU_SPELLS))
5855 p_ptr->update &= ~(PU_SPELLS);
5860 /* Character is not ready yet, no screen updates */
5861 if (!character_generated) return;
5864 /* Character is in "icky" mode, no screen updates */
5865 if (character_icky) return;
5868 if (p_ptr->update & (PU_UN_LITE))
5870 p_ptr->update &= ~(PU_UN_LITE);
5874 if (p_ptr->update & (PU_UN_VIEW))
5876 p_ptr->update &= ~(PU_UN_VIEW);
5880 if (p_ptr->update & (PU_VIEW))
5882 p_ptr->update &= ~(PU_VIEW);
5886 if (p_ptr->update & (PU_LITE))
5888 p_ptr->update &= ~(PU_LITE);
5893 if (p_ptr->update & (PU_FLOW))
5895 p_ptr->update &= ~(PU_FLOW);
5899 if (p_ptr->update & (PU_DISTANCE))
5901 p_ptr->update &= ~(PU_DISTANCE);
5903 /* Still need to call update_monsters(FALSE) after update_mon_lite() */
5904 /* p_ptr->update &= ~(PU_MONSTERS); */
5906 update_monsters(TRUE);
5909 if (p_ptr->update & (PU_MON_LITE))
5911 p_ptr->update &= ~(PU_MON_LITE);
5916 * Mega-Hack -- Delayed visual update
5917 * Only used if update_view(), update_lite() or update_mon_lite() was called
5919 if (p_ptr->update & (PU_DELAY_VIS))
5921 p_ptr->update &= ~(PU_DELAY_VIS);
5922 delayed_visual_update();
5925 if (p_ptr->update & (PU_MONSTERS))
5927 p_ptr->update &= ~(PU_MONSTERS);
5928 update_monsters(FALSE);
5934 * Handle "p_ptr->redraw"
5936 void redraw_stuff(void)
5939 if (!p_ptr->redraw) return;
5942 /* Character is not ready yet, no screen updates */
5943 if (!character_generated) return;
5946 /* Character is in "icky" mode, no screen updates */
5947 if (character_icky) return;
5951 /* Hack -- clear the screen */
5952 if (p_ptr->redraw & (PR_WIPE))
5954 p_ptr->redraw &= ~(PR_WIPE);
5960 if (p_ptr->redraw & (PR_MAP))
5962 p_ptr->redraw &= ~(PR_MAP);
5967 if (p_ptr->redraw & (PR_BASIC))
5969 p_ptr->redraw &= ~(PR_BASIC);
5970 p_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
5971 p_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
5972 p_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
5973 p_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
5979 if (p_ptr->redraw & (PR_EQUIPPY))
5981 p_ptr->redraw &= ~(PR_EQUIPPY);
5982 print_equippy(); /* To draw / delete equippy chars */
5985 if (p_ptr->redraw & (PR_MISC))
5987 p_ptr->redraw &= ~(PR_MISC);
5988 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
5989 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
5993 if (p_ptr->redraw & (PR_TITLE))
5995 p_ptr->redraw &= ~(PR_TITLE);
5999 if (p_ptr->redraw & (PR_LEV))
6001 p_ptr->redraw &= ~(PR_LEV);
6005 if (p_ptr->redraw & (PR_EXP))
6007 p_ptr->redraw &= ~(PR_EXP);
6011 if (p_ptr->redraw & (PR_STATS))
6013 p_ptr->redraw &= ~(PR_STATS);
6022 if (p_ptr->redraw & (PR_STATUS))
6024 p_ptr->redraw &= ~(PR_STATUS);
6028 if (p_ptr->redraw & (PR_ARMOR))
6030 p_ptr->redraw &= ~(PR_ARMOR);
6034 if (p_ptr->redraw & (PR_HP))
6036 p_ptr->redraw &= ~(PR_HP);
6040 if (p_ptr->redraw & (PR_MANA))
6042 p_ptr->redraw &= ~(PR_MANA);
6046 if (p_ptr->redraw & (PR_GOLD))
6048 p_ptr->redraw &= ~(PR_GOLD);
6052 if (p_ptr->redraw & (PR_DEPTH))
6054 p_ptr->redraw &= ~(PR_DEPTH);
6058 if (p_ptr->redraw & (PR_HEALTH))
6060 p_ptr->redraw &= ~(PR_HEALTH);
6061 health_redraw(FALSE);
6064 if (p_ptr->redraw & (PR_UHEALTH))
6066 p_ptr->redraw &= ~(PR_UHEALTH);
6067 health_redraw(TRUE);
6071 if (p_ptr->redraw & (PR_EXTRA))
6073 p_ptr->redraw &= ~(PR_EXTRA);
6074 p_ptr->redraw &= ~(PR_CUT | PR_STUN);
6075 p_ptr->redraw &= ~(PR_HUNGER);
6076 p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
6080 if (p_ptr->redraw & (PR_CUT))
6082 p_ptr->redraw &= ~(PR_CUT);
6086 if (p_ptr->redraw & (PR_STUN))
6088 p_ptr->redraw &= ~(PR_STUN);
6092 if (p_ptr->redraw & (PR_HUNGER))
6094 p_ptr->redraw &= ~(PR_HUNGER);
6098 if (p_ptr->redraw & (PR_STATE))
6100 p_ptr->redraw &= ~(PR_STATE);
6104 if (p_ptr->redraw & (PR_SPEED))
6106 p_ptr->redraw &= ~(PR_SPEED);
6110 if (p_ptr->pclass == CLASS_IMITATOR)
6112 if (p_ptr->redraw & (PR_IMITATION))
6114 p_ptr->redraw &= ~(PR_IMITATION);
6118 else if (p_ptr->redraw & (PR_STUDY))
6120 p_ptr->redraw &= ~(PR_STUDY);
6127 * Handle "p_ptr->window"
6129 void window_stuff(void)
6137 if (!p_ptr->window) return;
6140 for (j = 0; j < 8; j++)
6142 /* Save usable flags */
6143 if (angband_term[j]) mask |= window_flag[j];
6146 /* Apply usable flags */
6147 p_ptr->window &= mask;
6150 if (!p_ptr->window) return;
6153 /* Display inventory */
6154 if (p_ptr->window & (PW_INVEN))
6156 p_ptr->window &= ~(PW_INVEN);
6160 /* Display equipment */
6161 if (p_ptr->window & (PW_EQUIP))
6163 p_ptr->window &= ~(PW_EQUIP);
6167 /* Display spell list */
6168 if (p_ptr->window & (PW_SPELL))
6170 p_ptr->window &= ~(PW_SPELL);
6174 /* Display player */
6175 if (p_ptr->window & (PW_PLAYER))
6177 p_ptr->window &= ~(PW_PLAYER);
6181 /* Display monster list */
6182 if (p_ptr->window & (PW_MONSTER_LIST))
6184 p_ptr->window &= ~(PW_MONSTER_LIST);
6188 /* Display overhead view */
6189 if (p_ptr->window & (PW_MESSAGE))
6191 p_ptr->window &= ~(PW_MESSAGE);
6195 /* Display overhead view */
6196 if (p_ptr->window & (PW_OVERHEAD))
6198 p_ptr->window &= ~(PW_OVERHEAD);
6202 /* Display overhead view */
6203 if (p_ptr->window & (PW_DUNGEON))
6205 p_ptr->window &= ~(PW_DUNGEON);
6209 /* Display monster recall */
6210 if (p_ptr->window & (PW_MONSTER))
6212 p_ptr->window &= ~(PW_MONSTER);
6216 /* Display object recall */
6217 if (p_ptr->window & (PW_OBJECT))
6219 p_ptr->window &= ~(PW_OBJECT);
6226 * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
6228 void handle_stuff(void)
6231 if (p_ptr->update) update_stuff();
6234 if (p_ptr->redraw) redraw_stuff();
6237 if (p_ptr->window) window_stuff();
6241 s16b empty_hands(bool riding_control)
6243 s16b status = EMPTY_HAND_NONE;
6245 if (!inventory[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
6246 if (!inventory[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
6248 if (riding_control && (status != EMPTY_HAND_NONE) && p_ptr->riding && !(p_ptr->pet_extra_flags & PF_RYOUTE))
6250 if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
6251 else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
6258 bool heavy_armor(void)
6260 u16b monk_arm_wgt = 0;
6262 if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE;
6264 /* Weight the armor */
6265 if(inventory[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_RARM].weight;
6266 if(inventory[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_LARM].weight;
6267 monk_arm_wgt += inventory[INVEN_BODY].weight;
6268 monk_arm_wgt += inventory[INVEN_HEAD].weight;
6269 monk_arm_wgt += inventory[INVEN_OUTER].weight;
6270 monk_arm_wgt += inventory[INVEN_HANDS].weight;
6271 monk_arm_wgt += inventory[INVEN_FEET].weight;
6273 return (monk_arm_wgt > (100 + (p_ptr->lev * 4)));
6276 void update_playtime(void)
6278 /* Check if the game has started */
6279 if (start_time != 0)
6281 u32b tmp = time(NULL);
6282 playtime += (tmp - start_time);