3 * @brief プレイヤーのステータス処理 / status
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.
17 * @brief 現在の修正後能力値を3~17及び18/xxx形式に変換する / Converts stat num into a six-char (right justified) string
19 * @param out_val 出力先文字列ポインタ
22 void cnv_stat(int val, char *out_val)
27 int bonus = (val - 18);
31 sprintf(out_val, "18/%3s", "***");
33 else if (bonus >= 100)
35 sprintf(out_val, "18/%03d", bonus);
39 sprintf(out_val, " 18/%02d", bonus);
46 sprintf(out_val, " %2d", val);
51 * @brief 能力値現在値から3~17及び18/xxx様式に基づく加減算を行う。
52 * Modify a stat value by a "modifier", return new value
58 * Stats go up: 3,4,...,17,18,18/10,18/20,...,18/220
59 * Or even: 18/13, 18/23, 18/33, ..., 18/220
60 * Stats go down: 18/220, 18/210,..., 18/10, 18, 17, ..., 3
61 * Or even: 18/13, 18/03, 18, 17, ..., 3
64 s16b modify_stat_value(int value, int amount)
71 /* Apply each point */
72 for (i = 0; i < amount; i++)
74 /* One point at a time */
75 if (value < 18) value++;
77 /* Ten "points" at a time */
85 /* Apply each point */
86 for (i = 0; i < (0 - amount); i++)
88 /* Ten points at a time */
89 if (value >= 18+10) value -= 10;
91 /* Hack -- prevent weirdness */
92 else if (value > 18) value = 18;
94 /* One point at a time */
95 else if (value > 3) value--;
99 /* Return new value */
100 return (s16b)(value);
106 * @brief 画面左の能力値表示を行うために指定位置から13キャラ分を空白消去後指定のメッセージを明るい青で描画する /
107 * Print character info at given row, column in a 13 char field
113 static void prt_field(cptr info, TERM_LEN row, TERM_LEN col)
115 /* Dump 13 spaces to clear */
116 c_put_str(TERM_WHITE, " ", row, col);
118 /* Dump the info itself */
119 c_put_str(TERM_L_BLUE, info, row, col);
123 * @brief ゲーム時刻を表示する /
131 /* Dump 13 spaces to clear */
132 c_put_str(TERM_WHITE, " ", ROW_DAY, COL_DAY);
134 extract_day_hour_min(&day, &hour, &min);
136 /* Dump the info itself */
137 if (day < 1000) c_put_str(TERM_WHITE, format(_("%2d日目", "Day%3d"), day), ROW_DAY, COL_DAY);
138 else c_put_str(TERM_WHITE, _("***日目", "Day***"), ROW_DAY, COL_DAY);
140 c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
144 * @brief 現在のマップ名を返す /
145 * @return マップ名の文字列参照ポインタ
149 if (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)
150 && (quest[p_ptr->inside_quest].flags & QUEST_FLAG_PRESET))
151 return _("クエスト", "Quest");
152 else if (p_ptr->wild_mode)
153 return _("地上", "Surface");
154 else if (p_ptr->inside_arena)
155 return _("アリーナ", "Arena");
156 else if (p_ptr->inside_battle)
157 return _("闘技場", "Monster Arena");
158 else if (!dun_level && p_ptr->town_num)
159 return town[p_ptr->town_num].name;
161 return d_name+d_info[dungeon_type].name;
165 * @brief 現在のマップ名を描画する / Print dungeon
168 static void prt_dungeon(void)
173 /* Dump 13 spaces to clear */
174 c_put_str(TERM_WHITE, " ", ROW_DUNGEON, COL_DUNGEON);
176 dungeon_name = map_name();
178 col = COL_DUNGEON + 6 - strlen(dungeon_name)/2;
179 if (col < 0) col = 0;
181 /* Dump the info itself */
182 c_put_str(TERM_L_UMBER, format("%s",dungeon_name),
188 * @brief プレイヤー能力値を描画する / Print character stat in given row, column
189 * @param stat 描画するステータスのID
192 static void prt_stat(int stat)
196 /* Display "injured" stat */
197 if (p_ptr->stat_cur[stat] < p_ptr->stat_max[stat])
199 put_str(stat_names_reduced[stat], ROW_STAT + stat, 0);
200 cnv_stat(p_ptr->stat_use[stat], tmp);
201 c_put_str(TERM_YELLOW, tmp, ROW_STAT + stat, COL_STAT + 6);
204 /* Display "healthy" stat */
207 put_str(stat_names[stat], ROW_STAT + stat, 0);
208 cnv_stat(p_ptr->stat_use[stat], tmp);
209 c_put_str(TERM_L_GREEN, tmp, ROW_STAT + stat, COL_STAT + 6);
212 /* Indicate natural maximum */
213 if (p_ptr->stat_max[stat] == p_ptr->stat_max_max[stat])
216 /* 日本語にかぶらないように表示位置を変更 */
217 put_str("!", ROW_STAT + stat, 5);
219 put_str("!", ROW_STAT + stat, 3);
227 * 画面下部に表示する状態表示定義ID / Data structure for status bar
229 #define BAR_TSUYOSHI 0 /*!< 下部ステータス表示: オクレ兄さん状態 */
230 #define BAR_HALLUCINATION 1 /*!< 下部ステータス表示: 幻覚 */
231 #define BAR_BLINDNESS 2 /*!< 下部ステータス表示: 盲目 */
232 #define BAR_PARALYZE 3 /*!< 下部ステータス表示: 麻痺 */
233 #define BAR_CONFUSE 4 /*!< 下部ステータス表示: 混乱 */
234 #define BAR_POISONED 5 /*!< 下部ステータス表示: 毒 */
235 #define BAR_AFRAID 6 /*!< 下部ステータス表示: 恐怖 */
236 #define BAR_LEVITATE 7 /*!< 下部ステータス表示: 浮遊 */
237 #define BAR_REFLECTION 8 /*!< 下部ステータス表示: 反射 */
238 #define BAR_PASSWALL 9 /*!< 下部ステータス表示: 壁抜け */
239 #define BAR_WRAITH 10 /*!< 下部ステータス表示: 幽体化 */
240 #define BAR_PROTEVIL 11 /*!< 下部ステータス表示: 対邪悪結界 */
241 #define BAR_KAWARIMI 12 /*!< 下部ステータス表示: 変わり身 */
242 #define BAR_MAGICDEFENSE 13 /*!< 下部ステータス表示: 魔法の鎧 */
243 #define BAR_EXPAND 14 /*!< 下部ステータス表示: 横伸び */
244 #define BAR_STONESKIN 15 /*!< 下部ステータス表示: 石肌化 */
245 #define BAR_MULTISHADOW 16 /*!< 下部ステータス表示: 影分身 */
246 #define BAR_REGMAGIC 17 /*!< 下部ステータス表示: 魔法防御 */
247 #define BAR_ULTIMATE 18 /*!< 下部ステータス表示: 究極の耐性 */
248 #define BAR_INVULN 19 /*!< 下部ステータス表示: 無敵化 */
249 #define BAR_IMMACID 20 /*!< 下部ステータス表示: 酸免疫 */
250 #define BAR_RESACID 21 /*!< 下部ステータス表示: 酸耐性 */
251 #define BAR_IMMELEC 22 /*!< 下部ステータス表示: 電撃免疫 */
252 #define BAR_RESELEC 23 /*!< 下部ステータス表示: 電撃耐性 */
253 #define BAR_IMMFIRE 24 /*!< 下部ステータス表示: 火炎免疫 */
254 #define BAR_RESFIRE 25 /*!< 下部ステータス表示: 火炎耐性 */
255 #define BAR_IMMCOLD 26 /*!< 下部ステータス表示: 冷気免疫 */
256 #define BAR_RESCOLD 27 /*!< 下部ステータス表示: 冷気耐性 */
257 #define BAR_RESPOIS 28 /*!< 下部ステータス表示: 毒耐性 */
258 #define BAR_RESNETH 29 /*!< 下部ステータス表示: 地獄耐性 */
259 #define BAR_RESTIME 30 /*!< 下部ステータス表示: 時間逆転耐性 */
260 #define BAR_DUSTROBE 31 /*!< 下部ステータス表示: 破片オーラ */
261 #define BAR_SHFIRE 32 /*!< 下部ステータス表示: 火炎オーラ */
262 #define BAR_TOUKI 33 /*!< 下部ステータス表示: 闘気 */
263 #define BAR_SHHOLY 34 /*!< 下部ステータス表示: 聖なるオーラ */
264 #define BAR_EYEEYE 35 /*!< 下部ステータス表示: 目には目を */
265 #define BAR_BLESSED 36 /*!< 下部ステータス表示: 祝福 */
266 #define BAR_HEROISM 37 /*!< 下部ステータス表示: 士気高揚 */
267 #define BAR_BERSERK 38 /*!< 下部ステータス表示: 狂戦士化 */
268 #define BAR_ATTKFIRE 39 /*!< 下部ステータス表示: 焼棄スレイ */
269 #define BAR_ATTKCOLD 40 /*!< 下部ステータス表示: 冷凍スレイ */
270 #define BAR_ATTKELEC 41 /*!< 下部ステータス表示: 電撃スレイ */
271 #define BAR_ATTKACID 42 /*!< 下部ステータス表示: 溶解スレイ */
272 #define BAR_ATTKPOIS 43 /*!< 下部ステータス表示: 毒殺スレイ */
273 #define BAR_ATTKCONF 44 /*!< 下部ステータス表示: 混乱打撃 */
274 #define BAR_SENSEUNSEEN 45 /*!< 下部ステータス表示: 透明視 */
275 #define BAR_TELEPATHY 46 /*!< 下部ステータス表示: テレパシー */
276 #define BAR_REGENERATION 47 /*!< 下部ステータス表示: 急回復 */
277 #define BAR_INFRAVISION 48 /*!< 下部ステータス表示: 赤外線視力 */
278 #define BAR_STEALTH 49 /*!< 下部ステータス表示: 隠密 */
279 #define BAR_SUPERSTEALTH 50 /*!< 下部ステータス表示: 超隠密 */
280 #define BAR_RECALL 51 /*!< 下部ステータス表示: 帰還待ち */
281 #define BAR_ALTER 52 /*!< 下部ステータス表示: 現実変容待ち */
282 #define BAR_SHCOLD 53 /*!< 下部ステータス表示: 冷気オーラ */
283 #define BAR_SHELEC 54 /*!< 下部ステータス表示: 電撃オーラ */
284 #define BAR_SHSHADOW 55 /*!< 下部ステータス表示: 影のオーラ */
285 #define BAR_MIGHT 56 /*!< 下部ステータス表示: 腕力強化 */
286 #define BAR_BUILD 57 /*!< 下部ステータス表示: 肉体強化 */
287 #define BAR_ANTIMULTI 58 /*!< 下部ステータス表示: 反増殖 */
288 #define BAR_ANTITELE 59 /*!< 下部ステータス表示: 反テレポート */
289 #define BAR_ANTIMAGIC 60 /*!< 下部ステータス表示: 反魔法 */
290 #define BAR_PATIENCE 61 /*!< 下部ステータス表示: 我慢 */
291 #define BAR_REVENGE 62 /*!< 下部ステータス表示: 宣告 */
292 #define BAR_RUNESWORD 63 /*!< 下部ステータス表示: 魔剣化 */
293 #define BAR_VAMPILIC 64 /*!< 下部ステータス表示: 吸血 */
294 #define BAR_CURE 65 /*!< 下部ステータス表示: 回復 */
295 #define BAR_ESP_EVIL 66 /*!< 下部ステータス表示: 邪悪感知 */
304 {TERM_YELLOW, "つ", "つよし"},
305 {TERM_VIOLET, "幻", "幻覚"},
306 {TERM_L_DARK, "盲", "盲目"},
307 {TERM_RED, "痺", "麻痺"},
308 {TERM_VIOLET, "乱", "混乱"},
309 {TERM_GREEN, "毒", "毒"},
310 {TERM_BLUE, "恐", "恐怖"},
311 {TERM_L_BLUE, "浮", "浮遊"},
312 {TERM_SLATE, "反", "反射"},
313 {TERM_SLATE, "壁", "壁抜け"},
314 {TERM_L_DARK, "幽", "幽体"},
315 {TERM_SLATE, "邪", "防邪"},
316 {TERM_VIOLET, "変", "変わり身"},
317 {TERM_YELLOW, "魔", "魔法鎧"},
318 {TERM_L_UMBER, "伸", "伸び"},
319 {TERM_WHITE, "石", "石肌"},
320 {TERM_L_BLUE, "分", "分身"},
321 {TERM_SLATE, "防", "魔法防御"},
322 {TERM_YELLOW, "究", "究極"},
323 {TERM_YELLOW, "無", "無敵"},
324 {TERM_L_GREEN, "酸", "酸免疫"},
325 {TERM_GREEN, "酸", "耐酸"},
326 {TERM_L_BLUE, "電", "電免疫"},
327 {TERM_BLUE, "電", "耐電"},
328 {TERM_L_RED, "火", "火免疫"},
329 {TERM_RED, "火", "耐火"},
330 {TERM_WHITE, "冷", "冷免疫"},
331 {TERM_SLATE, "冷", "耐冷"},
332 {TERM_GREEN, "毒", "耐毒"},
333 {TERM_L_DARK, "獄", "耐地獄"},
334 {TERM_L_BLUE, "時", "耐時間"},
335 {TERM_L_DARK, "鏡", "鏡オーラ"},
336 {TERM_L_RED, "オ", "火オーラ"},
337 {TERM_WHITE, "闘", "闘気"},
338 {TERM_WHITE, "聖", "聖オーラ"},
339 {TERM_VIOLET, "目", "目には目"},
340 {TERM_WHITE, "祝", "祝福"},
341 {TERM_WHITE, "勇", "勇"},
342 {TERM_RED, "狂", "狂乱"},
343 {TERM_L_RED, "火", "魔剣火"},
344 {TERM_WHITE, "冷", "魔剣冷"},
345 {TERM_L_BLUE, "電", "魔剣電"},
346 {TERM_SLATE, "酸", "魔剣酸"},
347 {TERM_L_GREEN, "毒", "魔剣毒"},
348 {TERM_RED, "乱", "混乱打撃"},
349 {TERM_L_BLUE, "視", "透明視"},
350 {TERM_ORANGE, "テ", "テレパシ"},
351 {TERM_L_BLUE, "回", "回復"},
352 {TERM_L_RED, "赤", "赤外"},
353 {TERM_UMBER, "隠", "隠密"},
354 {TERM_YELLOW, "隠", "超隠密"},
355 {TERM_WHITE, "帰", "帰還"},
356 {TERM_WHITE, "現", "現実変容"},
358 {TERM_WHITE, "オ", "氷オーラ"},
359 {TERM_BLUE, "オ", "電オーラ"},
360 {TERM_L_DARK, "オ", "影オーラ"},
361 {TERM_YELLOW, "腕", "腕力強化"},
362 {TERM_RED, "肉", "肉体強化"},
363 {TERM_L_DARK, "殖", "反増殖"},
364 {TERM_ORANGE, "テ", "反テレポ"},
365 {TERM_RED, "魔", "反魔法"},
366 {TERM_SLATE, "我", "我慢"},
367 {TERM_SLATE, "宣", "宣告"},
368 {TERM_L_DARK, "剣", "魔剣化"},
369 {TERM_RED, "吸", "吸血打撃"},
370 {TERM_WHITE, "回", "回復"},
371 {TERM_L_DARK, "感", "邪悪感知"},
376 {TERM_YELLOW, "Ts", "Tsuyoshi"},
377 {TERM_VIOLET, "Ha", "Halluc"},
378 {TERM_L_DARK, "Bl", "Blind"},
379 {TERM_RED, "Pa", "Paralyzed"},
380 {TERM_VIOLET, "Cf", "Confused"},
381 {TERM_GREEN, "Po", "Poisoned"},
382 {TERM_BLUE, "Af", "Afraid"},
383 {TERM_L_BLUE, "Lv", "Levit"},
384 {TERM_SLATE, "Rf", "Reflect"},
385 {TERM_SLATE, "Pw", "PassWall"},
386 {TERM_L_DARK, "Wr", "Wraith"},
387 {TERM_SLATE, "Ev", "PrtEvl"},
388 {TERM_VIOLET, "Kw", "Kawarimi"},
389 {TERM_YELLOW, "Md", "MgcArm"},
390 {TERM_L_UMBER, "Eh", "Expand"},
391 {TERM_WHITE, "Ss", "StnSkn"},
392 {TERM_L_BLUE, "Ms", "MltShdw"},
393 {TERM_SLATE, "Rm", "ResMag"},
394 {TERM_YELLOW, "Ul", "Ultima"},
395 {TERM_YELLOW, "Iv", "Invuln"},
396 {TERM_L_GREEN, "IAc", "ImmAcid"},
397 {TERM_GREEN, "Ac", "Acid"},
398 {TERM_L_BLUE, "IEl", "ImmElec"},
399 {TERM_BLUE, "El", "Elec"},
400 {TERM_L_RED, "IFi", "ImmFire"},
401 {TERM_RED, "Fi", "Fire"},
402 {TERM_WHITE, "ICo", "ImmCold"},
403 {TERM_SLATE, "Co", "Cold"},
404 {TERM_GREEN, "Po", "Pois"},
405 {TERM_L_DARK, "Nt", "Nthr"},
406 {TERM_L_BLUE, "Ti", "Time"},
407 {TERM_L_DARK, "Mr", "Mirr"},
408 {TERM_L_RED, "SFi", "SFire"},
409 {TERM_WHITE, "Fo", "Force"},
410 {TERM_WHITE, "Ho", "Holy"},
411 {TERM_VIOLET, "Ee", "EyeEye"},
412 {TERM_WHITE, "Bs", "Bless"},
413 {TERM_WHITE, "He", "Hero"},
414 {TERM_RED, "Br", "Berserk"},
415 {TERM_L_RED, "BFi", "BFire"},
416 {TERM_WHITE, "BCo", "BCold"},
417 {TERM_L_BLUE, "BEl", "BElec"},
418 {TERM_SLATE, "BAc", "BAcid"},
419 {TERM_L_GREEN, "BPo", "BPois"},
420 {TERM_RED, "TCf", "TchCnf"},
421 {TERM_L_BLUE, "Se", "SInv"},
422 {TERM_ORANGE, "Te", "Telepa"},
423 {TERM_L_BLUE, "Rg", "Regen"},
424 {TERM_L_RED, "If", "Infr"},
425 {TERM_UMBER, "Sl", "Stealth"},
426 {TERM_YELLOW, "Stlt", "Stealth"},
427 {TERM_WHITE, "Rc", "Recall"},
428 {TERM_WHITE, "Al", "Alter"},
430 {TERM_WHITE, "SCo", "SCold"},
431 {TERM_BLUE, "SEl", "SElec"},
432 {TERM_L_DARK, "SSh", "SShadow"},
433 {TERM_YELLOW, "EMi", "ExMight"},
434 {TERM_RED, "Bu", "BuildUp"},
435 {TERM_L_DARK, "AMl", "AntiMulti"},
436 {TERM_ORANGE, "AT", "AntiTele"},
437 {TERM_RED, "AM", "AntiMagic"},
438 {TERM_SLATE, "Pa", "Patience"},
439 {TERM_SLATE, "Rv", "Revenge"},
440 {TERM_L_DARK, "Rs", "RuneSword"},
441 {TERM_RED, "Vm", "Vampiric"},
442 {TERM_WHITE, "Cu", "Cure"},
443 {TERM_L_DARK, "ET", "EvilTele"},
449 * @brief 32ビット変数配列の指定位置のビットフラグを1にする。
450 * @param FLG フラグ位置(ビット)
453 #define ADD_FLG(FLG) (bar_flags[FLG / 32] |= (1L << (FLG % 32)))
456 * @brief 32ビット変数配列の指定位置のビットフラグが1かどうかを返す。
457 * @param FLG フラグ位置(ビット)
460 #define IS_FLG(FLG) (bar_flags[FLG / 32] & (1L << (FLG % 32)))
464 * @brief 下部に状態表示を行う / Show status bar
467 static void prt_status(void)
469 BIT_FLAGS bar_flags[3];
470 TERM_LEN wid, hgt, row_statbar, max_col_statbar;
472 TERM_LEN col = 0, num = 0;
475 Term_get_size(&wid, &hgt);
476 row_statbar = hgt + ROW_STATBAR;
477 max_col_statbar = wid + MAX_COL_STATBAR;
479 Term_erase(0, row_statbar, max_col_statbar);
481 bar_flags[0] = bar_flags[1] = bar_flags[2] = 0L;
484 if (p_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
487 if (p_ptr->image) ADD_FLG(BAR_HALLUCINATION);
490 if (p_ptr->blind) ADD_FLG(BAR_BLINDNESS);
493 if (p_ptr->paralyzed) ADD_FLG(BAR_PARALYZE);
496 if (p_ptr->confused) ADD_FLG(BAR_CONFUSE);
499 if (p_ptr->poisoned) ADD_FLG(BAR_POISONED);
501 /* Times see-invisible */
502 if (p_ptr->tim_invis) ADD_FLG(BAR_SENSEUNSEEN);
505 if (IS_TIM_ESP()) ADD_FLG(BAR_TELEPATHY);
507 /* Timed regenerate */
508 if (p_ptr->tim_regen) ADD_FLG(BAR_REGENERATION);
510 /* Timed infra-vision */
511 if (p_ptr->tim_infra) ADD_FLG(BAR_INFRAVISION);
513 /* Protection from evil */
514 if (p_ptr->protevil) ADD_FLG(BAR_PROTEVIL);
516 /* Invulnerability */
517 if (IS_INVULN()) ADD_FLG(BAR_INVULN);
520 if (p_ptr->wraith_form) ADD_FLG(BAR_WRAITH);
523 if (p_ptr->kabenuke) ADD_FLG(BAR_PASSWALL);
525 if (p_ptr->tim_reflect) ADD_FLG(BAR_REFLECTION);
528 if (IS_HERO()) ADD_FLG(BAR_HEROISM);
530 /* Super Heroism / berserk */
531 if (p_ptr->shero) ADD_FLG(BAR_BERSERK);
534 if (IS_BLESSED()) ADD_FLG(BAR_BLESSED);
537 if (p_ptr->magicdef) ADD_FLG(BAR_MAGICDEFENSE);
539 if (p_ptr->tsubureru) ADD_FLG(BAR_EXPAND);
541 if (p_ptr->shield) ADD_FLG(BAR_STONESKIN);
543 if (p_ptr->special_defense & NINJA_KAWARIMI) ADD_FLG(BAR_KAWARIMI);
546 if (p_ptr->special_defense & DEFENSE_ACID) ADD_FLG(BAR_IMMACID);
547 if (IS_OPPOSE_ACID()) ADD_FLG(BAR_RESACID);
549 /* Oppose Lightning */
550 if (p_ptr->special_defense & DEFENSE_ELEC) ADD_FLG(BAR_IMMELEC);
551 if (IS_OPPOSE_ELEC()) ADD_FLG(BAR_RESELEC);
554 if (p_ptr->special_defense & DEFENSE_FIRE) ADD_FLG(BAR_IMMFIRE);
555 if (IS_OPPOSE_FIRE()) ADD_FLG(BAR_RESFIRE);
558 if (p_ptr->special_defense & DEFENSE_COLD) ADD_FLG(BAR_IMMCOLD);
559 if (IS_OPPOSE_COLD()) ADD_FLG(BAR_RESCOLD);
562 if (IS_OPPOSE_POIS()) ADD_FLG(BAR_RESPOIS);
565 if (p_ptr->word_recall) ADD_FLG(BAR_RECALL);
568 if (p_ptr->alter_reality) ADD_FLG(BAR_ALTER);
571 if (p_ptr->afraid) ADD_FLG(BAR_AFRAID);
574 if (p_ptr->tim_res_time) ADD_FLG(BAR_RESTIME);
576 if (p_ptr->multishadow) ADD_FLG(BAR_MULTISHADOW);
578 /* Confusing Hands */
579 if (p_ptr->special_attack & ATTACK_CONFUSE) ADD_FLG(BAR_ATTKCONF);
581 if (p_ptr->resist_magic) ADD_FLG(BAR_REGMAGIC);
583 /* Ultimate-resistance */
584 if (p_ptr->ult_res) ADD_FLG(BAR_ULTIMATE);
587 if (p_ptr->tim_levitation) ADD_FLG(BAR_LEVITATE);
589 if (p_ptr->tim_res_nether) ADD_FLG(BAR_RESNETH);
591 if (p_ptr->dustrobe) ADD_FLG(BAR_DUSTROBE);
594 if (p_ptr->special_attack & ATTACK_FIRE) ADD_FLG(BAR_ATTKFIRE);
595 if (p_ptr->special_attack & ATTACK_COLD) ADD_FLG(BAR_ATTKCOLD);
596 if (p_ptr->special_attack & ATTACK_ELEC) ADD_FLG(BAR_ATTKELEC);
597 if (p_ptr->special_attack & ATTACK_ACID) ADD_FLG(BAR_ATTKACID);
598 if (p_ptr->special_attack & ATTACK_POIS) ADD_FLG(BAR_ATTKPOIS);
599 if (p_ptr->special_defense & NINJA_S_STEALTH) ADD_FLG(BAR_SUPERSTEALTH);
601 if (p_ptr->tim_sh_fire) ADD_FLG(BAR_SHFIRE);
604 if (IS_TIM_STEALTH()) ADD_FLG(BAR_STEALTH);
606 if (p_ptr->tim_sh_touki) ADD_FLG(BAR_TOUKI);
609 if (p_ptr->tim_sh_holy) ADD_FLG(BAR_SHHOLY);
611 /* An Eye for an Eye */
612 if (p_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
615 if (p_ptr->realm1 == REALM_HEX)
617 if (hex_spelling(HEX_BLESS)) ADD_FLG(BAR_BLESSED);
618 if (hex_spelling(HEX_DEMON_AURA)) { ADD_FLG(BAR_SHFIRE); ADD_FLG(BAR_REGENERATION); }
619 if (hex_spelling(HEX_XTRA_MIGHT)) ADD_FLG(BAR_MIGHT);
620 if (hex_spelling(HEX_DETECT_EVIL)) ADD_FLG(BAR_ESP_EVIL);
621 if (hex_spelling(HEX_ICE_ARMOR)) ADD_FLG(BAR_SHCOLD);
622 if (hex_spelling(HEX_RUNESWORD)) ADD_FLG(BAR_RUNESWORD);
623 if (hex_spelling(HEX_BUILDING)) ADD_FLG(BAR_BUILD);
624 if (hex_spelling(HEX_ANTI_TELE)) ADD_FLG(BAR_ANTITELE);
625 if (hex_spelling(HEX_SHOCK_CLOAK)) ADD_FLG(BAR_SHELEC);
626 if (hex_spelling(HEX_SHADOW_CLOAK)) ADD_FLG(BAR_SHSHADOW);
627 if (hex_spelling(HEX_CONFUSION)) ADD_FLG(BAR_ATTKCONF);
628 if (hex_spelling(HEX_EYE_FOR_EYE)) ADD_FLG(BAR_EYEEYE);
629 if (hex_spelling(HEX_ANTI_MULTI)) ADD_FLG(BAR_ANTIMULTI);
630 if (hex_spelling(HEX_VAMP_BLADE)) ADD_FLG(BAR_VAMPILIC);
631 if (hex_spelling(HEX_ANTI_MAGIC)) ADD_FLG(BAR_ANTIMAGIC);
632 if (hex_spelling(HEX_CURE_LIGHT) ||
633 hex_spelling(HEX_CURE_SERIOUS) ||
634 hex_spelling(HEX_CURE_CRITICAL)) ADD_FLG(BAR_CURE);
636 if (HEX_REVENGE_TURN(p_ptr))
638 if (HEX_REVENGE_TYPE(p_ptr) == 1) ADD_FLG(BAR_PATIENCE);
639 if (HEX_REVENGE_TYPE(p_ptr) == 2) ADD_FLG(BAR_REVENGE);
643 /* Calcurate length */
644 for (i = 0; bar[i].sstr; i++)
648 col += strlen(bar[i].lstr) + 1;
653 /* If there are not excess spaces for long strings, use short one */
654 if (col - 1 > max_col_statbar)
659 for (i = 0; bar[i].sstr; i++)
663 col += strlen(bar[i].sstr);
667 /* If there are excess spaces for short string, use more */
668 if (col - 1 <= max_col_statbar - (num-1))
676 /* Centering display column */
677 col = (max_col_statbar - col) / 2;
679 /* Display status bar */
680 for (i = 0; bar[i].sstr; i++)
685 if (space == 2) str = bar[i].lstr;
686 else str = bar[i].sstr;
688 c_put_str(bar[i].attr, str, row_statbar, col);
690 if (space > 0) col++;
691 if (col > max_col_statbar) break;
698 * @brief プレイヤーの称号を表示する / Prints "title", including "wizard" or "winner" as needed.
701 static void prt_title(void)
708 p = _("[ウィザード]", "[=-WIZARD-=]");
710 else if (p_ptr->total_winner || (p_ptr->lev > PY_MAX_LEVEL))
712 if (p_ptr->arena_number > MAX_ARENA_MONS + 2)
714 p = _("*真・勝利者*", "*TRUEWINNER*");
718 p = _("***勝利者***", "***WINNER***");
725 my_strcpy(str, player_title[p_ptr->pclass][(p_ptr->lev - 1) / 5], sizeof(str));
729 prt_field(p, ROW_TITLE, COL_TITLE);
734 * @brief プレイヤーのレベルを表示する / Prints level
737 static void prt_level(void)
741 sprintf(tmp, _("%5d", "%6d"), p_ptr->lev);
743 if (p_ptr->lev >= p_ptr->max_plv)
745 put_str(_("レベル ", "LEVEL "), ROW_LEVEL, 0);
746 c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 7);
750 put_str(_("xレベル", "Level "), ROW_LEVEL, 0);
751 c_put_str(TERM_YELLOW, tmp, ROW_LEVEL, COL_LEVEL + 7);
757 * @brief プレイヤーの経験値を表示する / Display the experience
760 static void prt_exp(void)
764 if ((!exp_need)||(p_ptr->prace == RACE_ANDROID))
766 (void)sprintf(out_val, "%8ld", (long)p_ptr->exp);
770 if (p_ptr->lev >= PY_MAX_LEVEL)
772 (void)sprintf(out_val, "********");
776 (void)sprintf(out_val, "%8ld", (long)(player_exp [p_ptr->lev - 1] * p_ptr->expfact / 100L) - p_ptr->exp);
780 if (p_ptr->exp >= p_ptr->max_exp)
782 if (p_ptr->prace == RACE_ANDROID) put_str(_("強化 ", "Cst "), ROW_EXP, 0);
783 else put_str(_("経験 ", "EXP "), ROW_EXP, 0);
784 c_put_str(TERM_L_GREEN, out_val, ROW_EXP, COL_EXP + 4);
788 put_str(_("x経験", "Exp "), ROW_EXP, 0);
789 c_put_str(TERM_YELLOW, out_val, ROW_EXP, COL_EXP + 4);
794 * @brief プレイヤーの所持金を表示する / Prints current gold
797 static void prt_gold(void)
800 put_str(_("$ ", "AU "), ROW_GOLD, COL_GOLD);
801 sprintf(tmp, "%9ld", (long)p_ptr->au);
802 c_put_str(TERM_L_GREEN, tmp, ROW_GOLD, COL_GOLD + 3);
807 * @brief プレイヤーのACを表示する / Prints current AC
810 static void prt_ac(void)
815 /* AC の表示方式を変更している */
816 put_str(" AC( )", ROW_AC, COL_AC);
817 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
818 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 6);
820 put_str("Cur AC ", ROW_AC, COL_AC);
821 sprintf(tmp, "%5d", p_ptr->dis_ac + p_ptr->dis_to_a);
822 c_put_str(TERM_L_GREEN, tmp, ROW_AC, COL_AC + 7);
829 * @brief プレイヤーのHPを表示する / Prints Cur/Max hit points
832 static void prt_hp(void)
834 /* ヒットポイントの表示方法を変更 */
840 put_str("HP", ROW_CURHP, COL_CURHP);
843 sprintf(tmp, "%4ld", (long int)p_ptr->chp);
845 if (p_ptr->chp >= p_ptr->mhp)
847 color = TERM_L_GREEN;
849 else if (p_ptr->chp > (p_ptr->mhp * hitpoint_warn) / 10)
858 c_put_str(color, tmp, ROW_CURHP, COL_CURHP+3);
861 put_str( "/", ROW_CURHP, COL_CURHP + 7 );
864 sprintf(tmp, "%4ld", (long int)p_ptr->mhp);
865 color = TERM_L_GREEN;
867 c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
872 * @brief プレイヤーのMPを表示する / Prints players max/cur spell points
875 static void prt_sp(void)
877 /* マジックポイントの表示方法を変更している */
882 /* Do not show mana unless it matters */
883 if (!mp_ptr->spell_book) return;
886 put_str(_("MP", "SP"), ROW_CURSP, COL_CURSP);
889 sprintf(tmp, "%4ld", (long int)p_ptr->csp);
891 if (p_ptr->csp >= p_ptr->msp)
893 color = TERM_L_GREEN;
895 else if (p_ptr->csp > (p_ptr->msp * mana_warn) / 10)
904 c_put_str(color, tmp, ROW_CURSP, COL_CURSP+3);
907 put_str( "/", ROW_CURSP, COL_CURSP + 7 );
910 sprintf(tmp, "%4ld", (long int)p_ptr->msp);
911 color = TERM_L_GREEN;
913 c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
918 * @brief 現在のフロアの深さを表示する / Prints depth in stat area
921 static void prt_depth(void)
924 TERM_LEN wid, hgt, row_depth, col_depth;
925 TERM_COLOR attr = TERM_WHITE;
927 Term_get_size(&wid, &hgt);
928 col_depth = wid + COL_DEPTH;
929 row_depth = hgt + ROW_DEPTH;
933 strcpy(depths, _("地上", "Surf."));
935 else if (p_ptr->inside_quest && !dungeon_type)
937 strcpy(depths, _("地上", "Quest"));
941 if (depth_in_feet) (void)sprintf(depths, _("%d ft", "%d ft"), (int)dun_level * 50);
942 else (void)sprintf(depths, _("%d 階", "Lev %d"), (int)dun_level);
944 /* Get color of level based on feeling -JSV- */
945 switch (p_ptr->feeling)
947 case 0: attr = TERM_SLATE; break; /* Unknown */
948 case 1: attr = TERM_L_BLUE; break; /* Special */
949 case 2: attr = TERM_VIOLET; break; /* Horrible visions */
950 case 3: attr = TERM_RED; break; /* Very dangerous */
951 case 4: attr = TERM_L_RED; break; /* Very bad feeling */
952 case 5: attr = TERM_ORANGE; break; /* Bad feeling */
953 case 6: attr = TERM_YELLOW; break; /* Nervous */
954 case 7: attr = TERM_L_UMBER; break; /* Luck is turning */
955 case 8: attr = TERM_L_WHITE; break; /* Don't like */
956 case 9: attr = TERM_WHITE; break; /* Reasonably safe */
957 case 10: attr = TERM_WHITE; break; /* Boring place */
961 /* Right-Adjust the "depth", and clear old values */
962 c_prt(attr, format("%7s", depths), row_depth, col_depth);
967 * @brief プレイヤーの空腹状態を表示する / Prints status of hunger
970 static void prt_hunger(void)
972 if(p_ptr->wizard && p_ptr->inside_arena) return;
974 /* Fainting / Starving */
975 if (p_ptr->food < PY_FOOD_FAINT)
977 c_put_str(TERM_RED, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
981 else if (p_ptr->food < PY_FOOD_WEAK)
983 c_put_str(TERM_ORANGE, _("衰弱 ", "Weak "), ROW_HUNGRY, COL_HUNGRY);
987 else if (p_ptr->food < PY_FOOD_ALERT)
989 c_put_str(TERM_YELLOW, _("空腹 ", "Hungry"), ROW_HUNGRY, COL_HUNGRY);
993 else if (p_ptr->food < PY_FOOD_FULL)
995 c_put_str(TERM_L_GREEN, " ", ROW_HUNGRY, COL_HUNGRY);
999 else if (p_ptr->food < PY_FOOD_MAX)
1001 c_put_str(TERM_L_GREEN, _("満腹 ", "Full "), ROW_HUNGRY, COL_HUNGRY);
1007 c_put_str(TERM_GREEN, _("食過ぎ", "Gorged"), ROW_HUNGRY, COL_HUNGRY);
1013 * @brief プレイヤーの行動状態を表示する / Prints Searching, Resting, Paralysis, or 'count' status
1016 * Display is always exactly 10 characters wide (see below)
1017 * This function was a major bottleneck when resting, so a lot of
1018 * the text formatting code was optimized in place below.
1020 static void prt_state(void)
1022 TERM_COLOR attr = TERM_WHITE;
1028 if (command_rep > 999)
1030 (void)sprintf(text, "%2d00", command_rep / 100);
1034 (void)sprintf(text, " %2d", command_rep);
1041 switch(p_ptr->action)
1045 strcpy(text, _("探索", "Sear"));
1052 /* Start with "Rest" */
1053 strcpy(text, _(" ", " "));
1055 /* Extensive (timed) rest */
1056 if (resting >= 1000)
1061 text[1] = '0' + (i % 10);
1062 text[0] = '0' + (i / 10);
1065 /* Long (timed) rest */
1066 else if (resting >= 100)
1069 text[3] = '0' + (i % 10);
1071 text[2] = '0' + (i % 10);
1072 text[1] = '0' + (i / 10);
1075 /* Medium (timed) rest */
1076 else if (resting >= 10)
1079 text[3] = '0' + (i % 10);
1080 text[2] = '0' + (i / 10);
1083 /* Short (timed) rest */
1084 else if (resting > 0)
1087 text[3] = '0' + (i);
1090 /* Rest until healed */
1091 else if (resting == COMMAND_ARG_REST_FULL_HEALING)
1093 text[0] = text[1] = text[2] = text[3] = '*';
1096 /* Rest until done */
1097 else if (resting == COMMAND_ARG_REST_UNTIL_DONE)
1099 text[0] = text[1] = text[2] = text[3] = '&';
1105 strcpy(text, _("学習", "lear"));
1106 if (new_mane) attr = TERM_L_RED;
1111 strcpy(text, _("釣り", "fish"));
1117 for (i = 0; i < MAX_KAMAE; i++)
1118 if (p_ptr->special_defense & (KAMAE_GENBU << i)) break;
1121 case 0: attr = TERM_GREEN;break;
1122 case 1: attr = TERM_WHITE;break;
1123 case 2: attr = TERM_L_BLUE;break;
1124 case 3: attr = TERM_L_RED;break;
1126 strcpy(text, kamae_shurui[i].desc);
1132 for (i = 0; i < MAX_KATA; i++)
1133 if (p_ptr->special_defense & (KATA_IAI << i)) break;
1134 strcpy(text, kata_shurui[i].desc);
1139 strcpy(text, _("歌 ", "Sing"));
1142 case ACTION_HAYAGAKE:
1144 strcpy(text, _("速駆", "Fast"));
1149 strcpy(text, _("詠唱", "Spel"));
1160 /* Display the info (or blanks) */
1161 c_put_str(attr, format("%5.5s",text), ROW_STATE, COL_STATE);
1166 * @brief プレイヤーの行動速度を表示する / Prints the speed of a character. -CJS-
1169 static void prt_speed(void)
1171 int i = p_ptr->pspeed;
1172 bool is_fast = IS_FAST();
1174 TERM_COLOR attr = TERM_WHITE;
1176 TERM_LEN wid, hgt, row_speed, col_speed;
1178 Term_get_size(&wid, &hgt);
1179 col_speed = wid + COL_SPEED;
1180 row_speed = hgt + ROW_SPEED;
1182 /* Hack -- Visually "undo" the Search Mode Slowdown */
1183 if (p_ptr->action == ACTION_SEARCH && !p_ptr->lightspeed) i += 10;
1190 monster_type *m_ptr = &m_list[p_ptr->riding];
1191 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1192 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1193 else attr = TERM_GREEN;
1195 else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
1196 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1197 else attr = TERM_L_GREEN;
1199 sprintf(buf, "%s(+%d)", (p_ptr->riding ? "乗馬" : "加速"), (i - 110));
1201 sprintf(buf, "Fast(+%d)", (i - 110));
1211 monster_type *m_ptr = &m_list[p_ptr->riding];
1212 if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
1213 else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
1214 else attr = TERM_RED;
1216 else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
1217 else if (p_ptr->slow && !is_fast) attr = TERM_VIOLET;
1218 else attr = TERM_L_UMBER;
1220 sprintf(buf, "%s(-%d)", (p_ptr->riding ? "乗馬" : "減速"), (110 - i));
1222 sprintf(buf, "Slow(-%d)", (110 - i));
1225 else if (p_ptr->riding)
1228 strcpy(buf, _("乗馬中", "Riding"));
1231 /* Display the speed */
1232 c_put_str(attr, format("%-9s", buf), row_speed, col_speed);
1237 * @brief プレイヤーの呪文学習可能状態を表示する
1240 static void prt_study(void)
1242 TERM_LEN wid, hgt, row_study, col_study;
1244 Term_get_size(&wid, &hgt);
1245 col_study = wid + COL_STUDY;
1246 row_study = hgt + ROW_STUDY;
1248 if (p_ptr->new_spells)
1250 put_str(_("学習", "Stud"), row_study, col_study);
1254 put_str(" ", row_study, col_study);
1260 * @brief プレイヤーのものまね可能状態を表示する
1263 static void prt_imitation(void)
1265 TERM_LEN wid, hgt, row_study, col_study;
1267 Term_get_size(&wid, &hgt);
1268 col_study = wid + COL_STUDY;
1269 row_study = hgt + ROW_STUDY;
1271 if (p_ptr->pclass == CLASS_IMITATOR)
1273 if (p_ptr->mane_num)
1276 if (new_mane) attr = TERM_L_RED;
1277 else attr = TERM_WHITE;
1278 c_put_str(attr, _("まね", "Imit"), row_study, col_study);
1282 put_str(" ", row_study, col_study);
1288 * @brief プレイヤーの負傷状態を表示する
1291 static void prt_cut(void)
1297 c_put_str(TERM_L_RED, _("致命傷 ", "Mortal wound"), ROW_CUT, COL_CUT);
1301 c_put_str(TERM_RED, _("ひどい深手 ", "Deep gash "), ROW_CUT, COL_CUT);
1305 c_put_str(TERM_RED, _("重傷 ", "Severe cut "), ROW_CUT, COL_CUT);
1309 c_put_str(TERM_ORANGE, _("大変な傷 ", "Nasty cut "), ROW_CUT, COL_CUT);
1313 c_put_str(TERM_ORANGE, _("ひどい傷 ", "Bad cut "), ROW_CUT, COL_CUT);
1317 c_put_str(TERM_YELLOW, _("軽傷 ", "Light cut "), ROW_CUT, COL_CUT);
1321 c_put_str(TERM_YELLOW, _("かすり傷 ", "Graze "), ROW_CUT, COL_CUT);
1325 put_str(" ", ROW_CUT, COL_CUT);
1331 * @brief プレイヤーの朦朧状態を表示する
1334 static void prt_stun(void)
1336 int s = p_ptr->stun;
1340 c_put_str(TERM_RED, _("意識不明瞭 ", "Knocked out "), ROW_STUN, COL_STUN);
1344 c_put_str(TERM_ORANGE, _("ひどく朦朧 ", "Heavy stun "), ROW_STUN, COL_STUN);
1348 c_put_str(TERM_ORANGE, _("朦朧 ", "Stun "), ROW_STUN, COL_STUN);
1352 put_str(" ", ROW_STUN, COL_STUN);
1359 * @brief モンスターの体力ゲージを表示する
1360 * @param riding TRUEならば騎乗中のモンスターの体力、FALSEならターゲットモンスターの体力を表示する。表示位置は固定。
1364 * Redraw the "monster health bar" -DRS-
1365 * Rather extensive modifications by -BEN-
1367 * The "monster health bar" provides visual feedback on the "health"
1368 * of the monster currently being "tracked". There are several ways
1369 * to "track" a monster, including targetting it, attacking it, and
1370 * affecting it (and nobody else) with a ranged attack.
1372 * Display the monster health bar (affectionately known as the
1373 * "health-o-meter"). Clear health bar if nothing is being tracked.
1374 * Auto-track current target monster when bored. Note that the
1375 * health-bar stops tracking any monster that "disappears".
1378 static void health_redraw(bool riding)
1382 monster_type *m_ptr;
1386 health_who = p_ptr->riding;
1387 row = ROW_RIDING_INFO;
1388 col = COL_RIDING_INFO;
1392 health_who = p_ptr->health_who;
1397 m_ptr = &m_list[health_who];
1399 if (p_ptr->wizard && p_ptr->inside_battle)
1404 Term_putstr(col - 2, row, 12, TERM_WHITE, " / ");
1405 Term_putstr(col - 2, row + 1, 12, TERM_WHITE, " / ");
1406 Term_putstr(col - 2, row + 2, 12, TERM_WHITE, " / ");
1407 Term_putstr(col - 2, row + 3, 12, TERM_WHITE, " / ");
1411 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));
1412 Term_putstr(col - 1, row, 5, TERM_WHITE, format("%5d", m_list[1].hp));
1413 Term_putstr(col + 5, row, 6, TERM_WHITE, format("%5d", m_list[1].max_maxhp));
1418 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));
1419 Term_putstr(col - 1, row + 1, 5, TERM_WHITE, format("%5d", m_list[2].hp));
1420 Term_putstr(col + 5, row + 1, 6, TERM_WHITE, format("%5d", m_list[2].max_maxhp));
1425 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));
1426 Term_putstr(col - 1, row + 2, 5, TERM_WHITE, format("%5d", m_list[3].hp));
1427 Term_putstr(col + 5, row + 2, 6, TERM_WHITE, format("%5d", m_list[3].max_maxhp));
1432 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));
1433 Term_putstr(col - 1, row + 3, 5, TERM_WHITE, format("%5d", m_list[4].hp));
1434 Term_putstr(col + 5, row + 3, 6, TERM_WHITE, format("%5d", m_list[4].max_maxhp));
1443 /* Erase the health bar */
1444 Term_erase(col, row, 12);
1447 /* Tracking an unseen monster */
1448 else if (!m_ptr->ml)
1450 /* Indicate that the monster health is "unknown" */
1451 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1454 /* Tracking a hallucinatory monster */
1455 else if (p_ptr->image)
1457 /* Indicate that the monster health is "unknown" */
1458 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1461 /* Tracking a dead monster (???) */
1462 else if (m_ptr->hp < 0)
1464 /* Indicate that the monster health is "unknown" */
1465 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1468 /* Tracking a visible monster */
1471 /* Extract the "percent" of health */
1472 int pct = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->maxhp : 0;
1473 int pct2 = m_ptr->maxhp > 0 ? 100L * m_ptr->hp / m_ptr->max_maxhp: 0;
1475 /* Convert percent into "health" */
1476 int len = (pct2 < 10) ? 1 : (pct2 < 90) ? (pct2 / 10 + 1) : 10;
1478 /* Default to almost dead */
1479 TERM_COLOR attr = TERM_RED;
1482 if (MON_INVULNER(m_ptr)) attr = TERM_WHITE;
1485 else if (MON_CSLEEP(m_ptr)) attr = TERM_BLUE;
1488 else if (MON_MONFEAR(m_ptr)) attr = TERM_VIOLET;
1491 else if (pct >= 100) attr = TERM_L_GREEN;
1493 /* Somewhat Wounded */
1494 else if (pct >= 60) attr = TERM_YELLOW;
1497 else if (pct >= 25) attr = TERM_ORANGE;
1500 else if (pct >= 10) attr = TERM_L_RED;
1502 /* Default to "unknown" */
1503 Term_putstr(col, row, 12, TERM_WHITE, "[----------]");
1505 /* Dump the current "health" (use '*' symbols) */
1506 Term_putstr(col + 1, row, len, attr, "**********");
1514 * @brief プレイヤーのステータスを一括表示する(左側部分) / Display basic info (mostly left of map)
1517 static void prt_frame_basic(void)
1521 /* Race and Class */
1522 if (p_ptr->mimic_form)
1523 prt_field(mimic_info[p_ptr->mimic_form].title, ROW_RACE, COL_RACE);
1527 my_strcpy(str, rp_ptr->title, sizeof(str));
1528 prt_field(str, ROW_RACE, COL_RACE);
1530 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
1531 /* prt_field(ap_ptr->title, ROW_SEIKAKU, COL_SEIKAKU); */
1537 /* Level/Experience */
1542 for (i = 0; i < 6; i++) prt_stat(i);
1560 health_redraw(FALSE);
1561 health_redraw(TRUE);
1566 * @brief プレイヤーのステータスを一括表示する(下部分) / Display extra info (mostly below map)
1569 static void prt_frame_extra(void)
1594 * @brief サブウィンドウに所持品一覧を表示する / Hack -- display inventory in sub-windows
1597 static void fix_inven(void)
1602 for (j = 0; j < 8; j++)
1607 if (!angband_term[j]) continue;
1609 /* No relevant flags */
1610 if (!(window_flag[j] & (PW_INVEN))) continue;
1613 Term_activate(angband_term[j]);
1615 /* Display inventory */
1626 * @brief モンスターの現在数を一行で表現する / Print monster info in line
1629 * @param m_ptr 思い出を表示するモンスター情報の参照ポインタ
1630 * @param n_same モンスターの数の現在数
1634 * nnn : number or unique(U) or wanted unique(W)
1635 * X : symbol of monster
1636 * LV : monster lv if known
1637 * name: name of monster
1641 static void print_monster_line(TERM_LEN x, TERM_LEN y, monster_type* m_ptr, int n_same){
1644 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1645 monster_race* r_ptr = &r_info[r_idx];
1649 //Number of 'U'nique
1650 if(r_ptr->flags1&RF1_UNIQUE){//unique
1651 bool is_kubi = FALSE;
1652 for(i=0;i<MAX_KUBI;i++){
1653 if(kubi_r_idx[i] == r_idx){
1658 Term_addstr(-1, TERM_WHITE, is_kubi?" W":" U");
1660 sprintf(buf, "%3d", n_same);
1661 Term_addstr(-1, TERM_WHITE, buf);
1664 Term_addstr(-1, TERM_WHITE, " ");
1665 //Term_add_bigch(r_ptr->d_attr, r_ptr->d_char);
1666 //Term_addstr(-1, TERM_WHITE, "/");
1667 Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
1669 if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
1670 sprintf(buf, " %2d", (int)r_ptr->level);
1674 Term_addstr(-1, TERM_WHITE, buf);
1676 sprintf(buf, " %s ", r_name+r_ptr->name);
1677 Term_addstr(-1, TERM_WHITE, buf);
1679 //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
1683 * @brief モンスターの出現リストを表示する / Print monster info in line
1686 * @param max_lines 最大何行描画するか
1688 void print_monster_list(TERM_LEN x, TERM_LEN y, TERM_LEN max_lines){
1690 monster_type* last_mons = NULL;
1691 monster_type* m_ptr = NULL;
1695 for(i=0;i<temp_n;i++){
1696 cave_type* c_ptr = &cave[temp_y[i]][temp_x[i]];
1697 if(!c_ptr->m_idx || !m_list[c_ptr->m_idx].ml)continue;//no mons or cannot look
1698 m_ptr = &m_list[c_ptr->m_idx];
1699 if(is_pet(m_ptr))continue;//pet
1700 if(!m_ptr->r_idx)continue;//dead?
1703 MONRACE_IDX r_idx = m_ptr->ap_r_idx;
1704 monster_race* r_ptr = &r_info[r_idx];
1705 cptr name = (r_name + r_ptr->name);
1706 cptr ename = (r_name + r_ptr->name);
1707 //ミミック類や「それ」等は、一覧に出てはいけない
1708 if(r_ptr->flags1&RF1_CHAR_CLEAR)continue;
1709 if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue;
1711 if((strcmp(name, "生ける虚無『ヌル』")==0)||
1712 (strcmp(ename, "Null the Living Void")==0))continue;
1713 //"金無垢の指輪"は、一覧に出てはいけない
1714 if((strcmp(name, "金無垢の指輪")==0)||
1715 (strcmp(ename, "Plain Gold Ring")==0))continue;
1719 //ソート済みなので同じモンスターは連続する.これを利用して同じモンスターをカウント,まとめて表示する.
1720 if(!last_mons){//先頭モンスター
1726 if(last_mons->ap_r_idx == m_ptr->ap_r_idx){
1728 continue;//表示処理を次に回す
1730 //print last mons info
1731 print_monster_line(x, line++, last_mons, n_same);
1734 if(line-y-1==max_lines){//残り1行
1738 if(line-y-1==max_lines && i!=temp_n){
1739 Term_gotoxy(x, line);
1740 Term_addstr(-1, TERM_WHITE, "-- and more --");
1742 if(last_mons)print_monster_line(x, line++, last_mons, n_same);
1747 * @brief 出現中モンスターのリストをサブウィンドウに表示する / Hack -- display monster list in sub-windows
1750 static void fix_monster_list(void)
1756 for (j = 0; j < 8; j++)
1761 if (!angband_term[j]) continue;
1763 /* No relevant flags */
1764 if (!(window_flag[j] & (PW_MONSTER_LIST))) continue;
1767 Term_activate(angband_term[j]);
1768 Term_get_size(&w, &h);
1772 target_set_prepare_look();//モンスター一覧を生成,ソート
1773 print_monster_list(0, 0, h);
1784 * @brief 現在の装備品をサブウィンドウに表示する /
1785 * Hack -- display equipment in sub-windows
1788 static void fix_equip(void)
1793 for (j = 0; j < 8; j++)
1798 if (!angband_term[j]) continue;
1800 /* No relevant flags */
1801 if (!(window_flag[j] & (PW_EQUIP))) continue;
1804 Term_activate(angband_term[j]);
1806 /* Display equipment */
1817 * @brief 現在の習得済魔法をサブウィンドウに表示する /
1818 * Hack -- display spells in sub-windows
1821 static void fix_spell(void)
1826 for (j = 0; j < 8; j++)
1831 if (!angband_term[j]) continue;
1833 /* No relevant flags */
1834 if (!(window_flag[j] & (PW_SPELL))) continue;
1837 Term_activate(angband_term[j]);
1839 /* Display spell list */
1840 display_spell_list();
1850 * @brief 現在のプレイヤーステータスをサブウィンドウに表示する /
1851 * Hack -- display character in sub-windows
1854 static void fix_player(void)
1859 for (j = 0; j < 8; j++)
1864 if (!angband_term[j]) continue;
1866 /* No relevant flags */
1867 if (!(window_flag[j] & (PW_PLAYER))) continue;
1870 Term_activate(angband_term[j]);
1882 * @brief ゲームメッセージ履歴をサブウィンドウに表示する /
1883 * Hack -- display recent messages in sub-windows
1884 * Adjust for width and split messages
1887 static void fix_message(void)
1894 for (j = 0; j < 8; j++)
1899 if (!angband_term[j]) continue;
1901 /* No relevant flags */
1902 if (!(window_flag[j] & (PW_MESSAGE))) continue;
1905 Term_activate(angband_term[j]);
1907 Term_get_size(&w, &h);
1910 for (i = 0; i < h; i++)
1912 /* Dump the message on the appropriate line */
1913 Term_putstr(0, (h - 1) - i, -1, (byte)((i < now_message) ? TERM_WHITE : TERM_SLATE), message_str((s16b)i));
1916 Term_locate(&x, &y);
1918 /* Clear to end of line */
1919 Term_erase(x, y, 255);
1930 * @brief 簡易マップをサブウィンドウに表示する /
1931 * Hack -- display overhead view in sub-windows
1932 * Adjust for width and split messages
1935 * Note that the "player" symbol does NOT appear on the map.
1937 static void fix_overhead(void)
1943 for (j = 0; j < 8; j++)
1949 if (!angband_term[j]) continue;
1951 /* No relevant flags */
1952 if (!(window_flag[j] & (PW_OVERHEAD))) continue;
1955 Term_activate(angband_term[j]);
1957 /* Full map in too small window is useless */
1958 Term_get_size(&wid, &hgt);
1959 if (wid > COL_MAP + 2 && hgt > ROW_MAP + 2)
1962 display_map(&cy, &cx);
1973 * @brief ダンジョンの地形をサブウィンドウに表示する /
1974 * Hack -- display dungeon view in sub-windows
1977 static void fix_dungeon(void)
1982 for (j = 0; j < 8; j++)
1987 if (!angband_term[j]) continue;
1989 /* No relevant flags */
1990 if (!(window_flag[j] & (PW_DUNGEON))) continue;
1993 Term_activate(angband_term[j]);
1995 /* Redraw dungeon view */
2006 * @brief モンスターの思い出をサブウィンドウに表示する /
2007 * Hack -- display dungeon view in sub-windows
2010 static void fix_monster(void)
2015 for (j = 0; j < 8; j++)
2020 if (!angband_term[j]) continue;
2022 /* No relevant flags */
2023 if (!(window_flag[j] & (PW_MONSTER))) continue;
2026 Term_activate(angband_term[j]);
2028 /* Display monster race info */
2029 if (p_ptr->monster_race_idx) display_roff(p_ptr->monster_race_idx);
2039 * @brief ベースアイテム情報をサブウィンドウに表示する /
2040 * Hack -- display object recall in sub-windows
2043 static void fix_object(void)
2048 for (j = 0; j < 8; j++)
2053 if (!angband_term[j]) continue;
2055 /* No relevant flags */
2056 if (!(window_flag[j] & (PW_OBJECT))) continue;
2059 Term_activate(angband_term[j]);
2061 /* Display monster race info */
2062 if (p_ptr->object_kind_idx) display_koff(p_ptr->object_kind_idx);
2073 * @brief プレイヤーの現在学習可能な魔法数を計算し、増減に応じて魔法の忘却、再学習を処置する。 /
2074 * Calculate number of spells player should have, and forget,
2075 * or remember, spells until that number is properly reflected.
2078 * Note that this function induces various "status" messages,
2079 * which must be bypasses until the character is created.
2081 static void calc_spells(void)
2083 int i, j, k, levels;
2085 int num_boukyaku = 0;
2087 const magic_type *s_ptr;
2094 /* Hack -- must be literate */
2095 if (!mp_ptr->spell_book) return;
2097 /* Hack -- wait for creation */
2098 if (!character_generated) return;
2100 /* Hack -- handle "xtra" mode */
2101 if (character_xtra) return;
2103 if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
2105 p_ptr->new_spells = 0;
2109 p = spell_category_name(mp_ptr->spell_book);
2111 /* Determine the number of spells allowed */
2112 levels = p_ptr->lev - mp_ptr->spell_first + 1;
2114 /* Hack -- no negative spells */
2115 if (levels < 0) levels = 0;
2117 /* Extract total allowed spells */
2118 num_allowed = (adj_mag_study[p_ptr->stat_ind[mp_ptr->spell_stat]] * levels / 2);
2120 if ((p_ptr->pclass != CLASS_SAMURAI) && (mp_ptr->spell_book != TV_LIFE_BOOK))
2124 if (p_ptr->pclass == CLASS_SAMURAI)
2128 else if (p_ptr->realm2 == REALM_NONE)
2130 num_allowed = (num_allowed+1)/2;
2131 if (num_allowed>(32+bonus)) num_allowed = 32+bonus;
2133 else if ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))
2135 if (num_allowed>(96+bonus)) num_allowed = 96+bonus;
2139 if (num_allowed>(80+bonus)) num_allowed = 80+bonus;
2142 /* Count the number of spells we know */
2143 for (j = 0; j < 64; j++)
2145 /* Count known spells */
2147 (p_ptr->spell_forgotten1 & (1L << j)) :
2148 (p_ptr->spell_forgotten2 & (1L << (j - 32))))
2154 /* See how many spells we must forget or may learn */
2155 p_ptr->new_spells = num_allowed + p_ptr->add_spells + num_boukyaku - p_ptr->learned_spells;
2157 /* Forget spells which are too hard */
2158 for (i = 63; i >= 0; i--)
2160 /* Efficiency -- all done */
2161 if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
2163 /* Access the spell */
2164 j = p_ptr->spell_order[i];
2166 /* Skip non-spells */
2167 if (j >= 99) continue;
2171 if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2))
2174 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j];
2176 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32];
2179 s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2181 s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32];
2183 /* Skip spells we are allowed to know */
2184 if (s_ptr->slevel <= p_ptr->lev) continue;
2188 (p_ptr->spell_learned1 & (1L << j)) :
2189 (p_ptr->spell_learned2 & (1L << (j - 32))))
2191 /* Mark as forgotten */
2194 p_ptr->spell_forgotten1 |= (1L << j);
2195 which = p_ptr->realm1;
2199 p_ptr->spell_forgotten2 |= (1L << (j - 32));
2200 which = p_ptr->realm2;
2203 /* No longer known */
2206 p_ptr->spell_learned1 &= ~(1L << j);
2207 which = p_ptr->realm1;
2211 p_ptr->spell_learned2 &= ~(1L << (j - 32));
2212 which = p_ptr->realm2;
2216 msg_format("%sの%sを忘れてしまった。", do_spell(which, j%32, SPELL_NAME), p );
2218 msg_format("You have forgotten the %s of %s.", p, do_spell(which, j%32, SPELL_NAME));
2222 /* One more can be learned */
2223 p_ptr->new_spells++;
2228 /* Forget spells if we know too many spells */
2229 for (i = 63; i >= 0; i--)
2231 /* Stop when possible */
2232 if (p_ptr->new_spells >= 0) break;
2234 /* Efficiency -- all done */
2235 if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break;
2237 /* Get the (i+1)th spell learned */
2238 j = p_ptr->spell_order[i];
2240 /* Skip unknown spells */
2241 if (j >= 99) continue;
2243 /* Forget it (if learned) */
2245 (p_ptr->spell_learned1 & (1L << j)) :
2246 (p_ptr->spell_learned2 & (1L << (j - 32))))
2248 /* Mark as forgotten */
2251 p_ptr->spell_forgotten1 |= (1L << j);
2252 which = p_ptr->realm1;
2256 p_ptr->spell_forgotten2 |= (1L << (j - 32));
2257 which = p_ptr->realm2;
2260 /* No longer known */
2263 p_ptr->spell_learned1 &= ~(1L << j);
2264 which = p_ptr->realm1;
2268 p_ptr->spell_learned2 &= ~(1L << (j - 32));
2269 which = p_ptr->realm2;
2273 msg_format("%sの%sを忘れてしまった。",
2274 do_spell(which, j%32, SPELL_NAME), p );
2276 msg_format("You have forgotten the %s of %s.", p,
2277 do_spell(which, j%32, SPELL_NAME));
2281 /* One more can be learned */
2282 p_ptr->new_spells++;
2287 /* Check for spells to remember */
2288 for (i = 0; i < 64; i++)
2290 /* None left to remember */
2291 if (p_ptr->new_spells <= 0) break;
2293 /* Efficiency -- all done */
2294 if (!p_ptr->spell_forgotten1 && !p_ptr->spell_forgotten2) break;
2296 /* Get the next spell we learned */
2297 j = p_ptr->spell_order[i];
2299 /* Skip unknown spells */
2302 /* Access the spell */
2303 if (!is_magic((j < 32) ? p_ptr->realm1 : p_ptr->realm2))
2306 s_ptr = &technic_info[p_ptr->realm1 - MIN_TECHNIC][j];
2308 s_ptr = &technic_info[p_ptr->realm2 - MIN_TECHNIC][j%32];
2311 s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2313 s_ptr = &mp_ptr->info[p_ptr->realm2-1][j%32];
2315 /* Skip spells we cannot remember */
2316 if (s_ptr->slevel > p_ptr->lev) continue;
2318 /* First set of spells */
2320 (p_ptr->spell_forgotten1 & (1L << j)) :
2321 (p_ptr->spell_forgotten2 & (1L << (j - 32))))
2323 /* No longer forgotten */
2326 p_ptr->spell_forgotten1 &= ~(1L << j);
2327 which = p_ptr->realm1;
2331 p_ptr->spell_forgotten2 &= ~(1L << (j - 32));
2332 which = p_ptr->realm2;
2335 /* Known once more */
2338 p_ptr->spell_learned1 |= (1L << j);
2339 which = p_ptr->realm1;
2343 p_ptr->spell_learned2 |= (1L << (j - 32));
2344 which = p_ptr->realm2;
2348 msg_format("%sの%sを思い出した。", do_spell(which, j%32, SPELL_NAME), p );
2350 msg_format("You have remembered the %s of %s.", p, do_spell(which, j%32, SPELL_NAME));
2354 /* One less can be learned */
2355 p_ptr->new_spells--;
2361 if (p_ptr->realm2 == REALM_NONE)
2363 /* Count spells that can be learned */
2364 for (j = 0; j < 32; j++)
2366 if (!is_magic(p_ptr->realm1)) s_ptr = &technic_info[p_ptr->realm1-MIN_TECHNIC][j];
2367 else s_ptr = &mp_ptr->info[p_ptr->realm1-1][j];
2369 /* Skip spells we cannot remember */
2370 if (s_ptr->slevel > p_ptr->lev) continue;
2372 /* Skip spells we already know */
2373 if (p_ptr->spell_learned1 & (1L << j))
2382 if ((p_ptr->new_spells > k) &&
2383 ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK)))
2385 p_ptr->new_spells = (s16b)k;
2389 if (p_ptr->new_spells < 0) p_ptr->new_spells = 0;
2391 /* Spell count changed */
2392 if (p_ptr->old_spells != p_ptr->new_spells)
2394 /* Message if needed */
2395 if (p_ptr->new_spells)
2398 if( p_ptr->new_spells < 10 ){
2399 msg_format("あと %d つの%sを学べる。", p_ptr->new_spells, p);
2401 msg_format("あと %d 個の%sを学べる。", p_ptr->new_spells, p);
2404 msg_format("You can learn %d more %s%s.",
2405 p_ptr->new_spells, p,
2406 (p_ptr->new_spells != 1) ? "s" : "");
2411 /* Save the new_spells value */
2412 p_ptr->old_spells = p_ptr->new_spells;
2414 /* Redraw Study Status */
2415 p_ptr->redraw |= (PR_STUDY);
2417 /* Redraw object recall */
2418 p_ptr->window |= (PW_OBJECT);
2423 * @brief プレイヤーの最大MPを計算する /
2424 * Calculate maximum mana. You do not need to know any spells.
2425 * Note that mana is lowered by heavy (or inappropriate) armor.
2428 * This function induces status messages.
2430 static void calc_mana(void)
2432 int msp, levels, cur_wgt, max_wgt;
2437 /* Hack -- Must be literate */
2438 if (!mp_ptr->spell_book) return;
2440 if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
2441 (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
2442 (p_ptr->pclass == CLASS_BLUE_MAGE))
2444 levels = p_ptr->lev;
2448 if(mp_ptr->spell_first > p_ptr->lev)
2453 /* Display mana later */
2454 p_ptr->redraw |= (PR_MANA);
2458 /* Extract "effective" player level */
2459 levels = (p_ptr->lev - mp_ptr->spell_first) + 1;
2462 if (p_ptr->pclass == CLASS_SAMURAI)
2464 msp = (adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] + 10) * 2;
2465 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
2469 /* Extract total mana */
2470 msp = adj_mag_mana[p_ptr->stat_ind[mp_ptr->spell_stat]] * (levels+3) / 4;
2472 /* Hack -- usually add one mana */
2475 if (msp) msp += (msp * rp_ptr->r_adj[mp_ptr->spell_stat] / 20);
2477 if (msp && (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)) msp += msp/2;
2479 /* Hack: High mages have a 25% mana bonus */
2480 if (msp && (p_ptr->pclass == CLASS_HIGH_MAGE)) msp += msp / 4;
2482 if (msp && (p_ptr->pclass == CLASS_SORCERER)) msp += msp*(25+p_ptr->lev)/100;
2485 /* Only mages are affected */
2486 if (mp_ptr->spell_xtra & MAGIC_GLOVE_REDUCE_MANA)
2488 BIT_FLAGS flgs[TR_FLAG_SIZE];
2490 /* Assume player is not encumbered by gloves */
2491 p_ptr->cumber_glove = FALSE;
2493 /* Get the gloves */
2494 o_ptr = &inventory[INVEN_HANDS];
2496 /* Examine the gloves */
2497 object_flags(o_ptr, flgs);
2499 /* Normal gloves hurt mage-type spells */
2501 !(have_flag(flgs, TR_FREE_ACT)) &&
2502 !(have_flag(flgs, TR_DEC_MANA)) &&
2503 !(have_flag(flgs, TR_EASY_SPELL)) &&
2504 !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) &&
2505 !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
2508 p_ptr->cumber_glove = TRUE;
2511 msp = (3 * msp) / 4;
2516 /* Assume player not encumbered by armor */
2517 p_ptr->cumber_armor = FALSE;
2519 /* Weigh the armor */
2521 if(inventory[INVEN_RARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
2522 if(inventory[INVEN_LARM].tval> TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
2523 cur_wgt += inventory[INVEN_BODY].weight;
2524 cur_wgt += inventory[INVEN_HEAD].weight;
2525 cur_wgt += inventory[INVEN_OUTER].weight;
2526 cur_wgt += inventory[INVEN_HANDS].weight;
2527 cur_wgt += inventory[INVEN_FEET].weight;
2529 /* Subtract a percentage of maximum mana. */
2530 switch (p_ptr->pclass)
2532 /* For these classes, mana is halved if armour
2533 * is 30 pounds over their weight limit. */
2535 case CLASS_HIGH_MAGE:
2536 case CLASS_BLUE_MAGE:
2538 case CLASS_FORCETRAINER:
2539 case CLASS_SORCERER:
2541 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight;
2542 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight;
2546 /* Mana halved if armour is 40 pounds over weight limit. */
2551 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight*2/3;
2552 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight*2/3;
2556 case CLASS_MINDCRAFTER:
2557 case CLASS_BEASTMASTER:
2558 case CLASS_MIRROR_MASTER:
2560 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/2;
2561 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/2;
2565 /* Mana halved if armour is 50 pounds over weight limit. */
2568 case CLASS_RED_MAGE:
2569 case CLASS_WARRIOR_MAGE:
2571 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/3;
2572 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/3;
2576 /* Mana halved if armour is 60 pounds over weight limit. */
2578 case CLASS_CHAOS_WARRIOR:
2580 if (inventory[INVEN_RARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_RARM].weight/5;
2581 if (inventory[INVEN_LARM].tval <= TV_SWORD) cur_wgt += inventory[INVEN_LARM].weight/5;
2585 /* For new classes created, but not yet added to this formula. */
2592 /* Determine the weight allowance */
2593 max_wgt = mp_ptr->spell_weight;
2595 /* Heavy armor penalizes mana by a percentage. -LM- */
2596 if ((cur_wgt - max_wgt) > 0)
2599 p_ptr->cumber_armor = TRUE;
2601 /* Subtract a percentage of maximum mana. */
2602 switch (p_ptr->pclass)
2604 /* For these classes, mana is halved if armour
2605 * is 30 pounds over their weight limit. */
2607 case CLASS_HIGH_MAGE:
2608 case CLASS_BLUE_MAGE:
2610 msp -= msp * (cur_wgt - max_wgt) / 600;
2614 /* Mana halved if armour is 40 pounds over weight limit. */
2616 case CLASS_MINDCRAFTER:
2617 case CLASS_BEASTMASTER:
2619 case CLASS_FORCETRAINER:
2621 case CLASS_MIRROR_MASTER:
2623 msp -= msp * (cur_wgt - max_wgt) / 800;
2627 case CLASS_SORCERER:
2629 msp -= msp * (cur_wgt - max_wgt) / 900;
2633 /* Mana halved if armour is 50 pounds over weight limit. */
2637 case CLASS_RED_MAGE:
2639 msp -= msp * (cur_wgt - max_wgt) / 1000;
2643 /* Mana halved if armour is 60 pounds over weight limit. */
2645 case CLASS_CHAOS_WARRIOR:
2646 case CLASS_WARRIOR_MAGE:
2648 msp -= msp * (cur_wgt - max_wgt) / 1200;
2654 p_ptr->cumber_armor = FALSE;
2658 /* For new classes created, but not yet added to this formula. */
2661 msp -= msp * (cur_wgt - max_wgt) / 800;
2667 /* Mana can never be negative */
2668 if (msp < 0) msp = 0;
2671 /* Maximum mana has changed */
2672 if (p_ptr->msp != msp)
2674 /* Enforce maximum */
2675 if ((p_ptr->csp >= msp) && (p_ptr->pclass != CLASS_SAMURAI))
2678 p_ptr->csp_frac = 0;
2682 /* レベルアップの時は上昇量を表示する */
2683 if ((level_up == 1) && (msp > p_ptr->msp))
2685 msg_format("最大マジック・ポイントが %d 増加した!", (msp - p_ptr->msp));
2691 /* Display mana later */
2692 p_ptr->redraw |= (PR_MANA);
2694 p_ptr->window |= (PW_PLAYER);
2695 p_ptr->window |= (PW_SPELL);
2699 /* Hack -- handle "xtra" mode */
2700 if (character_xtra) return;
2702 /* Take note when "glove state" changes */
2703 if (p_ptr->old_cumber_glove != p_ptr->cumber_glove)
2705 if (p_ptr->cumber_glove)
2707 msg_print(_("手が覆われて呪文が唱えにくい感じがする。", "Your covered hands feel unsuitable for spellcasting."));
2711 msg_print(_("この手の状態なら、ぐっと呪文が唱えやすい感じだ。", "Your hands feel more suitable for spellcasting."));
2715 p_ptr->old_cumber_glove = p_ptr->cumber_glove;
2719 /* Take note when "armor state" changes */
2720 if (p_ptr->old_cumber_armor != p_ptr->cumber_armor)
2722 if (p_ptr->cumber_armor)
2724 msg_print(_("装備の重さで動きが鈍くなってしまっている。", "The weight of your equipment encumbers your movement."));
2728 msg_print(_("ぐっと楽に体を動かせるようになった。", "You feel able to move more freely."));
2732 p_ptr->old_cumber_armor = p_ptr->cumber_armor;
2739 * @brief プレイヤーの最大HPを計算する /
2740 * Calculate the players (maximal) hit points
2741 * Adjust current hitpoints if necessary
2745 static void calc_hitpoints(void)
2750 /* Un-inflate "half-hitpoint bonus per level" value */
2751 bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128) * p_ptr->lev / 4;
2753 /* Calculate hitpoints */
2754 mhp = p_ptr->player_hp[p_ptr->lev - 1];
2756 if (p_ptr->mimic_form)
2758 if (p_ptr->pclass == CLASS_SORCERER)
2759 tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp/2 + cp_ptr->c_mhp + ap_ptr->a_mhp;
2761 tmp_hitdie = mimic_info[p_ptr->mimic_form].r_mhp + cp_ptr->c_mhp + ap_ptr->a_mhp;
2762 mhp = mhp * tmp_hitdie / p_ptr->hitdie;
2765 if (p_ptr->pclass == CLASS_SORCERER)
2767 if (p_ptr->lev < 30)
2768 mhp = (mhp * (45+p_ptr->lev) / 100);
2770 mhp = (mhp * 75 / 100);
2771 bonus = (bonus * 65 / 100);
2776 if (p_ptr->pclass == CLASS_BERSERKER)
2778 mhp = mhp*(110+(((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 110))/100;
2781 /* Always have at least one hitpoint per level */
2782 if (mhp < p_ptr->lev + 1) mhp = p_ptr->lev + 1;
2784 /* Factor in the hero / superhero settings */
2785 if (IS_HERO()) mhp += 10;
2786 if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
2787 if (p_ptr->tsuyoshi) mhp += 50;
2789 /* Factor in the hex spell settings */
2790 if (hex_spelling(HEX_XTRA_MIGHT)) mhp += 15;
2791 if (hex_spelling(HEX_BUILDING)) mhp += 60;
2793 /* New maximum hitpoints */
2794 if (p_ptr->mhp != mhp)
2796 /* Enforce maximum */
2797 if (p_ptr->chp >= mhp)
2800 p_ptr->chp_frac = 0;
2804 /* レベルアップの時は上昇量を表示する */
2805 if ((level_up == 1) && (mhp > p_ptr->mhp))
2807 msg_format("最大ヒット・ポイントが %d 増加した!", (mhp - p_ptr->mhp) );
2810 /* Save the new max-hitpoints */
2813 /* Display hitpoints (later) */
2814 p_ptr->redraw |= (PR_HP);
2816 p_ptr->window |= (PW_PLAYER);
2821 * @brief プレイヤーの光源半径を計算する / Extract and set the current "lite radius"
2824 * SWD: Experimental modification: multiple light sources have additive effect.
2826 static void calc_torch(void)
2830 BIT_FLAGS flgs[TR_FLAG_SIZE];
2832 /* Assume no light */
2833 p_ptr->cur_lite = 0;
2835 /* Loop through all wielded items */
2836 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2838 o_ptr = &inventory[i];
2839 /* Skip empty slots */
2840 if (!o_ptr->k_idx) continue;
2842 if (o_ptr->name2 == EGO_LITE_SHINE) p_ptr->cur_lite++;
2845 if (o_ptr->name2 != EGO_LITE_DARKNESS)
2847 if (o_ptr->tval == TV_LITE)
2849 if((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue;
2850 if((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue;
2854 /* Extract the flags */
2855 object_flags(o_ptr, flgs);
2857 /* calc the lite_radius */
2860 if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 1;
2861 if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 2;
2862 if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS) rad += 3;
2863 if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
2864 if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
2865 if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
2866 p_ptr->cur_lite += (s16b)rad;
2869 /* max radius is 14 (was 5) without rewriting other code -- */
2870 /* see cave.c:update_lite() and defines.h:LITE_MAX */
2871 if (d_info[dungeon_type].flags1 & DF1_DARKNESS && p_ptr->cur_lite > 1)
2872 p_ptr->cur_lite = 1;
2875 * check if the player doesn't have light radius,
2876 * but does weakly glow as an intrinsic.
2878 if (p_ptr->cur_lite <= 0 && p_ptr->lite) p_ptr->cur_lite++;
2880 if (p_ptr->cur_lite > 14) p_ptr->cur_lite = 14;
2881 if (p_ptr->cur_lite < 0) p_ptr->cur_lite = 0;
2883 /* end experimental mods */
2885 /* Notice changes in the "lite radius" */
2886 if (p_ptr->old_lite != p_ptr->cur_lite)
2888 /* Hack -- PU_MON_LITE for monsters' darkness */
2889 p_ptr->update |= (PU_LITE | PU_MON_LITE | PU_MONSTERS);
2891 /* Remember the old lite */
2892 p_ptr->old_lite = p_ptr->cur_lite;
2894 if ((p_ptr->cur_lite > 0) && (p_ptr->special_defense & NINJA_S_STEALTH))
2895 set_superstealth(FALSE);
2901 * @brief プレイヤーの所持重量制限を計算する /
2902 * Computes current weight limit.
2905 WEIGHT weight_limit(void)
2909 /* Weight limit based only on strength */
2910 i = (WEIGHT)adj_str_wgt[p_ptr->stat_ind[A_STR]] * 50; /* Constant was 100 */
2911 if (p_ptr->pclass == CLASS_BERSERKER) i = i * 3 / 2;
2913 /* Return the result */
2918 * @brief プレイヤーが現在右手/左手に武器を持っているか判定する /
2919 * @param i 判定する手のID(右手:0 左手:1)
2920 * @return 持っているならばTRUE
2922 bool buki_motteruka(int i)
2924 return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE);
2928 * @brief 射撃武器がプレイヤーにとって重すぎるかどうかの判定 /
2929 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
2930 * @return 重すぎるならばTRUE
2932 bool is_heavy_shoot(object_type *o_ptr)
2934 int hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
2935 /* It is hard to carholdry a heavy bow */
2936 return (hold < o_ptr->weight / 10);
2940 * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す /
2941 * @param o_ptr 判定する射撃武器のアイテム情報参照ポインタ
2942 * @return 対応する矢/弾薬のベースアイテムID
2944 int bow_tval_ammo(object_type *o_ptr)
2946 /* Analyze the launcher */
2947 switch (o_ptr->sval)
2977 * @brief 装備中の射撃武器の威力倍率を返す /
2978 * calcurate the fire rate of target object
2979 * @param o_ptr 計算する射撃武器のアイテム情報参照ポインタ
2980 * @return 射撃倍率の値(100で1.00倍)
2982 s16b calc_num_fire(object_type *o_ptr)
2984 int extra_shots = 0;
2987 OBJECT_TYPE_VALUE tval_ammo = bow_tval_ammo(o_ptr);
2989 BIT_FLAGS flgs[TR_FLAG_SIZE];
2991 /* Scan the usable inventory */
2992 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
2994 q_ptr = &inventory[i];
2996 /* Skip non-objects */
2997 if (!q_ptr->k_idx) continue;
2999 /* Do not apply current equip */
3000 if (i == INVEN_BOW) continue;
3002 /* Extract the item flags */
3003 object_flags(q_ptr, flgs);
3006 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
3009 object_flags(o_ptr, flgs);
3010 if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
3012 if (o_ptr->k_idx && !is_heavy_shoot(o_ptr))
3016 num += (extra_shots * 100);
3018 /* Hack -- Rangers love Bows */
3019 if ((p_ptr->pclass == CLASS_RANGER) &&
3020 (tval_ammo == TV_ARROW))
3022 num += (p_ptr->lev * 4);
3025 if ((p_ptr->pclass == CLASS_CAVALRY) &&
3026 (tval_ammo == TV_ARROW))
3028 num += (p_ptr->lev * 3);
3031 if (p_ptr->pclass == CLASS_ARCHER)
3033 if (tval_ammo == TV_ARROW)
3034 num += ((p_ptr->lev * 5)+50);
3035 else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
3036 num += (p_ptr->lev * 4);
3040 * Addendum -- also "Reward" high level warriors,
3041 * with _any_ missile weapon -- TY
3043 if (p_ptr->pclass == CLASS_WARRIOR &&
3044 (tval_ammo <= TV_BOLT) &&
3045 (tval_ammo >= TV_SHOT))
3047 num += (p_ptr->lev * 2);
3049 if ((p_ptr->pclass == CLASS_ROGUE) &&
3050 (tval_ammo == TV_SHOT))
3052 num += (p_ptr->lev * 4);
3059 * @brief プレイヤーの全ステータスを更新する /
3060 * Calculate the players current "state", taking into account
3061 * not only race/class intrinsics, but also objects being worn
3062 * and temporary spell effects.
3066 * See also calc_mana() and calc_hitpoints().
3068 * Take note of the new "speed code", in particular, a very strong
3069 * player will start slowing down as soon as he reaches 150 pounds,
3070 * but not until he reaches 450 pounds will he be half as fast as
3071 * a normal kobold. This both hurts and helps the player, hurts
3072 * because in the old days a player could just avoid 300 pounds,
3073 * and helps because now carrying 300 pounds is not very painful.
3075 * The "weapon" and "bow" do *not* add to the bonuses to hit or to
3076 * damage, since that would affect non-combat things. These values
3077 * are actually added in later, at the appropriate place.
3079 * This function induces various "status" messages.
3082 void calc_bonuses(void)
3084 int i, j, hold, neutral[2];
3086 int default_hand = 0;
3087 int empty_hands_status = empty_hands(TRUE);
3090 BIT_FLAGS flgs[TR_FLAG_SIZE];
3092 bool yoiyami = FALSE;
3093 bool down_saving = FALSE;
3095 bool have_dd_s = FALSE, have_dd_t = FALSE;
3097 bool have_sw = FALSE, have_kabe = FALSE;
3098 bool easy_2weapon = FALSE;
3099 bool riding_levitation = FALSE;
3100 OBJECT_IDX this_o_idx, next_o_idx = 0;
3101 const player_race *tmp_rp_ptr;
3103 /* Save the old vision stuff */
3104 bool old_telepathy = p_ptr->telepathy;
3105 bool old_esp_animal = p_ptr->esp_animal;
3106 bool old_esp_undead = p_ptr->esp_undead;
3107 bool old_esp_demon = p_ptr->esp_demon;
3108 bool old_esp_orc = p_ptr->esp_orc;
3109 bool old_esp_troll = p_ptr->esp_troll;
3110 bool old_esp_giant = p_ptr->esp_giant;
3111 bool old_esp_dragon = p_ptr->esp_dragon;
3112 bool old_esp_human = p_ptr->esp_human;
3113 bool old_esp_evil = p_ptr->esp_evil;
3114 bool old_esp_good = p_ptr->esp_good;
3115 bool old_esp_nonliving = p_ptr->esp_nonliving;
3116 bool old_esp_unique = p_ptr->esp_unique;
3117 bool old_see_inv = p_ptr->see_inv;
3118 bool old_mighty_throw = p_ptr->mighty_throw;
3120 /* Save the old armor class */
3121 s16b old_dis_ac = p_ptr->dis_ac;
3122 s16b old_dis_to_a = p_ptr->dis_to_a;
3125 /* Clear extra blows/shots */
3126 extra_blows[0] = extra_blows[1] = 0;
3128 /* Clear the stat modifiers */
3129 for (i = 0; i < 6; i++) p_ptr->stat_add[i] = 0;
3132 /* Clear the Displayed/Real armor class */
3133 p_ptr->dis_ac = p_ptr->ac = 0;
3135 /* Clear the Displayed/Real Bonuses */
3136 p_ptr->dis_to_h[0] = p_ptr->to_h[0] = 0;
3137 p_ptr->dis_to_h[1] = p_ptr->to_h[1] = 0;
3138 p_ptr->dis_to_d[0] = p_ptr->to_d[0] = 0;
3139 p_ptr->dis_to_d[1] = p_ptr->to_d[1] = 0;
3140 p_ptr->dis_to_h_b = p_ptr->to_h_b = 0;
3141 p_ptr->dis_to_a = p_ptr->to_a = 0;
3145 p_ptr->to_m_chance = 0;
3147 /* Clear the Extra Dice Bonuses */
3148 p_ptr->to_dd[0] = p_ptr->to_ds[0] = 0;
3149 p_ptr->to_dd[1] = p_ptr->to_ds[1] = 0;
3151 /* Start with "normal" speed */
3154 /* Start with a single blow per turn */
3155 p_ptr->num_blow[0] = 1;
3156 p_ptr->num_blow[1] = 1;
3158 /* Start with a single shot per turn */
3159 p_ptr->num_fire = 100;
3161 /* Reset the "xtra" tval */
3162 p_ptr->tval_xtra = 0;
3164 /* Reset the "ammo" tval */
3165 p_ptr->tval_ammo = 0;
3167 /* Clear all the flags */
3169 p_ptr->bless_blade = FALSE;
3170 p_ptr->xtra_might = FALSE;
3171 p_ptr->impact[0] = FALSE;
3172 p_ptr->impact[1] = FALSE;
3173 p_ptr->pass_wall = FALSE;
3174 p_ptr->kill_wall = FALSE;
3175 p_ptr->dec_mana = FALSE;
3176 p_ptr->easy_spell = FALSE;
3177 p_ptr->heavy_spell = FALSE;
3178 p_ptr->see_inv = FALSE;
3179 p_ptr->free_act = FALSE;
3180 p_ptr->slow_digest = FALSE;
3181 p_ptr->regenerate = FALSE;
3182 p_ptr->can_swim = FALSE;
3183 p_ptr->levitation = FALSE;
3184 p_ptr->hold_exp = FALSE;
3185 p_ptr->telepathy = FALSE;
3186 p_ptr->esp_animal = FALSE;
3187 p_ptr->esp_undead = FALSE;
3188 p_ptr->esp_demon = FALSE;
3189 p_ptr->esp_orc = FALSE;
3190 p_ptr->esp_troll = FALSE;
3191 p_ptr->esp_giant = FALSE;
3192 p_ptr->esp_dragon = FALSE;
3193 p_ptr->esp_human = FALSE;
3194 p_ptr->esp_evil = FALSE;
3195 p_ptr->esp_good = FALSE;
3196 p_ptr->esp_nonliving = FALSE;
3197 p_ptr->esp_unique = FALSE;
3198 p_ptr->lite = FALSE;
3199 p_ptr->sustain_str = FALSE;
3200 p_ptr->sustain_int = FALSE;
3201 p_ptr->sustain_wis = FALSE;
3202 p_ptr->sustain_con = FALSE;
3203 p_ptr->sustain_dex = FALSE;
3204 p_ptr->sustain_chr = FALSE;
3205 p_ptr->resist_acid = FALSE;
3206 p_ptr->resist_elec = FALSE;
3207 p_ptr->resist_fire = FALSE;
3208 p_ptr->resist_cold = FALSE;
3209 p_ptr->resist_pois = FALSE;
3210 p_ptr->resist_conf = FALSE;
3211 p_ptr->resist_sound = FALSE;
3212 p_ptr->resist_lite = FALSE;
3213 p_ptr->resist_dark = FALSE;
3214 p_ptr->resist_chaos = FALSE;
3215 p_ptr->resist_disen = FALSE;
3216 p_ptr->resist_shard = FALSE;
3217 p_ptr->resist_nexus = FALSE;
3218 p_ptr->resist_blind = FALSE;
3219 p_ptr->resist_neth = FALSE;
3220 p_ptr->resist_time = FALSE;
3221 p_ptr->resist_fear = FALSE;
3222 p_ptr->reflect = FALSE;
3223 p_ptr->sh_fire = FALSE;
3224 p_ptr->sh_elec = FALSE;
3225 p_ptr->sh_cold = FALSE;
3226 p_ptr->anti_magic = FALSE;
3227 p_ptr->anti_tele = FALSE;
3228 p_ptr->warning = FALSE;
3229 p_ptr->mighty_throw = FALSE;
3230 p_ptr->see_nocto = FALSE;
3232 p_ptr->immune_acid = FALSE;
3233 p_ptr->immune_elec = FALSE;
3234 p_ptr->immune_fire = FALSE;
3235 p_ptr->immune_cold = FALSE;
3237 p_ptr->ryoute = FALSE;
3238 p_ptr->migite = FALSE;
3239 p_ptr->hidarite = FALSE;
3240 p_ptr->no_flowed = FALSE;
3242 p_ptr->align = friend_align;
3244 if (p_ptr->mimic_form) tmp_rp_ptr = &mimic_info[p_ptr->mimic_form];
3245 else tmp_rp_ptr = &race_info[p_ptr->prace];
3247 /* Base infravision (purely racial) */
3248 p_ptr->see_infra = tmp_rp_ptr->infra;
3250 /* Base skill -- disarming */
3251 p_ptr->skill_dis = tmp_rp_ptr->r_dis + cp_ptr->c_dis + ap_ptr->a_dis;
3253 /* Base skill -- magic devices */
3254 p_ptr->skill_dev = tmp_rp_ptr->r_dev + cp_ptr->c_dev + ap_ptr->a_dev;
3256 /* Base skill -- saving throw */
3257 p_ptr->skill_sav = tmp_rp_ptr->r_sav + cp_ptr->c_sav + ap_ptr->a_sav;
3259 /* Base skill -- stealth */
3260 p_ptr->skill_stl = tmp_rp_ptr->r_stl + cp_ptr->c_stl + ap_ptr->a_stl;
3262 /* Base skill -- searching ability */
3263 p_ptr->skill_srh = tmp_rp_ptr->r_srh + cp_ptr->c_srh + ap_ptr->a_srh;
3265 /* Base skill -- searching frequency */
3266 p_ptr->skill_fos = tmp_rp_ptr->r_fos + cp_ptr->c_fos + ap_ptr->a_fos;
3268 /* Base skill -- combat (normal) */
3269 p_ptr->skill_thn = tmp_rp_ptr->r_thn + cp_ptr->c_thn + ap_ptr->a_thn;
3271 /* Base skill -- combat (shooting) */
3272 p_ptr->skill_thb = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3274 /* Base skill -- combat (throwing) */
3275 p_ptr->skill_tht = tmp_rp_ptr->r_thb + cp_ptr->c_thb + ap_ptr->a_thb;
3277 /* Base skill -- digging */
3278 p_ptr->skill_dig = 0;
3280 if (buki_motteruka(INVEN_RARM)) p_ptr->migite = TRUE;
3281 if (buki_motteruka(INVEN_LARM))
3283 p_ptr->hidarite = TRUE;
3284 if (!p_ptr->migite) default_hand = 1;
3287 if (CAN_TWO_HANDS_WIELDING())
3289 if (p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) &&
3290 object_allow_two_hands_wielding(&inventory[INVEN_RARM]))
3292 p_ptr->ryoute = TRUE;
3294 else if (p_ptr->hidarite && (empty_hands(FALSE) == EMPTY_HAND_RARM) &&
3295 object_allow_two_hands_wielding(&inventory[INVEN_LARM]))
3297 p_ptr->ryoute = TRUE;
3301 switch (p_ptr->pclass)
3304 case CLASS_FORCETRAINER:
3305 case CLASS_BERSERKER:
3306 if (empty_hands(FALSE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))
3308 p_ptr->migite = TRUE;
3309 p_ptr->ryoute = TRUE;
3316 if (!p_ptr->migite && !p_ptr->hidarite)
3318 if (empty_hands_status & EMPTY_HAND_RARM) p_ptr->migite = TRUE;
3319 else if (empty_hands_status == EMPTY_HAND_LARM)
3321 p_ptr->hidarite = TRUE;
3326 if (p_ptr->special_defense & KAMAE_MASK)
3328 if (!(empty_hands_status & EMPTY_HAND_RARM))
3330 set_action(ACTION_NONE);
3334 switch (p_ptr->pclass)
3337 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3338 if (p_ptr->lev > 44) p_ptr->regenerate = TRUE;
3341 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3343 case CLASS_CHAOS_WARRIOR:
3344 if (p_ptr->lev > 29) p_ptr->resist_chaos = TRUE;
3345 if (p_ptr->lev > 39) p_ptr->resist_fear = TRUE;
3347 case CLASS_MINDCRAFTER:
3348 if (p_ptr->lev > 9) p_ptr->resist_fear = TRUE;
3349 if (p_ptr->lev > 19) p_ptr->sustain_wis = TRUE;
3350 if (p_ptr->lev > 29) p_ptr->resist_conf = TRUE;
3351 if (p_ptr->lev > 39) p_ptr->telepathy = TRUE;
3354 case CLASS_FORCETRAINER:
3355 /* Unencumbered Monks become faster every 10 levels */
3356 if (!(heavy_armor()))
3358 if (!(prace_is_(RACE_KLACKON) ||
3359 prace_is_(RACE_SPRITE) ||
3360 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3361 new_speed += (p_ptr->lev) / 10;
3363 /* Free action if unencumbered at level 25 */
3364 if (p_ptr->lev > 24)
3365 p_ptr->free_act = TRUE;
3368 case CLASS_SORCERER:
3370 p_ptr->dis_to_a -= 50;
3373 p_ptr->resist_sound = TRUE;
3376 if (p_ptr->lev > 29) p_ptr->resist_fear = TRUE;
3378 case CLASS_BERSERKER:
3380 p_ptr->sustain_str = TRUE;
3381 p_ptr->sustain_dex = TRUE;
3382 p_ptr->sustain_con = TRUE;
3383 p_ptr->regenerate = TRUE;
3384 p_ptr->free_act = TRUE;
3386 if (p_ptr->lev > 29) new_speed++;
3387 if (p_ptr->lev > 39) new_speed++;
3388 if (p_ptr->lev > 44) new_speed++;
3389 if (p_ptr->lev > 49) new_speed++;
3390 p_ptr->to_a += 10+p_ptr->lev/2;
3391 p_ptr->dis_to_a += 10+p_ptr->lev/2;
3392 p_ptr->skill_dig += (100+p_ptr->lev*8);
3393 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3394 p_ptr->redraw |= PR_STATUS;
3396 case CLASS_MIRROR_MASTER:
3397 if (p_ptr->lev > 39) p_ptr->reflect = TRUE;
3400 /* Unencumbered Ninjas become faster every 10 levels */
3403 new_speed -= (p_ptr->lev) / 10;
3404 p_ptr->skill_stl -= (p_ptr->lev)/10;
3406 else if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
3407 (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
3410 if (!(prace_is_(RACE_KLACKON) ||
3411 prace_is_(RACE_SPRITE) ||
3412 (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)))
3413 new_speed += (p_ptr->lev) / 10;
3414 p_ptr->skill_stl += (p_ptr->lev)/10;
3416 /* Free action if unencumbered at level 25 */
3417 if (p_ptr->lev > 24)
3418 p_ptr->free_act = TRUE;
3420 if ((!inventory[INVEN_RARM].k_idx || p_ptr->migite) &&
3421 (!inventory[INVEN_LARM].k_idx || p_ptr->hidarite))
3423 p_ptr->to_a += p_ptr->lev/2+5;
3424 p_ptr->dis_to_a += p_ptr->lev/2+5;
3426 p_ptr->slow_digest = TRUE;
3427 p_ptr->resist_fear = TRUE;
3428 if (p_ptr->lev > 19) p_ptr->resist_pois = TRUE;
3429 if (p_ptr->lev > 24) p_ptr->sustain_dex = TRUE;
3430 if (p_ptr->lev > 29) p_ptr->see_inv = TRUE;
3431 if (p_ptr->lev > 44)
3433 p_ptr->oppose_pois = 1;
3434 p_ptr->redraw |= PR_STATUS;
3436 p_ptr->see_nocto = TRUE;
3441 if (p_ptr->mimic_form)
3443 switch (p_ptr->mimic_form)
3446 p_ptr->hold_exp = TRUE;
3447 p_ptr->resist_chaos = TRUE;
3448 p_ptr->resist_neth = TRUE;
3449 p_ptr->resist_fire = TRUE;
3450 p_ptr->oppose_fire = 1;
3451 p_ptr->see_inv=TRUE;
3453 p_ptr->redraw |= PR_STATUS;
3455 p_ptr->dis_to_a += 10;
3456 p_ptr->align -= 200;
3458 case MIMIC_DEMON_LORD:
3459 p_ptr->hold_exp = TRUE;
3460 p_ptr->resist_chaos = TRUE;
3461 p_ptr->resist_neth = TRUE;
3462 p_ptr->immune_fire = TRUE;
3463 p_ptr->resist_acid = TRUE;
3464 p_ptr->resist_fire = TRUE;
3465 p_ptr->resist_cold = TRUE;
3466 p_ptr->resist_elec = TRUE;
3467 p_ptr->resist_pois = TRUE;
3468 p_ptr->resist_conf = TRUE;
3469 p_ptr->resist_disen = TRUE;
3470 p_ptr->resist_nexus = TRUE;
3471 p_ptr->resist_fear = TRUE;
3472 p_ptr->sh_fire = TRUE;
3473 p_ptr->see_inv = TRUE;
3474 p_ptr->telepathy = TRUE;
3475 p_ptr->levitation = TRUE;
3476 p_ptr->kill_wall = TRUE;
3479 p_ptr->dis_to_a += 20;
3480 p_ptr->align -= 200;
3483 p_ptr->resist_dark = TRUE;
3484 p_ptr->hold_exp = TRUE;
3485 p_ptr->resist_neth = TRUE;
3486 p_ptr->resist_cold = TRUE;
3487 p_ptr->resist_pois = TRUE;
3488 p_ptr->see_inv = TRUE;
3491 p_ptr->dis_to_a += 10;
3492 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3498 switch (p_ptr->prace)
3501 p_ptr->resist_lite = TRUE;
3504 p_ptr->hold_exp = TRUE;
3507 p_ptr->free_act = TRUE;
3510 p_ptr->resist_blind = TRUE;
3513 p_ptr->resist_dark = TRUE;
3515 case RACE_HALF_TROLL:
3516 p_ptr->sustain_str = TRUE;
3518 if (p_ptr->lev > 14)
3520 /* High level trolls heal fast... */
3521 p_ptr->regenerate = TRUE;
3523 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_BERSERKER)
3525 p_ptr->slow_digest = TRUE;
3526 /* Let's not make Regeneration
3527 * a disadvantage for the poor warriors who can
3528 * never learn a spell that satisfies hunger (actually
3529 * neither can rogues, but half-trolls are not
3530 * supposed to play rogues) */
3535 p_ptr->sustain_con = TRUE;
3536 p_ptr->regenerate = TRUE; /* Amberites heal fast... */
3539 p_ptr->resist_lite = TRUE;
3540 p_ptr->see_inv = TRUE;
3542 case RACE_BARBARIAN:
3543 p_ptr->resist_fear = TRUE;
3545 case RACE_HALF_OGRE:
3546 p_ptr->resist_dark = TRUE;
3547 p_ptr->sustain_str = TRUE;
3549 case RACE_HALF_GIANT:
3550 p_ptr->sustain_str = TRUE;
3551 p_ptr->resist_shard = TRUE;
3553 case RACE_HALF_TITAN:
3554 p_ptr->resist_chaos = TRUE;
3557 p_ptr->resist_sound = TRUE;
3560 p_ptr->resist_acid = TRUE;
3561 if (p_ptr->lev > 19) p_ptr->immune_acid = TRUE;
3564 p_ptr->resist_conf = TRUE;
3565 p_ptr->resist_acid = TRUE;
3567 /* Klackons become faster */
3568 new_speed += (p_ptr->lev) / 10;
3571 p_ptr->resist_pois = TRUE;
3574 p_ptr->resist_disen = TRUE;
3575 p_ptr->resist_dark = TRUE;
3578 p_ptr->resist_dark = TRUE;
3579 if (p_ptr->lev > 19) p_ptr->see_inv = TRUE;
3581 case RACE_DRACONIAN:
3582 p_ptr->levitation = TRUE;
3583 if (p_ptr->lev > 4) p_ptr->resist_fire = TRUE;
3584 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3585 if (p_ptr->lev > 14) p_ptr->resist_acid = TRUE;
3586 if (p_ptr->lev > 19) p_ptr->resist_elec = TRUE;
3587 if (p_ptr->lev > 34) p_ptr->resist_pois = TRUE;
3589 case RACE_MIND_FLAYER:
3590 p_ptr->sustain_int = TRUE;
3591 p_ptr->sustain_wis = TRUE;
3592 if (p_ptr->lev > 14) p_ptr->see_inv = TRUE;
3593 if (p_ptr->lev > 29) p_ptr->telepathy = TRUE;
3596 p_ptr->resist_fire = TRUE;
3597 if (p_ptr->lev > 9) p_ptr->see_inv = TRUE;
3600 p_ptr->slow_digest = TRUE;
3601 p_ptr->free_act = TRUE;
3602 p_ptr->see_inv = TRUE;
3603 p_ptr->resist_pois = TRUE;
3604 if (p_ptr->lev > 34) p_ptr->hold_exp = TRUE;
3607 p_ptr->resist_shard = TRUE;
3608 p_ptr->hold_exp = TRUE;
3609 p_ptr->see_inv = TRUE;
3610 p_ptr->resist_pois = TRUE;
3611 if (p_ptr->lev > 9) p_ptr->resist_cold = TRUE;
3614 p_ptr->resist_neth = TRUE;
3615 p_ptr->hold_exp = TRUE;
3616 p_ptr->see_inv = TRUE;
3617 p_ptr->resist_pois = TRUE;
3618 p_ptr->slow_digest = TRUE;
3619 if (p_ptr->lev > 4) p_ptr->resist_cold = TRUE;
3622 p_ptr->resist_dark = TRUE;
3623 p_ptr->hold_exp = TRUE;
3624 p_ptr->resist_neth = TRUE;
3625 p_ptr->resist_cold = TRUE;
3626 p_ptr->resist_pois = TRUE;
3627 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3630 p_ptr->levitation = TRUE;
3631 p_ptr->free_act = TRUE;
3632 p_ptr->resist_neth = TRUE;
3633 p_ptr->hold_exp = TRUE;
3634 p_ptr->see_inv = TRUE;
3635 p_ptr->resist_pois = TRUE;
3636 p_ptr->slow_digest = TRUE;
3637 p_ptr->resist_cold = TRUE;
3638 p_ptr->pass_wall = TRUE;
3639 if (p_ptr->lev > 34) p_ptr->telepathy = TRUE;
3642 p_ptr->levitation = TRUE;
3643 p_ptr->resist_lite = TRUE;
3645 /* Sprites become faster */
3646 new_speed += (p_ptr->lev) / 10;
3649 p_ptr->resist_conf = TRUE;
3650 p_ptr->resist_sound = TRUE;
3653 /* Ents dig like maniacs, but only with their hands. */
3654 if (!inventory[INVEN_RARM].k_idx)
3655 p_ptr->skill_dig += p_ptr->lev * 10;
3656 /* Ents get tougher and stronger as they age, but lose dexterity. */
3657 if (p_ptr->lev > 25) p_ptr->stat_add[A_STR]++;
3658 if (p_ptr->lev > 40) p_ptr->stat_add[A_STR]++;
3659 if (p_ptr->lev > 45) p_ptr->stat_add[A_STR]++;
3661 if (p_ptr->lev > 25) p_ptr->stat_add[A_DEX]--;
3662 if (p_ptr->lev > 40) p_ptr->stat_add[A_DEX]--;
3663 if (p_ptr->lev > 45) p_ptr->stat_add[A_DEX]--;
3665 if (p_ptr->lev > 25) p_ptr->stat_add[A_CON]++;
3666 if (p_ptr->lev > 40) p_ptr->stat_add[A_CON]++;
3667 if (p_ptr->lev > 45) p_ptr->stat_add[A_CON]++;
3670 p_ptr->levitation = TRUE;
3671 p_ptr->see_inv = TRUE;
3672 p_ptr->align += 200;
3675 p_ptr->resist_fire = TRUE;
3676 p_ptr->resist_neth = TRUE;
3677 p_ptr->hold_exp = TRUE;
3678 if (p_ptr->lev > 9) p_ptr->see_inv = TRUE;
3679 if (p_ptr->lev > 44)
3681 p_ptr->oppose_fire = 1;
3682 p_ptr->redraw |= PR_STATUS;
3684 p_ptr->align -= 200;
3687 p_ptr->sustain_con = TRUE;
3690 p_ptr->levitation = TRUE;
3693 p_ptr->resist_conf = TRUE;
3696 p_ptr->slow_digest = TRUE;
3697 p_ptr->free_act = TRUE;
3698 p_ptr->resist_pois = TRUE;
3699 p_ptr->hold_exp = TRUE;
3707 if (p_ptr->ult_res || (p_ptr->special_defense & KATA_MUSOU))
3709 p_ptr->see_inv = TRUE;
3710 p_ptr->free_act = TRUE;
3711 p_ptr->slow_digest = TRUE;
3712 p_ptr->regenerate = TRUE;
3713 p_ptr->levitation = TRUE;
3714 p_ptr->hold_exp = TRUE;
3715 p_ptr->telepathy = TRUE;
3717 p_ptr->sustain_str = TRUE;
3718 p_ptr->sustain_int = TRUE;
3719 p_ptr->sustain_wis = TRUE;
3720 p_ptr->sustain_con = TRUE;
3721 p_ptr->sustain_dex = TRUE;
3722 p_ptr->sustain_chr = TRUE;
3723 p_ptr->resist_acid = TRUE;
3724 p_ptr->resist_elec = TRUE;
3725 p_ptr->resist_fire = TRUE;
3726 p_ptr->resist_cold = TRUE;
3727 p_ptr->resist_pois = TRUE;
3728 p_ptr->resist_conf = TRUE;
3729 p_ptr->resist_sound = TRUE;
3730 p_ptr->resist_lite = TRUE;
3731 p_ptr->resist_dark = TRUE;
3732 p_ptr->resist_chaos = TRUE;
3733 p_ptr->resist_disen = TRUE;
3734 p_ptr->resist_shard = TRUE;
3735 p_ptr->resist_nexus = TRUE;
3736 p_ptr->resist_blind = TRUE;
3737 p_ptr->resist_neth = TRUE;
3738 p_ptr->resist_fear = TRUE;
3739 p_ptr->reflect = TRUE;
3740 p_ptr->sh_fire = TRUE;
3741 p_ptr->sh_elec = TRUE;
3742 p_ptr->sh_cold = TRUE;
3744 p_ptr->dis_to_a += 100;
3746 /* Temporary shield */
3747 else if (p_ptr->tsubureru || p_ptr->shield || p_ptr->magicdef)
3750 p_ptr->dis_to_a += 50;
3753 if (p_ptr->tim_res_nether)
3755 p_ptr->resist_neth = TRUE;
3757 if (p_ptr->tim_sh_fire)
3759 p_ptr->sh_fire = TRUE;
3761 if (p_ptr->tim_res_time)
3763 p_ptr->resist_time = TRUE;
3767 if (p_ptr->pseikaku == SEIKAKU_SEXY) p_ptr->cursed |= (TRC_AGGRAVATE);
3768 if (p_ptr->pseikaku == SEIKAKU_NAMAKE) p_ptr->to_m_chance += 10;
3769 if (p_ptr->pseikaku == SEIKAKU_KIREMONO) p_ptr->to_m_chance -= 3;
3770 if ((p_ptr->pseikaku == SEIKAKU_GAMAN) || (p_ptr->pseikaku == SEIKAKU_CHIKARA)) p_ptr->to_m_chance++;
3773 if (p_ptr->pseikaku == SEIKAKU_LUCKY) p_ptr->muta3 |= MUT3_GOOD_LUCK;
3775 if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
3777 p_ptr->resist_blind = TRUE;
3778 p_ptr->resist_conf = TRUE;
3779 p_ptr->hold_exp = TRUE;
3780 if (p_ptr->pclass != CLASS_NINJA) p_ptr->lite = TRUE;
3782 if ((p_ptr->prace != RACE_KLACKON) && (p_ptr->prace != RACE_SPRITE))
3783 /* Munchkin become faster */
3784 new_speed += (p_ptr->lev) / 10 + 5;
3787 if (music_singing(MUSIC_WALL))
3789 p_ptr->kill_wall = TRUE;
3792 /* Hack -- apply racial/class stat maxes */
3793 /* Apply the racial modifiers */
3794 for (i = 0; i < 6; i++)
3796 /* Modify the stats for "race" */
3797 p_ptr->stat_add[i] += (tmp_rp_ptr->r_adj[i] + cp_ptr->c_adj[i] + ap_ptr->a_adj[i]);
3801 /* I'm adding the mutations here for the lack of a better place... */
3804 /* Hyper Strength */
3805 if (p_ptr->muta3 & MUT3_HYPER_STR)
3807 p_ptr->stat_add[A_STR] += 4;
3811 if (p_ptr->muta3 & MUT3_PUNY)
3813 p_ptr->stat_add[A_STR] -= 4;
3816 /* Living computer */
3817 if (p_ptr->muta3 & MUT3_HYPER_INT)
3819 p_ptr->stat_add[A_INT] += 4;
3820 p_ptr->stat_add[A_WIS] += 4;
3824 if (p_ptr->muta3 & MUT3_MORONIC)
3826 p_ptr->stat_add[A_INT] -= 4;
3827 p_ptr->stat_add[A_WIS] -= 4;
3830 if (p_ptr->muta3 & MUT3_RESILIENT)
3832 p_ptr->stat_add[A_CON] += 4;
3835 if (p_ptr->muta3 & MUT3_XTRA_FAT)
3837 p_ptr->stat_add[A_CON] += 2;
3841 if (p_ptr->muta3 & MUT3_ALBINO)
3843 p_ptr->stat_add[A_CON] -= 4;
3846 if (p_ptr->muta3 & MUT3_FLESH_ROT)
3848 p_ptr->stat_add[A_CON] -= 2;
3849 p_ptr->stat_add[A_CHR] -= 1;
3850 p_ptr->regenerate = FALSE;
3851 /* Cancel innate regeneration */
3854 if (p_ptr->muta3 & MUT3_SILLY_VOI)
3856 p_ptr->stat_add[A_CHR] -= 4;
3859 if (p_ptr->muta3 & MUT3_BLANK_FAC)
3861 p_ptr->stat_add[A_CHR] -= 1;
3864 if (p_ptr->muta3 & MUT3_XTRA_EYES)
3866 p_ptr->skill_fos += 15;
3867 p_ptr->skill_srh += 15;
3870 if (p_ptr->muta3 & MUT3_MAGIC_RES)
3872 p_ptr->skill_sav += (15 + (p_ptr->lev / 5));
3875 if (p_ptr->muta3 & MUT3_XTRA_NOIS)
3877 p_ptr->skill_stl -= 3;
3880 if (p_ptr->muta3 & MUT3_INFRAVIS)
3882 p_ptr->see_infra += 3;
3885 if (p_ptr->muta3 & MUT3_XTRA_LEGS)
3890 if (p_ptr->muta3 & MUT3_SHORT_LEG)
3895 if (p_ptr->muta3 & MUT3_ELEC_TOUC)
3897 p_ptr->sh_elec = TRUE;
3900 if (p_ptr->muta3 & MUT3_FIRE_BODY)
3902 p_ptr->sh_fire = TRUE;
3906 if (p_ptr->muta3 & MUT3_WART_SKIN)
3908 p_ptr->stat_add[A_CHR] -= 2;
3910 p_ptr->dis_to_a += 5;
3913 if (p_ptr->muta3 & MUT3_SCALES)
3915 p_ptr->stat_add[A_CHR] -= 1;
3917 p_ptr->dis_to_a += 10;
3920 if (p_ptr->muta3 & MUT3_IRON_SKIN)
3922 p_ptr->stat_add[A_DEX] -= 1;
3924 p_ptr->dis_to_a += 25;
3927 if (p_ptr->muta3 & MUT3_WINGS)
3929 p_ptr->levitation = TRUE;
3932 if (p_ptr->muta3 & MUT3_FEARLESS)
3934 p_ptr->resist_fear = TRUE;
3937 if (p_ptr->muta3 & MUT3_REGEN)
3939 p_ptr->regenerate = TRUE;
3942 if (p_ptr->muta3 & MUT3_ESP)
3944 p_ptr->telepathy = TRUE;
3947 if (p_ptr->muta3 & MUT3_LIMBER)
3949 p_ptr->stat_add[A_DEX] += 3;
3952 if (p_ptr->muta3 & MUT3_ARTHRITIS)
3954 p_ptr->stat_add[A_DEX] -= 3;
3957 if (p_ptr->muta3 & MUT3_MOTION)
3959 p_ptr->free_act = TRUE;
3960 p_ptr->skill_stl += 1;
3963 if (p_ptr->muta3 & MUT3_ILL_NORM)
3965 p_ptr->stat_add[A_CHR] = 0;
3969 if (p_ptr->tsuyoshi)
3971 p_ptr->stat_add[A_STR] += 4;
3972 p_ptr->stat_add[A_CON] += 4;
3975 /* Scan the usable inventory */
3976 for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
3978 int bonus_to_h, bonus_to_d;
3979 o_ptr = &inventory[i];
3981 /* Skip non-objects */
3982 if (!o_ptr->k_idx) continue;
3984 /* Extract the item flags */
3985 object_flags(o_ptr, flgs);
3987 p_ptr->cursed |= (o_ptr->curse_flags & (0xFFFFFFF0L));
3988 if (o_ptr->name1 == ART_CHAINSWORD) p_ptr->cursed |= TRC_CHAINSWORD;
3991 if (have_flag(flgs, TR_STR)) p_ptr->stat_add[A_STR] += o_ptr->pval;
3992 if (have_flag(flgs, TR_INT)) p_ptr->stat_add[A_INT] += o_ptr->pval;
3993 if (have_flag(flgs, TR_WIS)) p_ptr->stat_add[A_WIS] += o_ptr->pval;
3994 if (have_flag(flgs, TR_DEX)) p_ptr->stat_add[A_DEX] += o_ptr->pval;
3995 if (have_flag(flgs, TR_CON)) p_ptr->stat_add[A_CON] += o_ptr->pval;
3996 if (have_flag(flgs, TR_CHR)) p_ptr->stat_add[A_CHR] += o_ptr->pval;
3998 if (have_flag(flgs, TR_MAGIC_MASTERY)) p_ptr->skill_dev += 8*o_ptr->pval;
4000 /* Affect stealth */
4001 if (have_flag(flgs, TR_STEALTH)) p_ptr->skill_stl += o_ptr->pval;
4003 /* Affect searching ability (factor of five) */
4004 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_srh += (o_ptr->pval * 5);
4006 /* Affect searching frequency (factor of five) */
4007 if (have_flag(flgs, TR_SEARCH)) p_ptr->skill_fos += (o_ptr->pval * 5);
4009 /* Affect infravision */
4010 if (have_flag(flgs, TR_INFRA)) p_ptr->see_infra += o_ptr->pval;
4012 /* Affect digging (factor of 20) */
4013 if (have_flag(flgs, TR_TUNNEL)) p_ptr->skill_dig += (o_ptr->pval * 20);
4016 if (have_flag(flgs, TR_SPEED)) new_speed += o_ptr->pval;
4019 if (have_flag(flgs, TR_BLOWS))
4021 if((i == INVEN_RARM || i == INVEN_RIGHT) && !p_ptr->ryoute) extra_blows[0] += o_ptr->pval;
4022 else if((i == INVEN_LARM || i == INVEN_LEFT) && !p_ptr->ryoute) extra_blows[1] += o_ptr->pval;
4023 else {extra_blows[0] += o_ptr->pval; extra_blows[1] += o_ptr->pval;}
4026 /* Hack -- cause earthquakes */
4027 if (have_flag(flgs, TR_IMPACT)) p_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
4030 if (have_flag(flgs, TR_AGGRAVATE)) p_ptr->cursed |= TRC_AGGRAVATE;
4031 if (have_flag(flgs, TR_DRAIN_EXP)) p_ptr->cursed |= TRC_DRAIN_EXP;
4032 if (have_flag(flgs, TR_TY_CURSE)) p_ptr->cursed |= TRC_TY_CURSE;
4033 if (have_flag(flgs, TR_ADD_L_CURSE)) p_ptr->cursed |= TRC_ADD_L_CURSE;
4034 if (have_flag(flgs, TR_ADD_H_CURSE)) p_ptr->cursed |= TRC_ADD_H_CURSE;
4035 if (have_flag(flgs, TR_DRAIN_HP)) p_ptr->cursed |= TRC_DRAIN_HP;
4036 if (have_flag(flgs, TR_DRAIN_MANA)) p_ptr->cursed |= TRC_DRAIN_MANA;
4037 if (have_flag(flgs, TR_CALL_ANIMAL)) p_ptr->cursed |= TRC_CALL_ANIMAL;
4038 if (have_flag(flgs, TR_CALL_DEMON)) p_ptr->cursed |= TRC_CALL_DEMON;
4039 if (have_flag(flgs, TR_CALL_DRAGON)) p_ptr->cursed |= TRC_CALL_DRAGON;
4040 if (have_flag(flgs, TR_CALL_UNDEAD)) p_ptr->cursed |= TRC_CALL_UNDEAD;
4041 if (have_flag(flgs, TR_COWARDICE)) p_ptr->cursed |= TRC_COWARDICE;
4042 if (have_flag(flgs, TR_LOW_MELEE)) p_ptr->cursed |= TRC_LOW_MELEE;
4043 if (have_flag(flgs, TR_LOW_AC)) p_ptr->cursed |= TRC_LOW_AC;
4044 if (have_flag(flgs, TR_LOW_MAGIC)) p_ptr->cursed |= TRC_LOW_MAGIC;
4045 if (have_flag(flgs, TR_FAST_DIGEST)) p_ptr->cursed |= TRC_FAST_DIGEST;
4046 if (have_flag(flgs, TR_SLOW_REGEN)) p_ptr->cursed |= TRC_SLOW_REGEN;
4047 if (have_flag(flgs, TR_DEC_MANA)) p_ptr->dec_mana = TRUE;
4048 if (have_flag(flgs, TR_BLESSED)) p_ptr->bless_blade = TRUE;
4049 if (have_flag(flgs, TR_XTRA_MIGHT)) p_ptr->xtra_might = TRUE;
4050 if (have_flag(flgs, TR_SLOW_DIGEST)) p_ptr->slow_digest = TRUE;
4051 if (have_flag(flgs, TR_REGEN)) p_ptr->regenerate = TRUE;
4052 if (have_flag(flgs, TR_TELEPATHY)) p_ptr->telepathy = TRUE;
4053 if (have_flag(flgs, TR_ESP_ANIMAL)) p_ptr->esp_animal = TRUE;
4054 if (have_flag(flgs, TR_ESP_UNDEAD)) p_ptr->esp_undead = TRUE;
4055 if (have_flag(flgs, TR_ESP_DEMON)) p_ptr->esp_demon = TRUE;
4056 if (have_flag(flgs, TR_ESP_ORC)) p_ptr->esp_orc = TRUE;
4057 if (have_flag(flgs, TR_ESP_TROLL)) p_ptr->esp_troll = TRUE;
4058 if (have_flag(flgs, TR_ESP_GIANT)) p_ptr->esp_giant = TRUE;
4059 if (have_flag(flgs, TR_ESP_DRAGON)) p_ptr->esp_dragon = TRUE;
4060 if (have_flag(flgs, TR_ESP_HUMAN)) p_ptr->esp_human = TRUE;
4061 if (have_flag(flgs, TR_ESP_EVIL)) p_ptr->esp_evil = TRUE;
4062 if (have_flag(flgs, TR_ESP_GOOD)) p_ptr->esp_good = TRUE;
4063 if (have_flag(flgs, TR_ESP_NONLIVING)) p_ptr->esp_nonliving = TRUE;
4064 if (have_flag(flgs, TR_ESP_UNIQUE)) p_ptr->esp_unique = TRUE;
4066 if (have_flag(flgs, TR_SEE_INVIS)) p_ptr->see_inv = TRUE;
4067 if (have_flag(flgs, TR_LEVITATION)) p_ptr->levitation = TRUE;
4068 if (have_flag(flgs, TR_FREE_ACT)) p_ptr->free_act = TRUE;
4069 if (have_flag(flgs, TR_HOLD_EXP)) p_ptr->hold_exp = TRUE;
4070 if (have_flag(flgs, TR_WARNING)){
4071 if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription),'$')))
4072 p_ptr->warning = TRUE;
4075 if (have_flag(flgs, TR_TELEPORT))
4077 if (object_is_cursed(o_ptr)) p_ptr->cursed |= TRC_TELEPORT;
4080 cptr insc = quark_str(o_ptr->inscription);
4082 if (o_ptr->inscription && my_strchr(insc, '.'))
4085 * {.} will stop random teleportation.
4090 /* Controlled random teleportation */
4091 p_ptr->cursed |= TRC_TELEPORT_SELF;
4096 /* Immunity flags */
4097 if (have_flag(flgs, TR_IM_FIRE)) p_ptr->immune_fire = TRUE;
4098 if (have_flag(flgs, TR_IM_ACID)) p_ptr->immune_acid = TRUE;
4099 if (have_flag(flgs, TR_IM_COLD)) p_ptr->immune_cold = TRUE;
4100 if (have_flag(flgs, TR_IM_ELEC)) p_ptr->immune_elec = TRUE;
4102 /* Resistance flags */
4103 if (have_flag(flgs, TR_RES_ACID)) p_ptr->resist_acid = TRUE;
4104 if (have_flag(flgs, TR_RES_ELEC)) p_ptr->resist_elec = TRUE;
4105 if (have_flag(flgs, TR_RES_FIRE)) p_ptr->resist_fire = TRUE;
4106 if (have_flag(flgs, TR_RES_COLD)) p_ptr->resist_cold = TRUE;
4107 if (have_flag(flgs, TR_RES_POIS)) p_ptr->resist_pois = TRUE;
4108 if (have_flag(flgs, TR_RES_FEAR)) p_ptr->resist_fear = TRUE;
4109 if (have_flag(flgs, TR_RES_CONF)) p_ptr->resist_conf = TRUE;
4110 if (have_flag(flgs, TR_RES_SOUND)) p_ptr->resist_sound = TRUE;
4111 if (have_flag(flgs, TR_RES_LITE)) p_ptr->resist_lite = TRUE;
4112 if (have_flag(flgs, TR_RES_DARK)) p_ptr->resist_dark = TRUE;
4113 if (have_flag(flgs, TR_RES_CHAOS)) p_ptr->resist_chaos = TRUE;
4114 if (have_flag(flgs, TR_RES_DISEN)) p_ptr->resist_disen = TRUE;
4115 if (have_flag(flgs, TR_RES_SHARDS)) p_ptr->resist_shard = TRUE;
4116 if (have_flag(flgs, TR_RES_NEXUS)) p_ptr->resist_nexus = TRUE;
4117 if (have_flag(flgs, TR_RES_BLIND)) p_ptr->resist_blind = TRUE;
4118 if (have_flag(flgs, TR_RES_NETHER)) p_ptr->resist_neth = TRUE;
4120 if (have_flag(flgs, TR_REFLECT)) p_ptr->reflect = TRUE;
4121 if (have_flag(flgs, TR_SH_FIRE)) p_ptr->sh_fire = TRUE;
4122 if (have_flag(flgs, TR_SH_ELEC)) p_ptr->sh_elec = TRUE;
4123 if (have_flag(flgs, TR_SH_COLD)) p_ptr->sh_cold = TRUE;
4124 if (have_flag(flgs, TR_NO_MAGIC)) p_ptr->anti_magic = TRUE;
4125 if (have_flag(flgs, TR_NO_TELE)) p_ptr->anti_tele = TRUE;
4128 if (have_flag(flgs, TR_SUST_STR)) p_ptr->sustain_str = TRUE;
4129 if (have_flag(flgs, TR_SUST_INT)) p_ptr->sustain_int = TRUE;
4130 if (have_flag(flgs, TR_SUST_WIS)) p_ptr->sustain_wis = TRUE;
4131 if (have_flag(flgs, TR_SUST_DEX)) p_ptr->sustain_dex = TRUE;
4132 if (have_flag(flgs, TR_SUST_CON)) p_ptr->sustain_con = TRUE;
4133 if (have_flag(flgs, TR_SUST_CHR)) p_ptr->sustain_chr = TRUE;
4135 if (o_ptr->name2 == EGO_YOIYAMI) yoiyami = TRUE;
4136 if (o_ptr->name2 == EGO_2WEAPON) easy_2weapon = TRUE;
4137 if (o_ptr->name2 == EGO_RING_RES_TIME) p_ptr->resist_time = TRUE;
4138 if (o_ptr->name2 == EGO_RING_THROW) p_ptr->mighty_throw = TRUE;
4139 if (have_flag(flgs, TR_EASY_SPELL)) p_ptr->easy_spell = TRUE;
4140 if (o_ptr->name2 == EGO_AMU_FOOL) p_ptr->heavy_spell = TRUE;
4141 if (o_ptr->name2 == EGO_AMU_NAIVETY) down_saving = TRUE;
4143 if (o_ptr->curse_flags & TRC_LOW_MAGIC)
4145 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4147 p_ptr->to_m_chance += 10;
4151 p_ptr->to_m_chance += 3;
4155 if (o_ptr->tval == TV_CAPTURE) continue;
4157 /* Modify the base armor class */
4158 p_ptr->ac += o_ptr->ac;
4160 /* The base armor class is always known */
4161 p_ptr->dis_ac += o_ptr->ac;
4163 /* Apply the bonuses to armor class */
4164 p_ptr->to_a += o_ptr->to_a;
4166 /* Apply the mental bonuses to armor class, if known */
4167 if (object_is_known(o_ptr)) p_ptr->dis_to_a += o_ptr->to_a;
4169 if (o_ptr->curse_flags & TRC_LOW_MELEE)
4171 int slot = i - INVEN_RARM;
4174 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4176 p_ptr->to_h[slot] -= 15;
4177 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 15;
4181 p_ptr->to_h[slot] -= 5;
4182 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h[slot] -= 5;
4187 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4189 p_ptr->to_h_b -= 15;
4190 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 15;
4195 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_h_b -= 5;
4200 if (o_ptr->curse_flags & TRC_LOW_AC)
4202 if (o_ptr->curse_flags & TRC_HEAVY_CURSE)
4205 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 30;
4210 if (o_ptr->ident & IDENT_MENTAL) p_ptr->dis_to_a -= 10;
4214 /* Hack -- do not apply "weapon" bonuses */
4215 if (i == INVEN_RARM && buki_motteruka(i)) continue;
4216 if (i == INVEN_LARM && buki_motteruka(i)) continue;
4218 /* Hack -- do not apply "bow" bonuses */
4219 if (i == INVEN_BOW) continue;
4221 bonus_to_h = o_ptr->to_h;
4222 bonus_to_d = o_ptr->to_d;
4224 if (p_ptr->pclass == CLASS_NINJA)
4226 if (o_ptr->to_h > 0) bonus_to_h = (o_ptr->to_h+1)/2;
4227 if (o_ptr->to_d > 0) bonus_to_d = (o_ptr->to_d+1)/2;
4230 /* To Bow and Natural attack */
4232 /* Apply the bonuses to hit/damage */
4233 p_ptr->to_h_b += (s16b)bonus_to_h;
4234 p_ptr->to_h_m += (s16b)bonus_to_h;
4235 p_ptr->to_d_m += (s16b)bonus_to_d;
4237 /* Apply the mental bonuses tp hit/damage, if known */
4238 if (object_is_known(o_ptr)) p_ptr->dis_to_h_b += (s16b)bonus_to_h;
4241 if ((i == INVEN_LEFT || i == INVEN_RIGHT) && !p_ptr->ryoute)
4243 /* Apply the bonuses to hit/damage */
4244 p_ptr->to_h[i-INVEN_RIGHT] += (s16b)bonus_to_h;
4245 p_ptr->to_d[i-INVEN_RIGHT] += (s16b)bonus_to_d;
4247 /* Apply the mental bonuses tp hit/damage, if known */
4248 if (object_is_known(o_ptr))
4250 p_ptr->dis_to_h[i-INVEN_RIGHT] += (s16b)bonus_to_h;
4251 p_ptr->dis_to_d[i-INVEN_RIGHT] += (s16b)bonus_to_d;
4254 else if (p_ptr->migite && p_ptr->hidarite)
4256 /* Apply the bonuses to hit/damage */
4257 p_ptr->to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4258 p_ptr->to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4259 p_ptr->to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4260 p_ptr->to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4262 /* Apply the mental bonuses tp hit/damage, if known */
4263 if (object_is_known(o_ptr))
4265 p_ptr->dis_to_h[0] += (bonus_to_h > 0) ? (bonus_to_h+1)/2 : bonus_to_h;
4266 p_ptr->dis_to_h[1] += (bonus_to_h > 0) ? bonus_to_h/2 : bonus_to_h;
4267 p_ptr->dis_to_d[0] += (bonus_to_d > 0) ? (bonus_to_d+1)/2 : bonus_to_d;
4268 p_ptr->dis_to_d[1] += (bonus_to_d > 0) ? bonus_to_d/2 : bonus_to_d;
4273 /* Apply the bonuses to hit/damage */
4274 p_ptr->to_h[default_hand] += (s16b)bonus_to_h;
4275 p_ptr->to_d[default_hand] += (s16b)bonus_to_d;
4277 /* Apply the mental bonuses to hit/damage, if known */
4278 if (object_is_known(o_ptr))
4280 p_ptr->dis_to_h[default_hand] += (s16b)bonus_to_h;
4281 p_ptr->dis_to_d[default_hand] += (s16b)bonus_to_d;
4286 if (old_mighty_throw != p_ptr->mighty_throw)
4288 /* Redraw average damege display of Shuriken */
4289 p_ptr->window |= PW_INVEN;
4292 if (p_ptr->cursed & TRC_TELEPORT) p_ptr->cursed &= ~(TRC_TELEPORT_SELF);
4294 /* Monks get extra ac for armour _not worn_ */
4295 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor())
4297 if (!(inventory[INVEN_BODY].k_idx))
4299 p_ptr->to_a += (p_ptr->lev * 3) / 2;
4300 p_ptr->dis_to_a += (p_ptr->lev * 3) / 2;
4302 if (!(inventory[INVEN_OUTER].k_idx) && (p_ptr->lev > 15))
4304 p_ptr->to_a += ((p_ptr->lev - 13) / 3);
4305 p_ptr->dis_to_a += ((p_ptr->lev - 13) / 3);
4307 if (!(inventory[INVEN_LARM].k_idx) && (p_ptr->lev > 10))
4309 p_ptr->to_a += ((p_ptr->lev - 8) / 3);
4310 p_ptr->dis_to_a += ((p_ptr->lev - 8) / 3);
4312 if (!(inventory[INVEN_HEAD].k_idx) && (p_ptr->lev > 4))
4314 p_ptr->to_a += (p_ptr->lev - 2) / 3;
4315 p_ptr->dis_to_a += (p_ptr->lev -2) / 3;
4317 if (!(inventory[INVEN_HANDS].k_idx))
4319 p_ptr->to_a += (p_ptr->lev / 2);
4320 p_ptr->dis_to_a += (p_ptr->lev / 2);
4322 if (!(inventory[INVEN_FEET].k_idx))
4324 p_ptr->to_a += (p_ptr->lev / 3);
4325 p_ptr->dis_to_a += (p_ptr->lev / 3);
4327 if (p_ptr->special_defense & KAMAE_BYAKKO)
4329 p_ptr->stat_add[A_STR] += 2;
4330 p_ptr->stat_add[A_DEX] += 2;
4331 p_ptr->stat_add[A_CON] -= 3;
4333 else if (p_ptr->special_defense & KAMAE_SEIRYU)
4336 else if (p_ptr->special_defense & KAMAE_GENBU)
4338 p_ptr->stat_add[A_INT] -= 1;
4339 p_ptr->stat_add[A_WIS] -= 1;
4340 p_ptr->stat_add[A_DEX] -= 2;
4341 p_ptr->stat_add[A_CON] += 3;
4343 else if (p_ptr->special_defense & KAMAE_SUZAKU)
4345 p_ptr->stat_add[A_STR] -= 2;
4346 p_ptr->stat_add[A_INT] += 1;
4347 p_ptr->stat_add[A_WIS] += 1;
4348 p_ptr->stat_add[A_DEX] += 2;
4349 p_ptr->stat_add[A_CON] -= 2;
4353 if (p_ptr->special_defense & KATA_KOUKIJIN)
4355 for (i = 0; i < 6; i++)
4356 p_ptr->stat_add[i] += 5;
4358 p_ptr->dis_to_a -= 50;
4361 /* Hack -- aura of fire also provides light */
4362 if (p_ptr->sh_fire) p_ptr->lite = TRUE;
4364 /* Golems also get an intrinsic AC bonus */
4365 if (prace_is_(RACE_GOLEM) || prace_is_(RACE_ANDROID))
4367 p_ptr->to_a += 10 + (p_ptr->lev * 2 / 5);
4368 p_ptr->dis_to_a += 10 + (p_ptr->lev * 2 / 5);
4372 if (p_ptr->realm1 == REALM_HEX)
4374 if (hex_spelling_any()) p_ptr->skill_stl -= (1 + CASTING_HEX_NUM(p_ptr));
4375 if (hex_spelling(HEX_DETECT_EVIL)) p_ptr->esp_evil = TRUE;
4376 if (hex_spelling(HEX_XTRA_MIGHT)) p_ptr->stat_add[A_STR] += 4;
4377 if (hex_spelling(HEX_BUILDING))
4379 p_ptr->stat_add[A_STR] += 4;
4380 p_ptr->stat_add[A_DEX] += 4;
4381 p_ptr->stat_add[A_CON] += 4;
4383 if (hex_spelling(HEX_DEMON_AURA))
4385 p_ptr->sh_fire = TRUE;
4386 p_ptr->regenerate = TRUE;
4388 if (hex_spelling(HEX_ICE_ARMOR))
4390 p_ptr->sh_cold = TRUE;
4392 p_ptr->dis_to_a += 30;
4394 if (hex_spelling(HEX_SHOCK_CLOAK))
4396 p_ptr->sh_elec = TRUE;
4399 for (i = INVEN_RARM; i <= INVEN_FEET; i++)
4401 ARMOUR_CLASS ac = 0;
4402 o_ptr = &inventory[i];
4403 if (!o_ptr->k_idx) continue;
4404 if (!object_is_armour(o_ptr)) continue;
4405 if (!object_is_cursed(o_ptr)) continue;
4407 if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
4408 if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
4409 p_ptr->to_a += (s16b)ac;
4410 p_ptr->dis_to_a += (s16b)ac;
4414 /* Calculate stats */
4415 for (i = 0; i < 6; i++)
4419 /* Extract the new "stat_use" value for the stat */
4420 top = modify_stat_value(p_ptr->stat_max[i], p_ptr->stat_add[i]);
4422 /* Notice changes */
4423 if (p_ptr->stat_top[i] != top)
4425 /* Save the new value */
4426 p_ptr->stat_top[i] = (s16b)top;
4428 /* Redisplay the stats later */
4429 p_ptr->redraw |= (PR_STATS);
4431 p_ptr->window |= (PW_PLAYER);
4435 /* Extract the new "stat_use" value for the stat */
4436 use = modify_stat_value(p_ptr->stat_cur[i], p_ptr->stat_add[i]);
4438 if ((i == A_CHR) && (p_ptr->muta3 & MUT3_ILL_NORM))
4440 /* 10 to 18/90 charisma, guaranteed, based on level */
4441 if (use < 8 + 2 * p_ptr->lev)
4443 use = 8 + 2 * p_ptr->lev;
4447 /* Notice changes */
4448 if (p_ptr->stat_use[i] != use)
4450 /* Save the new value */
4451 p_ptr->stat_use[i] = (s16b)use;
4453 /* Redisplay the stats later */
4454 p_ptr->redraw |= (PR_STATS);
4456 p_ptr->window |= (PW_PLAYER);
4460 /* Values: 3, 4, ..., 17 */
4461 if (use <= 18) ind = (use - 3);
4463 /* Ranges: 18/00-18/09, ..., 18/210-18/219 */
4464 else if (use <= 18+219) ind = (15 + (use - 18) / 10);
4466 /* Range: 18/220+ */
4469 /* Notice changes */
4470 if (p_ptr->stat_ind[i] != ind)
4472 /* Save the new index */
4473 p_ptr->stat_ind[i] = (s16b)ind;
4475 /* Change in CON affects Hitpoints */
4478 p_ptr->update |= (PU_HP);
4481 /* Change in INT may affect Mana/Spells */
4482 else if (i == A_INT)
4484 if (mp_ptr->spell_stat == A_INT)
4486 p_ptr->update |= (PU_MANA | PU_SPELLS);
4490 /* Change in WIS may affect Mana/Spells */
4491 else if (i == A_WIS)
4493 if (mp_ptr->spell_stat == A_WIS)
4495 p_ptr->update |= (PU_MANA | PU_SPELLS);
4499 /* Change in WIS may affect Mana/Spells */
4500 else if (i == A_CHR)
4502 if (mp_ptr->spell_stat == A_CHR)
4504 p_ptr->update |= (PU_MANA | PU_SPELLS);
4508 p_ptr->window |= (PW_PLAYER);
4513 /* Apply temporary "stun" */
4514 if (p_ptr->stun > 50)
4516 p_ptr->to_h[0] -= 20;
4517 p_ptr->to_h[1] -= 20;
4518 p_ptr->to_h_b -= 20;
4519 p_ptr->to_h_m -= 20;
4520 p_ptr->dis_to_h[0] -= 20;
4521 p_ptr->dis_to_h[1] -= 20;
4522 p_ptr->dis_to_h_b -= 20;
4523 p_ptr->to_d[0] -= 20;
4524 p_ptr->to_d[1] -= 20;
4525 p_ptr->to_d_m -= 20;
4526 p_ptr->dis_to_d[0] -= 20;
4527 p_ptr->dis_to_d[1] -= 20;
4529 else if (p_ptr->stun)
4531 p_ptr->to_h[0] -= 5;
4532 p_ptr->to_h[1] -= 5;
4535 p_ptr->dis_to_h[0] -= 5;
4536 p_ptr->dis_to_h[1] -= 5;
4537 p_ptr->dis_to_h_b -= 5;
4538 p_ptr->to_d[0] -= 5;
4539 p_ptr->to_d[1] -= 5;
4541 p_ptr->dis_to_d[0] -= 5;
4542 p_ptr->dis_to_d[1] -= 5;
4546 if (p_ptr->wraith_form)
4548 p_ptr->reflect = TRUE;
4549 p_ptr->pass_wall = TRUE;
4552 if (p_ptr->kabenuke)
4554 p_ptr->pass_wall = TRUE;
4557 /* Temporary blessing */
4561 p_ptr->dis_to_a += 5;
4562 p_ptr->to_h[0] += 10;
4563 p_ptr->to_h[1] += 10;
4564 p_ptr->to_h_b += 10;
4565 p_ptr->to_h_m += 10;
4566 p_ptr->dis_to_h[0] += 10;
4567 p_ptr->dis_to_h[1] += 10;
4568 p_ptr->dis_to_h_b += 10;
4571 if (p_ptr->magicdef)
4573 p_ptr->resist_blind = TRUE;
4574 p_ptr->resist_conf = TRUE;
4575 p_ptr->reflect = TRUE;
4576 p_ptr->free_act = TRUE;
4577 p_ptr->levitation = TRUE;
4580 /* Temporary "Hero" */
4583 p_ptr->to_h[0] += 12;
4584 p_ptr->to_h[1] += 12;
4585 p_ptr->to_h_b += 12;
4586 p_ptr->to_h_m += 12;
4587 p_ptr->dis_to_h[0] += 12;
4588 p_ptr->dis_to_h[1] += 12;
4589 p_ptr->dis_to_h_b += 12;
4592 /* Temporary "Beserk" */
4595 p_ptr->to_h[0] += 12;
4596 p_ptr->to_h[1] += 12;
4597 p_ptr->to_h_b -= 12;
4598 p_ptr->to_h_m += 12;
4599 p_ptr->to_d[0] += 3+(p_ptr->lev/5);
4600 p_ptr->to_d[1] += 3+(p_ptr->lev/5);
4601 p_ptr->to_d_m += 3+(p_ptr->lev/5);
4602 p_ptr->dis_to_h[0] += 12;
4603 p_ptr->dis_to_h[1] += 12;
4604 p_ptr->dis_to_h_b -= 12;
4605 p_ptr->dis_to_d[0] += 3+(p_ptr->lev/5);
4606 p_ptr->dis_to_d[1] += 3+(p_ptr->lev/5);
4608 p_ptr->dis_to_a -= 10;
4609 p_ptr->skill_stl -= 7;
4610 p_ptr->skill_dev -= 20;
4611 p_ptr->skill_sav -= 30;
4612 p_ptr->skill_srh -= 15;
4613 p_ptr->skill_fos -= 15;
4614 p_ptr->skill_tht -= 20;
4615 p_ptr->skill_dig += 30;
4618 /* Temporary "fast" */
4624 /* Temporary "slow" */
4630 /* Temporary "telepathy" */
4633 p_ptr->telepathy = TRUE;
4636 if (p_ptr->ele_immune)
4638 if (p_ptr->special_defense & DEFENSE_ACID)
4639 p_ptr->immune_acid = TRUE;
4640 else if (p_ptr->special_defense & DEFENSE_ELEC)
4641 p_ptr->immune_elec = TRUE;
4642 else if (p_ptr->special_defense & DEFENSE_FIRE)
4643 p_ptr->immune_fire = TRUE;
4644 else if (p_ptr->special_defense & DEFENSE_COLD)
4645 p_ptr->immune_cold = TRUE;
4648 /* Temporary see invisible */
4649 if (p_ptr->tim_invis)
4651 p_ptr->see_inv = TRUE;
4654 /* Temporary infravision boost */
4655 if (p_ptr->tim_infra)
4657 p_ptr->see_infra+=3;
4660 /* Temporary regeneration boost */
4661 if (p_ptr->tim_regen)
4663 p_ptr->regenerate = TRUE;
4666 /* Temporary levitation */
4667 if (p_ptr->tim_levitation)
4669 p_ptr->levitation = TRUE;
4672 /* Temporary reflection */
4673 if (p_ptr->tim_reflect)
4675 p_ptr->reflect = TRUE;
4678 /* Hack -- Hero/Shero -> Res fear */
4679 if (IS_HERO() || p_ptr->shero)
4681 p_ptr->resist_fear = TRUE;
4685 /* Hack -- Telepathy Change */
4686 if (p_ptr->telepathy != old_telepathy)
4688 p_ptr->update |= (PU_MONSTERS);
4691 if ((p_ptr->esp_animal != old_esp_animal) ||
4692 (p_ptr->esp_undead != old_esp_undead) ||
4693 (p_ptr->esp_demon != old_esp_demon) ||
4694 (p_ptr->esp_orc != old_esp_orc) ||
4695 (p_ptr->esp_troll != old_esp_troll) ||
4696 (p_ptr->esp_giant != old_esp_giant) ||
4697 (p_ptr->esp_dragon != old_esp_dragon) ||
4698 (p_ptr->esp_human != old_esp_human) ||
4699 (p_ptr->esp_evil != old_esp_evil) ||
4700 (p_ptr->esp_good != old_esp_good) ||
4701 (p_ptr->esp_nonliving != old_esp_nonliving) ||
4702 (p_ptr->esp_unique != old_esp_unique))
4704 p_ptr->update |= (PU_MONSTERS);
4707 /* Hack -- See Invis Change */
4708 if (p_ptr->see_inv != old_see_inv)
4710 p_ptr->update |= (PU_MONSTERS);
4713 /* Bloating slows the player down (a little) */
4714 if (p_ptr->food >= PY_FOOD_MAX) new_speed -= 10;
4716 if (p_ptr->special_defense & KAMAE_SUZAKU) new_speed += 10;
4718 if ((p_ptr->migite && (empty_hands_status & EMPTY_HAND_RARM)) ||
4719 (p_ptr->hidarite && (empty_hands_status & EMPTY_HAND_LARM)))
4721 p_ptr->to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
4722 p_ptr->dis_to_h[default_hand] += (p_ptr->skill_exp[GINOU_SUDE] - WEAPON_EXP_BEGINNER) / 200;
4725 if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
4727 int penalty1, penalty2;
4728 penalty1 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_RARM].weight) / 8);
4729 penalty2 = ((100 - p_ptr->skill_exp[GINOU_NITOURYU] / 160) - (130 - inventory[INVEN_LARM].weight) / 8);
4730 if ((inventory[INVEN_RARM].name1 == ART_QUICKTHORN) && (inventory[INVEN_LARM].name1 == ART_TINYTHORN))
4732 penalty1 = penalty1 / 2 - 5;
4733 penalty2 = penalty2 / 2 - 5;
4736 p_ptr->dis_to_a += 10;
4740 if (penalty1 > 0) penalty1 /= 2;
4741 if (penalty2 > 0) penalty2 /= 2;
4743 else if ((inventory[INVEN_LARM].tval == TV_SWORD) && ((inventory[INVEN_LARM].sval == SV_MAIN_GAUCHE) || (inventory[INVEN_LARM].sval == SV_WAKIZASHI)))
4745 penalty1 = MAX(0, penalty1 - 10);
4746 penalty2 = MAX(0, penalty2 - 10);
4748 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI))
4750 penalty1 = MIN(0, penalty1);
4751 penalty2 = MIN(0, penalty2);
4753 p_ptr->dis_to_a += 10;
4757 if ((inventory[INVEN_RARM].name1 == ART_MUSASI_KATANA) && (penalty1 > 0))
4759 if ((inventory[INVEN_LARM].name1 == ART_MUSASI_WAKIZASI) && (penalty2 > 0))
4762 if (inventory[INVEN_RARM].tval == TV_POLEARM) penalty1 += 10;
4763 if (inventory[INVEN_LARM].tval == TV_POLEARM) penalty2 += 10;
4764 p_ptr->to_h[0] -= (s16b)penalty1;
4765 p_ptr->to_h[1] -= (s16b)penalty2;
4766 p_ptr->dis_to_h[0] -= (s16b)penalty1;
4767 p_ptr->dis_to_h[1] -= (s16b)penalty2;
4770 /* Extract the current weight (in tenth pounds) */
4771 j = p_ptr->total_weight;
4775 /* Extract the "weight limit" (in tenth pounds) */
4776 i = (int)weight_limit();
4780 monster_type *riding_m_ptr = &m_list[p_ptr->riding];
4781 monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
4782 SPEED speed = riding_m_ptr->mspeed;
4784 if (riding_m_ptr->mspeed > 110)
4786 new_speed = 110 + (s16b)((speed - 110) * (p_ptr->skill_exp[GINOU_RIDING] * 3 + p_ptr->lev * 160L - 10000L) / (22000L));
4787 if (new_speed < 110) new_speed = 110;
4793 new_speed += (p_ptr->skill_exp[GINOU_RIDING] + p_ptr->lev *160L)/3200;
4794 if (MON_FAST(riding_m_ptr)) new_speed += 10;
4795 if (MON_SLOW(riding_m_ptr)) new_speed -= 10;
4796 riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
4797 if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE;
4799 if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) p_ptr->pass_wall = FALSE;
4800 if (riding_r_ptr->flags2 & RF2_KILL_WALL) p_ptr->kill_wall = TRUE;
4802 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;
4804 /* Extract the "weight limit" */
4805 i = 1500 + riding_r_ptr->level * 25;
4808 /* Apply "encumbrance" from weight */
4809 if (j > i) new_speed -= ((j - i) / (i / 5));
4811 /* Searching slows the player down */
4812 if (p_ptr->action == ACTION_SEARCH) new_speed -= 10;
4814 /* Actual Modifier Bonuses (Un-inflate stat bonuses) */
4815 p_ptr->to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4816 p_ptr->to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4817 p_ptr->to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4818 p_ptr->to_d_m += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4819 p_ptr->to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4820 p_ptr->to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4821 p_ptr->to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4822 p_ptr->to_h_m += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4823 p_ptr->to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4824 p_ptr->to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4825 p_ptr->to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4826 p_ptr->to_h_m += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4828 /* Displayed Modifier Bonuses (Un-inflate stat bonuses) */
4829 p_ptr->dis_to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128);
4830 p_ptr->dis_to_d[0] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4831 p_ptr->dis_to_d[1] += ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128);
4832 p_ptr->dis_to_h[0] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4833 p_ptr->dis_to_h[1] += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4834 p_ptr->dis_to_h_b += ((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
4835 p_ptr->dis_to_h[0] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4836 p_ptr->dis_to_h[1] += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4837 p_ptr->dis_to_h_b += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128);
4840 /* Obtain the "hold" value */
4841 hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
4844 /* Examine the "current bow" */
4845 o_ptr = &inventory[INVEN_BOW];
4847 /* It is hard to carholdry a heavy bow */
4848 p_ptr->heavy_shoot = is_heavy_shoot(o_ptr);
4849 if (p_ptr->heavy_shoot)
4851 /* Hard to wield a heavy bow */
4852 p_ptr->to_h_b += 2 * (hold - o_ptr->weight / 10);
4853 p_ptr->dis_to_h_b += 2 * (hold - o_ptr->weight / 10);
4856 /* Compute "extra shots" if needed */
4859 p_ptr->tval_ammo = (byte_hack)bow_tval_ammo(o_ptr);
4861 /* Apply special flags */
4862 if (o_ptr->k_idx && !p_ptr->heavy_shoot)
4865 p_ptr->num_fire = calc_num_fire(o_ptr);
4867 /* Snipers love Cross bows */
4868 if ((p_ptr->pclass == CLASS_SNIPER) &&
4869 (p_ptr->tval_ammo == TV_BOLT))
4871 p_ptr->to_h_b += (10 + (p_ptr->lev / 5));
4872 p_ptr->dis_to_h_b += (10 + (p_ptr->lev / 5));
4877 if (p_ptr->ryoute) hold *= 2;
4879 for(i = 0 ; i < 2 ; i++)
4881 /* Examine the "main weapon" */
4882 o_ptr = &inventory[INVEN_RARM+i];
4884 object_flags(o_ptr, flgs);
4886 /* Assume not heavy */
4887 p_ptr->heavy_wield[i] = FALSE;
4888 p_ptr->icky_wield[i] = FALSE;
4889 p_ptr->riding_wield[i] = FALSE;
4891 if (!buki_motteruka(INVEN_RARM+i))
4893 p_ptr->num_blow[i] = 1;
4896 /* It is hard to hold a heavy weapon */
4897 if (hold < o_ptr->weight / 10)
4899 /* Hard to wield a heavy weapon */
4900 p_ptr->to_h[i] += 2 * (hold - o_ptr->weight / 10);
4901 p_ptr->dis_to_h[i] += 2 * (hold - o_ptr->weight / 10);
4904 p_ptr->heavy_wield[i] = TRUE;
4906 else if (p_ptr->ryoute && (hold < o_ptr->weight/5)) omoi = TRUE;
4908 if ((i == 1) && (o_ptr->tval == TV_SWORD) && ((o_ptr->sval == SV_MAIN_GAUCHE) || (o_ptr->sval == SV_WAKIZASHI)))
4911 p_ptr->dis_to_a += 5;
4914 /* Normal weapons */
4915 if (o_ptr->k_idx && !p_ptr->heavy_wield[i])
4917 int str_index, dex_index;
4919 int num = 0, wgt = 0, mul = 0, div = 0;
4921 /* Analyze the class */
4922 switch (p_ptr->pclass)
4926 num = 6; wgt = 70; mul = 5; break;
4929 case CLASS_BERSERKER:
4930 num = 6; wgt = 70; mul = 7; break;
4934 case CLASS_HIGH_MAGE:
4935 case CLASS_BLUE_MAGE:
4936 num = 3; wgt = 100; mul = 2; break;
4938 /* Priest, Mindcrafter, Magic-Eater */
4940 case CLASS_MAGIC_EATER:
4941 case CLASS_MINDCRAFTER:
4942 num = 5; wgt = 100; mul = 3; break;
4946 num = 5; wgt = 40; mul = 3; break;
4950 num = 5; wgt = 70; mul = 4; break;
4955 num = 5; wgt = 70; mul = 4; break;
4959 num = 5; wgt = 150; mul = 5; break;
4962 case CLASS_WARRIOR_MAGE:
4963 case CLASS_RED_MAGE:
4964 num = 5; wgt = 70; mul = 3; break;
4967 case CLASS_CHAOS_WARRIOR:
4968 num = 5; wgt = 70; mul = 4; break;
4972 num = 5; wgt = 60; mul = 3; break;
4976 num = 4; wgt = 100; mul = 3; break;
4979 case CLASS_IMITATOR:
4980 num = 5; wgt = 70; mul = 4; break;
4983 case CLASS_BEASTMASTER:
4984 num = 5; wgt = 70; mul = 3; break;
4988 if ((p_ptr->riding) && (have_flag(flgs, TR_RIDING))) {num = 5; wgt = 70; mul = 4;}
4989 else {num = 5; wgt = 100; mul = 3;}
4993 case CLASS_SORCERER:
4994 num = 1; wgt = 1; mul = 1; break;
4996 /* Archer, Bard, Sniper */
5000 num = 4; wgt = 70; mul = 2; break;
5003 case CLASS_FORCETRAINER:
5004 num = 4; wgt = 60; mul = 2; break;
5007 case CLASS_MIRROR_MASTER:
5008 num = 3; wgt = 100; mul = 3; break;
5012 num = 4; wgt = 20; mul = 1; break;
5015 /* Hex - extra mights gives +1 bonus to max blows */
5016 if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING)) { num++; wgt /= 2; mul += 2; }
5018 /* Enforce a minimum "weight" (tenth pounds) */
5019 div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
5021 /* Access the strength vs weight */
5022 str_index = (adj_str_blow[p_ptr->stat_ind[A_STR]] * mul / div);
5024 if (p_ptr->ryoute && !omoi) str_index++;
5025 if (p_ptr->pclass == CLASS_NINJA) str_index = MAX(0, str_index-1);
5028 if (str_index > 11) str_index = 11;
5030 /* Index by dexterity */
5031 dex_index = (adj_dex_blow[p_ptr->stat_ind[A_DEX]]);
5034 if (dex_index > 11) dex_index = 11;
5036 /* Use the blows table */
5037 p_ptr->num_blow[i] = blows_table[str_index][dex_index];
5040 if (p_ptr->num_blow[i] > num) p_ptr->num_blow[i] = (s16b)num;
5042 /* Add in the "bonus blows" */
5043 p_ptr->num_blow[i] += (s16b)extra_blows[i];
5046 if (p_ptr->pclass == CLASS_WARRIOR) p_ptr->num_blow[i] += (p_ptr->lev / 40);
5047 else if (p_ptr->pclass == CLASS_BERSERKER)
5049 p_ptr->num_blow[i] += (p_ptr->lev / 23);
5051 else if ((p_ptr->pclass == CLASS_ROGUE) && (o_ptr->weight < 50) && (p_ptr->stat_ind[A_DEX] >= 30)) p_ptr->num_blow[i] ++;
5053 if (p_ptr->special_defense & KATA_FUUJIN) p_ptr->num_blow[i] -= 1;
5055 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) p_ptr->num_blow[i] = 1;
5058 /* Require at least one blow */
5059 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
5061 /* Boost digging skill by weapon weight */
5062 p_ptr->skill_dig += (o_ptr->weight / 10);
5066 /* Priest weapon penalty for non-blessed edged weapons */
5067 if ((p_ptr->pclass == CLASS_PRIEST) && (!(have_flag(flgs, TR_BLESSED))) &&
5068 ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM)))
5070 /* Reduce the real bonuses */
5071 p_ptr->to_h[i] -= 2;
5072 p_ptr->to_d[i] -= 2;
5074 /* Reduce the mental bonuses */
5075 p_ptr->dis_to_h[i] -= 2;
5076 p_ptr->dis_to_d[i] -= 2;
5079 p_ptr->icky_wield[i] = TRUE;
5081 else if (p_ptr->pclass == CLASS_BERSERKER)
5083 p_ptr->to_h[i] += p_ptr->lev/5;
5084 p_ptr->to_d[i] += p_ptr->lev/6;
5085 p_ptr->dis_to_h[i] += p_ptr->lev/5;
5086 p_ptr->dis_to_d[i] += p_ptr->lev/6;
5087 if (((i == 0) && !p_ptr->hidarite) || p_ptr->ryoute)
5089 p_ptr->to_h[i] += p_ptr->lev/5;
5090 p_ptr->to_d[i] += p_ptr->lev/6;
5091 p_ptr->dis_to_h[i] += p_ptr->lev/5;
5092 p_ptr->dis_to_d[i] += p_ptr->lev/6;
5095 else if (p_ptr->pclass == CLASS_SORCERER)
5097 if (!((o_ptr->tval == TV_HAFTED) && ((o_ptr->sval == SV_WIZSTAFF) || (o_ptr->sval == SV_NAMAKE_HAMMER))))
5099 /* Reduce the real bonuses */
5100 p_ptr->to_h[i] -= 200;
5101 p_ptr->to_d[i] -= 200;
5103 /* Reduce the mental bonuses */
5104 p_ptr->dis_to_h[i] -= 200;
5105 p_ptr->dis_to_d[i] -= 200;
5108 p_ptr->icky_wield[i] = TRUE;
5112 /* Reduce the real bonuses */
5113 p_ptr->to_h[i] -= 30;
5114 p_ptr->to_d[i] -= 10;
5116 /* Reduce the mental bonuses */
5117 p_ptr->dis_to_h[i] -= 30;
5118 p_ptr->dis_to_d[i] -= 10;
5122 if (p_ptr->realm1 == REALM_HEX)
5124 if (object_is_cursed(o_ptr))
5126 if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
5127 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_h[i] += 7; p_ptr->dis_to_h[i] += 7; }
5128 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_h[i] += 13; p_ptr->dis_to_h[i] += 13; }
5129 if (o_ptr->curse_flags & (TRC_TY_CURSE)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
5130 if (hex_spelling(HEX_RUNESWORD))
5132 if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_d[i] += 5; p_ptr->dis_to_d[i] += 5; }
5133 if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_d[i] += 7; p_ptr->dis_to_d[i] += 7; }
5134 if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_d[i] += 13; p_ptr->dis_to_d[i] += 13; }
5140 if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
5142 p_ptr->to_h[i] +=15;
5143 p_ptr->dis_to_h[i] +=15;
5144 p_ptr->to_dd[i] += 2;
5146 else if (!(have_flag(flgs, TR_RIDING)))
5149 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
5155 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
5157 if (penalty < 30) penalty = 30;
5159 p_ptr->to_h[i] -= (s16b)penalty;
5160 p_ptr->dis_to_h[i] -= (s16b)penalty;
5163 p_ptr->riding_wield[i] = TRUE;
5172 p_ptr->riding_ryoute = FALSE;
5174 if (p_ptr->ryoute || (empty_hands(FALSE) == EMPTY_HAND_NONE)) p_ptr->riding_ryoute = TRUE;
5175 else if (p_ptr->pet_extra_flags & PF_RYOUTE)
5177 switch (p_ptr->pclass)
5180 case CLASS_FORCETRAINER:
5181 case CLASS_BERSERKER:
5182 if ((empty_hands(FALSE) != EMPTY_HAND_NONE) && !buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
5183 p_ptr->riding_ryoute = TRUE;
5188 if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
5190 if (p_ptr->tval_ammo != TV_ARROW) penalty = 5;
5194 penalty = r_info[m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 80;
5196 if (penalty < 30) penalty = 30;
5198 if (p_ptr->tval_ammo == TV_BOLT) penalty *= 2;
5199 p_ptr->to_h_b -= (s16b)penalty;
5200 p_ptr->dis_to_h_b -= (s16b)penalty;
5203 /* Different calculation for monks with empty hands */
5204 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) &&
5205 (empty_hands_status & EMPTY_HAND_RARM) && !p_ptr->hidarite)
5207 int blow_base = p_ptr->lev + adj_dex_blow[p_ptr->stat_ind[A_DEX]];
5208 p_ptr->num_blow[0] = 0;
5210 if (p_ptr->pclass == CLASS_FORCETRAINER)
5212 if (blow_base > 18) p_ptr->num_blow[0]++;
5213 if (blow_base > 31) p_ptr->num_blow[0]++;
5214 if (blow_base > 44) p_ptr->num_blow[0]++;
5215 if (blow_base > 58) p_ptr->num_blow[0]++;
5218 p_ptr->to_d[0] += P_PTR_KI / 5;
5219 p_ptr->dis_to_d[0] += P_PTR_KI / 5;
5224 if (blow_base > 12) p_ptr->num_blow[0]++;
5225 if (blow_base > 22) p_ptr->num_blow[0]++;
5226 if (blow_base > 31) p_ptr->num_blow[0]++;
5227 if (blow_base > 39) p_ptr->num_blow[0]++;
5228 if (blow_base > 46) p_ptr->num_blow[0]++;
5229 if (blow_base > 53) p_ptr->num_blow[0]++;
5230 if (blow_base > 59) p_ptr->num_blow[0]++;
5233 if (heavy_armor() && (p_ptr->pclass != CLASS_BERSERKER))
5234 p_ptr->num_blow[0] /= 2;
5237 p_ptr->to_h[0] += (p_ptr->lev / 3);
5238 p_ptr->dis_to_h[0] += (p_ptr->lev / 3);
5240 p_ptr->to_d[0] += (p_ptr->lev / 6);
5241 p_ptr->dis_to_d[0] += (p_ptr->lev / 6);
5244 if (p_ptr->special_defense & KAMAE_BYAKKO)
5247 p_ptr->dis_to_a -= 40;
5250 else if (p_ptr->special_defense & KAMAE_SEIRYU)
5253 p_ptr->dis_to_a -= 50;
5254 p_ptr->resist_acid = TRUE;
5255 p_ptr->resist_fire = TRUE;
5256 p_ptr->resist_elec = TRUE;
5257 p_ptr->resist_cold = TRUE;
5258 p_ptr->resist_pois = TRUE;
5259 p_ptr->sh_fire = TRUE;
5260 p_ptr->sh_elec = TRUE;
5261 p_ptr->sh_cold = TRUE;
5262 p_ptr->levitation = TRUE;
5264 else if (p_ptr->special_defense & KAMAE_GENBU)
5266 p_ptr->to_a += (p_ptr->lev*p_ptr->lev)/50;
5267 p_ptr->dis_to_a += (p_ptr->lev*p_ptr->lev)/50;
5268 p_ptr->reflect = TRUE;
5269 p_ptr->num_blow[0] -= 2;
5270 if ((p_ptr->pclass == CLASS_MONK) && (p_ptr->lev > 42)) p_ptr->num_blow[0]--;
5271 if (p_ptr->num_blow[0] < 0) p_ptr->num_blow[0] = 0;
5273 else if (p_ptr->special_defense & KAMAE_SUZAKU)
5275 p_ptr->to_h[0] -= (p_ptr->lev / 3);
5276 p_ptr->to_d[0] -= (p_ptr->lev / 6);
5278 p_ptr->dis_to_h[0] -= (p_ptr->lev / 3);
5279 p_ptr->dis_to_d[0] -= (p_ptr->lev / 6);
5280 p_ptr->num_blow[0] /= 2;
5281 p_ptr->levitation = TRUE;
5284 p_ptr->num_blow[0] += 1+extra_blows[0];
5287 if (p_ptr->riding) p_ptr->levitation = riding_levitation;
5289 monk_armour_aux = FALSE;
5293 monk_armour_aux = TRUE;
5296 for (i = 0; i < 2; i++)
5298 if (buki_motteruka(INVEN_RARM+i))
5300 OBJECT_TYPE_VALUE tval = inventory[INVEN_RARM+i].tval - TV_WEAPON_BEGIN;
5301 OBJECT_SUBTYPE_VALUE sval = inventory[INVEN_RARM+i].sval;
5303 p_ptr->to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
5304 p_ptr->dis_to_h[i] += (p_ptr->weapon_exp[tval][sval] - WEAPON_EXP_BEGINNER) / 200;
5305 if ((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER))
5307 if (!s_info[p_ptr->pclass].w_max[tval][sval])
5309 p_ptr->to_h[i] -= 40;
5310 p_ptr->dis_to_h[i] -= 40;
5311 p_ptr->icky_wield[i] = TRUE;
5314 else if (p_ptr->pclass == CLASS_NINJA)
5316 if ((s_info[CLASS_NINJA].w_max[tval][sval] <= WEAPON_EXP_BEGINNER) || (inventory[INVEN_LARM-i].tval == TV_SHIELD))
5318 p_ptr->to_h[i] -= 40;
5319 p_ptr->dis_to_h[i] -= 40;
5320 p_ptr->icky_wield[i] = TRUE;
5321 p_ptr->num_blow[i] /= 2;
5322 if (p_ptr->num_blow[i] < 1) p_ptr->num_blow[i] = 1;
5326 if (inventory[INVEN_RARM + i].name1 == ART_IRON_BALL) p_ptr->align -= 1000;
5330 /* Maximum speed is (+99). (internally it's 110 + 99) */
5331 /* Temporary lightspeed forces to be maximum speed */
5332 if ((p_ptr->lightspeed && !p_ptr->riding) || (new_speed > 209))
5337 /* Minimum speed is (-99). (internally it's 110 - 99) */
5338 if (new_speed < 11) new_speed = 11;
5340 /* Display the speed (if needed) */
5341 if (p_ptr->pspeed != (byte)new_speed)
5343 p_ptr->pspeed = (byte)new_speed;
5344 p_ptr->redraw |= (PR_SPEED);
5349 if (p_ptr->to_a > (0 - p_ptr->ac))
5350 p_ptr->to_a = 0 - p_ptr->ac;
5351 if (p_ptr->dis_to_a > (0 - p_ptr->dis_ac))
5352 p_ptr->dis_to_a = 0 - p_ptr->dis_ac;
5355 /* Redraw armor (if needed) */
5356 if ((p_ptr->dis_ac != old_dis_ac) || (p_ptr->dis_to_a != old_dis_to_a))
5358 p_ptr->redraw |= (PR_ARMOR);
5359 p_ptr->window |= (PW_PLAYER);
5362 if (p_ptr->ryoute && !omoi)
5364 int bonus_to_h=0, bonus_to_d=0;
5365 bonus_to_d = ((int)(adj_str_td[p_ptr->stat_ind[A_STR]]) - 128)/2;
5366 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);
5368 p_ptr->to_h[default_hand] += MAX(bonus_to_h,1);
5369 p_ptr->dis_to_h[default_hand] += MAX(bonus_to_h,1);
5370 p_ptr->to_d[default_hand] += MAX(bonus_to_d,1);
5371 p_ptr->dis_to_d[default_hand] += MAX(bonus_to_d,1);
5374 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;
5376 /* Affect Skill -- stealth (bonus one) */
5377 p_ptr->skill_stl += 1;
5379 if (IS_TIM_STEALTH()) p_ptr->skill_stl += 99;
5381 /* Affect Skill -- disarming (DEX and INT) */
5382 p_ptr->skill_dis += adj_dex_dis[p_ptr->stat_ind[A_DEX]];
5383 p_ptr->skill_dis += adj_int_dis[p_ptr->stat_ind[A_INT]];
5385 /* Affect Skill -- magic devices (INT) */
5386 p_ptr->skill_dev += adj_int_dev[p_ptr->stat_ind[A_INT]];
5388 /* Affect Skill -- saving throw (WIS) */
5389 p_ptr->skill_sav += adj_wis_sav[p_ptr->stat_ind[A_WIS]];
5391 /* Affect Skill -- digging (STR) */
5392 p_ptr->skill_dig += adj_str_dig[p_ptr->stat_ind[A_STR]];
5394 /* Affect Skill -- disarming (Level, by Class) */
5395 p_ptr->skill_dis += ((cp_ptr->x_dis * p_ptr->lev / 10) + (ap_ptr->a_dis * p_ptr->lev / 50));
5397 /* Affect Skill -- magic devices (Level, by Class) */
5398 p_ptr->skill_dev += ((cp_ptr->x_dev * p_ptr->lev / 10) + (ap_ptr->a_dev * p_ptr->lev / 50));
5400 /* Affect Skill -- saving throw (Level, by Class) */
5401 p_ptr->skill_sav += ((cp_ptr->x_sav * p_ptr->lev / 10) + (ap_ptr->a_sav * p_ptr->lev / 50));
5403 /* Affect Skill -- stealth (Level, by Class) */
5404 p_ptr->skill_stl += (cp_ptr->x_stl * p_ptr->lev / 10);
5406 /* Affect Skill -- search ability (Level, by Class) */
5407 p_ptr->skill_srh += (cp_ptr->x_srh * p_ptr->lev / 10);
5409 /* Affect Skill -- search frequency (Level, by Class) */
5410 p_ptr->skill_fos += (cp_ptr->x_fos * p_ptr->lev / 10);
5412 /* Affect Skill -- combat (normal) (Level, by Class) */
5413 p_ptr->skill_thn += ((cp_ptr->x_thn * p_ptr->lev / 10) + (ap_ptr->a_thn * p_ptr->lev / 50));
5415 /* Affect Skill -- combat (shooting) (Level, by Class) */
5416 p_ptr->skill_thb += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5418 /* Affect Skill -- combat (throwing) (Level, by Class) */
5419 p_ptr->skill_tht += ((cp_ptr->x_thb * p_ptr->lev / 10) + (ap_ptr->a_thb * p_ptr->lev / 50));
5422 if ((prace_is_(RACE_S_FAIRY)) && (p_ptr->pseikaku != SEIKAKU_SEXY) && (p_ptr->cursed & TRC_AGGRAVATE))
5424 p_ptr->cursed &= ~(TRC_AGGRAVATE);
5425 p_ptr->skill_stl = MIN(p_ptr->skill_stl - 3, (p_ptr->skill_stl + 2) / 2);
5428 /* Limit Skill -- stealth from 0 to 30 */
5429 if (p_ptr->skill_stl > 30) p_ptr->skill_stl = 30;
5430 if (p_ptr->skill_stl < 0) p_ptr->skill_stl = 0;
5432 /* Limit Skill -- digging from 1 up */
5433 if (p_ptr->skill_dig < 1) p_ptr->skill_dig = 1;
5435 if (p_ptr->anti_magic && (p_ptr->skill_sav < (90 + p_ptr->lev))) p_ptr->skill_sav = 90 + p_ptr->lev;
5437 if (p_ptr->tsubureru) p_ptr->skill_sav = 10;
5439 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;
5441 if (down_saving) p_ptr->skill_sav /= 2;
5443 /* Hack -- Each elemental immunity includes resistance */
5444 if (p_ptr->immune_acid) p_ptr->resist_acid = TRUE;
5445 if (p_ptr->immune_elec) p_ptr->resist_elec = TRUE;
5446 if (p_ptr->immune_fire) p_ptr->resist_fire = TRUE;
5447 if (p_ptr->immune_cold) p_ptr->resist_cold = TRUE;
5449 /* Determine player alignment */
5450 for (i = 0, j = 0; i < 8; i++)
5452 switch (p_ptr->vir_types[i])
5455 p_ptr->align += p_ptr->virtues[i] * 2;
5465 p_ptr->align -= p_ptr->virtues[i];
5468 p_ptr->align += p_ptr->virtues[i];
5473 for (i = 0; i < j; i++)
5475 if (p_ptr->align > 0)
5477 p_ptr->align -= p_ptr->virtues[neutral[i]] / 2;
5478 if (p_ptr->align < 0) p_ptr->align = 0;
5480 else if (p_ptr->align < 0)
5482 p_ptr->align += p_ptr->virtues[neutral[i]] / 2;
5483 if (p_ptr->align > 0) p_ptr->align = 0;
5487 /* Hack -- handle "xtra" mode */
5488 if (character_xtra) return;
5490 /* Take note when "heavy bow" changes */
5491 if (p_ptr->old_heavy_shoot != p_ptr->heavy_shoot)
5493 if (p_ptr->heavy_shoot)
5495 msg_print(_("こんな重い弓を装備しているのは大変だ。", "You have trouble wielding such a heavy bow."));
5497 else if (inventory[INVEN_BOW].k_idx)
5499 msg_print(_("この弓なら装備していても辛くない。", "You have no trouble wielding your bow."));
5503 msg_print(_("重い弓を装備からはずして体が楽になった。", "You feel relieved to put down your heavy bow."));
5507 p_ptr->old_heavy_shoot = p_ptr->heavy_shoot;
5510 for (i = 0 ; i < 2 ; i++)
5512 /* Take note when "heavy weapon" changes */
5513 if (p_ptr->old_heavy_wield[i] != p_ptr->heavy_wield[i])
5515 if (p_ptr->heavy_wield[i])
5517 msg_print(_("こんな重い武器を装備しているのは大変だ。", "You have trouble wielding such a heavy weapon."));
5519 else if (buki_motteruka(INVEN_RARM+i))
5521 msg_print(_("これなら装備していても辛くない。", "You have no trouble wielding your weapon."));
5523 else if (p_ptr->heavy_wield[1-i])
5525 msg_print(_("まだ武器が重い。", "You have still trouble wielding a heavy weapon."));
5529 msg_print(_("重い武器を装備からはずして体が楽になった。", "You feel relieved to put down your heavy weapon."));
5533 p_ptr->old_heavy_wield[i] = p_ptr->heavy_wield[i];
5536 /* Take note when "heavy weapon" changes */
5537 if (p_ptr->old_riding_wield[i] != p_ptr->riding_wield[i])
5539 if (p_ptr->riding_wield[i])
5541 msg_print(_("この武器は乗馬中に使うにはむかないようだ。", "This weapon is not suitable for use while riding."));
5543 else if (!p_ptr->riding)
5545 msg_print(_("この武器は徒歩で使いやすい。", "This weapon was not suitable for use while riding."));
5547 else if (buki_motteruka(INVEN_RARM+i))
5549 msg_print(_("これなら乗馬中にぴったりだ。", "This weapon is suitable for use while riding."));
5552 p_ptr->old_riding_wield[i] = p_ptr->riding_wield[i];
5555 /* Take note when "illegal weapon" changes */
5556 if (p_ptr->old_icky_wield[i] != p_ptr->icky_wield[i])
5558 if (p_ptr->icky_wield[i])
5560 msg_print(_("今の装備はどうも自分にふさわしくない気がする。", "You do not feel comfortable with your weapon."));
5563 chg_virtue(V_FAITH, -1);
5566 else if (buki_motteruka(INVEN_RARM+i))
5568 msg_print(_("今の装備は自分にふさわしい気がする。", "You feel comfortable with your weapon."));
5572 msg_print(_("装備をはずしたら随分と気が楽になった。", "You feel more comfortable after removing your weapon."));
5576 p_ptr->old_icky_wield[i] = p_ptr->icky_wield[i];
5580 if (p_ptr->riding && (p_ptr->old_riding_ryoute != p_ptr->riding_ryoute))
5582 if (p_ptr->riding_ryoute)
5585 msg_format("%s馬を操れない。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "両手がふさがっていて" : "");
5587 msg_print("You are using both hand for fighting, and you can't control a riding pet.");
5593 msg_format("%s馬を操れるようになった。", (empty_hands(FALSE) == EMPTY_HAND_NONE) ? "手が空いて" : "");
5595 msg_print("You began to control riding pet with one hand.");
5599 p_ptr->old_riding_ryoute = p_ptr->riding_ryoute;
5602 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (monk_armour_aux != monk_notify_aux))
5606 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
5609 chg_virtue(V_HARMONY, -1);
5614 msg_print(_("バランスがとれるようになった。", "You regain your balance."));
5617 monk_notify_aux = monk_armour_aux;
5620 for (i = 0; i < INVEN_PACK; i++)
5623 if ((inventory[i].tval == TV_SORCERY_BOOK) && (inventory[i].sval == 2)) have_dd_s = TRUE;
5624 if ((inventory[i].tval == TV_TRUMP_BOOK) && (inventory[i].sval == 1)) have_dd_t = TRUE;
5626 if ((inventory[i].tval == TV_NATURE_BOOK) && (inventory[i].sval == 2)) have_sw = TRUE;
5627 if ((inventory[i].tval == TV_CRAFT_BOOK) && (inventory[i].sval == 2)) have_kabe = TRUE;
5630 for (this_o_idx = cave[p_ptr->y][p_ptr->x].o_idx; this_o_idx; this_o_idx = next_o_idx)
5632 o_ptr = &o_list[this_o_idx];
5634 /* Acquire next object */
5635 next_o_idx = o_ptr->next_o_idx;
5638 if ((o_ptr->tval == TV_SORCERY_BOOK) && (o_ptr->sval == 3)) have_dd_s = TRUE;
5639 if ((o_ptr->tval == TV_TRUMP_BOOK) && (o_ptr->sval == 1)) have_dd_t = TRUE;
5641 if ((o_ptr->tval == TV_NATURE_BOOK) && (o_ptr->sval == 2)) have_sw = TRUE;
5642 if ((o_ptr->tval == TV_CRAFT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
5645 if (p_ptr->pass_wall && !p_ptr->kill_wall) p_ptr->no_flowed = TRUE;
5647 if (have_dd_s && ((p_ptr->realm1 == REALM_SORCERY) || (p_ptr->realm2 == REALM_SORCERY) || (p_ptr->pclass == CLASS_SORCERER)))
5649 const magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY-1][SPELL_DD_S];
5650 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5653 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)))
5655 const magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP-1][SPELL_DD_T];
5656 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5659 if (have_sw && ((p_ptr->realm1 == REALM_NATURE) || (p_ptr->realm2 == REALM_NATURE) || (p_ptr->pclass == CLASS_SORCERER)))
5661 const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE-1][SPELL_SW];
5662 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5665 if (have_kabe && ((p_ptr->realm1 == REALM_CRAFT) || (p_ptr->realm2 == REALM_CRAFT) || (p_ptr->pclass == CLASS_SORCERER)))
5667 const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT-1][SPELL_KABE];
5668 if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
5674 * @brief p_ptr->redraw のフラグに応じた更新をまとめて行う / Handle "p_ptr->redraw"
5676 * @details 更新処理の対象はゲーム中の全描画処理
5678 static void redraw_stuff(void)
5680 if (!p_ptr->redraw) return;
5682 /* Character is not ready yet, no screen updates */
5683 if (!character_generated) return;
5685 /* Character is in "icky" mode, no screen updates */
5686 if (character_icky) return;
5688 /* Hack -- clear the screen */
5689 if (p_ptr->redraw & (PR_WIPE))
5691 p_ptr->redraw &= ~(PR_WIPE);
5696 if (p_ptr->redraw & (PR_MAP))
5698 p_ptr->redraw &= ~(PR_MAP);
5702 if (p_ptr->redraw & (PR_BASIC))
5704 p_ptr->redraw &= ~(PR_BASIC);
5705 p_ptr->redraw &= ~(PR_MISC | PR_TITLE | PR_STATS);
5706 p_ptr->redraw &= ~(PR_LEV | PR_EXP | PR_GOLD);
5707 p_ptr->redraw &= ~(PR_ARMOR | PR_HP | PR_MANA);
5708 p_ptr->redraw &= ~(PR_DEPTH | PR_HEALTH | PR_UHEALTH);
5714 if (p_ptr->redraw & (PR_EQUIPPY))
5716 p_ptr->redraw &= ~(PR_EQUIPPY);
5717 print_equippy(); /* To draw / delete equippy chars */
5720 if (p_ptr->redraw & (PR_MISC))
5722 p_ptr->redraw &= ~(PR_MISC);
5723 prt_field(rp_ptr->title, ROW_RACE, COL_RACE);
5724 /* prt_field(cp_ptr->title, ROW_CLASS, COL_CLASS); */
5727 if (p_ptr->redraw & (PR_TITLE))
5729 p_ptr->redraw &= ~(PR_TITLE);
5733 if (p_ptr->redraw & (PR_LEV))
5735 p_ptr->redraw &= ~(PR_LEV);
5739 if (p_ptr->redraw & (PR_EXP))
5741 p_ptr->redraw &= ~(PR_EXP);
5745 if (p_ptr->redraw & (PR_STATS))
5747 p_ptr->redraw &= ~(PR_STATS);
5756 if (p_ptr->redraw & (PR_STATUS))
5758 p_ptr->redraw &= ~(PR_STATUS);
5762 if (p_ptr->redraw & (PR_ARMOR))
5764 p_ptr->redraw &= ~(PR_ARMOR);
5768 if (p_ptr->redraw & (PR_HP))
5770 p_ptr->redraw &= ~(PR_HP);
5774 if (p_ptr->redraw & (PR_MANA))
5776 p_ptr->redraw &= ~(PR_MANA);
5780 if (p_ptr->redraw & (PR_GOLD))
5782 p_ptr->redraw &= ~(PR_GOLD);
5786 if (p_ptr->redraw & (PR_DEPTH))
5788 p_ptr->redraw &= ~(PR_DEPTH);
5792 if (p_ptr->redraw & (PR_HEALTH))
5794 p_ptr->redraw &= ~(PR_HEALTH);
5795 health_redraw(FALSE);
5798 if (p_ptr->redraw & (PR_UHEALTH))
5800 p_ptr->redraw &= ~(PR_UHEALTH);
5801 health_redraw(TRUE);
5804 if (p_ptr->redraw & (PR_EXTRA))
5806 p_ptr->redraw &= ~(PR_EXTRA);
5807 p_ptr->redraw &= ~(PR_CUT | PR_STUN);
5808 p_ptr->redraw &= ~(PR_HUNGER);
5809 p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
5813 if (p_ptr->redraw & (PR_CUT))
5815 p_ptr->redraw &= ~(PR_CUT);
5819 if (p_ptr->redraw & (PR_STUN))
5821 p_ptr->redraw &= ~(PR_STUN);
5825 if (p_ptr->redraw & (PR_HUNGER))
5827 p_ptr->redraw &= ~(PR_HUNGER);
5831 if (p_ptr->redraw & (PR_STATE))
5833 p_ptr->redraw &= ~(PR_STATE);
5837 if (p_ptr->redraw & (PR_SPEED))
5839 p_ptr->redraw &= ~(PR_SPEED);
5843 if (p_ptr->pclass == CLASS_IMITATOR)
5845 if (p_ptr->redraw & (PR_IMITATION))
5847 p_ptr->redraw &= ~(PR_IMITATION);
5851 else if (p_ptr->redraw & (PR_STUDY))
5853 p_ptr->redraw &= ~(PR_STUDY);
5859 * @brief p_ptr->window のフラグに応じた更新をまとめて行う / Handle "p_ptr->window"
5861 * @details 更新処理の対象はサブウィンドウ全般
5863 static void window_stuff(void)
5866 BIT_FLAGS mask = 0L;
5869 if (!p_ptr->window) return;
5872 for (j = 0; j < 8; j++)
5874 /* Save usable flags */
5875 if (angband_term[j]) mask |= window_flag[j];
5878 /* Apply usable flags */
5879 p_ptr->window &= mask;
5882 if (!p_ptr->window) return;
5884 /* Display inventory */
5885 if (p_ptr->window & (PW_INVEN))
5887 p_ptr->window &= ~(PW_INVEN);
5891 /* Display equipment */
5892 if (p_ptr->window & (PW_EQUIP))
5894 p_ptr->window &= ~(PW_EQUIP);
5898 /* Display spell list */
5899 if (p_ptr->window & (PW_SPELL))
5901 p_ptr->window &= ~(PW_SPELL);
5905 /* Display player */
5906 if (p_ptr->window & (PW_PLAYER))
5908 p_ptr->window &= ~(PW_PLAYER);
5912 /* Display monster list */
5913 if (p_ptr->window & (PW_MONSTER_LIST))
5915 p_ptr->window &= ~(PW_MONSTER_LIST);
5919 /* Display overhead view */
5920 if (p_ptr->window & (PW_MESSAGE))
5922 p_ptr->window &= ~(PW_MESSAGE);
5926 /* Display overhead view */
5927 if (p_ptr->window & (PW_OVERHEAD))
5929 p_ptr->window &= ~(PW_OVERHEAD);
5933 /* Display overhead view */
5934 if (p_ptr->window & (PW_DUNGEON))
5936 p_ptr->window &= ~(PW_DUNGEON);
5940 /* Display monster recall */
5941 if (p_ptr->window & (PW_MONSTER))
5943 p_ptr->window &= ~(PW_MONSTER);
5947 /* Display object recall */
5948 if (p_ptr->window & (PW_OBJECT))
5950 p_ptr->window &= ~(PW_OBJECT);
5957 * @brief 全更新処理をチェックして処理していく
5958 * Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window"
5961 void handle_stuff(void)
5963 if (p_ptr->update) update_creature(p_ptr);
5964 if (p_ptr->redraw) redraw_stuff();
5965 if (p_ptr->window) window_stuff();
5968 void update_output(void)
5970 if (p_ptr->redraw) redraw_stuff();
5971 if (p_ptr->window) window_stuff();
5975 * @brief p_ptr->update のフラグに応じた更新をまとめて行う / Handle "p_ptr->update"
5977 * @details 更新処理の対象はプレイヤーの能力修正/光源寿命/HP/MP/魔法の学習状態、他多数の外界の状態判定。
5979 void update_creature(player_type *creature_ptr)
5981 if (!creature_ptr->update) return;
5983 /* Actually do auto-destroy */
5984 if (creature_ptr->update & (PU_AUTODESTROY))
5986 creature_ptr->update &= ~(PU_AUTODESTROY);
5987 autopick_delayed_alter();
5990 /* Combine the pack */
5991 if (creature_ptr->update & (PU_COMBINE))
5993 creature_ptr->update &= ~(PU_COMBINE);
5997 /* Reorder the pack */
5998 if (creature_ptr->update & (PU_REORDER))
6000 creature_ptr->update &= ~(PU_REORDER);
6004 if (creature_ptr->update & (PU_BONUS))
6006 creature_ptr->update &= ~(PU_BONUS);
6010 if (creature_ptr->update & (PU_TORCH))
6012 creature_ptr->update &= ~(PU_TORCH);
6016 if (creature_ptr->update & (PU_HP))
6018 creature_ptr->update &= ~(PU_HP);
6022 if (creature_ptr->update & (PU_MANA))
6024 creature_ptr->update &= ~(PU_MANA);
6028 if (creature_ptr->update & (PU_SPELLS))
6030 creature_ptr->update &= ~(PU_SPELLS);
6034 /* Character is not ready yet, no screen updates */
6035 if (!character_generated) return;
6037 /* Character is in "icky" mode, no screen updates */
6038 if (character_icky) return;
6040 if (creature_ptr->update & (PU_UN_LITE))
6042 creature_ptr->update &= ~(PU_UN_LITE);
6046 if (creature_ptr->update & (PU_UN_VIEW))
6048 creature_ptr->update &= ~(PU_UN_VIEW);
6052 if (creature_ptr->update & (PU_VIEW))
6054 creature_ptr->update &= ~(PU_VIEW);
6058 if (creature_ptr->update & (PU_LITE))
6060 creature_ptr->update &= ~(PU_LITE);
6065 if (creature_ptr->update & (PU_FLOW))
6067 creature_ptr->update &= ~(PU_FLOW);
6071 if (creature_ptr->update & (PU_DISTANCE))
6073 creature_ptr->update &= ~(PU_DISTANCE);
6075 /* Still need to call update_monsters(FALSE) after update_mon_lite() */
6076 /* creature_ptr->update &= ~(PU_MONSTERS); */
6078 update_monsters(TRUE);
6081 if (creature_ptr->update & (PU_MON_LITE))
6083 creature_ptr->update &= ~(PU_MON_LITE);
6088 * Mega-Hack -- Delayed visual update
6089 * Only used if update_view(), update_lite() or update_mon_lite() was called
6091 if (creature_ptr->update & (PU_DELAY_VIS))
6093 creature_ptr->update &= ~(PU_DELAY_VIS);
6094 delayed_visual_update();
6097 if (creature_ptr->update & (PU_MONSTERS))
6099 creature_ptr->update &= ~(PU_MONSTERS);
6100 update_monsters(FALSE);
6105 * @brief プレイヤーの現在開いている手の状態を返す
6106 * @param riding_control 乗馬中により片手を必要としている状態ならばTRUEを返す。
6107 * @return 開いている手のビットフラグ
6109 BIT_FLAGS16 empty_hands(bool riding_control)
6111 BIT_FLAGS16 status = EMPTY_HAND_NONE;
6113 if (!inventory[INVEN_RARM].k_idx) status |= EMPTY_HAND_RARM;
6114 if (!inventory[INVEN_LARM].k_idx) status |= EMPTY_HAND_LARM;
6116 if (riding_control && (status != EMPTY_HAND_NONE) && p_ptr->riding && !(p_ptr->pet_extra_flags & PF_RYOUTE))
6118 if (status & EMPTY_HAND_LARM) status &= ~(EMPTY_HAND_LARM);
6119 else if (status & EMPTY_HAND_RARM) status &= ~(EMPTY_HAND_RARM);
6127 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
6128 * @return ペナルティが適用されるならばTRUE。
6130 bool heavy_armor(void)
6132 WEIGHT monk_arm_wgt = 0;
6134 if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE;
6136 /* Weight the armor */
6137 if(inventory[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_RARM].weight;
6138 if(inventory[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += inventory[INVEN_LARM].weight;
6139 monk_arm_wgt += inventory[INVEN_BODY].weight;
6140 monk_arm_wgt += inventory[INVEN_HEAD].weight;
6141 monk_arm_wgt += inventory[INVEN_OUTER].weight;
6142 monk_arm_wgt += inventory[INVEN_HANDS].weight;
6143 monk_arm_wgt += inventory[INVEN_FEET].weight;
6145 return (monk_arm_wgt > (100 + (p_ptr->lev * 4)));
6149 * @brief 実ゲームプレイ時間を更新する
6151 void update_playtime(void)
6153 /* Check if the game has started */
6154 if (start_time != 0)
6156 u32b tmp = (u32b)time(NULL);
6157 playtime += (tmp - start_time);