• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision81892743ca374730be80ef436203a52a46c2fd92 (tree)
Time2019-06-18 23:31:14
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 brand_weapon() を spells-object.c/h へ移動.

Change Summary

Incremental Difference

--- a/src/realm-chaos.c
+++ b/src/realm-chaos.c
@@ -7,6 +7,7 @@
77 #include "spells-summon.h"
88 #include "spells-status.h"
99 #include "spells-floor.h"
10+#include "spells-object.h"
1011 #include "spells.h"
1112 #include "targeting.h"
1213 #include "view-mainwindow.h"
--- a/src/realm-crusade.c
+++ b/src/realm-crusade.c
@@ -5,6 +5,7 @@
55 #include "cmd-spell.h"
66 #include "floor.h"
77 #include "spells.h"
8+#include "spells-object.h"
89 #include "spells-summon.h"
910 #include "spells-status.h"
1011 #include "spells-floor.h"
--- a/src/realm-daemon.c
+++ b/src/realm-daemon.c
@@ -8,6 +8,7 @@
88 #include "spells-summon.h"
99 #include "spells-floor.h"
1010 #include "spells-status.h"
11+#include "spells-object.h"
1112 #include "player-effects.h"
1213 #include "player-race.h"
1314 #include "player-damage.h"
--- a/src/realm-death.c
+++ b/src/realm-death.c
@@ -3,6 +3,7 @@
33 #include "spells.h"
44 #include "spells-summon.h"
55 #include "spells-status.h"
6+#include "spells-object.h"
67 #include "avatar.h"
78 #include "player-status.h"
89 #include "player-effects.h"
--- a/src/realm-trump.c
+++ b/src/realm-trump.c
@@ -6,6 +6,7 @@
66 #include "spells.h"
77 #include "spells-summon.h"
88 #include "spells-status.h"
9+#include "spells-object.h"
910 #include "player-effects.h"
1011 #include "player-class.h"
1112 #include "targeting.h"
--- a/src/spells-object.c
+++ b/src/spells-object.c
@@ -1331,3 +1331,147 @@ bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
13311331 return (TRUE);
13321332 }
13331333
1334+
1335+
1336+/*!
1337+ * @brief 武器へのエゴ付加処理 /
1338+ * Brand the current weapon
1339+ * @param brand_type エゴ化ID(e_info.txtとは連動していない)
1340+ * @return なし
1341+ */
1342+void brand_weapon(int brand_type)
1343+{
1344+ OBJECT_IDX item;
1345+ object_type *o_ptr;
1346+ concptr q, s;
1347+
1348+ /* Assume enchant weapon */
1349+ item_tester_hook = object_allow_enchant_melee_weapon;
1350+
1351+ q = _("どの武器を強化しますか? ", "Enchant which weapon? ");
1352+ s = _("強化できる武器がない。", "You have nothing to enchant.");
1353+
1354+ o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
1355+ if (!o_ptr) return;
1356+
1357+ /* you can never modify artifacts / ego-items */
1358+ /* you can never modify cursed items */
1359+ /* TY: You _can_ modify broken items (if you're silly enough) */
1360+ if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
1361+ !object_is_cursed(o_ptr) &&
1362+ !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1363+ !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1364+ !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1365+ {
1366+ concptr act = NULL;
1367+
1368+ /* Let's get the name before it is changed... */
1369+ GAME_TEXT o_name[MAX_NLEN];
1370+ object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1371+
1372+ switch (brand_type)
1373+ {
1374+ case 17:
1375+ if (o_ptr->tval == TV_SWORD)
1376+ {
1377+ act = _("は鋭さを増した!", "becomes very sharp!");
1378+
1379+ o_ptr->name2 = EGO_SHARPNESS;
1380+ o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, current_floor_ptr->dun_level) + 1;
1381+
1382+ if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
1383+ o_ptr->pval = 2;
1384+ }
1385+ else
1386+ {
1387+ act = _("は破壊力を増した!", "seems very powerful.");
1388+ o_ptr->name2 = EGO_EARTHQUAKES;
1389+ o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, current_floor_ptr->dun_level);
1390+ }
1391+ break;
1392+ case 16:
1393+ act = _("は人間の血を求めている!", "seems to be looking for humans!");
1394+ o_ptr->name2 = EGO_KILL_HUMAN;
1395+ break;
1396+ case 15:
1397+ act = _("は電撃に覆われた!", "covered with lightning!");
1398+ o_ptr->name2 = EGO_BRAND_ELEC;
1399+ break;
1400+ case 14:
1401+ act = _("は酸に覆われた!", "coated with acid!");
1402+ o_ptr->name2 = EGO_BRAND_ACID;
1403+ break;
1404+ case 13:
1405+ act = _("は邪悪なる怪物を求めている!", "seems to be looking for evil monsters!");
1406+ o_ptr->name2 = EGO_KILL_EVIL;
1407+ break;
1408+ case 12:
1409+ act = _("は異世界の住人の肉体を求めている!", "seems to be looking for demons!");
1410+ o_ptr->name2 = EGO_KILL_DEMON;
1411+ break;
1412+ case 11:
1413+ act = _("は屍を求めている!", "seems to be looking for undead!");
1414+ o_ptr->name2 = EGO_KILL_UNDEAD;
1415+ break;
1416+ case 10:
1417+ act = _("は動物の血を求めている!", "seems to be looking for animals!");
1418+ o_ptr->name2 = EGO_KILL_ANIMAL;
1419+ break;
1420+ case 9:
1421+ act = _("はドラゴンの血を求めている!", "seems to be looking for dragons!");
1422+ o_ptr->name2 = EGO_KILL_DRAGON;
1423+ break;
1424+ case 8:
1425+ act = _("はトロルの血を求めている!", "seems to be looking for troll!s");
1426+ o_ptr->name2 = EGO_KILL_TROLL;
1427+ break;
1428+ case 7:
1429+ act = _("はオークの血を求めている!", "seems to be looking for orcs!");
1430+ o_ptr->name2 = EGO_KILL_ORC;
1431+ break;
1432+ case 6:
1433+ act = _("は巨人の血を求めている!", "seems to be looking for giants!");
1434+ o_ptr->name2 = EGO_KILL_GIANT;
1435+ break;
1436+ case 5:
1437+ act = _("は非常に不安定になったようだ。", "seems very unstable now.");
1438+ o_ptr->name2 = EGO_TRUMP;
1439+ o_ptr->pval = randint1(2);
1440+ break;
1441+ case 4:
1442+ act = _("は血を求めている!", "thirsts for blood!");
1443+ o_ptr->name2 = EGO_VAMPIRIC;
1444+ break;
1445+ case 3:
1446+ act = _("は毒に覆われた。", "is coated with poison.");
1447+ o_ptr->name2 = EGO_BRAND_POIS;
1448+ break;
1449+ case 2:
1450+ act = _("は純ログルスに飲み込まれた。", "is engulfed in raw Logrus!");
1451+ o_ptr->name2 = EGO_CHAOTIC;
1452+ break;
1453+ case 1:
1454+ act = _("は炎のシールドに覆われた!", "is covered in a fiery shield!");
1455+ o_ptr->name2 = EGO_BRAND_FIRE;
1456+ break;
1457+ default:
1458+ act = _("は深く冷たいブルーに輝いた!", "glows deep, icy blue!");
1459+ o_ptr->name2 = EGO_BRAND_COLD;
1460+ break;
1461+ }
1462+
1463+ msg_format(_("あなたの%s%s", "Your %s %s"), o_name, act);
1464+ enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1465+
1466+ o_ptr->discount = 99;
1467+ chg_virtue(V_ENCHANT, 2);
1468+ }
1469+ else
1470+ {
1471+ if (flush_failure) flush();
1472+
1473+ msg_print(_("属性付加に失敗した。", "The Branding failed."));
1474+ chg_virtue(V_ENCHANT, -2);
1475+ }
1476+ calc_android_exp();
1477+}
--- a/src/spells-object.h
+++ b/src/spells-object.h
@@ -25,3 +25,4 @@ extern bool pulish_shield(void);
2525 #define ENCH_FORCE 0x08 /*!< 装備強化処理: 無条件に成功させる / Force enchantment */
2626 extern bool enchant(object_type *o_ptr, int n, int eflag);
2727 extern bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac);
28+extern void brand_weapon(int brand_type);
--- a/src/spells.h
+++ b/src/spells.h
@@ -295,7 +295,6 @@ extern bool recall_player(player_type *creature_ptr, TIME_EFFECT turns);
295295 extern bool free_level_recall(player_type *creature_ptr);
296296 extern bool reset_recall(void);
297297 extern bool apply_disenchant(BIT_FLAGS mode);
298-extern void brand_weapon(int brand_type);
299298 extern void call_the_(void);
300299 extern void fetch(DIRECTION dir, WEIGHT wgt, bool require_los);
301300 extern void alter_reality(void);
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -57,8 +57,6 @@
5757 #include "autopick.h"
5858 #include "targeting.h"
5959
60-#include "spells-object.h" // temp for brand_weapon()
61-
6260
6361 /*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
6462 #define MAX_TRIES 100
@@ -1027,150 +1025,6 @@ bool apply_disenchant(BIT_FLAGS mode)
10271025
10281026
10291027 /*!
1030- * @brief 武器へのエゴ付加処理 /
1031- * Brand the current weapon
1032- * @param brand_type エゴ化ID(e_info.txtとは連動していない)
1033- * @return なし
1034- */
1035-void brand_weapon(int brand_type)
1036-{
1037- OBJECT_IDX item;
1038- object_type *o_ptr;
1039- concptr q, s;
1040-
1041- /* Assume enchant weapon */
1042- item_tester_hook = object_allow_enchant_melee_weapon;
1043-
1044- q = _("どの武器を強化しますか? ", "Enchant which weapon? ");
1045- s = _("強化できる武器がない。", "You have nothing to enchant.");
1046-
1047- o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
1048- if (!o_ptr) return;
1049-
1050- /* you can never modify artifacts / ego-items */
1051- /* you can never modify cursed items */
1052- /* TY: You _can_ modify broken items (if you're silly enough) */
1053- if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
1054- !object_is_cursed(o_ptr) &&
1055- !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
1056- !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
1057- !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
1058- {
1059- concptr act = NULL;
1060-
1061- /* Let's get the name before it is changed... */
1062- GAME_TEXT o_name[MAX_NLEN];
1063- object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1064-
1065- switch (brand_type)
1066- {
1067- case 17:
1068- if (o_ptr->tval == TV_SWORD)
1069- {
1070- act = _("は鋭さを増した!", "becomes very sharp!");
1071-
1072- o_ptr->name2 = EGO_SHARPNESS;
1073- o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, current_floor_ptr->dun_level) + 1;
1074-
1075- if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
1076- o_ptr->pval = 2;
1077- }
1078- else
1079- {
1080- act = _("は破壊力を増した!", "seems very powerful.");
1081- o_ptr->name2 = EGO_EARTHQUAKES;
1082- o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, current_floor_ptr->dun_level);
1083- }
1084- break;
1085- case 16:
1086- act = _("は人間の血を求めている!", "seems to be looking for humans!");
1087- o_ptr->name2 = EGO_KILL_HUMAN;
1088- break;
1089- case 15:
1090- act = _("は電撃に覆われた!", "covered with lightning!");
1091- o_ptr->name2 = EGO_BRAND_ELEC;
1092- break;
1093- case 14:
1094- act = _("は酸に覆われた!", "coated with acid!");
1095- o_ptr->name2 = EGO_BRAND_ACID;
1096- break;
1097- case 13:
1098- act = _("は邪悪なる怪物を求めている!", "seems to be looking for evil monsters!");
1099- o_ptr->name2 = EGO_KILL_EVIL;
1100- break;
1101- case 12:
1102- act = _("は異世界の住人の肉体を求めている!", "seems to be looking for demons!");
1103- o_ptr->name2 = EGO_KILL_DEMON;
1104- break;
1105- case 11:
1106- act = _("は屍を求めている!", "seems to be looking for undead!");
1107- o_ptr->name2 = EGO_KILL_UNDEAD;
1108- break;
1109- case 10:
1110- act = _("は動物の血を求めている!", "seems to be looking for animals!");
1111- o_ptr->name2 = EGO_KILL_ANIMAL;
1112- break;
1113- case 9:
1114- act = _("はドラゴンの血を求めている!", "seems to be looking for dragons!");
1115- o_ptr->name2 = EGO_KILL_DRAGON;
1116- break;
1117- case 8:
1118- act = _("はトロルの血を求めている!", "seems to be looking for troll!s");
1119- o_ptr->name2 = EGO_KILL_TROLL;
1120- break;
1121- case 7:
1122- act = _("はオークの血を求めている!", "seems to be looking for orcs!");
1123- o_ptr->name2 = EGO_KILL_ORC;
1124- break;
1125- case 6:
1126- act = _("は巨人の血を求めている!", "seems to be looking for giants!");
1127- o_ptr->name2 = EGO_KILL_GIANT;
1128- break;
1129- case 5:
1130- act = _("は非常に不安定になったようだ。", "seems very unstable now.");
1131- o_ptr->name2 = EGO_TRUMP;
1132- o_ptr->pval = randint1(2);
1133- break;
1134- case 4:
1135- act = _("は血を求めている!", "thirsts for blood!");
1136- o_ptr->name2 = EGO_VAMPIRIC;
1137- break;
1138- case 3:
1139- act = _("は毒に覆われた。", "is coated with poison.");
1140- o_ptr->name2 = EGO_BRAND_POIS;
1141- break;
1142- case 2:
1143- act = _("は純ログルスに飲み込まれた。", "is engulfed in raw Logrus!");
1144- o_ptr->name2 = EGO_CHAOTIC;
1145- break;
1146- case 1:
1147- act = _("は炎のシールドに覆われた!", "is covered in a fiery shield!");
1148- o_ptr->name2 = EGO_BRAND_FIRE;
1149- break;
1150- default:
1151- act = _("は深く冷たいブルーに輝いた!", "glows deep, icy blue!");
1152- o_ptr->name2 = EGO_BRAND_COLD;
1153- break;
1154- }
1155-
1156- msg_format(_("あなたの%s%s", "Your %s %s"), o_name, act);
1157- enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
1158-
1159- o_ptr->discount = 99;
1160- chg_virtue(V_ENCHANT, 2);
1161- }
1162- else
1163- {
1164- if (flush_failure) flush();
1165-
1166- msg_print(_("属性付加に失敗した。", "The Branding failed."));
1167- chg_virtue(V_ENCHANT, -2);
1168- }
1169- calc_android_exp();
1170-}
1171-
1172-
1173-/*!
11741028 * @brief 虚無招来によるフロア中の全壁除去処理 /
11751029 * Vanish all walls in this floor
11761030 * @return 実際に処理が反映された場合TRUE
Show on old repository browser