変愚蛮怒のメインリポジトリです
修订版 | c00ecf37b219c5093ad562edcdf90712bcf3539e (tree) |
---|---|
时间 | 2020-02-01 22:18:02 |
作者 | Hourier <hourier@user...> |
Commiter | Hourier |
[Refactor] #37353 spells3.c において、1行ごとに挟まれていたコメントを削除 / Removed many comments per 1 line in spells3.c
@@ -98,14 +98,10 @@ bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT | ||
98 | 98 | while (look) |
99 | 99 | { |
100 | 100 | tries++; |
101 | - | |
102 | - /* Verify max distance */ | |
103 | 101 | if (dis > 200) dis = 200; |
104 | 102 | |
105 | - /* Try several locations */ | |
106 | 103 | for (int i = 0; i < 500; i++) |
107 | 104 | { |
108 | - /* Pick a (possibly illegal) location */ | |
109 | 105 | while (TRUE) |
110 | 106 | { |
111 | 107 | ny = rand_spread(oy, dis); |
@@ -114,12 +110,8 @@ bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT | ||
114 | 110 | if ((d >= min) && (d <= dis)) break; |
115 | 111 | } |
116 | 112 | |
117 | - /* Ignore illegal locations */ | |
118 | 113 | if (!in_bounds(caster_ptr->current_floor_ptr, ny, nx)) continue; |
119 | - | |
120 | 114 | if (!cave_monster_teleportable_bold(caster_ptr, m_idx, ny, nx, mode)) continue; |
121 | - | |
122 | - /* No teleporting into vaults and such */ | |
123 | 115 | if (!(caster_ptr->current_floor_ptr->inside_quest || caster_ptr->current_floor_ptr->inside_arena)) |
124 | 116 | if (caster_ptr->current_floor_ptr->grid_array[ny][nx].info & CAVE_ICKY) continue; |
125 | 117 |
@@ -127,28 +119,19 @@ bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT | ||
127 | 119 | break; |
128 | 120 | } |
129 | 121 | |
130 | - /* Increase the maximum distance */ | |
131 | 122 | dis = dis * 2; |
132 | - | |
133 | 123 | min = min / 2; |
134 | 124 | if (tries > MAX_TRIES) return FALSE; |
135 | 125 | } |
136 | 126 | |
137 | 127 | sound(SOUND_TPOTHER); |
138 | - | |
139 | - /* Update the old location */ | |
140 | 128 | caster_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0; |
141 | - | |
142 | - /* Update the new location */ | |
143 | 129 | caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; |
144 | 130 | |
145 | - /* Move the monster */ | |
146 | 131 | m_ptr->fy = ny; |
147 | 132 | m_ptr->fx = nx; |
148 | 133 | |
149 | - /* Forget the counter target */ | |
150 | 134 | reset_target(m_ptr); |
151 | - | |
152 | 135 | update_monster(caster_ptr, m_idx, TRUE); |
153 | 136 | lite_spot(caster_ptr, oy, ox); |
154 | 137 | lite_spot(caster_ptr, ny, nx); |
@@ -175,8 +158,6 @@ void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty | ||
175 | 158 | { |
176 | 159 | monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx]; |
177 | 160 | if(!m_ptr->r_idx) return; |
178 | - | |
179 | - /* "Skill" test */ | |
180 | 161 | if(randint1(100) > power) return; |
181 | 162 | |
182 | 163 | POSITION ny = m_ptr->fy; |
@@ -190,13 +171,10 @@ void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty | ||
190 | 171 | bool look = TRUE; |
191 | 172 | while (look && --attempts) |
192 | 173 | { |
193 | - /* Verify max distance */ | |
194 | 174 | if (dis > 200) dis = 200; |
195 | 175 | |
196 | - /* Try several locations */ | |
197 | 176 | for (int i = 0; i < 500; i++) |
198 | 177 | { |
199 | - /* Pick a (possibly illegal) location */ | |
200 | 178 | while (TRUE) |
201 | 179 | { |
202 | 180 | ny = rand_spread(ty, dis); |
@@ -205,33 +183,23 @@ void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty | ||
205 | 183 | if ((d >= min) && (d <= dis)) break; |
206 | 184 | } |
207 | 185 | |
208 | - /* Ignore illegal locations */ | |
209 | 186 | if (!in_bounds(caster_ptr->current_floor_ptr, ny, nx)) continue; |
210 | - | |
211 | 187 | if (!cave_monster_teleportable_bold(caster_ptr, m_idx, ny, nx, mode)) continue; |
212 | 188 | |
213 | 189 | look = FALSE; |
214 | 190 | break; |
215 | 191 | } |
216 | 192 | |
217 | - /* Increase the maximum distance */ | |
218 | 193 | dis = dis * 2; |
219 | - | |
220 | - /* Decrease the minimum distance */ | |
221 | 194 | min = min / 2; |
222 | 195 | } |
223 | 196 | |
224 | 197 | if (attempts < 1) return; |
225 | 198 | |
226 | 199 | sound(SOUND_TPOTHER); |
227 | - | |
228 | - /* Update the old location */ | |
229 | 200 | caster_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0; |
230 | - | |
231 | - /* Update the new location */ | |
232 | 201 | caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; |
233 | 202 | |
234 | - /* Move the monster */ | |
235 | 203 | m_ptr->fy = ny; |
236 | 204 | m_ptr->fx = nx; |
237 | 205 |
@@ -280,10 +248,8 @@ bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode | ||
280 | 248 | for (int i = 0; i <= MAX_TELEPORT_DISTANCE; i++) |
281 | 249 | candidates_at[i] = 0; |
282 | 250 | |
283 | - /* Limit the distance */ | |
284 | 251 | if (dis > MAX_TELEPORT_DISTANCE) dis = MAX_TELEPORT_DISTANCE; |
285 | 252 | |
286 | - /* Search valid locations */ | |
287 | 253 | int left = MAX(1, creature_ptr->x - dis); |
288 | 254 | int right = MIN(creature_ptr->current_floor_ptr->width - 2, creature_ptr->x + dis); |
289 | 255 | int top = MAX(1, creature_ptr->y - dis); |
@@ -293,38 +259,26 @@ bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode | ||
293 | 259 | { |
294 | 260 | for (POSITION x = left; x <= right; x++) |
295 | 261 | { |
296 | - /* Skip illegal locations */ | |
297 | 262 | if (!cave_player_teleportable_bold(creature_ptr, y, x, mode)) continue; |
298 | 263 | |
299 | - /* Calculate distance */ | |
300 | 264 | int d = distance(creature_ptr->y, creature_ptr->x, y, x); |
301 | - | |
302 | - /* Skip too far locations */ | |
303 | 265 | if (d > dis) continue; |
304 | 266 | |
305 | - /* Count the total number of candidates */ | |
306 | 267 | total_candidates++; |
307 | - | |
308 | - /* Count the number of candidates in this circumference */ | |
309 | 268 | candidates_at[d]++; |
310 | 269 | } |
311 | 270 | } |
312 | 271 | |
313 | - /* No valid location! */ | |
314 | 272 | if (0 == total_candidates) return FALSE; |
315 | 273 | |
316 | - /* Fix the minimum distance */ | |
317 | 274 | int cur_candidates; |
318 | 275 | int min = dis; |
319 | 276 | for (cur_candidates = 0; min >= 0; min--) |
320 | 277 | { |
321 | 278 | cur_candidates += candidates_at[min]; |
322 | - | |
323 | - /* 50% of all candidates will have an equal chance to be choosen. */ | |
324 | 279 | if (cur_candidates && (cur_candidates >= total_candidates / 2)) break; |
325 | 280 | } |
326 | 281 | |
327 | - /* Pick up a single location randomly */ | |
328 | 282 | int pick = randint1(cur_candidates); |
329 | 283 | |
330 | 284 | /* Search again the choosen location */ |
@@ -333,40 +287,31 @@ bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode | ||
333 | 287 | { |
334 | 288 | for (xx = left; xx <= right; xx++) |
335 | 289 | { |
336 | - /* Skip illegal locations */ | |
337 | 290 | if (!cave_player_teleportable_bold(creature_ptr, yy, xx, mode)) continue; |
338 | 291 | |
339 | - /* Calculate distance */ | |
340 | 292 | int d = distance(creature_ptr->y, creature_ptr->x, yy, xx); |
341 | - | |
342 | - /* Skip too far locations */ | |
343 | 293 | if (d > dis) continue; |
344 | - | |
345 | - /* Skip too close locations */ | |
346 | 294 | if (d < min) continue; |
347 | 295 | |
348 | - /* This grid was picked up? */ | |
349 | 296 | pick--; |
350 | 297 | if (!pick) break; |
351 | 298 | } |
352 | 299 | |
353 | - /* Exit the loop */ | |
354 | 300 | if (!pick) break; |
355 | 301 | } |
356 | 302 | |
357 | 303 | if (player_bold(creature_ptr, yy, xx)) return FALSE; |
358 | 304 | |
359 | 305 | sound(SOUND_TELEPORT); |
360 | - | |
361 | 306 | #ifdef JP |
362 | 307 | if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON)) |
363 | 308 | msg_format("『こっちだぁ、%s』", creature_ptr->name); |
364 | 309 | #endif |
365 | - | |
366 | 310 | (void)move_player_effect(creature_ptr, yy, xx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP); |
367 | 311 | return TRUE; |
368 | 312 | } |
369 | 313 | |
314 | + | |
370 | 315 | /*! |
371 | 316 | * @brief プレイヤーのテレポート処理メインルーチン |
372 | 317 | * @param creature_ptr プレーヤーへの参照ポインタ |
@@ -475,7 +420,6 @@ void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT | ||
475 | 420 | POSITION dis = 0, ctr = 0; |
476 | 421 | while (TRUE) |
477 | 422 | { |
478 | - /* Pick a nearby legal location */ | |
479 | 423 | while (TRUE) |
480 | 424 | { |
481 | 425 | y = (POSITION)rand_spread(ny, dis); |
@@ -483,13 +427,14 @@ void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT | ||
483 | 427 | if (in_bounds(creature_ptr->current_floor_ptr, y, x)) break; |
484 | 428 | } |
485 | 429 | |
486 | - /* Accept any grid when wizard mode */ | |
487 | - if (current_world_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx || (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx == creature_ptr->riding))) break; | |
430 | + bool is_anywhere = current_world_ptr->wizard; | |
431 | + is_anywhere &= !(mode & TELEPORT_PASSIVE); | |
432 | + is_anywhere &= (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0) || | |
433 | + creature_ptr->current_floor_ptr->grid_array[y][x].m_idx == creature_ptr->riding; | |
434 | + if (is_anywhere) break; | |
488 | 435 | |
489 | - /* Accept teleportable floor grids */ | |
490 | 436 | if (cave_player_teleportable_bold(creature_ptr, y, x, mode)) break; |
491 | 437 | |
492 | - /* Occasionally advance the distance */ | |
493 | 438 | if (++ctr > (4 * dis * dis + 4 * dis + 1)) |
494 | 439 | { |
495 | 440 | ctr = 0; |
@@ -601,34 +546,29 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx) | ||
601 | 546 | { |
602 | 547 | GAME_TEXT m_name[160]; |
603 | 548 | bool see_m = TRUE; |
604 | - if (m_idx <= 0) /* To player */ | |
549 | + if (m_idx <= 0) | |
605 | 550 | { |
606 | 551 | strcpy(m_name, _("あなた", "you")); |
607 | 552 | } |
608 | - else /* To monster */ | |
553 | + else | |
609 | 554 | { |
610 | 555 | monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx]; |
611 | - | |
612 | - /* Get the monster name (or "it") */ | |
613 | 556 | monster_desc(creature_ptr, m_name, m_ptr, 0); |
614 | - | |
615 | 557 | see_m = is_seen(m_ptr); |
616 | 558 | } |
617 | 559 | |
618 | - /* No effect in some case */ | |
619 | 560 | if (is_teleport_level_ineffective(creature_ptr, m_idx)) |
620 | 561 | { |
621 | 562 | if (see_m) msg_print(_("効果がなかった。", "There is no effect.")); |
622 | 563 | return; |
623 | 564 | } |
624 | 565 | |
625 | - if ((m_idx <= 0) && creature_ptr->anti_tele) /* To player */ | |
566 | + if ((m_idx <= 0) && creature_ptr->anti_tele) | |
626 | 567 | { |
627 | 568 | msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!")); |
628 | 569 | return; |
629 | 570 | } |
630 | 571 | |
631 | - /* Choose up or down */ | |
632 | 572 | bool go_up; |
633 | 573 | if (randint0(100) < 50) go_up = TRUE; |
634 | 574 | else go_up = FALSE; |
@@ -639,7 +579,6 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx) | ||
639 | 579 | else if (get_check("Force to go down? ")) go_up = FALSE; |
640 | 580 | } |
641 | 581 | |
642 | - /* Down only */ | |
643 | 582 | if ((ironman_downward && (m_idx <= 0)) || (creature_ptr->current_floor_ptr->dun_level <= d_info[creature_ptr->dungeon_idx].mindepth)) |
644 | 583 | { |
645 | 584 | #ifdef JP |
@@ -647,7 +586,7 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx) | ||
647 | 586 | #else |
648 | 587 | if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s"); |
649 | 588 | #endif |
650 | - if (m_idx <= 0) /* To player */ | |
589 | + if (m_idx <= 0) | |
651 | 590 | { |
652 | 591 | if (!creature_ptr->current_floor_ptr->dun_level) |
653 | 592 | { |
@@ -673,8 +612,6 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx) | ||
673 | 612 | creature_ptr->leaving = TRUE; |
674 | 613 | } |
675 | 614 | } |
676 | - | |
677 | - /* Up only */ | |
678 | 615 | else if (quest_number(creature_ptr, creature_ptr->current_floor_ptr->dun_level) || (creature_ptr->current_floor_ptr->dun_level >= d_info[creature_ptr->dungeon_idx].maxdepth)) |
679 | 616 | { |
680 | 617 | #ifdef JP |
@@ -683,8 +620,7 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx) | ||
683 | 620 | if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s"); |
684 | 621 | #endif |
685 | 622 | |
686 | - | |
687 | - if (m_idx <= 0) /* To player */ | |
623 | + if (m_idx <= 0) | |
688 | 624 | { |
689 | 625 | if (record_stair) exe_write_diary(creature_ptr, DIARY_TELEPORT_LEVEL, -1, NULL); |
690 | 626 |
@@ -705,8 +641,7 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx) | ||
705 | 641 | if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s"); |
706 | 642 | #endif |
707 | 643 | |
708 | - | |
709 | - if (m_idx <= 0) /* To player */ | |
644 | + if (m_idx <= 0) | |
710 | 645 | { |
711 | 646 | if (record_stair) exe_write_diary(creature_ptr, DIARY_TELEPORT_LEVEL, -1, NULL); |
712 | 647 |
@@ -724,10 +659,8 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx) | ||
724 | 659 | if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s"); |
725 | 660 | #endif |
726 | 661 | |
727 | - if (m_idx <= 0) /* To player */ | |
662 | + if (m_idx <= 0) | |
728 | 663 | { |
729 | - /* Never reach this code on the surface */ | |
730 | - /* if (!creature_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = creature_ptr->recall_dungeon; */ | |
731 | 664 | if (record_stair) exe_write_diary(creature_ptr, DIARY_TELEPORT_LEVEL, 1, NULL); |
732 | 665 | if (autosave_l) do_cmd_save_game(creature_ptr, TRUE); |
733 | 666 |
@@ -736,7 +669,6 @@ void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx) | ||
736 | 669 | } |
737 | 670 | } |
738 | 671 | |
739 | - /* Monster level teleportation is simple deleting now */ | |
740 | 672 | if (m_idx <= 0) |
741 | 673 | { |
742 | 674 | sound(SOUND_TPLEVEL); |
@@ -771,8 +703,6 @@ bool recall_player(player_type *creature_ptr, TIME_EFFECT turns) | ||
771 | 703 | * TODO: Recall the player to the last |
772 | 704 | * visited town when in the wilderness |
773 | 705 | */ |
774 | - | |
775 | - /* Ironman option */ | |
776 | 706 | if (creature_ptr->current_floor_ptr->inside_arena || ironman_downward) |
777 | 707 | { |
778 | 708 | msg_print(_("何も起こらなかった。", "Nothing happens.")); |
@@ -820,12 +750,9 @@ bool recall_player(player_type *creature_ptr, TIME_EFFECT turns) | ||
820 | 750 | bool free_level_recall(player_type *creature_ptr) |
821 | 751 | { |
822 | 752 | DUNGEON_IDX select_dungeon = choose_dungeon(_("にテレポート", "teleport"), 4, 0); |
823 | - | |
824 | 753 | if (!select_dungeon) return FALSE; |
825 | 754 | |
826 | 755 | DEPTH max_depth = d_info[select_dungeon].maxdepth; |
827 | - | |
828 | - /* Limit depth in Angband */ | |
829 | 756 | if (select_dungeon == DUNGEON_ANGBAND) |
830 | 757 | { |
831 | 758 | if (quest[QUEST_OBERON].status != QUEST_STATUS_FINISHED) max_depth = 98; |
@@ -834,7 +761,6 @@ bool free_level_recall(player_type *creature_ptr) | ||
834 | 761 | |
835 | 762 | QUANTITY amt = get_quantity(format(_("%sの何階にテレポートしますか?", "Teleport to which level of %s? "), |
836 | 763 | d_name + d_info[select_dungeon].name), (QUANTITY)max_depth); |
837 | - | |
838 | 764 | if (amt <= 0) |
839 | 765 | { |
840 | 766 | return FALSE; |
@@ -865,8 +791,6 @@ bool reset_recall(player_type *caster_ptr) | ||
865 | 791 | char tmp_val[160]; |
866 | 792 | |
867 | 793 | select_dungeon = choose_dungeon(_("をセット", "reset"), 2, 14); |
868 | - | |
869 | - /* Ironman option */ | |
870 | 794 | if (ironman_downward) |
871 | 795 | { |
872 | 796 | msg_print(_("何も起こらなかった。", "Nothing happens.")); |
@@ -874,20 +798,15 @@ bool reset_recall(player_type *caster_ptr) | ||
874 | 798 | } |
875 | 799 | |
876 | 800 | if (!select_dungeon) return FALSE; |
877 | - /* Prompt */ | |
878 | 801 | sprintf(ppp, _("何階にセットしますか (%d-%d):", "Reset to which level (%d-%d): "), |
879 | 802 | (int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]); |
880 | - | |
881 | - /* Default */ | |
882 | 803 | sprintf(tmp_val, "%d", (int)MAX(caster_ptr->current_floor_ptr->dun_level, 1)); |
883 | 804 | |
884 | - /* Ask for a level */ | |
885 | 805 | if (!get_string(ppp, tmp_val, 10)) |
886 | 806 | { |
887 | 807 | return FALSE; |
888 | 808 | } |
889 | 809 | |
890 | - /* Extract request */ | |
891 | 810 | dummy = atoi(tmp_val); |
892 | 811 | if (dummy < 1) dummy = 1; |
893 | 812 | if (dummy > max_dlv[select_dungeon]) dummy = max_dlv[select_dungeon]; |
@@ -897,7 +816,6 @@ bool reset_recall(player_type *caster_ptr) | ||
897 | 816 | |
898 | 817 | if (record_maxdepth) |
899 | 818 | exe_write_diary(caster_ptr, DIARY_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall")); |
900 | - /* Accept request */ | |
901 | 819 | #ifdef JP |
902 | 820 | msg_format("%sの帰還レベルを %d 階にセット。", d_name + d_info[select_dungeon].name, dummy, dummy * 50); |
903 | 821 | #else |
@@ -932,15 +850,11 @@ bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode) | ||
932 | 850 | |
933 | 851 | object_type *o_ptr; |
934 | 852 | o_ptr = &target_ptr->inventory_list[t]; |
935 | - | |
936 | - /* No item, nothing happens */ | |
937 | 853 | if (!o_ptr->k_idx) return FALSE; |
938 | 854 | |
939 | - /* Disenchant equipments only -- No disenchant on monster ball */ | |
940 | 855 | if (!object_is_weapon_armour_ammo(o_ptr)) |
941 | 856 | return FALSE; |
942 | 857 | |
943 | - /* Nothing to disenchant */ | |
944 | 858 | if ((o_ptr->to_h <= 0) && (o_ptr->to_d <= 0) && (o_ptr->to_a <= 0) && (o_ptr->pval <= 1)) |
945 | 859 | { |
946 | 860 | return FALSE; |
@@ -948,8 +862,6 @@ bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode) | ||
948 | 862 | |
949 | 863 | GAME_TEXT o_name[MAX_NLEN]; |
950 | 864 | object_desc(target_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); |
951 | - | |
952 | - /* Artifacts have 71% chance to resist */ | |
953 | 865 | if (object_is_artifact(o_ptr) && (randint0(100) < 71)) |
954 | 866 | { |
955 | 867 | #ifdef JP |
@@ -961,26 +873,20 @@ bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode) | ||
961 | 873 | return TRUE; |
962 | 874 | } |
963 | 875 | |
964 | - /* Memorize old value */ | |
965 | 876 | int to_h = o_ptr->to_h; |
966 | 877 | int to_d = o_ptr->to_d; |
967 | 878 | int to_a = o_ptr->to_a; |
968 | 879 | int pval = o_ptr->pval; |
969 | 880 | |
970 | - /* Disenchant tohit */ | |
971 | 881 | if (o_ptr->to_h > 0) o_ptr->to_h--; |
972 | 882 | if ((o_ptr->to_h > 5) && (randint0(100) < 20)) o_ptr->to_h--; |
973 | 883 | |
974 | - /* Disenchant todam */ | |
975 | 884 | if (o_ptr->to_d > 0) o_ptr->to_d--; |
976 | 885 | if ((o_ptr->to_d > 5) && (randint0(100) < 20)) o_ptr->to_d--; |
977 | 886 | |
978 | - /* Disenchant toac */ | |
979 | 887 | if (o_ptr->to_a > 0) o_ptr->to_a--; |
980 | 888 | if ((o_ptr->to_a > 5) && (randint0(100) < 20)) o_ptr->to_a--; |
981 | 889 | |
982 | - /* Disenchant pval (occasionally) */ | |
983 | - /* Unless called from wild_magic() */ | |
984 | 890 | if ((o_ptr->pval > 1) && one_in_(13) && !(mode & 0x01)) o_ptr->pval--; |
985 | 891 | |
986 | 892 | bool is_actually_disenchanted = to_h != o_ptr->to_h; |
@@ -995,7 +901,6 @@ bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode) | ||
995 | 901 | msg_format("Your %s (%c) %s disenchanted!", o_name, index_to_label(t), |
996 | 902 | ((o_ptr->number != 1) ? "were" : "was")); |
997 | 903 | #endif |
998 | - | |
999 | 904 | chg_virtue(target_ptr, V_HARMONY, 1); |
1000 | 905 | chg_virtue(target_ptr, V_ENCHANT, -2); |
1001 | 906 | target_ptr->update |= (PU_BONUS); |
@@ -1019,7 +924,6 @@ bool vanish_dungeon(player_type *caster_ptr) | ||
1019 | 924 | is_special_floor |= !caster_ptr->current_floor_ptr->dun_level; |
1020 | 925 | if (is_special_floor) return FALSE; |
1021 | 926 | |
1022 | - /* Scan all normal grids */ | |
1023 | 927 | grid_type *g_ptr; |
1024 | 928 | feature_type *f_ptr; |
1025 | 929 | monster_type *m_ptr; |
@@ -1030,20 +934,12 @@ bool vanish_dungeon(player_type *caster_ptr) | ||
1030 | 934 | { |
1031 | 935 | g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x]; |
1032 | 936 | |
1033 | - /* Seeing true feature code (ignore mimic) */ | |
1034 | 937 | f_ptr = &f_info[g_ptr->feat]; |
1035 | - | |
1036 | - /* Lose room and vault */ | |
1037 | 938 | g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); |
1038 | - | |
1039 | 939 | m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; |
1040 | - | |
1041 | - /* Awake monster */ | |
1042 | 940 | if (g_ptr->m_idx && MON_CSLEEP(m_ptr)) |
1043 | 941 | { |
1044 | 942 | (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0); |
1045 | - | |
1046 | - /* Notice the "waking up" */ | |
1047 | 943 | if (m_ptr->ml) |
1048 | 944 | { |
1049 | 945 | monster_desc(caster_ptr, m_name, m_ptr, 0); |
@@ -1051,41 +947,29 @@ bool vanish_dungeon(player_type *caster_ptr) | ||
1051 | 947 | } |
1052 | 948 | } |
1053 | 949 | |
1054 | - /* Process all walls, doors and patterns */ | |
1055 | 950 | if (have_flag(f_ptr->flags, FF_HURT_DISI)) cave_alter_feat(caster_ptr, y, x, FF_HURT_DISI); |
1056 | 951 | } |
1057 | 952 | } |
1058 | 953 | |
1059 | - /* Special boundary walls -- Top and bottom */ | |
1060 | 954 | for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++) |
1061 | 955 | { |
1062 | 956 | g_ptr = &caster_ptr->current_floor_ptr->grid_array[0][x]; |
1063 | 957 | f_ptr = &f_info[g_ptr->mimic]; |
1064 | - | |
1065 | - /* Lose room and vault */ | |
1066 | 958 | g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); |
1067 | 959 | |
1068 | - /* Set boundary mimic if needed */ | |
1069 | 960 | if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) |
1070 | 961 | { |
1071 | 962 | g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); |
1072 | - | |
1073 | - /* Check for change to boring grid */ | |
1074 | 963 | if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); |
1075 | 964 | } |
1076 | 965 | |
1077 | 966 | g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->current_floor_ptr->height - 1][x]; |
1078 | 967 | f_ptr = &f_info[g_ptr->mimic]; |
1079 | - | |
1080 | - /* Lose room and vault */ | |
1081 | 968 | g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); |
1082 | 969 | |
1083 | - /* Set boundary mimic if needed */ | |
1084 | 970 | if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) |
1085 | 971 | { |
1086 | 972 | g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); |
1087 | - | |
1088 | - /* Check for change to boring grid */ | |
1089 | 973 | if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); |
1090 | 974 | } |
1091 | 975 | } |
@@ -1095,43 +979,32 @@ bool vanish_dungeon(player_type *caster_ptr) | ||
1095 | 979 | { |
1096 | 980 | g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][0]; |
1097 | 981 | f_ptr = &f_info[g_ptr->mimic]; |
1098 | - | |
1099 | - /* Lose room and vault */ | |
1100 | 982 | g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); |
1101 | 983 | |
1102 | - /* Set boundary mimic if needed */ | |
1103 | 984 | if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) |
1104 | 985 | { |
1105 | 986 | g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); |
1106 | - | |
1107 | - /* Check for change to boring grid */ | |
1108 | 987 | if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); |
1109 | 988 | } |
1110 | 989 | |
1111 | 990 | g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][caster_ptr->current_floor_ptr->width - 1]; |
1112 | 991 | f_ptr = &f_info[g_ptr->mimic]; |
1113 | - | |
1114 | - /* Lose room and vault */ | |
1115 | 992 | g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); |
1116 | 993 | |
1117 | - /* Set boundary mimic if needed */ | |
1118 | 994 | if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) |
1119 | 995 | { |
1120 | 996 | g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); |
1121 | - | |
1122 | - /* Check for change to boring grid */ | |
1123 | 997 | if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK); |
1124 | 998 | } |
1125 | 999 | } |
1126 | 1000 | |
1127 | - /* Mega-Hack -- Forget the view and lite */ | |
1128 | 1001 | caster_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS); |
1129 | 1002 | caster_ptr->redraw |= (PR_MAP); |
1130 | 1003 | caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); |
1131 | - | |
1132 | 1004 | return TRUE; |
1133 | 1005 | } |
1134 | 1006 | |
1007 | + | |
1135 | 1008 | /*! |
1136 | 1009 | * @brief 虚無招来処理 / |
1137 | 1010 | * @param caster_ptr プレーヤーへの参照ポインタ |
@@ -1178,7 +1051,6 @@ void call_the_void(player_type *caster_ptr) | ||
1178 | 1051 | return; |
1179 | 1052 | } |
1180 | 1053 | |
1181 | - /* Prevent destruction of quest levels and town */ | |
1182 | 1054 | bool is_special_fllor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest); |
1183 | 1055 | is_special_fllor |= !caster_ptr->current_floor_ptr->dun_level; |
1184 | 1056 | if (is_special_fllor) |
@@ -1227,7 +1099,6 @@ void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los) | ||
1227 | 1099 | object_type *o_ptr; |
1228 | 1100 | GAME_TEXT o_name[MAX_NLEN]; |
1229 | 1101 | |
1230 | - /* Check to see if an object is already there */ | |
1231 | 1102 | if (caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].o_idx) |
1232 | 1103 | { |
1233 | 1104 | msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something.")); |
@@ -1247,22 +1118,18 @@ void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los) | ||
1247 | 1118 | } |
1248 | 1119 | |
1249 | 1120 | g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx]; |
1250 | - | |
1251 | - /* We need an item to fetch */ | |
1252 | 1121 | if (!g_ptr->o_idx) |
1253 | 1122 | { |
1254 | 1123 | msg_print(_("そこには何もありません。", "There is no object at this place.")); |
1255 | 1124 | return; |
1256 | 1125 | } |
1257 | 1126 | |
1258 | - /* No fetching from vault */ | |
1259 | 1127 | if (g_ptr->info & CAVE_ICKY) |
1260 | 1128 | { |
1261 | 1129 | msg_print(_("アイテムがコントロールを外れて落ちた。", "The item slips from your control.")); |
1262 | 1130 | return; |
1263 | 1131 | } |
1264 | 1132 | |
1265 | - /* We need to see the item */ | |
1266 | 1133 | if (require_los) |
1267 | 1134 | { |
1268 | 1135 | if (!player_has_los_bold(caster_ptr, ty, tx)) |
@@ -1296,10 +1163,8 @@ void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los) | ||
1296 | 1163 | } |
1297 | 1164 | |
1298 | 1165 | o_ptr = &caster_ptr->current_floor_ptr->o_list[g_ptr->o_idx]; |
1299 | - | |
1300 | 1166 | if (o_ptr->weight > wgt) |
1301 | 1167 | { |
1302 | - /* Too heavy to 'fetch' */ | |
1303 | 1168 | msg_print(_("そのアイテムは重過ぎます。", "The object is too heavy.")); |
1304 | 1169 | return; |
1305 | 1170 | } |
@@ -1327,7 +1192,6 @@ void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los) | ||
1327 | 1192 | */ |
1328 | 1193 | void reserve_alter_reality(player_type *caster_ptr) |
1329 | 1194 | { |
1330 | - /* Ironman option */ | |
1331 | 1195 | if (caster_ptr->current_floor_ptr->inside_arena || ironman_downward) |
1332 | 1196 | { |
1333 | 1197 | msg_print(_("何も起こらなかった。", "Nothing happens.")); |
@@ -1358,17 +1222,12 @@ void reserve_alter_reality(player_type *caster_ptr) | ||
1358 | 1222 | */ |
1359 | 1223 | void identify_pack(player_type *target_ptr) |
1360 | 1224 | { |
1361 | - INVENTORY_IDX i; | |
1362 | - | |
1363 | - /* Simply identify and know every item */ | |
1364 | - for (i = 0; i < INVEN_TOTAL; i++) | |
1225 | + for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) | |
1365 | 1226 | { |
1366 | 1227 | object_type *o_ptr = &target_ptr->inventory_list[i]; |
1367 | 1228 | if (!o_ptr->k_idx) continue; |
1368 | 1229 | |
1369 | 1230 | identify_item(target_ptr, o_ptr); |
1370 | - | |
1371 | - /* Auto-inscription */ | |
1372 | 1231 | autopick_alter_item(target_ptr, i, FALSE); |
1373 | 1232 | } |
1374 | 1233 | } |
@@ -1397,14 +1256,8 @@ static int remove_curse_aux(player_type *creature_ptr, int all) | ||
1397 | 1256 | { |
1398 | 1257 | object_type *o_ptr = &creature_ptr->inventory_list[i]; |
1399 | 1258 | if (!o_ptr->k_idx) continue; |
1400 | - | |
1401 | - /* Uncursed already */ | |
1402 | 1259 | if (!object_is_cursed(o_ptr)) continue; |
1403 | - | |
1404 | - /* Heavily Cursed Items need a special spell */ | |
1405 | 1260 | if (!all && (o_ptr->curse_flags & TRC_HEAVY_CURSE)) continue; |
1406 | - | |
1407 | - /* Perma-Cursed Items can NEVER be uncursed */ | |
1408 | 1261 | if (o_ptr->curse_flags & TRC_PERMA_CURSE) |
1409 | 1262 | { |
1410 | 1263 | o_ptr->curse_flags &= (TRC_CURSED | TRC_HEAVY_CURSE | TRC_PERMA_CURSE); |
@@ -1417,15 +1270,11 @@ static int remove_curse_aux(player_type *creature_ptr, int all) | ||
1417 | 1270 | |
1418 | 1271 | creature_ptr->update |= (PU_BONUS); |
1419 | 1272 | creature_ptr->window |= (PW_EQUIP); |
1420 | - | |
1421 | - /* Count the uncursings */ | |
1422 | 1273 | cnt++; |
1423 | 1274 | } |
1424 | 1275 | |
1425 | 1276 | if (cnt) |
1426 | - { | |
1427 | 1277 | msg_print(_("誰かに見守られているような気がする。", "You feel as if someone is watching over you.")); |
1428 | - } | |
1429 | 1278 | |
1430 | 1279 | return cnt; |
1431 | 1280 | } |
@@ -1472,13 +1321,10 @@ bool alchemy(player_type *caster_ptr) | ||
1472 | 1321 | o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0); |
1473 | 1322 | if (!o_ptr) return FALSE; |
1474 | 1323 | |
1475 | - /* See how many items */ | |
1476 | 1324 | int amt = 1; |
1477 | 1325 | if (o_ptr->number > 1) |
1478 | 1326 | { |
1479 | 1327 | amt = get_quantity(NULL, o_ptr->number); |
1480 | - | |
1481 | - /* Allow user abort */ | |
1482 | 1328 | if (amt <= 0) return FALSE; |
1483 | 1329 | } |
1484 | 1330 |
@@ -1488,19 +1334,16 @@ bool alchemy(player_type *caster_ptr) | ||
1488 | 1334 | object_desc(caster_ptr, o_name, o_ptr, 0); |
1489 | 1335 | o_ptr->number = old_number; |
1490 | 1336 | |
1491 | - /* Verify unless quantity given */ | |
1492 | 1337 | if (!force) |
1493 | 1338 | { |
1494 | 1339 | if (confirm_destroy || (object_value(o_ptr) > 0)) |
1495 | 1340 | { |
1496 | - /* Make a verification */ | |
1497 | 1341 | char out_val[MAX_NLEN + 40]; |
1498 | 1342 | sprintf(out_val, _("本当に%sを金に変えますか?", "Really current_world_ptr->game_turn %s to gold? "), o_name); |
1499 | 1343 | if (!get_check(out_val)) return FALSE; |
1500 | 1344 | } |
1501 | 1345 | } |
1502 | 1346 | |
1503 | - /* Artifacts cannot be destroyed */ | |
1504 | 1347 | if (!can_player_destroy_object(o_ptr)) |
1505 | 1348 | { |
1506 | 1349 | msg_format(_("%sを金に変えることに失敗した。", "You fail to current_world_ptr->game_turn %s to gold!"), o_name); |
@@ -1541,7 +1384,6 @@ bool artifact_scroll(player_type *caster_ptr) | ||
1541 | 1384 | |
1542 | 1385 | concptr q = _("どのアイテムを強化しますか? ", "Enchant which item? "); |
1543 | 1386 | concptr s = _("強化できるアイテムがない。", "You have nothing to enchant."); |
1544 | - | |
1545 | 1387 | object_type *o_ptr; |
1546 | 1388 | OBJECT_IDX item; |
1547 | 1389 | o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); |
@@ -1565,7 +1407,6 @@ bool artifact_scroll(player_type *caster_ptr) | ||
1565 | 1407 | #endif |
1566 | 1408 | okay = FALSE; |
1567 | 1409 | } |
1568 | - | |
1569 | 1410 | else if (object_is_ego(o_ptr)) |
1570 | 1411 | { |
1571 | 1412 | #ifdef JP |
@@ -1577,7 +1418,6 @@ bool artifact_scroll(player_type *caster_ptr) | ||
1577 | 1418 | #endif |
1578 | 1419 | okay = FALSE; |
1579 | 1420 | } |
1580 | - | |
1581 | 1421 | else if (o_ptr->xtra3) |
1582 | 1422 | { |
1583 | 1423 | #ifdef JP |
@@ -1587,7 +1427,6 @@ bool artifact_scroll(player_type *caster_ptr) | ||
1587 | 1427 | ((o_ptr->number > 1) ? "customized items" : "a customized item")); |
1588 | 1428 | #endif |
1589 | 1429 | } |
1590 | - | |
1591 | 1430 | else |
1592 | 1431 | { |
1593 | 1432 | if (o_ptr->number > 1) |
@@ -1709,7 +1548,6 @@ bool ident_spell(player_type *caster_ptr, bool only_equip) | ||
1709 | 1548 | } |
1710 | 1549 | |
1711 | 1550 | concptr s = _("鑑定するべきアイテムがない。", "You have nothing to identify."); |
1712 | - | |
1713 | 1551 | OBJECT_IDX item; |
1714 | 1552 | object_type *o_ptr; |
1715 | 1553 | o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); |
@@ -1783,6 +1621,7 @@ bool mundane_spell(player_type *owner_ptr, bool only_equip) | ||
1783 | 1621 | return TRUE; |
1784 | 1622 | } |
1785 | 1623 | |
1624 | + | |
1786 | 1625 | /*! |
1787 | 1626 | * @brief アイテム*鑑定*のメインルーチン処理 / |
1788 | 1627 | * Identify an object in the inventory (or on the floor) |
@@ -1824,7 +1663,6 @@ bool identify_fully(player_type *caster_ptr, bool only_equip) | ||
1824 | 1663 | |
1825 | 1664 | bool old_known = identify_item(caster_ptr, o_ptr); |
1826 | 1665 | |
1827 | - /* Mark the item as fully known */ | |
1828 | 1666 | o_ptr->ident |= (IDENT_MENTAL); |
1829 | 1667 | handle_stuff(caster_ptr); |
1830 | 1668 |
@@ -1890,58 +1728,35 @@ bool recharge(player_type *caster_ptr, int power) | ||
1890 | 1728 | bool is_recharge_successful = TRUE; |
1891 | 1729 | if (o_ptr->tval == TV_ROD) |
1892 | 1730 | { |
1893 | - /* Extract a recharge strength by comparing object level to power. */ | |
1894 | 1731 | recharge_strength = ((power > lev / 2) ? (power - lev / 2) : 0) / 5; |
1895 | - | |
1896 | - | |
1897 | - /* Back-fire */ | |
1898 | 1732 | if (one_in_(recharge_strength)) |
1899 | 1733 | { |
1900 | - /* Activate the failure code. */ | |
1901 | 1734 | is_recharge_successful = FALSE; |
1902 | 1735 | } |
1903 | - | |
1904 | - /* Recharge */ | |
1905 | 1736 | else |
1906 | 1737 | { |
1907 | - /* Recharge amount */ | |
1908 | 1738 | recharge_amount = (power * damroll(3, 2)); |
1909 | - | |
1910 | - /* Recharge by that amount */ | |
1911 | 1739 | if (o_ptr->timeout > recharge_amount) |
1912 | 1740 | o_ptr->timeout -= recharge_amount; |
1913 | 1741 | else |
1914 | 1742 | o_ptr->timeout = 0; |
1915 | 1743 | } |
1916 | 1744 | } |
1917 | - | |
1918 | - /* Recharge wand/staff */ | |
1919 | 1745 | else |
1920 | 1746 | { |
1921 | - /* Extract a recharge strength by comparing object level to power. | |
1922 | - * Divide up a stack of wands' charges to calculate charge penalty. | |
1923 | - */ | |
1924 | 1747 | if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1)) |
1925 | 1748 | recharge_strength = (100 + power - lev - (8 * o_ptr->pval / o_ptr->number)) / 15; |
1926 | - | |
1927 | - /* All staffs, unstacked wands. */ | |
1928 | 1749 | else recharge_strength = (100 + power - lev - (8 * o_ptr->pval)) / 15; |
1750 | + | |
1929 | 1751 | if (recharge_strength < 0) recharge_strength = 0; |
1930 | 1752 | |
1931 | - /* Back-fire */ | |
1932 | 1753 | if (one_in_(recharge_strength)) |
1933 | 1754 | { |
1934 | - /* Activate the failure code. */ | |
1935 | 1755 | is_recharge_successful = FALSE; |
1936 | 1756 | } |
1937 | - | |
1938 | - /* If the spell didn't backfire, recharge the wand or staff. */ | |
1939 | 1757 | else |
1940 | 1758 | { |
1941 | - /* Recharge based on the standard number of charges. */ | |
1942 | 1759 | recharge_amount = randint1(1 + k_ptr->pval / 2); |
1943 | - | |
1944 | - /* Multiple wands in a stack increase recharging somewhat. */ | |
1945 | 1760 | if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1)) |
1946 | 1761 | { |
1947 | 1762 | recharge_amount += |
@@ -1950,23 +1765,14 @@ bool recharge(player_type *caster_ptr, int power) | ||
1950 | 1765 | if (recharge_amount > 12) recharge_amount = 12; |
1951 | 1766 | } |
1952 | 1767 | |
1953 | - /* But each staff in a stack gets fewer additional charges, | |
1954 | - * although always at least one. | |
1955 | - */ | |
1956 | 1768 | if ((o_ptr->tval == TV_STAFF) && (o_ptr->number > 1)) |
1957 | 1769 | { |
1958 | 1770 | recharge_amount /= (TIME_EFFECT)o_ptr->number; |
1959 | 1771 | if (recharge_amount < 1) recharge_amount = 1; |
1960 | 1772 | } |
1961 | 1773 | |
1962 | - /* Recharge the wand or staff. */ | |
1963 | 1774 | o_ptr->pval += recharge_amount; |
1964 | - | |
1965 | - | |
1966 | - /* Hack -- we no longer "know" the item */ | |
1967 | 1775 | o_ptr->ident &= ~(IDENT_KNOWN); |
1968 | - | |
1969 | - /* Hack -- we no longer think the item is empty */ | |
1970 | 1776 | o_ptr->ident &= ~(IDENT_EMPTY); |
1971 | 1777 | } |
1972 | 1778 | } |
@@ -1982,12 +1788,8 @@ bool recharge(player_type *caster_ptr, int power) | ||
1982 | 1788 | { |
1983 | 1789 | object_desc(caster_ptr, o_name, o_ptr, OD_NAME_ONLY); |
1984 | 1790 | msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name); |
1985 | - | |
1986 | - /* Artifact rods. */ | |
1987 | 1791 | if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout < 10000)) |
1988 | 1792 | o_ptr->timeout = (o_ptr->timeout + 100) * 2; |
1989 | - | |
1990 | - /* Artifact wands and staffs. */ | |
1991 | 1793 | else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF)) |
1992 | 1794 | o_ptr->pval = 0; |
1993 | 1795 | return update_player(caster_ptr); |
@@ -2099,17 +1901,14 @@ void display_spell_list(player_type *caster_ptr) | ||
2099 | 1901 | |
2100 | 1902 | clear_from(0); |
2101 | 1903 | |
2102 | - /* They have too many spells to list */ | |
2103 | 1904 | if (caster_ptr->pclass == CLASS_SORCERER) return; |
2104 | 1905 | if (caster_ptr->pclass == CLASS_RED_MAGE) return; |
2105 | - | |
2106 | 1906 | if (caster_ptr->pclass == CLASS_SNIPER) |
2107 | 1907 | { |
2108 | 1908 | display_snipe_list(caster_ptr); |
2109 | 1909 | return; |
2110 | 1910 | } |
2111 | 1911 | |
2112 | - /* mind.c type classes */ | |
2113 | 1912 | if ((caster_ptr->pclass == CLASS_MINDCRAFTER) || |
2114 | 1913 | (caster_ptr->pclass == CLASS_BERSERKER) || |
2115 | 1914 | (caster_ptr->pclass == CLASS_NINJA) || |
@@ -2119,16 +1918,15 @@ void display_spell_list(player_type *caster_ptr) | ||
2119 | 1918 | PERCENTAGE minfail = 0; |
2120 | 1919 | PLAYER_LEVEL plev = caster_ptr->lev; |
2121 | 1920 | PERCENTAGE chance = 0; |
2122 | - mind_type spell; | |
2123 | - char comment[80]; | |
2124 | - char psi_desc[80]; | |
2125 | - int use_mind; | |
1921 | + mind_type spell; | |
1922 | + char comment[80]; | |
1923 | + char psi_desc[80]; | |
1924 | + int use_mind; | |
2126 | 1925 | bool use_hp = FALSE; |
2127 | 1926 | |
2128 | 1927 | y = 1; |
2129 | 1928 | x = 1; |
2130 | 1929 | |
2131 | - /* Display a list of spells */ | |
2132 | 1930 | prt("", y, x); |
2133 | 1931 | put_str(_("名前", "Name"), y, x + 5); |
2134 | 1932 | put_str(_("Lv MP 失率 効果", "Lv Mana Fail Info"), y, x + 35); |
@@ -2143,28 +1941,17 @@ void display_spell_list(player_type *caster_ptr) | ||
2143 | 1941 | default: use_mind = 0;break; |
2144 | 1942 | } |
2145 | 1943 | |
2146 | - /* Dump the spells */ | |
2147 | - int i; | |
2148 | - for (i = 0; i < MAX_MIND_POWERS; i++) | |
1944 | + for (int i = 0; i < MAX_MIND_POWERS; i++) | |
2149 | 1945 | { |
2150 | 1946 | byte a = TERM_WHITE; |
2151 | - | |
2152 | - /* Access the available spell */ | |
2153 | 1947 | spell = mind_powers[use_mind].info[i]; |
2154 | 1948 | if (spell.min_lev > plev) break; |
2155 | 1949 | |
2156 | - /* Get the failure rate */ | |
2157 | 1950 | chance = spell.fail; |
2158 | - | |
2159 | - /* Reduce failure rate by "effective" level adjustment */ | |
2160 | 1951 | chance -= 3 * (caster_ptr->lev - spell.min_lev); |
2161 | - | |
2162 | - /* Reduce failure rate by INT/WIS adjustment */ | |
2163 | 1952 | chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1); |
2164 | - | |
2165 | 1953 | if (!use_hp) |
2166 | 1954 | { |
2167 | - /* Not enough mana to cast */ | |
2168 | 1955 | if (spell.mana_cost > caster_ptr->csp) |
2169 | 1956 | { |
2170 | 1957 | chance += 5 * (spell.mana_cost - caster_ptr->csp); |
@@ -2173,7 +1960,6 @@ void display_spell_list(player_type *caster_ptr) | ||
2173 | 1960 | } |
2174 | 1961 | else |
2175 | 1962 | { |
2176 | - /* Not enough hp to cast */ | |
2177 | 1963 | if (spell.mana_cost > caster_ptr->chp) |
2178 | 1964 | { |
2179 | 1965 | chance += 100; |
@@ -2181,23 +1967,15 @@ void display_spell_list(player_type *caster_ptr) | ||
2181 | 1967 | } |
2182 | 1968 | } |
2183 | 1969 | |
2184 | - /* Extract the minimum failure rate */ | |
2185 | 1970 | minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]]; |
2186 | - | |
2187 | - /* Minimum failure rate */ | |
2188 | 1971 | if (chance < minfail) chance = minfail; |
2189 | 1972 | |
2190 | - /* Stunning makes spells harder */ | |
2191 | 1973 | if (caster_ptr->stun > 50) chance += 25; |
2192 | 1974 | else if (caster_ptr->stun) chance += 15; |
2193 | 1975 | |
2194 | - /* Always a 5 percent chance of working */ | |
2195 | 1976 | if (chance > 95) chance = 95; |
2196 | 1977 | |
2197 | - /* Get info */ | |
2198 | 1978 | mindcraft_info(caster_ptr, comment, use_mind, i); |
2199 | - | |
2200 | - /* Dump the spell */ | |
2201 | 1979 | sprintf(psi_desc, " %c) %-30s%2d %4d %3d%%%s", |
2202 | 1980 | I2A(i), spell.name, |
2203 | 1981 | spell.min_lev, spell.mana_cost, chance, comment); |
@@ -2208,30 +1986,18 @@ void display_spell_list(player_type *caster_ptr) | ||
2208 | 1986 | return; |
2209 | 1987 | } |
2210 | 1988 | |
2211 | - /* Cannot read spellbooks */ | |
2212 | 1989 | if (REALM_NONE == caster_ptr->realm1) return; |
2213 | 1990 | |
2214 | - /* Normal spellcaster with books */ | |
2215 | - | |
2216 | - /* Scan books */ | |
2217 | 1991 | for (int j = 0; j < ((caster_ptr->realm2 > REALM_NONE) ? 2 : 1); j++) |
2218 | 1992 | { |
2219 | - /* Reset vertical */ | |
2220 | 1993 | m[j] = 0; |
2221 | - | |
2222 | - /* Vertical location */ | |
2223 | 1994 | y = (j < 3) ? 0 : (m[j - 3] + 2); |
2224 | - | |
2225 | - /* Horizontal location */ | |
2226 | 1995 | x = 27 * (j % 3); |
2227 | - | |
2228 | - /* Scan spells */ | |
2229 | 1996 | int n = 0; |
2230 | 1997 | for (int i = 0; i < 32; i++) |
2231 | 1998 | { |
2232 | 1999 | byte a = TERM_WHITE; |
2233 | 2000 | |
2234 | - /* Access the spell */ | |
2235 | 2001 | if (!is_magic((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2)) |
2236 | 2002 | { |
2237 | 2003 | s_ptr = &technic_info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - MIN_TECHNIC][i % 32]; |
@@ -2243,48 +2009,33 @@ void display_spell_list(player_type *caster_ptr) | ||
2243 | 2009 | |
2244 | 2010 | strcpy(name, exe_spell(caster_ptr, (j < 1) ? caster_ptr->realm1 : caster_ptr->realm2, i % 32, SPELL_NAME)); |
2245 | 2011 | |
2246 | - /* Illegible */ | |
2247 | 2012 | if (s_ptr->slevel >= 99) |
2248 | 2013 | { |
2249 | - /* Illegible */ | |
2250 | 2014 | strcpy(name, _("(判読不能)", "(illegible)")); |
2251 | - | |
2252 | - /* Unusable */ | |
2253 | 2015 | a = TERM_L_DARK; |
2254 | 2016 | } |
2255 | - | |
2256 | - /* Forgotten */ | |
2257 | 2017 | else if ((j < 1) ? |
2258 | 2018 | ((caster_ptr->spell_forgotten1 & (1L << i))) : |
2259 | 2019 | ((caster_ptr->spell_forgotten2 & (1L << (i % 32))))) |
2260 | 2020 | { |
2261 | - /* Forgotten */ | |
2262 | 2021 | a = TERM_ORANGE; |
2263 | 2022 | } |
2264 | - | |
2265 | - /* Unknown */ | |
2266 | 2023 | else if (!((j < 1) ? |
2267 | 2024 | (caster_ptr->spell_learned1 & (1L << i)) : |
2268 | 2025 | (caster_ptr->spell_learned2 & (1L << (i % 32))))) |
2269 | 2026 | { |
2270 | - /* Unknown */ | |
2271 | 2027 | a = TERM_RED; |
2272 | 2028 | } |
2273 | - | |
2274 | - /* Untried */ | |
2275 | 2029 | else if (!((j < 1) ? |
2276 | 2030 | (caster_ptr->spell_worked1 & (1L << i)) : |
2277 | 2031 | (caster_ptr->spell_worked2 & (1L << (i % 32))))) |
2278 | 2032 | { |
2279 | - /* Untried */ | |
2280 | 2033 | a = TERM_YELLOW; |
2281 | 2034 | } |
2282 | 2035 | |
2283 | - /* Dump the spell --(-- */ | |
2284 | 2036 | sprintf(out_val, "%c/%c) %-20.20s", |
2285 | 2037 | I2A(n / 8), I2A(n % 8), name); |
2286 | 2038 | |
2287 | - /* Track maximum */ | |
2288 | 2039 | m[j] = y + n; |
2289 | 2040 | Term_putstr(x, m[j], -1, a, out_val); |
2290 | 2041 | n++; |
@@ -2325,21 +2076,13 @@ MANA_POINT mod_need_mana(player_type *caster_ptr, MANA_POINT need_mana, SPELL_ID | ||
2325 | 2076 | #define MANA_CONST 2400 |
2326 | 2077 | #define MANA_DIV 4 |
2327 | 2078 | #define DEC_MANA_DIV 3 |
2328 | - | |
2329 | - /* Realm magic */ | |
2330 | 2079 | if ((realm > REALM_NONE) && (realm <= MAX_REALM)) |
2331 | 2080 | { |
2332 | - /* | |
2333 | - * need_mana defaults if spell exp equals SPELL_EXP_EXPERT and !caster_ptr->dec_mana. | |
2334 | - * MANA_CONST is used to calculate need_mana effected from spell proficiency. | |
2335 | - */ | |
2336 | 2081 | need_mana = need_mana * (MANA_CONST + SPELL_EXP_EXPERT - experience_of_spell(caster_ptr, spell, realm)) + (MANA_CONST - 1); |
2337 | 2082 | need_mana *= caster_ptr->dec_mana ? DEC_MANA_DIV : MANA_DIV; |
2338 | 2083 | need_mana /= MANA_CONST * MANA_DIV; |
2339 | 2084 | if (need_mana < 1) need_mana = 1; |
2340 | 2085 | } |
2341 | - | |
2342 | - /* Non-realm magic */ | |
2343 | 2086 | else |
2344 | 2087 | { |
2345 | 2088 | if (caster_ptr->dec_mana) need_mana = (need_mana + 1) * DEC_MANA_DIV / MANA_DIV; |
@@ -2406,12 +2149,9 @@ PERCENTAGE mod_spell_chance_2(player_type *caster_ptr, PERCENTAGE chance) | ||
2406 | 2149 | */ |
2407 | 2150 | PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm) |
2408 | 2151 | { |
2409 | - /* Paranoia -- must be literate */ | |
2410 | 2152 | if (!mp_ptr->spell_book) return 100; |
2411 | - | |
2412 | 2153 | if (use_realm == REALM_HISSATSU) return 0; |
2413 | 2154 | |
2414 | - /* Access the spell */ | |
2415 | 2155 | const magic_type *s_ptr; |
2416 | 2156 | if (!is_magic(use_realm)) |
2417 | 2157 | { |
@@ -2422,22 +2162,13 @@ PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_ | ||
2422 | 2162 | s_ptr = &mp_ptr->info[use_realm - 1][spell]; |
2423 | 2163 | } |
2424 | 2164 | |
2425 | - /* Extract the base spell failure rate */ | |
2426 | 2165 | PERCENTAGE chance = s_ptr->sfail; |
2427 | - | |
2428 | - /* Reduce failure rate by "effective" level adjustment */ | |
2429 | 2166 | chance -= 3 * (caster_ptr->lev - s_ptr->slevel); |
2430 | - | |
2431 | - /* Reduce failure rate by INT/WIS adjustment */ | |
2432 | 2167 | chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1); |
2433 | - | |
2434 | 2168 | if (caster_ptr->riding) |
2435 | 2169 | chance += (MAX(r_info[caster_ptr->current_floor_ptr->m_list[caster_ptr->riding].r_idx].level - caster_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0)); |
2436 | 2170 | |
2437 | - /* Extract mana consumption rate */ | |
2438 | 2171 | MANA_POINT need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, use_realm); |
2439 | - | |
2440 | - /* Not enough mana to cast */ | |
2441 | 2172 | if (need_mana > caster_ptr->csp) |
2442 | 2173 | { |
2443 | 2174 | chance += 5 * (need_mana - caster_ptr->csp); |
@@ -2445,25 +2176,16 @@ PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_ | ||
2445 | 2176 | |
2446 | 2177 | if ((use_realm != caster_ptr->realm1) && ((caster_ptr->pclass == CLASS_MAGE) || (caster_ptr->pclass == CLASS_PRIEST))) chance += 5; |
2447 | 2178 | |
2448 | - /* Extract the minimum failure rate */ | |
2449 | 2179 | PERCENTAGE minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]]; |
2450 | - | |
2451 | - /* | |
2452 | - * Non mage/priest characters never get too good | |
2453 | - * (added high mage, mindcrafter) | |
2454 | - */ | |
2455 | 2180 | if (mp_ptr->spell_xtra & MAGIC_FAIL_5PERCENT) |
2456 | 2181 | { |
2457 | 2182 | if (minfail < 5) minfail = 5; |
2458 | 2183 | } |
2459 | 2184 | |
2460 | - /* Hack -- Priest prayer penalty for "edged" weapons -DGK */ | |
2461 | 2185 | if (((caster_ptr->pclass == CLASS_PRIEST) || (caster_ptr->pclass == CLASS_SORCERER)) && caster_ptr->icky_wield[0]) chance += 25; |
2462 | 2186 | if (((caster_ptr->pclass == CLASS_PRIEST) || (caster_ptr->pclass == CLASS_SORCERER)) && caster_ptr->icky_wield[1]) chance += 25; |
2463 | 2187 | |
2464 | 2188 | chance = mod_spell_chance_1(caster_ptr, chance); |
2465 | - | |
2466 | - /* Goodness or evilness gives a penalty to failure rate */ | |
2467 | 2189 | PERCENTAGE penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4; |
2468 | 2190 | switch (use_realm) |
2469 | 2191 | { |
@@ -2483,7 +2205,6 @@ PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_ | ||
2483 | 2205 | if (caster_ptr->stun > 50) chance += 25; |
2484 | 2206 | else if (caster_ptr->stun) chance += 15; |
2485 | 2207 | |
2486 | - /* Always a 5 percent chance of working */ | |
2487 | 2208 | if (chance > 95) chance = 95; |
2488 | 2209 | |
2489 | 2210 | if ((use_realm == caster_ptr->realm1) || (use_realm == caster_ptr->realm2) |
@@ -2515,7 +2236,6 @@ void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *sp | ||
2515 | 2236 | if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && current_world_ptr->wizard) |
2516 | 2237 | msg_print(_("警告! print_spell が領域なしに呼ばれた", "Warning! print_spells called with null realm")); |
2517 | 2238 | |
2518 | - /* Title the list */ | |
2519 | 2239 | prt("", y, x); |
2520 | 2240 | char buf[256]; |
2521 | 2241 | if (use_realm == REALM_HISSATSU) |
@@ -2533,7 +2253,6 @@ void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *sp | ||
2533 | 2253 | |
2534 | 2254 | int i; |
2535 | 2255 | int exp_level; |
2536 | - SPELL_IDX spell; | |
2537 | 2256 | const magic_type *s_ptr; |
2538 | 2257 | char info[80]; |
2539 | 2258 | char out_val[160]; |
@@ -2541,7 +2260,7 @@ void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *sp | ||
2541 | 2260 | bool max = FALSE; |
2542 | 2261 | for (i = 0; i < num; i++) |
2543 | 2262 | { |
2544 | - spell = spells[i]; | |
2263 | + SPELL_IDX spell = spells[i]; | |
2545 | 2264 | |
2546 | 2265 | if (!is_magic(use_realm)) |
2547 | 2266 | { |
@@ -2558,10 +2277,7 @@ void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *sp | ||
2558 | 2277 | else |
2559 | 2278 | { |
2560 | 2279 | EXP exp = experience_of_spell(caster_ptr, spell, use_realm); |
2561 | - | |
2562 | - /* Extract mana consumption rate */ | |
2563 | 2280 | need_mana = mod_need_mana(caster_ptr, s_ptr->smana, spell, use_realm); |
2564 | - | |
2565 | 2281 | if ((increment == 64) || (s_ptr->slevel >= 99)) exp_level = EXP_LEVEL_UNSKILLED; |
2566 | 2282 | else exp_level = spell_exp_level(exp); |
2567 | 2283 |
@@ -2584,7 +2300,7 @@ void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *sp | ||
2584 | 2300 | strcpy(out_val, " "); |
2585 | 2301 | } |
2586 | 2302 | else sprintf(out_val, " %c) ", I2A(i)); |
2587 | - /* Skip illegible spells */ | |
2303 | + | |
2588 | 2304 | if (s_ptr->slevel >= 99) |
2589 | 2305 | { |
2590 | 2306 | strcat(out_val, format("%-30s", _("(判読不能)", "(illegible)"))); |
@@ -2592,18 +2308,9 @@ void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *sp | ||
2592 | 2308 | continue; |
2593 | 2309 | } |
2594 | 2310 | |
2595 | - /* XXX XXX Could label spells above the players level */ | |
2596 | - | |
2597 | - /* Get extra info */ | |
2598 | 2311 | strcpy(info, exe_spell(caster_ptr, use_realm, spell, SPELL_INFO)); |
2599 | - | |
2600 | - /* Use that info */ | |
2601 | 2312 | concptr comment = info; |
2602 | - | |
2603 | - /* Assume spell is known and tried */ | |
2604 | 2313 | byte line_attr = TERM_WHITE; |
2605 | - | |
2606 | - /* Analyze the spell */ | |
2607 | 2314 | if ((caster_ptr->pclass == CLASS_SORCERER) || (caster_ptr->pclass == CLASS_RED_MAGE)) |
2608 | 2315 | { |
2609 | 2316 | if (s_ptr->slevel > caster_ptr->max_plv) |
@@ -2644,18 +2351,15 @@ void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *sp | ||
2644 | 2351 | line_attr = TERM_L_GREEN; |
2645 | 2352 | } |
2646 | 2353 | |
2647 | - /* Dump the spell --(-- */ | |
2648 | 2354 | if (use_realm == REALM_HISSATSU) |
2649 | 2355 | { |
2650 | 2356 | strcat(out_val, format("%-25s %2d %4d", |
2651 | - exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), /* realm, spell */ | |
2652 | - s_ptr->slevel, need_mana)); | |
2357 | + exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), s_ptr->slevel, need_mana)); | |
2653 | 2358 | } |
2654 | 2359 | else |
2655 | 2360 | { |
2656 | 2361 | strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%% %s", |
2657 | - exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), /* realm, spell */ | |
2658 | - (max ? '!' : ' '), ryakuji, | |
2362 | + exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), (max ? '!' : ' '), ryakuji, | |
2659 | 2363 | s_ptr->slevel, need_mana, spell_chance(caster_ptr, spell, use_realm), comment)); |
2660 | 2364 | } |
2661 | 2365 |
@@ -2677,36 +2381,23 @@ void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *sp | ||
2677 | 2381 | */ |
2678 | 2382 | static MONRACE_IDX poly_r_idx(player_type *caster_ptr, MONRACE_IDX r_idx) |
2679 | 2383 | { |
2680 | - /* Hack -- Uniques/Questors never polymorph */ | |
2681 | 2384 | monster_race *r_ptr = &r_info[r_idx]; |
2682 | 2385 | if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags1 & RF1_QUESTOR)) |
2683 | 2386 | return (r_idx); |
2684 | 2387 | |
2685 | - /* Allowable range of "levels" for resulting monster */ | |
2686 | 2388 | DEPTH lev1 = r_ptr->level - ((randint1(20) / randint1(9)) + 1); |
2687 | 2389 | DEPTH lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1); |
2688 | - | |
2689 | - /* Pick a (possibly new) non-unique race */ | |
2690 | 2390 | MONRACE_IDX r; |
2691 | 2391 | for (int i = 0; i < 1000; i++) |
2692 | 2392 | { |
2693 | - /* Pick a new race, using a level calculation */ | |
2694 | 2393 | r = get_mon_num(caster_ptr, (caster_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5); |
2695 | - | |
2696 | - /* Handle failure */ | |
2697 | 2394 | if (!r) break; |
2698 | 2395 | |
2699 | 2396 | r_ptr = &r_info[r]; |
2700 | - | |
2701 | - /* Ignore unique monsters */ | |
2702 | 2397 | if (r_ptr->flags1 & RF1_UNIQUE) continue; |
2703 | - | |
2704 | - /* Ignore monsters with incompatible levels */ | |
2705 | 2398 | if ((r_ptr->level < lev1) || (r_ptr->level > lev2)) continue; |
2706 | 2399 | |
2707 | - /* Use that index */ | |
2708 | 2400 | r_idx = r; |
2709 | - | |
2710 | 2401 | break; |
2711 | 2402 | } |
2712 | 2403 |
@@ -2735,67 +2426,48 @@ bool polymorph_monster(player_type *caster_ptr, POSITION y, POSITION x) | ||
2735 | 2426 | if (floor_ptr->inside_arena || caster_ptr->phase_out) return FALSE; |
2736 | 2427 | if ((caster_ptr->riding == g_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return FALSE; |
2737 | 2428 | |
2738 | - /* Memorize the monster before polymorphing */ | |
2739 | 2429 | monster_type back_m = *m_ptr; |
2740 | - | |
2741 | - /* Pick a "new" monster race */ | |
2742 | 2430 | new_r_idx = poly_r_idx(caster_ptr, old_r_idx); |
2743 | - | |
2744 | - /* Handle polymorph */ | |
2745 | 2431 | if (new_r_idx == old_r_idx) return FALSE; |
2746 | 2432 | |
2747 | 2433 | bool preserve_hold_objects = back_m.hold_o_idx ? TRUE : FALSE; |
2748 | 2434 | OBJECT_IDX this_o_idx, next_o_idx = 0; |
2749 | 2435 | |
2750 | - /* Get the monsters attitude */ | |
2751 | 2436 | BIT_FLAGS mode = 0L; |
2752 | 2437 | if (is_friendly(m_ptr)) mode |= PM_FORCE_FRIENDLY; |
2753 | 2438 | if (is_pet(m_ptr)) mode |= PM_FORCE_PET; |
2754 | 2439 | if (m_ptr->mflag2 & MFLAG2_NOPET) mode |= PM_NO_PET; |
2755 | 2440 | |
2756 | - /* Mega-hack -- ignore held objects */ | |
2757 | 2441 | m_ptr->hold_o_idx = 0; |
2758 | - | |
2759 | - /* "Kill" the "old" monster */ | |
2760 | 2442 | delete_monster_idx(caster_ptr, g_ptr->m_idx); |
2761 | - | |
2762 | - /* Create a new monster (no groups) */ | |
2763 | 2443 | bool polymorphed = FALSE; |
2764 | 2444 | if (place_monster_aux(caster_ptr, 0, y, x, new_r_idx, mode)) |
2765 | 2445 | { |
2766 | 2446 | floor_ptr->m_list[hack_m_idx_ii].nickname = back_m.nickname; |
2767 | 2447 | floor_ptr->m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx; |
2768 | 2448 | floor_ptr->m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx; |
2769 | - | |
2770 | - /* Success */ | |
2771 | 2449 | polymorphed = TRUE; |
2772 | 2450 | } |
2773 | 2451 | else |
2774 | 2452 | { |
2775 | - /* Placing the new monster failed */ | |
2776 | 2453 | if (place_monster_aux(caster_ptr, 0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN))) |
2777 | 2454 | { |
2778 | 2455 | floor_ptr->m_list[hack_m_idx_ii] = back_m; |
2779 | - | |
2780 | - /* Re-initialize monster process */ | |
2781 | 2456 | mproc_init(floor_ptr); |
2782 | 2457 | } |
2783 | 2458 | else preserve_hold_objects = FALSE; |
2784 | 2459 | } |
2785 | 2460 | |
2786 | - /* Mega-hack -- preserve held objects */ | |
2787 | 2461 | if (preserve_hold_objects) |
2788 | 2462 | { |
2789 | 2463 | for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx) |
2790 | 2464 | { |
2791 | 2465 | object_type *o_ptr = &floor_ptr->o_list[this_o_idx]; |
2792 | 2466 | next_o_idx = o_ptr->next_o_idx; |
2793 | - | |
2794 | - /* Held by new monster */ | |
2795 | 2467 | o_ptr->held_m_idx = hack_m_idx_ii; |
2796 | 2468 | } |
2797 | 2469 | } |
2798 | - else if (back_m.hold_o_idx) /* Failed (paranoia) */ | |
2470 | + else if (back_m.hold_o_idx) | |
2799 | 2471 | { |
2800 | 2472 | for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx) |
2801 | 2473 | { |
@@ -2809,6 +2481,7 @@ bool polymorph_monster(player_type *caster_ptr, POSITION y, POSITION x) | ||
2809 | 2481 | return polymorphed; |
2810 | 2482 | } |
2811 | 2483 | |
2484 | + | |
2812 | 2485 | /*! |
2813 | 2486 | * @brief 次元の扉処理 / |
2814 | 2487 | * Dimension Door |
@@ -2846,7 +2519,6 @@ static bool dimension_door_aux(player_type *caster_ptr, POSITION x, POSITION y) | ||
2846 | 2519 | bool dimension_door(player_type *caster_ptr) |
2847 | 2520 | { |
2848 | 2521 | DEPTH x = 0, y = 0; |
2849 | - | |
2850 | 2522 | if (!tgt_pt(caster_ptr, &x, &y)) return FALSE; |
2851 | 2523 | if (dimension_door_aux(caster_ptr, x, y)) return TRUE; |
2852 | 2524 |
@@ -2881,14 +2553,12 @@ bool mirror_tunnel(player_type *caster_ptr) | ||
2881 | 2553 | bool eat_magic(player_type *caster_ptr, int power) |
2882 | 2554 | { |
2883 | 2555 | byte fail_type = 1; |
2884 | - | |
2885 | - concptr q, s; | |
2886 | 2556 | GAME_TEXT o_name[MAX_NLEN]; |
2887 | 2557 | |
2888 | 2558 | item_tester_hook = item_tester_hook_recharge; |
2889 | 2559 | |
2890 | - q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? "); | |
2891 | - s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain."); | |
2560 | + concptr q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? "); | |
2561 | + concptr s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain."); | |
2892 | 2562 | |
2893 | 2563 | object_type *o_ptr; |
2894 | 2564 | OBJECT_IDX item; |
@@ -2904,11 +2574,8 @@ bool eat_magic(player_type *caster_ptr, int power) | ||
2904 | 2574 | if (o_ptr->tval == TV_ROD) |
2905 | 2575 | { |
2906 | 2576 | recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5; |
2907 | - | |
2908 | - /* Back-fire */ | |
2909 | 2577 | if (one_in_(recharge_strength)) |
2910 | 2578 | { |
2911 | - /* Activate the failure code. */ | |
2912 | 2579 | is_eating_successful = FALSE; |
2913 | 2580 | } |
2914 | 2581 | else |
@@ -2926,11 +2593,9 @@ bool eat_magic(player_type *caster_ptr, int power) | ||
2926 | 2593 | } |
2927 | 2594 | else |
2928 | 2595 | { |
2929 | - /* All staffs, wands. */ | |
2930 | 2596 | recharge_strength = (100 + power - lev) / 15; |
2931 | 2597 | if (recharge_strength < 0) recharge_strength = 0; |
2932 | 2598 | |
2933 | - /* Back-fire */ | |
2934 | 2599 | if (one_in_(recharge_strength)) |
2935 | 2600 | { |
2936 | 2601 | is_eating_successful = FALSE; |
@@ -2942,7 +2607,6 @@ bool eat_magic(player_type *caster_ptr, int power) | ||
2942 | 2607 | caster_ptr->csp += lev / 2; |
2943 | 2608 | o_ptr->pval --; |
2944 | 2609 | |
2945 | - /* XXX Hack -- unstack if necessary */ | |
2946 | 2610 | if ((o_ptr->tval == TV_STAFF) && (item >= 0) && (o_ptr->number > 1)) |
2947 | 2611 | { |
2948 | 2612 | object_type forge; |
@@ -2950,13 +2614,8 @@ bool eat_magic(player_type *caster_ptr, int power) | ||
2950 | 2614 | q_ptr = &forge; |
2951 | 2615 | object_copy(q_ptr, o_ptr); |
2952 | 2616 | |
2953 | - /* Modify quantity */ | |
2954 | 2617 | q_ptr->number = 1; |
2955 | - | |
2956 | - /* Restore the charges */ | |
2957 | 2618 | o_ptr->pval++; |
2958 | - | |
2959 | - /* Unstack the used item */ | |
2960 | 2619 | o_ptr->number--; |
2961 | 2620 | caster_ptr->total_weight -= q_ptr->weight; |
2962 | 2621 | item = inven_carry(caster_ptr, q_ptr); |
@@ -2978,27 +2637,20 @@ bool eat_magic(player_type *caster_ptr, int power) | ||
2978 | 2637 | return redraw_player(caster_ptr); |
2979 | 2638 | } |
2980 | 2639 | |
2981 | - /* Artifacts are never destroyed. */ | |
2982 | 2640 | if (object_is_fixed_artifact(o_ptr)) |
2983 | 2641 | { |
2984 | 2642 | object_desc(caster_ptr, o_name, o_ptr, OD_NAME_ONLY); |
2985 | 2643 | msg_format(_("魔力が逆流した!%sは完全に魔力を失った。", "The recharging backfires - %s is completely drained!"), o_name); |
2986 | - | |
2987 | - /* Artifact rods. */ | |
2988 | 2644 | if (o_ptr->tval == TV_ROD) |
2989 | 2645 | o_ptr->timeout = k_ptr->pval * o_ptr->number; |
2990 | - | |
2991 | - /* Artifact wands and staffs. */ | |
2992 | 2646 | else if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF)) |
2993 | 2647 | o_ptr->pval = 0; |
2648 | + | |
2994 | 2649 | return redraw_player(caster_ptr); |
2995 | 2650 | } |
2996 | 2651 | |
2997 | - /* Get the object description */ | |
2998 | 2652 | object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); |
2999 | 2653 | |
3000 | - /*** Determine Seriousness of Failure ***/ | |
3001 | - | |
3002 | 2654 | /* Mages recharge objects more safely. */ |
3003 | 2655 | if (IS_WIZARD_CLASS(caster_ptr)) |
3004 | 2656 | { |
@@ -3044,9 +2696,6 @@ bool eat_magic(player_type *caster_ptr, int power) | ||
3044 | 2696 | } |
3045 | 2697 | } |
3046 | 2698 | |
3047 | - /*** Apply draining and destruction. ***/ | |
3048 | - | |
3049 | - /* Drain object or stack of objects. */ | |
3050 | 2699 | if (fail_type == 1) |
3051 | 2700 | { |
3052 | 2701 | if (o_ptr->tval == TV_ROD) |
@@ -3062,7 +2711,6 @@ bool eat_magic(player_type *caster_ptr, int power) | ||
3062 | 2711 | } |
3063 | 2712 | } |
3064 | 2713 | |
3065 | - /* Destroy an object or one in a stack of objects. */ | |
3066 | 2714 | if (fail_type == 2) |
3067 | 2715 | { |
3068 | 2716 | if (o_ptr->number > 1) |
@@ -3080,7 +2728,6 @@ bool eat_magic(player_type *caster_ptr, int power) | ||
3080 | 2728 | vary_item(caster_ptr, item, -1); |
3081 | 2729 | } |
3082 | 2730 | |
3083 | - /* Destroy all members of a stack of objects. */ | |
3084 | 2731 | if (fail_type == 3) |
3085 | 2732 | { |
3086 | 2733 | if (o_ptr->number > 1) |
@@ -3102,17 +2749,14 @@ bool eat_magic(player_type *caster_ptr, int power) | ||
3102 | 2749 | */ |
3103 | 2750 | void massacre(player_type *caster_ptr) |
3104 | 2751 | { |
3105 | - POSITION x, y; | |
3106 | 2752 | grid_type *g_ptr; |
3107 | 2753 | monster_type *m_ptr; |
3108 | 2754 | for (DIRECTION dir = 0; dir < 8; dir++) |
3109 | 2755 | { |
3110 | - y = caster_ptr->y + ddy_ddd[dir]; | |
3111 | - x = caster_ptr->x + ddx_ddd[dir]; | |
2756 | + POSITION y = caster_ptr->y + ddy_ddd[dir]; | |
2757 | + POSITION x = caster_ptr->x + ddx_ddd[dir]; | |
3112 | 2758 | g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x]; |
3113 | 2759 | m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; |
3114 | - | |
3115 | - /* Hack -- attack monsters */ | |
3116 | 2760 | if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT))) |
3117 | 2761 | py_attack(caster_ptr, y, x, 0); |
3118 | 2762 | } |
@@ -3137,7 +2781,6 @@ bool eat_rock(player_type *caster_ptr) | ||
3137 | 2781 | mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)]; |
3138 | 2782 | |
3139 | 2783 | stop_mouth(caster_ptr); |
3140 | - | |
3141 | 2784 | if (!have_flag(mimic_f_ptr->flags, FF_HURT_ROCK)) |
3142 | 2785 | { |
3143 | 2786 | msg_print(_("この地形は食べられない。", "You cannot eat this feature.")); |
@@ -3220,7 +2863,10 @@ bool shock_power(player_type *caster_ptr) | ||
3220 | 2863 | ty = y; |
3221 | 2864 | tx = x; |
3222 | 2865 | } |
3223 | - else break; | |
2866 | + else | |
2867 | + { | |
2868 | + break; | |
2869 | + } | |
3224 | 2870 | } |
3225 | 2871 | |
3226 | 2872 | bool is_shock_successful = ty != oy; |
@@ -3391,11 +3037,8 @@ bool fire_crimson(player_type *shooter_ptr) | ||
3391 | 3037 | DIRECTION dir; |
3392 | 3038 | if (!get_aim_dir(shooter_ptr, &dir)) return FALSE; |
3393 | 3039 | |
3394 | - /* Use the given direction */ | |
3395 | 3040 | POSITION tx = shooter_ptr->x + 99 * ddx[dir]; |
3396 | 3041 | POSITION ty = shooter_ptr->y + 99 * ddy[dir]; |
3397 | - | |
3398 | - /* Hack -- Use an actual "target" */ | |
3399 | 3042 | if ((dir == 5) && target_okay(shooter_ptr)) |
3400 | 3043 | { |
3401 | 3044 | tx = target_col; |
@@ -3405,13 +3048,8 @@ bool fire_crimson(player_type *shooter_ptr) | ||
3405 | 3048 | int num = 1; |
3406 | 3049 | if (shooter_ptr->pclass == CLASS_ARCHER) |
3407 | 3050 | { |
3408 | - /* Extra shot at level 10 */ | |
3409 | 3051 | if (shooter_ptr->lev >= 10) num++; |
3410 | - | |
3411 | - /* Extra shot at level 30 */ | |
3412 | 3052 | if (shooter_ptr->lev >= 30) num++; |
3413 | - | |
3414 | - /* Extra shot at level 45 */ | |
3415 | 3053 | if (shooter_ptr->lev >= 45) num++; |
3416 | 3054 | } |
3417 | 3055 |
@@ -3458,7 +3096,7 @@ bool tele_town(player_type *caster_ptr) | ||
3458 | 3096 | num++; |
3459 | 3097 | } |
3460 | 3098 | |
3461 | - if (!num) | |
3099 | + if (num == 0) | |
3462 | 3100 | { |
3463 | 3101 | msg_print(_("まだ行けるところがない。", "You have not yet visited any town.")); |
3464 | 3102 | msg_print(NULL); |