#include "monster/monster-status.h"
#include "object/artifact.h"
#include "object/item-use-flags.h"
-#include "object/object2.h"
#include "player/avatar.h"
#include "player/player-damage.h"
#include "player/player-effects.h"
*/
#include "cmd-item/cmd-eat.h"
+#include "floor/floor-object.h"
#include "floor/floor.h"
#include "inventory/inventory-object.h"
#include "inventory/player-inventory.h"
#include "cmd-item/cmd-usestaff.h"
#include "cmd/cmd-basic.h"
+#include "floor/floor-object.h"
#include "floor/floor.h"
#include "inventory/inventory-object.h"
#include "inventory/player-inventory.h"
#include "object/object-generator.h"
#include "object/object-hook.h"
#include "object/object-kind.h"
-#include "object/object2.h"
#include "object/special-object-flags.h"
#include "object/sv-staff-types.h"
#include "player/avatar.h"
#include "cmd-item/cmd-zapwand.h"
#include "cmd/cmd-basic.h"
+#include "floor/floor-object.h"
#include "floor/floor.h"
#include "inventory/player-inventory.h"
#include "io/targeting.h"
#include "object/object-appraiser.h"
#include "object/object-hook.h"
#include "object/object-kind.h"
-#include "object/object2.h"
#include "object/special-object-flags.h"
#include "object/sv-wand-types.h"
#include "player/avatar.h"
#include "core/stuff-handler.h"
#include "effect/effect-characteristics.h"
#include "effect/spells-effect-util.h"
+#include "floor/floor-object.h"
#include "grid/grid.h"
#include "inventory/inventory-object.h"
#include "io/targeting.h"
#include "object/object-hook.h"
#include "object/object-kind.h"
#include "object/object-mark-types.h"
-#include "object/object2.h"
#include "object/sv-bow-types.h"
#include "object/tr-types.h"
#include "player/avatar.h"
#include "object/artifact.h"
#include "object/item-apply-magic.h"
#include "object/object-generator.h"
-#include "object/object2.h"
#include "player/player-personalities-table.h"
#include "player/player-status.h"
#include "system/system-variables.h"
#include "object/object-flavor.h"
#include "object/object-hook.h"
#include "object/object-mark-types.h"
-#include "object/object2.h"
#include "object/sv-other-types.h"
#include "object/sv-scroll-types.h"
#include "object/tr-types.h"
#include "core/stuff-handler.h"
#include "effect/effect-monster-util.h"
#include "effect/effect-monster-switcher.h"
+#include "floor/floor-object.h"
#include "monster/monster-status.h"
#include "player/avatar.h"
#include "spell/spells-type.h"
*/
#include "floor/floor-object.h"
+#include "main/sound-definitions-table.h"
#include "object/artifact.h"
#include "object/item-apply-magic.h"
#include "object/object-appraiser.h"
#include "object/object2.h"
#include "object/special-object-flags.h"
#include "view/object-describer.h"
+#include "world/world-object.h"
+#include "world/world.h"
#define MAX_GOLD 18 /* Number of "gold" entries */
break;
}
}
+
+/*!
+ * @brief 生成済のオブジェクトをフロアの所定の位置に落とす。
+ * Let an object fall to the ground at or near a location.
+ * @param owner_ptr プレーヤーへの参照ポインタ
+ * @param j_ptr 落としたいオブジェクト構造体の参照ポインタ
+ * @param chance ドロップの消滅率(%)
+ * @param y 配置したいフロアのY座標
+ * @param x 配置したいフロアのX座標
+ * @return 生成に成功したらオブジェクトのIDを返す。
+ * @details
+ * The initial location is assumed to be "in_bounds(floor_ptr, )".\n
+ *\n
+ * This function takes a parameter "chance". This is the percentage\n
+ * chance that the item will "disappear" instead of drop. If the object\n
+ * has been thrown, then this is the chance of disappearance on contact.\n
+ *\n
+ * Hack -- this function uses "chance" to determine if it should produce\n
+ * some form of "description" of the drop event (under the player).\n
+ *\n
+ * We check several locations to see if we can find a location at which\n
+ * the object can combine, stack, or be placed. Artifacts will try very\n
+ * hard to be placed, including "teleporting" to a useful grid if needed.\n
+ */
+OBJECT_IDX drop_near(player_type *owner_ptr, object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION x)
+{
+ int i, k, d, s;
+ POSITION dy, dx;
+ POSITION ty, tx = 0;
+ OBJECT_IDX o_idx = 0;
+ OBJECT_IDX this_o_idx, next_o_idx = 0;
+ grid_type *g_ptr;
+ GAME_TEXT o_name[MAX_NLEN];
+ bool flag = FALSE;
+ bool done = FALSE;
+#ifdef JP
+#else
+ bool plural = (j_ptr->number != 1);
+#endif
+ object_desc(owner_ptr, o_name, j_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+ if (!object_is_artifact(j_ptr) && (randint0(100) < chance)) {
+#ifdef JP
+ msg_format("%sは消えた。", o_name);
+#else
+ msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
+#endif
+ if (current_world_ptr->wizard)
+ msg_print(_("(破損)", "(breakage)"));
+
+ return 0;
+ }
+
+ int bs = -1;
+ int bn = 0;
+
+ POSITION by = y;
+ POSITION bx = x;
+ floor_type *floor_ptr = owner_ptr->current_floor_ptr;
+ for (dy = -3; dy <= 3; dy++) {
+ for (dx = -3; dx <= 3; dx++) {
+ bool comb = FALSE;
+ d = (dy * dy) + (dx * dx);
+ if (d > 10)
+ continue;
+
+ ty = y + dy;
+ tx = x + dx;
+ if (!in_bounds(floor_ptr, ty, tx))
+ continue;
+ if (!projectable(owner_ptr, y, x, ty, tx))
+ continue;
+
+ g_ptr = &floor_ptr->grid_array[ty][tx];
+ if (!cave_drop_bold(floor_ptr, ty, tx))
+ continue;
+
+ k = 0;
+ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) {
+ object_type *o_ptr;
+ o_ptr = &floor_ptr->o_list[this_o_idx];
+ next_o_idx = o_ptr->next_o_idx;
+ if (object_similar(o_ptr, j_ptr))
+ comb = TRUE;
+
+ k++;
+ }
+
+ if (!comb)
+ k++;
+ if (k > 99)
+ continue;
+
+ s = 1000 - (d + k * 5);
+ if (s < bs)
+ continue;
+
+ if (s > bs)
+ bn = 0;
+
+ if ((++bn >= 2) && !one_in_(bn))
+ continue;
+
+ bs = s;
+ by = ty;
+ bx = tx;
+
+ flag = TRUE;
+ }
+ }
+
+ if (!flag && !object_is_artifact(j_ptr)) {
+#ifdef JP
+ msg_format("%sは消えた。", o_name);
+#else
+ msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
+#endif
+ if (current_world_ptr->wizard)
+ msg_print(_("(床スペースがない)", "(no floor space)"));
+
+ return 0;
+ }
+
+ for (i = 0; !flag && (i < 1000); i++) {
+ ty = rand_spread(by, 1);
+ tx = rand_spread(bx, 1);
+
+ if (!in_bounds(floor_ptr, ty, tx))
+ continue;
+
+ by = ty;
+ bx = tx;
+
+ if (!cave_drop_bold(floor_ptr, by, bx))
+ continue;
+
+ flag = TRUE;
+ }
+
+ if (!flag) {
+ int candidates = 0, pick;
+ for (ty = 1; ty < floor_ptr->height - 1; ty++) {
+ for (tx = 1; tx < floor_ptr->width - 1; tx++) {
+ if (cave_drop_bold(floor_ptr, ty, tx))
+ candidates++;
+ }
+ }
+
+ if (!candidates) {
+#ifdef JP
+ msg_format("%sは消えた。", o_name);
+#else
+ msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
+#endif
+
+ if (current_world_ptr->wizard)
+ msg_print(_("(床スペースがない)", "(no floor space)"));
+
+ if (preserve_mode) {
+ if (object_is_fixed_artifact(j_ptr) && !object_is_known(j_ptr)) {
+ a_info[j_ptr->name1].cur_num = 0;
+ }
+ }
+
+ return 0;
+ }
+
+ pick = randint1(candidates);
+ for (ty = 1; ty < floor_ptr->height - 1; ty++) {
+ for (tx = 1; tx < floor_ptr->width - 1; tx++) {
+ if (cave_drop_bold(floor_ptr, ty, tx)) {
+ pick--;
+ if (!pick)
+ break;
+ }
+ }
+
+ if (!pick)
+ break;
+ }
+
+ by = ty;
+ bx = tx;
+ }
+
+ g_ptr = &floor_ptr->grid_array[by][bx];
+ for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx) {
+ object_type *o_ptr;
+ o_ptr = &floor_ptr->o_list[this_o_idx];
+ next_o_idx = o_ptr->next_o_idx;
+ if (object_similar(o_ptr, j_ptr)) {
+ object_absorb(o_ptr, j_ptr);
+ done = TRUE;
+ break;
+ }
+ }
+
+ if (!done)
+ o_idx = o_pop(floor_ptr);
+
+ if (!done && !o_idx) {
+#ifdef JP
+ msg_format("%sは消えた。", o_name);
+#else
+ msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
+#endif
+ if (current_world_ptr->wizard)
+ msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
+
+ if (object_is_fixed_artifact(j_ptr)) {
+ a_info[j_ptr->name1].cur_num = 0;
+ }
+
+ return 0;
+ }
+
+ if (!done) {
+ object_copy(&floor_ptr->o_list[o_idx], j_ptr);
+ j_ptr = &floor_ptr->o_list[o_idx];
+ j_ptr->iy = by;
+ j_ptr->ix = bx;
+ j_ptr->held_m_idx = 0;
+ j_ptr->next_o_idx = g_ptr->o_idx;
+
+ g_ptr->o_idx = o_idx;
+ done = TRUE;
+ }
+
+ note_spot(owner_ptr, by, bx);
+ lite_spot(owner_ptr, by, bx);
+ sound(SOUND_DROP);
+
+ if (chance && player_bold(owner_ptr, by, bx)) {
+ msg_print(_("何かが足下に転がってきた。", "You feel something roll beneath your feet."));
+ }
+
+ return o_idx;
+}
+
+/*!
+ * @brief 床上の魔道具の残り残量メッセージを表示する /
+ * Describe the charges on an item on the floor.
+ * @param floo_ptr 現在フロアへの参照ポインタ
+ * @param item メッセージの対象にしたいアイテム所持スロット
+ * @return なし
+ */
+void floor_item_charges(floor_type *floor_ptr, INVENTORY_IDX item)
+{
+ object_type *o_ptr = &floor_ptr->o_list[item];
+ if ((o_ptr->tval != TV_STAFF) && (o_ptr->tval != TV_WAND))
+ return;
+ if (!object_is_known(o_ptr))
+ return;
+
+#ifdef JP
+ if (o_ptr->pval <= 0) {
+ msg_print("この床上のアイテムは、もう魔力が残っていない。");
+ } else {
+ msg_format("この床上のアイテムは、あと %d 回分の魔力が残っている。", o_ptr->pval);
+ }
+#else
+ if (o_ptr->pval != 1) {
+ msg_format("There are %d charges remaining.", o_ptr->pval);
+ } else {
+ msg_format("There is %d charge remaining.", o_ptr->pval);
+ }
+#endif
+}
void floor_item_optimize(player_type *owner_ptr, INVENTORY_IDX item);
void delete_object_idx(player_type *owner_ptr, OBJECT_IDX o_idx);
void excise_object_idx(floor_type *floor_ptr, OBJECT_IDX o_idx);
+OBJECT_IDX drop_near(player_type *owner_type, object_type *o_ptr, PERCENTAGE chance, POSITION y, POSITION x);
+void floor_item_charges(floor_type *owner_ptr, INVENTORY_IDX item);
#include "inventory/inventory-damage.h"
+#include "floor/floor.h"
#include "inventory/inventory-object.h"
#include "mind/racial-mirror-master.h"
#include "object/artifact.h"
#include "system/angband.h"
+#include "floor/floor-object.h"
#include "inventory/inventory-object.h"
#include "inventory/pack-overflow.h"
#include "player/player-move.h"
-#include "object/object2.h"
#include "object/object-flavor.h"
#include "core/stuff-handler.h"
#include "monster/monster-object.h"
#include "floor/floor-object.h"
-#include "object/object2.h"
#include "object/object-flavor.h"
#include "object/object-hook.h"
#include "object/object-mark-types.h"
#include "dungeon/dungeon.h"
#include "effect/effect-characteristics.h"
#include "floor/floor-object.h"
-#include "object/object2.h"
#include "object/object-flavor.h"
#include "object/object-generator.h"
#include "monster/monster-race-hook.h"
#include "object/artifact.h"
#include "cmd-item/cmd-activate.h"
#include "cmd-item/cmd-smith.h"
+#include "floor/floor-object.h"
#include "floor/floor.h"
#include "grid/grid.h"
#include "io/files-util.h"
#include "object/item-apply-magic.h"
#include "object/object-appraiser.h"
#include "object/object-generator.h"
-#include "object/object2.h"
#include "object/sv-other-types.h"
#include "player/player-class.h"
#include "player/player-damage.h"
/*!
- * @brief 生成済のオブジェクトをフロアの所定の位置に落とす。
- * Let an object fall to the ground at or near a location.
- * @param owner_ptr プレーヤーへの参照ポインタ
- * @param j_ptr 落としたいオブジェクト構造体の参照ポインタ
- * @param chance ドロップの消滅率(%)
- * @param y 配置したいフロアのY座標
- * @param x 配置したいフロアのX座標
- * @return 生成に成功したらオブジェクトのIDを返す。
- * @details
- * The initial location is assumed to be "in_bounds(floor_ptr, )".\n
- *\n
- * This function takes a parameter "chance". This is the percentage\n
- * chance that the item will "disappear" instead of drop. If the object\n
- * has been thrown, then this is the chance of disappearance on contact.\n
- *\n
- * Hack -- this function uses "chance" to determine if it should produce\n
- * some form of "description" of the drop event (under the player).\n
- *\n
- * We check several locations to see if we can find a location at which\n
- * the object can combine, stack, or be placed. Artifacts will try very\n
- * hard to be placed, including "teleporting" to a useful grid if needed.\n
- */
-OBJECT_IDX drop_near(player_type *owner_ptr, object_type *j_ptr, PERCENTAGE chance, POSITION y, POSITION x)
-{
- int i, k, d, s;
- POSITION dy, dx;
- POSITION ty, tx = 0;
- OBJECT_IDX o_idx = 0;
- OBJECT_IDX this_o_idx, next_o_idx = 0;
- grid_type *g_ptr;
- GAME_TEXT o_name[MAX_NLEN];
- bool flag = FALSE;
- bool done = FALSE;
-#ifdef JP
-#else
- bool plural = (j_ptr->number != 1);
-#endif
- object_desc(owner_ptr, o_name, j_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
- if (!object_is_artifact(j_ptr) && (randint0(100) < chance))
- {
-#ifdef JP
- msg_format("%sは消えた。", o_name);
-#else
- msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
-#endif
- if (current_world_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
-
- return 0;
- }
-
- int bs = -1;
- int bn = 0;
-
- POSITION by = y;
- POSITION bx = x;
- floor_type *floor_ptr = owner_ptr->current_floor_ptr;
- for (dy = -3; dy <= 3; dy++)
- {
- for (dx = -3; dx <= 3; dx++)
- {
- bool comb = FALSE;
- d = (dy * dy) + (dx * dx);
- if (d > 10) continue;
-
- ty = y + dy;
- tx = x + dx;
- if (!in_bounds(floor_ptr, ty, tx)) continue;
- if (!projectable(owner_ptr, y, x, ty, tx)) continue;
-
- g_ptr = &floor_ptr->grid_array[ty][tx];
- if (!cave_drop_bold(floor_ptr, ty, tx)) continue;
-
- k = 0;
- for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
- {
- object_type *o_ptr;
- o_ptr = &floor_ptr->o_list[this_o_idx];
- next_o_idx = o_ptr->next_o_idx;
- if (object_similar(o_ptr, j_ptr)) comb = TRUE;
-
- k++;
- }
-
- if (!comb) k++;
- if (k > 99) continue;
-
- s = 1000 - (d + k * 5);
- if (s < bs) continue;
-
- if (s > bs) bn = 0;
-
- if ((++bn >= 2) && !one_in_(bn)) continue;
-
- bs = s;
- by = ty;
- bx = tx;
-
- flag = TRUE;
- }
- }
-
- if (!flag && !object_is_artifact(j_ptr))
- {
-#ifdef JP
- msg_format("%sは消えた。", o_name);
-#else
- msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
-#endif
- if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
-
- return 0;
- }
-
- for (i = 0; !flag && (i < 1000); i++)
- {
- ty = rand_spread(by, 1);
- tx = rand_spread(bx, 1);
-
- if (!in_bounds(floor_ptr, ty, tx)) continue;
-
- by = ty;
- bx = tx;
-
- if (!cave_drop_bold(floor_ptr, by, bx)) continue;
-
- flag = TRUE;
- }
-
- if (!flag)
- {
- int candidates = 0, pick;
- for (ty = 1; ty < floor_ptr->height - 1; ty++)
- {
- for (tx = 1; tx < floor_ptr->width - 1; tx++)
- {
- if (cave_drop_bold(floor_ptr, ty, tx)) candidates++;
- }
- }
-
- if (!candidates)
- {
-#ifdef JP
- msg_format("%sは消えた。", o_name);
-#else
- msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
-#endif
-
- if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
-
- if (preserve_mode)
- {
- if (object_is_fixed_artifact(j_ptr) && !object_is_known(j_ptr))
- {
- a_info[j_ptr->name1].cur_num = 0;
- }
- }
-
- return 0;
- }
-
- pick = randint1(candidates);
- for (ty = 1; ty < floor_ptr->height - 1; ty++)
- {
- for (tx = 1; tx < floor_ptr->width - 1; tx++)
- {
- if (cave_drop_bold(floor_ptr, ty, tx))
- {
- pick--;
- if (!pick) break;
- }
- }
-
- if (!pick) break;
- }
-
- by = ty;
- bx = tx;
- }
-
-
- g_ptr = &floor_ptr->grid_array[by][bx];
- for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
- {
- object_type *o_ptr;
- o_ptr = &floor_ptr->o_list[this_o_idx];
- next_o_idx = o_ptr->next_o_idx;
- if (object_similar(o_ptr, j_ptr))
- {
- object_absorb(o_ptr, j_ptr);
- done = TRUE;
- break;
- }
- }
-
- if (!done) o_idx = o_pop(floor_ptr);
-
- if (!done && !o_idx)
- {
-#ifdef JP
- msg_format("%sは消えた。", o_name);
-#else
- msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
-#endif
- if (current_world_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
-
- if (object_is_fixed_artifact(j_ptr))
- {
- a_info[j_ptr->name1].cur_num = 0;
- }
-
- return 0;
- }
-
- if (!done)
- {
- object_copy(&floor_ptr->o_list[o_idx], j_ptr);
- j_ptr = &floor_ptr->o_list[o_idx];
- j_ptr->iy = by;
- j_ptr->ix = bx;
- j_ptr->held_m_idx = 0;
- j_ptr->next_o_idx = g_ptr->o_idx;
-
- g_ptr->o_idx = o_idx;
- done = TRUE;
- }
-
- note_spot(owner_ptr, by, bx);
- lite_spot(owner_ptr, by, bx);
- sound(SOUND_DROP);
-
- if (chance && player_bold(owner_ptr, by, bx))
- {
- msg_print(_("何かが足下に転がってきた。", "You feel something roll beneath your feet."));
- }
-
- return o_idx;
-}
-
-
-/*!
- * @brief 床上の魔道具の残り残量メッセージを表示する /
- * Describe the charges on an item on the floor.
- * @param floo_ptr 現在フロアへの参照ポインタ
- * @param item メッセージの対象にしたいアイテム所持スロット
- * @return なし
- */
-void floor_item_charges(floor_type *floor_ptr, INVENTORY_IDX item)
-{
- object_type *o_ptr = &floor_ptr->o_list[item];
- if ((o_ptr->tval != TV_STAFF) && (o_ptr->tval != TV_WAND)) return;
- if (!object_is_known(o_ptr)) return;
-
-#ifdef JP
- if (o_ptr->pval <= 0)
- {
- msg_print("この床上のアイテムは、もう魔力が残っていない。");
- }
- else
- {
- msg_format("この床上のアイテムは、あと %d 回分の魔力が残っている。", o_ptr->pval);
- }
-#else
- if (o_ptr->pval != 1)
- {
- msg_format("There are %d charges remaining.", o_ptr->pval);
- }
- else
- {
- msg_format("There is %d charge remaining.", o_ptr->pval);
- }
-#endif
-}
-
-
-/*!
* @brief 床上のアイテムの残り数メッセージを表示する /
* Describe the charges on an item on the floor.
* @param floo_ptr 現在フロアへの参照ポインタ
void object_absorb(object_type *o_ptr, object_type *j_ptr);
IDX lookup_kind(tval_type tval, OBJECT_SUBTYPE_VALUE sval);
void apply_magic(player_type *owner_type, object_type *o_ptr, DEPTH lev, BIT_FLAGS mode);
-OBJECT_IDX drop_near(player_type *owner_type, object_type *o_ptr, PERCENTAGE chance, POSITION y, POSITION x);
-void floor_item_charges(floor_type *owner_ptr, INVENTORY_IDX item);
bool object_sort_comp(object_type *o_ptr, s32b o_value, object_type *j_ptr);
void floor_item_describe(player_type *player_ptr, INVENTORY_IDX item); // 暫定、元々object2.c の内部からのみ呼ばれていた.
#include "object/object-hook.h"
#include "object/object-mark-types.h"
#include "object/object1.h"
-#include "object/object2.h"
#include "object/special-object-flags.h"
#include "object/sv-lite-types.h"
#include "object/sv-weapon-types.h"
#include "cmd-action/cmd-spell.h"
#include "effect/effect-characteristics.h"
#include "effect/spells-effect-util.h"
+#include "floor/floor-object.h"
#include "io/targeting.h"
#include "object/object-generator.h"
#include "object/object2.h"
#include "cmd-item/cmd-magiceat.h"
#include "core/stuff-handler.h"
#include "effect/effect-characteristics.h"
+#include "floor/floor-object.h"
#include "inventory/inventory-object.h"
#include "io/targeting.h"
#include "mind/racial-force-trainer.h"