変愚蛮怒のメインリポジトリです
Revision | f2867d61951199da47091e5f670ee5933570122f (tree) |
---|---|
Time | 2019-03-05 23:51:52 |
Author | deskull <deskull@user...> |
Commiter | deskull |
[Refactor] #37353 bless_weapon() and pulish_shield() to spells-object.c.c.
@@ -974,8 +974,6 @@ extern bool mundane_spell(bool only_equip); | ||
974 | 974 | extern bool identify_item(object_type *o_ptr); |
975 | 975 | extern bool identify_fully(bool only_equip); |
976 | 976 | extern bool recharge(int power); |
977 | -extern bool bless_weapon(void); | |
978 | -extern bool pulish_shield(void); | |
979 | 977 | extern bool potion_smash_effect(MONSTER_IDX who, POSITION y, POSITION x, KIND_OBJECT_IDX k_idx); |
980 | 978 | extern void display_spell_list(void); |
981 | 979 | extern EXP experience_of_spell(SPELL_IDX spell, REALM_IDX use_realm); |
@@ -1,6 +1,6 @@ | ||
1 | 1 | /*! |
2 | 2 | * @file melee1.c |
3 | - * @brief モンスターの打撃処理 / Monster attacks | |
3 | + * @brief 打撃処理 / Melee process. | |
4 | 4 | * @date 2014/01/17 |
5 | 5 | * @author |
6 | 6 | * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n |
@@ -2,6 +2,7 @@ | ||
2 | 2 | #include "cmd-spell.h" |
3 | 3 | #include "selfinfo.h" |
4 | 4 | #include "projection.h" |
5 | +#include "spells-object.h" | |
5 | 6 | #include "spells-summon.h" |
6 | 7 | #include "spells-status.h" |
7 | 8 | #include "mutation.h" |
@@ -703,7 +703,6 @@ bool curse_weapon_object(bool force, object_type *o_ptr) | ||
703 | 703 | */ |
704 | 704 | bool curse_weapon(bool force, int slot) |
705 | 705 | { |
706 | - /* Curse the weapon */ | |
707 | 706 | return curse_weapon_object(force, &inventory[slot]); |
708 | 707 | } |
709 | 708 |
@@ -920,4 +919,201 @@ void phlogiston(void) | ||
920 | 919 | p_ptr->update |= (PU_TORCH); |
921 | 920 | } |
922 | 921 | |
922 | +/*! | |
923 | + * @brief 武器の祝福処理 / | |
924 | + * Bless a weapon | |
925 | + * @return ターン消費を要する処理を行ったならばTRUEを返す | |
926 | + */ | |
927 | +bool bless_weapon(void) | |
928 | +{ | |
929 | + OBJECT_IDX item; | |
930 | + object_type *o_ptr; | |
931 | + BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
932 | + GAME_TEXT o_name[MAX_NLEN]; | |
933 | + concptr q, s; | |
934 | + | |
935 | + /* Bless only weapons */ | |
936 | + item_tester_hook = object_is_weapon; | |
937 | + | |
938 | + q = _("どのアイテムを祝福しますか?", "Bless which weapon? "); | |
939 | + s = _("祝福できる武器がありません。", "You have weapon to bless."); | |
940 | + | |
941 | + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); | |
942 | + if (!o_ptr) return FALSE; | |
943 | + | |
944 | + object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); | |
945 | + object_flags(o_ptr, flgs); | |
946 | + | |
947 | + if (object_is_cursed(o_ptr)) | |
948 | + { | |
949 | + if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) || | |
950 | + have_flag(flgs, TR_ADD_L_CURSE) || | |
951 | + have_flag(flgs, TR_ADD_H_CURSE) || | |
952 | + (o_ptr->curse_flags & TRC_PERMA_CURSE)) | |
953 | + { | |
954 | +#ifdef JP | |
955 | + msg_format("%sを覆う黒いオーラは祝福を跳ね返した!", o_name); | |
956 | +#else | |
957 | + msg_format("The black aura on %s %s disrupts the blessing!", ((item >= 0) ? "your" : "the"), o_name); | |
958 | +#endif | |
959 | + | |
960 | + return TRUE; | |
961 | + } | |
962 | + | |
963 | +#ifdef JP | |
964 | + msg_format("%s から邪悪なオーラが消えた。", o_name); | |
965 | +#else | |
966 | + msg_format("A malignant aura leaves %s %s.", ((item >= 0) ? "your" : "the"), o_name); | |
967 | +#endif | |
968 | + | |
969 | + | |
970 | + o_ptr->curse_flags = 0L; | |
971 | + | |
972 | + o_ptr->ident |= (IDENT_SENSE); | |
973 | + o_ptr->feeling = FEEL_NONE; | |
974 | + | |
975 | + /* Recalculate the bonuses */ | |
976 | + p_ptr->update |= (PU_BONUS); | |
977 | + p_ptr->window |= (PW_EQUIP); | |
978 | + } | |
979 | + | |
980 | + /* | |
981 | + * Next, we try to bless it. Artifacts have a 1/3 chance of | |
982 | + * being blessed, otherwise, the operation simply disenchants | |
983 | + * them, godly power negating the magic. Ok, the explanation | |
984 | + * is silly, but otherwise priests would always bless every | |
985 | + * artifact weapon they find. Ego weapons and normal weapons | |
986 | + * can be blessed automatically. | |
987 | + */ | |
988 | + if (have_flag(flgs, TR_BLESSED)) | |
989 | + { | |
990 | +#ifdef JP | |
991 | + msg_format("%s は既に祝福されている。", o_name); | |
992 | +#else | |
993 | + msg_format("%s %s %s blessed already.", | |
994 | + ((item >= 0) ? "Your" : "The"), o_name, | |
995 | + ((o_ptr->number > 1) ? "were" : "was")); | |
996 | +#endif | |
997 | + | |
998 | + return TRUE; | |
999 | + } | |
1000 | + | |
1001 | + if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3)) | |
1002 | + { | |
1003 | +#ifdef JP | |
1004 | + msg_format("%sは輝いた!", o_name); | |
1005 | +#else | |
1006 | + msg_format("%s %s shine%s!", | |
1007 | + ((item >= 0) ? "Your" : "The"), o_name, | |
1008 | + ((o_ptr->number > 1) ? "" : "s")); | |
1009 | +#endif | |
1010 | + | |
1011 | + add_flag(o_ptr->art_flags, TR_BLESSED); | |
1012 | + o_ptr->discount = 99; | |
1013 | + } | |
1014 | + else | |
1015 | + { | |
1016 | + bool dis_happened = FALSE; | |
1017 | + msg_print(_("その武器は祝福を嫌っている!", "The weapon resists your blessing!")); | |
1018 | + | |
1019 | + /* Disenchant tohit */ | |
1020 | + if (o_ptr->to_h > 0) | |
1021 | + { | |
1022 | + o_ptr->to_h--; | |
1023 | + dis_happened = TRUE; | |
1024 | + } | |
1025 | + | |
1026 | + if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--; | |
923 | 1027 | |
1028 | + /* Disenchant todam */ | |
1029 | + if (o_ptr->to_d > 0) | |
1030 | + { | |
1031 | + o_ptr->to_d--; | |
1032 | + dis_happened = TRUE; | |
1033 | + } | |
1034 | + | |
1035 | + if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--; | |
1036 | + | |
1037 | + /* Disenchant toac */ | |
1038 | + if (o_ptr->to_a > 0) | |
1039 | + { | |
1040 | + o_ptr->to_a--; | |
1041 | + dis_happened = TRUE; | |
1042 | + } | |
1043 | + | |
1044 | + if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--; | |
1045 | + | |
1046 | + if (dis_happened) | |
1047 | + { | |
1048 | + msg_print(_("周囲が凡庸な雰囲気で満ちた...", "There is a static feeling in the air...")); | |
1049 | + | |
1050 | +#ifdef JP | |
1051 | + msg_format("%s は劣化した!", o_name); | |
1052 | +#else | |
1053 | + msg_format("%s %s %s disenchanted!", ((item >= 0) ? "Your" : "The"), o_name, | |
1054 | + ((o_ptr->number > 1) ? "were" : "was")); | |
1055 | +#endif | |
1056 | + | |
1057 | + } | |
1058 | + } | |
1059 | + | |
1060 | + p_ptr->update |= (PU_BONUS); | |
1061 | + p_ptr->window |= (PW_EQUIP | PW_PLAYER); | |
1062 | + calc_android_exp(); | |
1063 | + | |
1064 | + return TRUE; | |
1065 | +} | |
1066 | + | |
1067 | + | |
1068 | +/*! | |
1069 | + * @brief 盾磨き処理 / | |
1070 | + * pulish shield | |
1071 | + * @return ターン消費を要する処理を行ったならばTRUEを返す | |
1072 | + */ | |
1073 | +bool pulish_shield(void) | |
1074 | +{ | |
1075 | + OBJECT_IDX item; | |
1076 | + object_type *o_ptr; | |
1077 | + BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
1078 | + GAME_TEXT o_name[MAX_NLEN]; | |
1079 | + concptr q, s; | |
1080 | + | |
1081 | + /* Assume enchant weapon */ | |
1082 | + item_tester_tval = TV_SHIELD; | |
1083 | + | |
1084 | + q = _("どの盾を磨きますか?", "Pulish which weapon? "); | |
1085 | + s = _("磨く盾がありません。", "You have weapon to pulish."); | |
1086 | + | |
1087 | + o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); | |
1088 | + if (!o_ptr) return FALSE; | |
1089 | + | |
1090 | + object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); | |
1091 | + object_flags(o_ptr, flgs); | |
1092 | + | |
1093 | + if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) && | |
1094 | + !object_is_cursed(o_ptr) && (o_ptr->sval != SV_MIRROR_SHIELD)) | |
1095 | + { | |
1096 | +#ifdef JP | |
1097 | + msg_format("%sは輝いた!", o_name); | |
1098 | +#else | |
1099 | + msg_format("%s %s shine%s!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s")); | |
1100 | +#endif | |
1101 | + o_ptr->name2 = EGO_REFLECTION; | |
1102 | + enchant(o_ptr, randint0(3) + 4, ENCH_TOAC); | |
1103 | + | |
1104 | + o_ptr->discount = 99; | |
1105 | + chg_virtue(V_ENCHANT, 2); | |
1106 | + | |
1107 | + return TRUE; | |
1108 | + } | |
1109 | + else | |
1110 | + { | |
1111 | + if (flush_failure) flush(); | |
1112 | + | |
1113 | + msg_print(_("失敗した。", "Failed.")); | |
1114 | + chg_virtue(V_ENCHANT, -2); | |
1115 | + } | |
1116 | + calc_android_exp(); | |
1117 | + | |
1118 | + return FALSE; | |
1119 | +} |
@@ -13,4 +13,6 @@ extern bool brand_bolts(void); | ||
13 | 13 | extern bool perilous_secrets(player_type *creature_ptr); |
14 | 14 | extern void get_bloody_moon_flags(object_type *o_ptr); |
15 | 15 | extern void phlogiston(void); |
16 | +extern bool bless_weapon(void); | |
17 | +extern bool pulish_shield(void); | |
16 | 18 |
@@ -2702,206 +2702,6 @@ bool recharge(int power) | ||
2702 | 2702 | |
2703 | 2703 | |
2704 | 2704 | /*! |
2705 | - * @brief 武器の祝福処理 / | |
2706 | - * Bless a weapon | |
2707 | - * @return ターン消費を要する処理を行ったならばTRUEを返す | |
2708 | - */ | |
2709 | -bool bless_weapon(void) | |
2710 | -{ | |
2711 | - OBJECT_IDX item; | |
2712 | - object_type *o_ptr; | |
2713 | - BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
2714 | - GAME_TEXT o_name[MAX_NLEN]; | |
2715 | - concptr q, s; | |
2716 | - | |
2717 | - /* Bless only weapons */ | |
2718 | - item_tester_hook = object_is_weapon; | |
2719 | - | |
2720 | - q = _("どのアイテムを祝福しますか?", "Bless which weapon? "); | |
2721 | - s = _("祝福できる武器がありません。", "You have weapon to bless."); | |
2722 | - | |
2723 | - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); | |
2724 | - if (!o_ptr) return FALSE; | |
2725 | - | |
2726 | - object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); | |
2727 | - object_flags(o_ptr, flgs); | |
2728 | - | |
2729 | - if (object_is_cursed(o_ptr)) | |
2730 | - { | |
2731 | - if (((o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint1(100) < 33)) || | |
2732 | - have_flag(flgs, TR_ADD_L_CURSE) || | |
2733 | - have_flag(flgs, TR_ADD_H_CURSE) || | |
2734 | - (o_ptr->curse_flags & TRC_PERMA_CURSE)) | |
2735 | - { | |
2736 | -#ifdef JP | |
2737 | - msg_format("%sを覆う黒いオーラは祝福を跳ね返した!", o_name); | |
2738 | -#else | |
2739 | - msg_format("The black aura on %s %s disrupts the blessing!", ((item >= 0) ? "your" : "the"), o_name); | |
2740 | -#endif | |
2741 | - | |
2742 | - return TRUE; | |
2743 | - } | |
2744 | - | |
2745 | -#ifdef JP | |
2746 | - msg_format("%s から邪悪なオーラが消えた。", o_name); | |
2747 | -#else | |
2748 | - msg_format("A malignant aura leaves %s %s.", ((item >= 0) ? "your" : "the"), o_name); | |
2749 | -#endif | |
2750 | - | |
2751 | - | |
2752 | - o_ptr->curse_flags = 0L; | |
2753 | - | |
2754 | - o_ptr->ident |= (IDENT_SENSE); | |
2755 | - o_ptr->feeling = FEEL_NONE; | |
2756 | - | |
2757 | - /* Recalculate the bonuses */ | |
2758 | - p_ptr->update |= (PU_BONUS); | |
2759 | - p_ptr->window |= (PW_EQUIP); | |
2760 | - } | |
2761 | - | |
2762 | - /* | |
2763 | - * Next, we try to bless it. Artifacts have a 1/3 chance of | |
2764 | - * being blessed, otherwise, the operation simply disenchants | |
2765 | - * them, godly power negating the magic. Ok, the explanation | |
2766 | - * is silly, but otherwise priests would always bless every | |
2767 | - * artifact weapon they find. Ego weapons and normal weapons | |
2768 | - * can be blessed automatically. | |
2769 | - */ | |
2770 | - if (have_flag(flgs, TR_BLESSED)) | |
2771 | - { | |
2772 | -#ifdef JP | |
2773 | - msg_format("%s は既に祝福されている。", o_name); | |
2774 | -#else | |
2775 | - msg_format("%s %s %s blessed already.", | |
2776 | - ((item >= 0) ? "Your" : "The"), o_name, | |
2777 | - ((o_ptr->number > 1) ? "were" : "was")); | |
2778 | -#endif | |
2779 | - | |
2780 | - return TRUE; | |
2781 | - } | |
2782 | - | |
2783 | - if (!(object_is_artifact(o_ptr) || object_is_ego(o_ptr)) || one_in_(3)) | |
2784 | - { | |
2785 | -#ifdef JP | |
2786 | - msg_format("%sは輝いた!", o_name); | |
2787 | -#else | |
2788 | - msg_format("%s %s shine%s!", | |
2789 | - ((item >= 0) ? "Your" : "The"), o_name, | |
2790 | - ((o_ptr->number > 1) ? "" : "s")); | |
2791 | -#endif | |
2792 | - | |
2793 | - add_flag(o_ptr->art_flags, TR_BLESSED); | |
2794 | - o_ptr->discount = 99; | |
2795 | - } | |
2796 | - else | |
2797 | - { | |
2798 | - bool dis_happened = FALSE; | |
2799 | - msg_print(_("その武器は祝福を嫌っている!", "The weapon resists your blessing!")); | |
2800 | - | |
2801 | - /* Disenchant tohit */ | |
2802 | - if (o_ptr->to_h > 0) | |
2803 | - { | |
2804 | - o_ptr->to_h--; | |
2805 | - dis_happened = TRUE; | |
2806 | - } | |
2807 | - | |
2808 | - if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--; | |
2809 | - | |
2810 | - /* Disenchant todam */ | |
2811 | - if (o_ptr->to_d > 0) | |
2812 | - { | |
2813 | - o_ptr->to_d--; | |
2814 | - dis_happened = TRUE; | |
2815 | - } | |
2816 | - | |
2817 | - if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--; | |
2818 | - | |
2819 | - /* Disenchant toac */ | |
2820 | - if (o_ptr->to_a > 0) | |
2821 | - { | |
2822 | - o_ptr->to_a--; | |
2823 | - dis_happened = TRUE; | |
2824 | - } | |
2825 | - | |
2826 | - if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--; | |
2827 | - | |
2828 | - if (dis_happened) | |
2829 | - { | |
2830 | - msg_print(_("周囲が凡庸な雰囲気で満ちた...", "There is a static feeling in the air...")); | |
2831 | - | |
2832 | -#ifdef JP | |
2833 | - msg_format("%s は劣化した!", o_name); | |
2834 | -#else | |
2835 | - msg_format("%s %s %s disenchanted!", ((item >= 0) ? "Your" : "The"), o_name, | |
2836 | - ((o_ptr->number > 1) ? "were" : "was")); | |
2837 | -#endif | |
2838 | - | |
2839 | - } | |
2840 | - } | |
2841 | - | |
2842 | - p_ptr->update |= (PU_BONUS); | |
2843 | - p_ptr->window |= (PW_EQUIP | PW_PLAYER); | |
2844 | - calc_android_exp(); | |
2845 | - | |
2846 | - return TRUE; | |
2847 | -} | |
2848 | - | |
2849 | - | |
2850 | -/*! | |
2851 | - * @brief 盾磨き処理 / | |
2852 | - * pulish shield | |
2853 | - * @return ターン消費を要する処理を行ったならばTRUEを返す | |
2854 | - */ | |
2855 | -bool pulish_shield(void) | |
2856 | -{ | |
2857 | - OBJECT_IDX item; | |
2858 | - object_type *o_ptr; | |
2859 | - BIT_FLAGS flgs[TR_FLAG_SIZE]; | |
2860 | - GAME_TEXT o_name[MAX_NLEN]; | |
2861 | - concptr q, s; | |
2862 | - | |
2863 | - /* Assume enchant weapon */ | |
2864 | - item_tester_tval = TV_SHIELD; | |
2865 | - | |
2866 | - q = _("どの盾を磨きますか?", "Pulish which weapon? "); | |
2867 | - s = _("磨く盾がありません。", "You have weapon to pulish."); | |
2868 | - | |
2869 | - o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT)); | |
2870 | - if (!o_ptr) return FALSE; | |
2871 | - | |
2872 | - object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); | |
2873 | - object_flags(o_ptr, flgs); | |
2874 | - | |
2875 | - if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) && | |
2876 | - !object_is_cursed(o_ptr) && (o_ptr->sval != SV_MIRROR_SHIELD)) | |
2877 | - { | |
2878 | -#ifdef JP | |
2879 | - msg_format("%sは輝いた!", o_name); | |
2880 | -#else | |
2881 | - msg_format("%s %s shine%s!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s")); | |
2882 | -#endif | |
2883 | - o_ptr->name2 = EGO_REFLECTION; | |
2884 | - enchant(o_ptr, randint0(3) + 4, ENCH_TOAC); | |
2885 | - | |
2886 | - o_ptr->discount = 99; | |
2887 | - chg_virtue(V_ENCHANT, 2); | |
2888 | - | |
2889 | - return TRUE; | |
2890 | - } | |
2891 | - else | |
2892 | - { | |
2893 | - if (flush_failure) flush(); | |
2894 | - | |
2895 | - msg_print(_("失敗した。", "Failed.")); | |
2896 | - chg_virtue(V_ENCHANT, -2); | |
2897 | - } | |
2898 | - calc_android_exp(); | |
2899 | - | |
2900 | - return FALSE; | |
2901 | -} | |
2902 | - | |
2903 | - | |
2904 | -/*! | |
2905 | 2705 | * @brief 薬の破損効果処理 / |
2906 | 2706 | * Potions "smash open" and cause an area effect when |
2907 | 2707 | * @param who 薬破損の主体ID(プレイヤー所持アイテムが壊れた場合0、床上のアイテムの場合モンスターID) |