#include "cmd-basic.h"
#include "artifact.h"
-#include "floor.h"
+#include "floor/floor.h"
#include "grid.h"
-#include "spells.h"
+#include "spell/spells3.h"
#include "spells-object.h"
-#include "object-boost.h"
-#include "object-hook.h"
-#include "object-flavor.h"
-#include "object-ego.h"
+#include "object/object-boost.h"
+#include "object/object-hook.h"
+#include "object/object-flavor.h"
+#include "object/object-ego.h"
#include "player-damage.h"
#include "player-status.h"
#include "avatar.h"
#include "player-effects.h"
#include "player-class.h"
-#include "objectkind.h"
-#include "autopick.h"
+#include "player-inventory.h"
+#include "object/object-kind.h"
+#include "autopick/autopick.h"
#include "targeting.h"
-#include "view-mainwindow.h"
+#include "view/display-main-window.h"
typedef struct
{ TV_SWORD, SV_BROKEN_SWORD, 5, AMS_NOTHING },
{ TV_SCROLL, SV_SCROLL_AMUSEMENT, 10, AMS_NOTHING },
- { 0, 0, 0 }
+ { 0, 0, 0, 0 }
};
/*!
* Hook to determine if an object is contertible in an arrow/bolt
* @return 製造を実際に行ったらTRUE、キャンセルしたらFALSEを返す
*/
-bool create_ammo(void)
+bool create_ammo(player_type *creature_ptr)
{
- int ext = 0;
- char ch;
-
- object_type forge;
- object_type *q_ptr;
-
char com[80];
- GAME_TEXT o_name[MAX_NLEN];
-
- q_ptr = &forge;
-
- if (p_ptr->lev >= 20)
+ if (creature_ptr->lev >= 20)
sprintf(com, _("[S]弾, [A]矢, [B]クロスボウの矢 :", "Create [S]hots, Create [A]rrow or Create [B]olt ?"));
- else if (p_ptr->lev >= 10)
+ else if (creature_ptr->lev >= 10)
sprintf(com, _("[S]弾, [A]矢:", "Create [S]hots or Create [A]rrow ?"));
else
sprintf(com, _("[S]弾:", "Create [S]hots ?"));
- if (cmd_limit_confused(p_ptr)) return FALSE;
- if (cmd_limit_blind(p_ptr)) return FALSE;
+ if (cmd_limit_confused(creature_ptr)) return FALSE;
+ if (cmd_limit_blind(creature_ptr)) return FALSE;
+ int ext = 0;
+ char ch;
while (TRUE)
{
if (!get_com(com, &ch, TRUE))
{
return FALSE;
}
+
if (ch == 'S' || ch == 's')
{
ext = 1;
break;
}
- if ((ch == 'A' || ch == 'a') && (p_ptr->lev >= 10))
+
+ if ((ch == 'A' || ch == 'a') && (creature_ptr->lev >= 10))
{
ext = 2;
break;
}
- if ((ch == 'B' || ch == 'b') && (p_ptr->lev >= 20))
+
+ if ((ch == 'B' || ch == 'b') && (creature_ptr->lev >= 20))
{
ext = 3;
break;
}
}
+ GAME_TEXT o_name[MAX_NLEN];
+ object_type forge;
+ object_type *q_ptr;
+ q_ptr = &forge;
+
/**********Create shots*********/
if (ext == 1)
{
DIRECTION dir;
grid_type *g_ptr;
- if (!get_rep_dir(&dir, FALSE)) return FALSE;
- y = p_ptr->y + ddy[dir];
- x = p_ptr->x + ddx[dir];
- g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ if (!get_rep_dir(creature_ptr, &dir, FALSE)) return FALSE;
+ y = creature_ptr->y + ddy[dir];
+ x = creature_ptr->x + ddx[dir];
+ g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_CAN_DIG))
{
- msg_print(_("そこには岩石がない。", "You need pile of rubble."));
+ msg_print(_("そこには岩石がない。", "You need a pile of rubble."));
return FALSE;
}
- else if (!cave_have_flag_grid(g_ptr, FF_CAN_DIG) || !cave_have_flag_grid(g_ptr, FF_HURT_ROCK))
+
+ if (!cave_have_flag_grid(g_ptr, FF_CAN_DIG) || !cave_have_flag_grid(g_ptr, FF_HURT_ROCK))
{
msg_print(_("硬すぎて崩せなかった。", "You failed to make ammo."));
+ return TRUE;
}
- else
- {
- s16b slot;
- q_ptr = &forge;
+
+ s16b slot;
+ q_ptr = &forge;
- /* Hack -- Give the player some small firestones */
- object_prep(q_ptr, lookup_kind(TV_SHOT, (OBJECT_SUBTYPE_VALUE)m_bonus(1, p_ptr->lev) + 1));
- q_ptr->number = (byte)rand_range(15, 30);
- object_aware(q_ptr);
- object_known(q_ptr);
- apply_magic(q_ptr, p_ptr->lev, AM_NO_FIXED_ART);
- q_ptr->discount = 99;
+ /* Hack -- Give the player some small firestones */
+ object_prep(q_ptr, lookup_kind(TV_SHOT, (OBJECT_SUBTYPE_VALUE)m_bonus(1, creature_ptr->lev) + 1));
+ q_ptr->number = (byte)rand_range(15, 30);
+ object_aware(creature_ptr, q_ptr);
+ object_known(q_ptr);
+ apply_magic(creature_ptr, q_ptr, creature_ptr->lev, AM_NO_FIXED_ART);
+ q_ptr->discount = 99;
- slot = inven_carry(q_ptr);
+ slot = inven_carry(creature_ptr, q_ptr);
- object_desc(o_name, q_ptr, 0);
- msg_format(_("%sを作った。", "You make some ammo."), o_name);
+ object_desc(creature_ptr, o_name, q_ptr, 0);
+ msg_format(_("%sを作った。", "You make some ammo."), o_name);
- /* Auto-inscription */
- if (slot >= 0) autopick_alter_item(slot, FALSE);
+ /* Auto-inscription */
+ if (slot >= 0) autopick_alter_item(creature_ptr, slot, FALSE);
- /* Destroy the wall */
- cave_alter_feat(y, x, FF_HURT_ROCK);
+ /* Destroy the wall */
+ cave_alter_feat(creature_ptr, y, x, FF_HURT_ROCK);
- p_ptr->update |= (PU_FLOW);
- }
+ creature_ptr->update |= (PU_FLOW);
+ return TRUE;
}
+
/**********Create arrows*********/
- else if (ext == 2)
+ if (ext == 2)
{
OBJECT_IDX item;
concptr q, s;
q = _("どのアイテムから作りますか? ", "Convert which item? ");
s = _("材料を持っていない。", "You have no item to convert.");
- q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
+ q_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
if (!q_ptr) return FALSE;
q_ptr = &forge;
/* Hack -- Give the player some small firestones */
- object_prep(q_ptr, lookup_kind(TV_ARROW, (OBJECT_SUBTYPE_VALUE)m_bonus(1, p_ptr->lev) + 1));
+ object_prep(q_ptr, lookup_kind(TV_ARROW, (OBJECT_SUBTYPE_VALUE)m_bonus(1, creature_ptr->lev) + 1));
q_ptr->number = (byte)rand_range(5, 10);
- object_aware(q_ptr);
+ object_aware(creature_ptr, q_ptr);
object_known(q_ptr);
- apply_magic(q_ptr, p_ptr->lev, AM_NO_FIXED_ART);
+ apply_magic(creature_ptr, q_ptr, creature_ptr->lev, AM_NO_FIXED_ART);
q_ptr->discount = 99;
- object_desc(o_name, q_ptr, 0);
+ object_desc(creature_ptr, o_name, q_ptr, 0);
msg_format(_("%sを作った。", "You make some ammo."), o_name);
- if (item >= 0)
- {
- inven_item_increase(item, -1);
- inven_item_describe(item);
- inven_item_optimize(item);
- }
- else
- {
- floor_item_increase(0 - item, -1);
- floor_item_describe(0 - item);
- floor_item_optimize(0 - item);
- }
-
- slot = inven_carry(q_ptr);
+ vary_item(creature_ptr, item, -1);
+ slot = inven_carry(creature_ptr, q_ptr);
/* Auto-inscription */
- if (slot >= 0) autopick_alter_item(slot, FALSE);
+ if (slot >= 0) autopick_alter_item(creature_ptr, slot, FALSE);
+ return TRUE;
}
+
/**********Create bolts*********/
- else if (ext == 3)
+ if (ext == 3)
{
OBJECT_IDX item;
concptr q, s;
q = _("どのアイテムから作りますか? ", "Convert which item? ");
s = _("材料を持っていない。", "You have no item to convert.");
- q_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
+ q_ptr = choose_object(creature_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
if (!q_ptr) return FALSE;
q_ptr = &forge;
/* Hack -- Give the player some small firestones */
- object_prep(q_ptr, lookup_kind(TV_BOLT, (OBJECT_SUBTYPE_VALUE)m_bonus(1, p_ptr->lev) + 1));
+ object_prep(q_ptr, lookup_kind(TV_BOLT, (OBJECT_SUBTYPE_VALUE)m_bonus(1, creature_ptr->lev) + 1));
q_ptr->number = (byte)rand_range(4, 8);
- object_aware(q_ptr);
+ object_aware(creature_ptr, q_ptr);
object_known(q_ptr);
- apply_magic(q_ptr, p_ptr->lev, AM_NO_FIXED_ART);
+ apply_magic(creature_ptr, q_ptr, creature_ptr->lev, AM_NO_FIXED_ART);
q_ptr->discount = 99;
- object_desc(o_name, q_ptr, 0);
+ object_desc(creature_ptr, o_name, q_ptr, 0);
msg_format(_("%sを作った。", "You make some ammo."), o_name);
- if (item >= 0)
- {
- inven_item_increase(item, -1);
- inven_item_describe(item);
- inven_item_optimize(item);
- }
- else
- {
- floor_item_increase(0 - item, -1);
- floor_item_describe(0 - item);
- floor_item_optimize(0 - item);
- }
+ vary_item(creature_ptr, item, -1);
- slot = inven_carry(q_ptr);
+ slot = inven_carry(creature_ptr, q_ptr);
/* Auto-inscription */
- if (slot >= 0) autopick_alter_item(slot, FALSE);
+ if (slot >= 0) autopick_alter_item(creature_ptr, slot, FALSE);
}
+
return TRUE;
}
+
/*!
* @brief 魔道具術師の魔力取り込み処理
+ * @param user_ptr アイテムを取り込むクリーチャー
* @return 取り込みを実行したらTRUE、キャンセルしたらFALSEを返す
*/
-bool import_magic_device(void)
+bool import_magic_device(player_type *user_ptr)
{
- OBJECT_IDX item;
- PARAMETER_VALUE pval;
- int ext = 0;
- concptr q, s;
- object_type *o_ptr;
- GAME_TEXT o_name[MAX_NLEN];
-
/* Only accept legal items */
item_tester_hook = item_tester_hook_recharge;
- q = _("どのアイテムの魔力を取り込みますか? ", "Gain power of which item? ");
- s = _("魔力を取り込めるアイテムがない。", "You have nothing to gain power.");
+ concptr q = _("どのアイテムの魔力を取り込みますか? ", "Gain power of which item? ");
+ concptr s = _("魔力を取り込めるアイテムがない。", "You have nothing to gain power.");
- o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
- if (!o_ptr) return (FALSE);
+ OBJECT_IDX item;
+ object_type *o_ptr;
+ o_ptr = choose_object(user_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
+ if (!o_ptr) return FALSE;
if (o_ptr->tval == TV_STAFF && o_ptr->sval == SV_STAFF_NOTHING)
{
return FALSE;
}
- pval = o_ptr->pval;
+ PARAMETER_VALUE pval = o_ptr->pval;
+ int ext = 0;
if (o_ptr->tval == TV_ROD)
ext = 72;
else if (o_ptr->tval == TV_WAND)
if (o_ptr->tval == TV_ROD)
{
- p_ptr->magic_num2[o_ptr->sval + ext] += (MAGIC_NUM2)o_ptr->number;
- if (p_ptr->magic_num2[o_ptr->sval + ext] > 99) p_ptr->magic_num2[o_ptr->sval + ext] = 99;
+ user_ptr->magic_num2[o_ptr->sval + ext] += (MAGIC_NUM2)o_ptr->number;
+ if (user_ptr->magic_num2[o_ptr->sval + ext] > 99) user_ptr->magic_num2[o_ptr->sval + ext] = 99;
}
else
{
{
int gain_num = pval;
if (o_ptr->tval == TV_WAND) gain_num = (pval + num - 1) / num;
- if (p_ptr->magic_num2[o_ptr->sval + ext])
+ if (user_ptr->magic_num2[o_ptr->sval + ext])
{
gain_num *= 256;
gain_num = (gain_num / 3 + randint0(gain_num / 3)) / 256;
if (gain_num < 1) gain_num = 1;
}
- p_ptr->magic_num2[o_ptr->sval + ext] += (MAGIC_NUM2)gain_num;
- if (p_ptr->magic_num2[o_ptr->sval + ext] > 99) p_ptr->magic_num2[o_ptr->sval + ext] = 99;
- p_ptr->magic_num1[o_ptr->sval + ext] += pval * 0x10000;
- if (p_ptr->magic_num1[o_ptr->sval + ext] > 99 * 0x10000) p_ptr->magic_num1[o_ptr->sval + ext] = 99 * 0x10000;
- if (p_ptr->magic_num1[o_ptr->sval + ext] > p_ptr->magic_num2[o_ptr->sval + ext] * 0x10000) p_ptr->magic_num1[o_ptr->sval + ext] = p_ptr->magic_num2[o_ptr->sval + ext] * 0x10000;
+ user_ptr->magic_num2[o_ptr->sval + ext] += (MAGIC_NUM2)gain_num;
+ if (user_ptr->magic_num2[o_ptr->sval + ext] > 99) user_ptr->magic_num2[o_ptr->sval + ext] = 99;
+ user_ptr->magic_num1[o_ptr->sval + ext] += pval * 0x10000;
+ if (user_ptr->magic_num1[o_ptr->sval + ext] > 99 * 0x10000) user_ptr->magic_num1[o_ptr->sval + ext] = 99 * 0x10000;
+ if (user_ptr->magic_num1[o_ptr->sval + ext] > user_ptr->magic_num2[o_ptr->sval + ext] * 0x10000) user_ptr->magic_num1[o_ptr->sval + ext] = user_ptr->magic_num2[o_ptr->sval + ext] * 0x10000;
if (o_ptr->tval == TV_WAND) pval -= (pval + num - 1) / num;
}
}
- object_desc(o_name, o_ptr, 0);
+ GAME_TEXT o_name[MAX_NLEN];
+ object_desc(user_ptr, o_name, o_ptr, 0);
msg_format(_("%sの魔力を取り込んだ。", "You absorb magic of %s."), o_name);
- /* Eliminate the item (from the pack) */
- if (item >= 0)
- {
- inven_item_increase(item, -999);
- inven_item_describe(item);
- inven_item_optimize(item);
- }
-
- /* Eliminate the item (from the floor) */
- else
- {
- floor_item_increase(0 - item, -999);
- floor_item_describe(0 - item);
- floor_item_optimize(0 - item);
- }
- take_turn(p_ptr, 100);
+ vary_item(user_ptr, item, -999);
+ take_turn(user_ptr, 100);
return TRUE;
}
+
/*!
* @brief 誰得ドロップを行う。
+ * @param creature_ptr プレーヤーへの参照ポインタ
* @param y1 配置したいフロアのY座標
* @param x1 配置したいフロアのX座標
* @param num 誰得の処理回数
* @param known TRUEならばオブジェクトが必ず*鑑定*済になる
* @return なし
*/
-void amusement(POSITION y1, POSITION x1, int num, bool known)
+void amusement(player_type *creature_ptr, POSITION y1, POSITION x1, int num, bool known)
{
- object_type *i_ptr;
- object_type object_type_body;
- int n, t = 0;
-
- for (n = 0; amuse_info[n].tval != 0; n++)
+ int t = 0;
+ for (int n = 0; amuse_info[n].tval != 0; n++)
{
t += amuse_info[n].prob;
}
/* Acquirement */
+ object_type *i_ptr;
+ object_type object_type_body;
while (num)
{
int i;
/* Make an object (if possible) */
object_prep(i_ptr, k_idx);
if (a_idx) i_ptr->name1 = a_idx;
- apply_magic(i_ptr, 1, AM_NO_FIXED_ART);
+ apply_magic(creature_ptr, i_ptr, 1, AM_NO_FIXED_ART);
if (amuse_info[i].flag & AMS_NO_UNIQUE)
{
if (known)
{
- object_aware(i_ptr);
+ object_aware(creature_ptr, i_ptr);
object_known(i_ptr);
}
/* Paranoia - reroll if nothing */
if (!(i_ptr->k_idx)) continue;
- (void)drop_near(i_ptr, -1, y1, x1);
+ (void)drop_near(creature_ptr, i_ptr, -1, y1, x1);
num--;
}
}
-
/*!
* @brief 獲得ドロップを行う。
* Scatter some "great" objects near the player
+ * @param caster_ptr プレーヤーへの参照ポインタ
* @param y1 配置したいフロアのY座標
* @param x1 配置したいフロアのX座標
* @param num 獲得の処理回数
* @param known TRUEならばオブジェクトが必ず*鑑定*済になる
* @return なし
*/
-void acquirement(POSITION y1, POSITION x1, int num, bool great, bool special, bool known)
+void acquirement(player_type *caster_ptr, POSITION y1, POSITION x1, int num, bool great, bool special, bool known)
{
object_type *i_ptr;
object_type object_type_body;
object_wipe(i_ptr);
/* Make a good (or great) object (if possible) */
- if (!make_object(i_ptr, mode)) continue;
+ if (!make_object(caster_ptr, i_ptr, mode)) continue;
if (known)
{
- object_aware(i_ptr);
+ object_aware(caster_ptr, i_ptr);
object_known(i_ptr);
}
- (void)drop_near(i_ptr, -1, y1, x1);
+ (void)drop_near(caster_ptr, i_ptr, -1, y1, x1);
}
}
+
void acquire_chaos_weapon(player_type *creature_ptr)
{
object_type forge;
}
object_prep(q_ptr, lookup_kind(dummy, dummy2));
- q_ptr->to_h = 3 + randint1(current_floor_ptr->dun_level) % 10;
- q_ptr->to_d = 3 + randint1(current_floor_ptr->dun_level) % 10;
+ q_ptr->to_h = 3 + randint1(creature_ptr->current_floor_ptr->dun_level) % 10;
+ q_ptr->to_d = 3 + randint1(creature_ptr->current_floor_ptr->dun_level) % 10;
one_resistance(q_ptr);
q_ptr->name2 = EGO_CHAOTIC;
- (void)drop_near(q_ptr, -1, creature_ptr->y, creature_ptr->x);
+ (void)drop_near(creature_ptr, q_ptr, -1, creature_ptr->y, creature_ptr->x);
}
/*!
- * @brief 防具呪縛処理 /
+* todo 元のreturnは間違っているが、修正後の↓文がどれくらい正しいかは要チェック
+ * @brief 防具呪縛処理 /
* Curse the players armor
- * @return 実際に呪縛されたらTRUEを返す
+ * @return 何も持っていない場合を除き、常にTRUEを返す
*/
-bool curse_armor(void)
+bool curse_armor(player_type *owner_ptr)
{
- int i;
- object_type *o_ptr;
-
- GAME_TEXT o_name[MAX_NLEN];
-
/* Curse the body armor */
- o_ptr = &p_ptr->inventory_list[INVEN_BODY];
+ object_type *o_ptr;
+ o_ptr = &owner_ptr->inventory_list[INVEN_BODY];
- /* Nothing to curse */
- if (!o_ptr->k_idx) return (FALSE);
+ if (!o_ptr->k_idx) return FALSE;
- object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
+ GAME_TEXT o_name[MAX_NLEN];
+ object_desc(owner_ptr, o_name, o_ptr, OD_OMIT_PREFIX);
/* Attempt a saving throw for artifacts */
if (object_is_artifact(o_ptr) && (randint0(100) < 50))
msg_format("A %s tries to %s, but your %s resists the effects!",
"terrible black aura", "surround your armor", o_name);
#endif
-
+ return TRUE;
}
/* not artifact or failed save... */
- else
- {
- msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
- chg_virtue(V_ENCHANT, -5);
-
- /* Blast the armor */
- o_ptr->name1 = 0;
- o_ptr->name2 = EGO_BLASTED;
- o_ptr->to_a = 0 - randint1(5) - randint1(5);
- o_ptr->to_h = 0;
- o_ptr->to_d = 0;
- o_ptr->ac = 0;
- o_ptr->dd = 0;
- o_ptr->ds = 0;
-
- for (i = 0; i < TR_FLAG_SIZE; i++)
- o_ptr->art_flags[i] = 0;
-
- /* Curse it */
- o_ptr->curse_flags = TRC_CURSED;
-
- /* Break it */
- o_ptr->ident |= (IDENT_BROKEN);
- p_ptr->update |= (PU_BONUS | PU_MANA);
- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
- }
-
- return (TRUE);
+ msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
+ chg_virtue(owner_ptr, V_ENCHANT, -5);
+
+ /* Blast the armor */
+ o_ptr->name1 = 0;
+ o_ptr->name2 = EGO_BLASTED;
+ o_ptr->to_a = 0 - randint1(5) - randint1(5);
+ o_ptr->to_h = 0;
+ o_ptr->to_d = 0;
+ o_ptr->ac = 0;
+ o_ptr->dd = 0;
+ o_ptr->ds = 0;
+
+ for (int i = 0; i < TR_FLAG_SIZE; i++)
+ o_ptr->art_flags[i] = 0;
+
+ /* Curse it */
+ o_ptr->curse_flags = TRC_CURSED;
+
+ /* Break it */
+ o_ptr->ident |= (IDENT_BROKEN);
+ owner_ptr->update |= (PU_BONUS | PU_MANA);
+ owner_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+ return TRUE;
}
+
/*!
+ * todo 元のreturnは間違っているが、修正後の↓文がどれくらい正しいかは要チェック
* @brief 武器呪縛処理 /
* Curse the players weapon
+ * @param owner_ptr 所持者の参照ポインタ
* @param force 無条件に呪縛を行うならばTRUE
* @param o_ptr 呪縛する武器のアイテム情報参照ポインタ
- * @return 実際に呪縛されたらTRUEを返す
+ * @return 何も持っていない場合を除き、常にTRUEを返す
*/
-bool curse_weapon_object(bool force, object_type *o_ptr)
+bool curse_weapon_object(player_type *owner_ptr, bool force, object_type *o_ptr)
{
- int i;
- GAME_TEXT o_name[MAX_NLEN];
+ if (!o_ptr->k_idx) return FALSE;
- /* Nothing to curse */
- if (!o_ptr->k_idx) return (FALSE);
- object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
+ GAME_TEXT o_name[MAX_NLEN];
+ object_desc(owner_ptr, o_name, o_ptr, OD_OMIT_PREFIX);
/* Attempt a saving throw */
if (object_is_artifact(o_ptr) && (randint0(100) < 50) && !force)
{
- /* Cool */
#ifdef JP
msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返した!",
"恐怖の暗黒オーラ", "武器", o_name);
msg_format("A %s tries to %s, but your %s resists the effects!",
"terrible black aura", "surround your weapon", o_name);
#endif
+ return TRUE;
}
/* not artifact or failed save... */
- else
- {
- if (!force) msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
- chg_virtue(V_ENCHANT, -5);
-
- /* Shatter the weapon */
- o_ptr->name1 = 0;
- o_ptr->name2 = EGO_SHATTERED;
- o_ptr->to_h = 0 - randint1(5) - randint1(5);
- o_ptr->to_d = 0 - randint1(5) - randint1(5);
- o_ptr->to_a = 0;
- o_ptr->ac = 0;
- o_ptr->dd = 0;
- o_ptr->ds = 0;
-
- for (i = 0; i < TR_FLAG_SIZE; i++)
- o_ptr->art_flags[i] = 0;
-
- /* Curse it */
- o_ptr->curse_flags = TRC_CURSED;
-
- /* Break it */
- o_ptr->ident |= (IDENT_BROKEN);
- p_ptr->update |= (PU_BONUS | PU_MANA);
- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
- }
-
- return (TRUE);
-}
-
-/*!
- * @brief 武器呪縛処理のメインルーチン /
- * Curse the players weapon
- * @param force 無条件に呪縛を行うならばTRUE
- * @param slot 呪縛する武器の装備スロット
- * @return 実際に呪縛されたらTRUEを返す
- */
-bool curse_weapon(bool force, int slot)
-{
- return curse_weapon_object(force, &p_ptr->inventory_list[slot]);
+ if (!force) msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
+ chg_virtue(owner_ptr, V_ENCHANT, -5);
+
+ /* Shatter the weapon */
+ o_ptr->name1 = 0;
+ o_ptr->name2 = EGO_SHATTERED;
+ o_ptr->to_h = 0 - randint1(5) - randint1(5);
+ o_ptr->to_d = 0 - randint1(5) - randint1(5);
+ o_ptr->to_a = 0;
+ o_ptr->ac = 0;
+ o_ptr->dd = 0;
+ o_ptr->ds = 0;
+
+ for (int i = 0; i < TR_FLAG_SIZE; i++)
+ o_ptr->art_flags[i] = 0;
+
+ /* Curse it */
+ o_ptr->curse_flags = TRC_CURSED;
+
+ /* Break it */
+ o_ptr->ident |= (IDENT_BROKEN);
+ owner_ptr->update |= (PU_BONUS | PU_MANA);
+ owner_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+ return TRUE;
}
/*!
* @brief 防具の錆止め防止処理
+ * @param caster_ptr 錆止め実行者の参照ポインタ
* @return ターン消費を要する処理を行ったならばTRUEを返す
*/
-bool rustproof(void)
+bool rustproof(player_type *caster_ptr)
{
- OBJECT_IDX item;
- object_type *o_ptr;
- GAME_TEXT o_name[MAX_NLEN];
- concptr q, s;
-
/* Select a piece of armour */
item_tester_hook = object_is_armour;
- q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? ");
- s = _("錆止めできるものがありません。", "You have nothing to rustproof.");
+ concptr q = _("どの防具に錆止めをしますか?", "Rustproof which piece of armour? ");
+ concptr s = _("錆止めできるものがありません。", "You have nothing to rustproof.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+ OBJECT_IDX item;
+ object_type *o_ptr;
+ o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
if (!o_ptr) return FALSE;
- object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+ GAME_TEXT o_name[MAX_NLEN];
+ object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
msg_format("%s %s %s now protected against corrosion.", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "are" : "is"));
#endif
- calc_android_exp();
+ calc_android_exp(caster_ptr);
return TRUE;
}
+
/*!
* @brief ボルトのエゴ化処理(火炎エゴのみ) /
* Enchant some bolts
- * @return 常にTRUEを返す
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @return なし
*/
-bool brand_bolts(void)
+void brand_bolts(player_type *caster_ptr)
{
- int i;
-
/* Use the first acceptable bolts */
- for (i = 0; i < INVEN_PACK; i++)
+ for (int i = 0; i < INVEN_PACK; i++)
{
- object_type *o_ptr = &p_ptr->inventory_list[i];
+ object_type *o_ptr = &caster_ptr->inventory_list[i];
/* Skip non-bolts */
if (o_ptr->tval != TV_BOLT) continue;
/* Ego-item */
o_ptr->name2 = EGO_FLAME;
- enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
- return (TRUE);
+ enchant(caster_ptr, o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
+ return;
}
if (flush_failure) flush();
-
- /* Fail */
msg_print(_("炎で強化するのに失敗した。", "The fiery enchantment failed."));
-
- return (TRUE);
}
-bool perilous_secrets(player_type *creature_ptr)
+bool perilous_secrets(player_type *user_ptr)
{
- if (!ident_spell(FALSE)) return FALSE;
+ if (!ident_spell(user_ptr, FALSE, 0)) return FALSE;
if (mp_ptr->spell_book)
{
/* Sufficient mana */
- if (20 <= creature_ptr->csp)
+ if (20 <= user_ptr->csp)
{
/* Use some mana */
- creature_ptr->csp -= 20;
+ user_ptr->csp -= 20;
}
/* Over-exert the player */
else
{
- int oops = 20 - creature_ptr->csp;
+ int oops = 20 - user_ptr->csp;
/* No mana left */
- creature_ptr->csp = 0;
- creature_ptr->csp_frac = 0;
+ user_ptr->csp = 0;
+ user_ptr->csp_frac = 0;
msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
/* Hack -- Bypass free action */
- (void)set_paralyzed(creature_ptr->paralyzed + randint1(5 * oops + 1));
+ (void)set_paralyzed(user_ptr, user_ptr->paralyzed + randint1(5 * oops + 1));
/* Confusing. */
- (void)set_confused(creature_ptr->confused + randint1(5 * oops + 1));
+ (void)set_confused(user_ptr, user_ptr->confused + randint1(5 * oops + 1));
}
- creature_ptr->redraw |= (PR_MANA);
+
+ user_ptr->redraw |= (PR_MANA);
}
- take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
+
+ take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
/* Confusing. */
- if (one_in_(5)) (void)set_confused(creature_ptr->confused + randint1(10));
+ if (one_in_(5)) (void)set_confused(user_ptr, user_ptr->confused + randint1(10));
/* Exercise a little care... */
- if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
+ if (one_in_(20)) take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
return TRUE;
-
}
+
/*!
* @brief 固定アーティファクト『ブラッディムーン』の特性を変更する。
* @details スレイ2d2種、及びone_resistance()による耐性1d2種、pval2種を得る。
*/
void get_bloody_moon_flags(object_type *o_ptr)
{
- int dummy, i;
-
- for (i = 0; i < TR_FLAG_SIZE; i++)
+ for (int i = 0; i < TR_FLAG_SIZE; i++)
o_ptr->art_flags[i] = a_info[ART_BLOOD].flags[i];
- dummy = randint1(2) + randint1(2);
- for (i = 0; i < dummy; i++)
+ int dummy = randint1(2) + randint1(2);
+ for (int i = 0; i < dummy; i++)
{
int flag = randint0(26);
if (flag >= 20) add_flag(o_ptr->art_flags, TR_KILL_UNDEAD + flag - 20);
}
dummy = randint1(2);
- for (i = 0; i < dummy; i++) one_resistance(o_ptr);
+ for (int i = 0; i < dummy; i++) one_resistance(o_ptr);
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
int tmp = randint0(11);
if (tmp < A_MAX) add_flag(o_ptr->art_flags, TR_STR + tmp);
}
}
+
/*!
* @brief 寿命つき光源の燃素追加処理 /
* Charge a lite (torch or latern)
* @return なし
*/
-void phlogiston(void)
+void phlogiston(player_type *caster_ptr)
{
GAME_TURN max_flog = 0;
- object_type * o_ptr = &p_ptr->inventory_list[INVEN_LITE];
+ object_type *o_ptr = &caster_ptr->inventory_list[INVEN_LITE];
/* It's a lamp */
if ((o_ptr->tval == TV_LITE) && (o_ptr->sval == SV_LITE_LANTERN))
msg_print(_("照明用アイテムは満タンになった。", "Your light item is full."));
}
- p_ptr->update |= (PU_TORCH);
+ caster_ptr->update |= (PU_TORCH);
}
+
/*!
* @brief 武器の祝福処理 /
* Bless a weapon
* @return ターン消費を要する処理を行ったならばTRUEを返す
*/
-bool bless_weapon(void)
+bool bless_weapon(player_type *caster_ptr)
{
- OBJECT_IDX item;
- object_type *o_ptr;
- BIT_FLAGS flgs[TR_FLAG_SIZE];
- GAME_TEXT o_name[MAX_NLEN];
- concptr q, s;
-
/* Bless only weapons */
item_tester_hook = object_is_weapon;
- q = _("どのアイテムを祝福しますか?", "Bless which weapon? ");
- s = _("祝福できる武器がありません。", "You have weapon to bless.");
+ concptr q = _("どのアイテムを祝福しますか?", "Bless which weapon? ");
+ concptr s = _("祝福できる武器がありません。", "You have weapon to bless.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+ OBJECT_IDX item;
+ object_type *o_ptr;
+ o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
if (!o_ptr) return FALSE;
- object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+ GAME_TEXT o_name[MAX_NLEN];
+ object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
object_flags(o_ptr, flgs);
if (object_is_cursed(o_ptr))
o_ptr->feeling = FEEL_NONE;
/* Recalculate the bonuses */
- p_ptr->update |= (PU_BONUS);
- p_ptr->window |= (PW_EQUIP);
+ caster_ptr->update |= (PU_BONUS);
+ caster_ptr->window |= (PW_EQUIP);
}
/*
}
}
- p_ptr->update |= (PU_BONUS);
- p_ptr->window |= (PW_EQUIP | PW_PLAYER);
- calc_android_exp();
+ caster_ptr->update |= (PU_BONUS);
+ caster_ptr->window |= (PW_EQUIP | PW_PLAYER);
+ calc_android_exp(caster_ptr);
return TRUE;
}
* pulish shield
* @return ターン消費を要する処理を行ったならばTRUEを返す
*/
-bool pulish_shield(void)
+bool pulish_shield(player_type *caster_ptr)
{
+ concptr q = _("どの盾を磨きますか?", "Pulish which weapon? ");
+ concptr s = _("磨く盾がありません。", "You have weapon to pulish.");
+
OBJECT_IDX item;
object_type *o_ptr;
- BIT_FLAGS flgs[TR_FLAG_SIZE];
- GAME_TEXT o_name[MAX_NLEN];
- concptr q, s;
-
- /* Assume enchant weapon */
- item_tester_tval = TV_SHIELD;
-
- q = _("どの盾を磨きますか?", "Pulish which weapon? ");
- s = _("磨く盾がありません。", "You have weapon to pulish.");
-
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+ o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), TV_SHIELD);
if (!o_ptr) return FALSE;
- object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+ GAME_TEXT o_name[MAX_NLEN];
+ object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+ BIT_FLAGS flgs[TR_FLAG_SIZE];
object_flags(o_ptr, flgs);
- if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
- !object_is_cursed(o_ptr) && (o_ptr->sval != SV_MIRROR_SHIELD))
+ bool is_pulish_successful = o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr);
+ is_pulish_successful &= !object_is_cursed(o_ptr);
+ is_pulish_successful &= (o_ptr->sval != SV_MIRROR_SHIELD);
+ if (is_pulish_successful)
{
#ifdef JP
msg_format("%sは輝いた!", o_name);
msg_format("%s %s shine%s!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s"));
#endif
o_ptr->name2 = EGO_REFLECTION;
- enchant(o_ptr, randint0(3) + 4, ENCH_TOAC);
+ enchant(caster_ptr, o_ptr, randint0(3) + 4, ENCH_TOAC);
o_ptr->discount = 99;
- chg_virtue(V_ENCHANT, 2);
+ chg_virtue(caster_ptr, V_ENCHANT, 2);
return TRUE;
}
- else
- {
- if (flush_failure) flush();
- msg_print(_("失敗した。", "Failed."));
- chg_virtue(V_ENCHANT, -2);
- }
- calc_android_exp();
+ if (flush_failure) flush();
+ msg_print(_("失敗した。", "Failed."));
+ chg_virtue(caster_ptr, V_ENCHANT, -2);
+ calc_android_exp(caster_ptr);
return FALSE;
}
+
/*!
* @brief 呪いの打ち破り処理 /
* Break the curse of an item
*/
static void break_curse(object_type *o_ptr)
{
- if (object_is_cursed(o_ptr) && !(o_ptr->curse_flags & TRC_PERMA_CURSE) && !(o_ptr->curse_flags & TRC_HEAVY_CURSE) && (randint0(100) < 25))
+ BIT_FLAGS is_curse_broken = object_is_cursed(o_ptr) &&
+ !(o_ptr->curse_flags & TRC_PERMA_CURSE) &&
+ !(o_ptr->curse_flags & TRC_HEAVY_CURSE) &&
+ (randint0(100) < 25);
+ if (!is_curse_broken)
{
- msg_print(_("かけられていた呪いが打ち破られた!", "The curse is broken!"));
-
- o_ptr->curse_flags = 0L;
- o_ptr->ident |= (IDENT_SENSE);
- o_ptr->feeling = FEEL_NONE;
+ return;
}
+
+ msg_print(_("かけられていた呪いが打ち破られた!", "The curse is broken!"));
+
+ o_ptr->curse_flags = 0L;
+ o_ptr->ident |= (IDENT_SENSE);
+ o_ptr->feeling = FEEL_NONE;
}
+
/*!
* @brief 装備修正強化処理 /
* Enchants a plus onto an item. -RAK-
+ * @param caster_ptr プレーヤーへの参照ポインタ
* @param o_ptr 強化するアイテムの参照ポインタ
* @param n 強化基本量
* @param eflag 強化オプション(命中/ダメージ/AC)
* the larger the pile, the lower the chance of success.
* </pre>
*/
-bool enchant(object_type *o_ptr, int n, int eflag)
+bool enchant(player_type *caster_ptr, object_type *o_ptr, int n, int eflag)
{
- int i, chance, prob;
- bool res = FALSE;
- bool a = object_is_artifact(o_ptr);
- bool force = (eflag & ENCH_FORCE);
-
/* Large piles resist enchantment */
- prob = o_ptr->number * 100;
+ int prob = o_ptr->number * 100;
/* Missiles are easy to enchant */
if ((o_ptr->tval == TV_BOLT) ||
}
/* Try "n" times */
- for (i = 0; i < n; i++)
+ int chance;
+ bool res = FALSE;
+ bool a = object_is_artifact(o_ptr);
+ bool force = (eflag & ENCH_FORCE);
+ for (int i = 0; i < n; i++)
{
/* Hack -- Roll for pile resistance */
if (!force && randint0(prob) >= 100) continue;
}
/* Enchant to armor class */
- if (eflag & ENCH_TOAC)
+ if (!(eflag & ENCH_TOAC))
{
- if (o_ptr->to_a < 0) chance = 0;
- else if (o_ptr->to_a > 15) chance = 1000;
- else chance = enchant_table[o_ptr->to_a];
+ continue;
+ }
- if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
- {
- o_ptr->to_a++;
- res = TRUE;
+ if (o_ptr->to_a < 0) chance = 0;
+ else if (o_ptr->to_a > 15) chance = 1000;
+ else chance = enchant_table[o_ptr->to_a];
- /* only when you get it above -1 -CFT */
- if (o_ptr->to_a >= 0)
- break_curse(o_ptr);
- }
+ if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
+ {
+ o_ptr->to_a++;
+ res = TRUE;
+
+ /* only when you get it above -1 -CFT */
+ if (o_ptr->to_a >= 0)
+ break_curse(o_ptr);
}
}
/* Failure */
- if (!res) return (FALSE);
- p_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
+ if (!res) return FALSE;
+ caster_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
+ caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
- calc_android_exp();
+ calc_android_exp(caster_ptr);
/* Success */
- return (TRUE);
+ return TRUE;
}
/*!
* @brief 装備修正強化処理のメインルーチン /
- * Enchant an item (in the p_ptr->inventory_list or on the floor)
+ * Enchant an item (in the inventory or on the floor)
+ * @param caster_ptr プレーヤーへの参照ポインタ
* @param num_hit 命中修正量
* @param num_dam ダメージ修正量
* @param num_ac AC修正量
* Note that "num_ac" requires armour, else weapon
* Returns TRUE if attempted, FALSE if cancelled
*/
-bool enchant_spell(HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
+bool enchant_spell(player_type *caster_ptr, HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
{
- OBJECT_IDX item;
- bool okay = FALSE;
- object_type *o_ptr;
- GAME_TEXT o_name[MAX_NLEN];
- concptr q, s;
-
/* Assume enchant weapon */
item_tester_hook = object_allow_enchant_weapon;
/* Enchant armor if requested */
if (num_ac) item_tester_hook = object_is_armour;
- q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
- s = _("強化できるアイテムがない。", "You have nothing to enchant.");
+ concptr q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
+ concptr s = _("強化できるアイテムがない。", "You have nothing to enchant.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
- if (!o_ptr) return (FALSE);
+ OBJECT_IDX item;
+ object_type *o_ptr;
+ o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+ if (!o_ptr) return FALSE;
- object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+ GAME_TEXT o_name[MAX_NLEN];
+ object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
#ifdef JP
msg_format("%s は明るく輝いた!", o_name);
#else
#endif
/* Enchant */
- if (enchant(o_ptr, num_hit, ENCH_TOHIT)) okay = TRUE;
- if (enchant(o_ptr, num_dam, ENCH_TODAM)) okay = TRUE;
- if (enchant(o_ptr, num_ac, ENCH_TOAC)) okay = TRUE;
+ bool is_enchant_successful = FALSE;
+ if (enchant(caster_ptr, o_ptr, num_hit, ENCH_TOHIT)) is_enchant_successful = TRUE;
+ if (enchant(caster_ptr, o_ptr, num_dam, ENCH_TODAM)) is_enchant_successful = TRUE;
+ if (enchant(caster_ptr, o_ptr, num_ac, ENCH_TOAC)) is_enchant_successful = TRUE;
- /* Failure */
- if (!okay)
+ if (!is_enchant_successful)
{
if (flush_failure) flush();
msg_print(_("強化に失敗した。", "The enchantment failed."));
- if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
+ if (one_in_(3)) chg_virtue(caster_ptr, V_ENCHANT, -1);
}
else
- chg_virtue(V_ENCHANT, 1);
+ chg_virtue(caster_ptr, V_ENCHANT, 1);
- calc_android_exp();
+ calc_android_exp(caster_ptr);
/* Something happened */
- return (TRUE);
+ return TRUE;
}
-
/*!
* @brief 武器へのエゴ付加処理 /
* Brand the current weapon
+ * @param caster_ptr プレーヤーへの参照ポインタ
* @param brand_type エゴ化ID(e_info.txtとは連動していない)
* @return なし
*/
-void brand_weapon(int brand_type)
+void brand_weapon(player_type *caster_ptr, int brand_type)
{
- OBJECT_IDX item;
- object_type *o_ptr;
- concptr q, s;
-
/* Assume enchant weapon */
item_tester_hook = object_allow_enchant_melee_weapon;
- q = _("どの武器を強化しますか? ", "Enchant which weapon? ");
- s = _("強化できる武器がない。", "You have nothing to enchant.");
+ concptr q = _("どの武器を強化しますか? ", "Enchant which weapon? ");
+ concptr s = _("強化できる武器がない。", "You have nothing to enchant.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
+ OBJECT_IDX item;
+ object_type *o_ptr;
+ o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
if (!o_ptr) return;
- /* you can never modify artifacts / ego-items */
- /* you can never modify cursed items */
- /* TY: You _can_ modify broken items (if you're silly enough) */
- if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
+ bool is_special_item = o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
!object_is_cursed(o_ptr) &&
- !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
+ !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) &&
!((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
- !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
+ !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE));
+ if (!is_special_item)
{
- concptr act = NULL;
+ if (flush_failure) flush();
- /* Let's get the name before it is changed... */
- GAME_TEXT o_name[MAX_NLEN];
- object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+ msg_print(_("属性付加に失敗した。", "The branding failed."));
+ chg_virtue(caster_ptr, V_ENCHANT, -2);
+ calc_android_exp(caster_ptr);
+ return;
+ }
+
+ /* Let's get the name before it is changed... */
+ GAME_TEXT o_name[MAX_NLEN];
+ object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
- switch (brand_type)
+ concptr act = NULL;
+ switch (brand_type)
+ {
+ case 17:
+ if (o_ptr->tval == TV_SWORD)
{
- case 17:
- if (o_ptr->tval == TV_SWORD)
- {
- act = _("は鋭さを増した!", "becomes very sharp!");
+ act = _("は鋭さを増した!", "becomes very sharp!");
- o_ptr->name2 = EGO_SHARPNESS;
- o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, current_floor_ptr->dun_level) + 1;
+ o_ptr->name2 = EGO_SHARPNESS;
+ o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, caster_ptr->current_floor_ptr->dun_level) + 1;
- if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
- o_ptr->pval = 2;
- }
- else
- {
- act = _("は破壊力を増した!", "seems very powerful.");
- o_ptr->name2 = EGO_EARTHQUAKES;
- o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, current_floor_ptr->dun_level);
- }
- break;
- case 16:
- act = _("は人間の血を求めている!", "seems to be looking for humans!");
- o_ptr->name2 = EGO_KILL_HUMAN;
- break;
- case 15:
- act = _("は電撃に覆われた!", "covered with lightning!");
- o_ptr->name2 = EGO_BRAND_ELEC;
- break;
- case 14:
- act = _("は酸に覆われた!", "coated with acid!");
- o_ptr->name2 = EGO_BRAND_ACID;
- break;
- case 13:
- act = _("は邪悪なる怪物を求めている!", "seems to be looking for evil monsters!");
- o_ptr->name2 = EGO_KILL_EVIL;
- break;
- case 12:
- act = _("は異世界の住人の肉体を求めている!", "seems to be looking for demons!");
- o_ptr->name2 = EGO_KILL_DEMON;
- break;
- case 11:
- act = _("は屍を求めている!", "seems to be looking for undead!");
- o_ptr->name2 = EGO_KILL_UNDEAD;
- break;
- case 10:
- act = _("は動物の血を求めている!", "seems to be looking for animals!");
- o_ptr->name2 = EGO_KILL_ANIMAL;
- break;
- case 9:
- act = _("はドラゴンの血を求めている!", "seems to be looking for dragons!");
- o_ptr->name2 = EGO_KILL_DRAGON;
- break;
- case 8:
- act = _("はトロルの血を求めている!", "seems to be looking for troll!s");
- o_ptr->name2 = EGO_KILL_TROLL;
- break;
- case 7:
- act = _("はオークの血を求めている!", "seems to be looking for orcs!");
- o_ptr->name2 = EGO_KILL_ORC;
- break;
- case 6:
- act = _("は巨人の血を求めている!", "seems to be looking for giants!");
- o_ptr->name2 = EGO_KILL_GIANT;
- break;
- case 5:
- act = _("は非常に不安定になったようだ。", "seems very unstable now.");
- o_ptr->name2 = EGO_TRUMP;
- o_ptr->pval = randint1(2);
- break;
- case 4:
- act = _("は血を求めている!", "thirsts for blood!");
- o_ptr->name2 = EGO_VAMPIRIC;
- break;
- case 3:
- act = _("は毒に覆われた。", "is coated with poison.");
- o_ptr->name2 = EGO_BRAND_POIS;
- break;
- case 2:
- act = _("は純ログルスに飲み込まれた。", "is engulfed in raw Logrus!");
- o_ptr->name2 = EGO_CHAOTIC;
- break;
- case 1:
- act = _("は炎のシールドに覆われた!", "is covered in a fiery shield!");
- o_ptr->name2 = EGO_BRAND_FIRE;
- break;
- default:
- act = _("は深く冷たいブルーに輝いた!", "glows deep, icy blue!");
- o_ptr->name2 = EGO_BRAND_COLD;
- break;
+ if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
+ o_ptr->pval = 2;
+ }
+ else
+ {
+ act = _("は破壊力を増した!", "seems very powerful.");
+ o_ptr->name2 = EGO_EARTHQUAKES;
+ o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, caster_ptr->current_floor_ptr->dun_level);
}
- msg_format(_("あなたの%s%s", "Your %s %s"), o_name, act);
- enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
-
- o_ptr->discount = 99;
- chg_virtue(V_ENCHANT, 2);
+ break;
+ case 16:
+ act = _("は人間の血を求めている!", "seems to be looking for humans!");
+ o_ptr->name2 = EGO_KILL_HUMAN;
+ break;
+ case 15:
+ act = _("は電撃に覆われた!", "covered with lightning!");
+ o_ptr->name2 = EGO_BRAND_ELEC;
+ break;
+ case 14:
+ act = _("は酸に覆われた!", "coated with acid!");
+ o_ptr->name2 = EGO_BRAND_ACID;
+ break;
+ case 13:
+ act = _("は邪悪なる怪物を求めている!", "seems to be looking for evil monsters!");
+ o_ptr->name2 = EGO_KILL_EVIL;
+ break;
+ case 12:
+ act = _("は異世界の住人の肉体を求めている!", "seems to be looking for demons!");
+ o_ptr->name2 = EGO_KILL_DEMON;
+ break;
+ case 11:
+ act = _("は屍を求めている!", "seems to be looking for undead!");
+ o_ptr->name2 = EGO_KILL_UNDEAD;
+ break;
+ case 10:
+ act = _("は動物の血を求めている!", "seems to be looking for animals!");
+ o_ptr->name2 = EGO_KILL_ANIMAL;
+ break;
+ case 9:
+ act = _("はドラゴンの血を求めている!", "seems to be looking for dragons!");
+ o_ptr->name2 = EGO_KILL_DRAGON;
+ break;
+ case 8:
+ act = _("はトロルの血を求めている!", "seems to be looking for troll!s");
+ o_ptr->name2 = EGO_KILL_TROLL;
+ break;
+ case 7:
+ act = _("はオークの血を求めている!", "seems to be looking for orcs!");
+ o_ptr->name2 = EGO_KILL_ORC;
+ break;
+ case 6:
+ act = _("は巨人の血を求めている!", "seems to be looking for giants!");
+ o_ptr->name2 = EGO_KILL_GIANT;
+ break;
+ case 5:
+ act = _("は非常に不安定になったようだ。", "seems very unstable now.");
+ o_ptr->name2 = EGO_TRUMP;
+ o_ptr->pval = randint1(2);
+ break;
+ case 4:
+ act = _("は血を求めている!", "thirsts for blood!");
+ o_ptr->name2 = EGO_VAMPIRIC;
+ break;
+ case 3:
+ act = _("は毒に覆われた。", "is coated with poison.");
+ o_ptr->name2 = EGO_BRAND_POIS;
+ break;
+ case 2:
+ act = _("は純ログルスに飲み込まれた。", "is engulfed in raw Logrus!");
+ o_ptr->name2 = EGO_CHAOTIC;
+ break;
+ case 1:
+ act = _("は炎のシールドに覆われた!", "is covered in a fiery shield!");
+ o_ptr->name2 = EGO_BRAND_FIRE;
+ break;
+ default:
+ act = _("は深く冷たいブルーに輝いた!", "glows deep, icy blue!");
+ o_ptr->name2 = EGO_BRAND_COLD;
+ break;
}
- else
- {
- if (flush_failure) flush();
- msg_print(_("属性付加に失敗した。", "The Branding failed."));
- chg_virtue(V_ENCHANT, -2);
- }
- calc_android_exp();
+ msg_format(_("あなたの%s%s", "Your %s %s"), o_name, act);
+ enchant(caster_ptr, o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
+
+ o_ptr->discount = 99;
+ chg_virtue(caster_ptr, V_ENCHANT, 2);
+ calc_android_exp(caster_ptr);
}