*/
#include "angband.h"
+#include "core.h"
+#include "util.h"
+
+#include "creature.h"
+
+#include "artifact.h"
#include "cmd-pet.h"
+#include "cmd-dump.h"
+#include "floor.h"
#include "grid.h"
#include "trap.h"
#include "monsterrace-hook.h"
#include "melee.h"
#include "world.h"
-#include "projection.h"
+#include "spells.h"
#include "spells-summon.h"
#include "mutation.h"
#include "quest.h"
#include "avatar.h"
#include "spells-status.h"
+#include "spells-floor.h"
#include "realm-hex.h"
+#include "autopick.h"
+#include "object-flavor.h"
+#include "object-hook.h"
+#include "monster-status.h"
+#include "player-move.h"
+#include "player-status.h"
+#include "player-effects.h"
+#include "player-skill.h"
+#include "player-class.h"
+#include "player-damage.h"
+
+#include "dungeon.h"
+#include "floor-events.h"
+#include "feature.h"
+#include "view-mainwindow.h"
+#include "objectkind.h"
+#include "monsterrace.h"
+#include "targeting.h"
+#include "realm-song.h"
+#include "english.h"
/*!
* @brief プレイヤー周辺の地形を感知する
{
POSITION x, y;
bool detect = FALSE;
- grid_type *c_ptr;
+ grid_type *g_ptr;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
/* Scan the current panel */
- for (y = 1; y < cur_hgt - 1; y++)
+ for (y = 1; y < current_floor_ptr->height - 1; y++)
{
- for (x = 1; x <= cur_wid - 1; x++)
+ for (x = 1; x <= current_floor_ptr->width - 1; x++)
{
int dist = distance(p_ptr->y, p_ptr->x, y, x);
if (dist > range) continue;
- c_ptr = &cave[y][x];
+ g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* Hack -- Safe */
if (flag == FF_TRAP)
/* Mark as detected */
if (dist <= range && known)
{
- if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
+ if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
- c_ptr->info &= ~(CAVE_UNSAFE);
+ g_ptr->info &= ~(CAVE_UNSAFE);
lite_spot(y, x);
}
}
- /* Detect flags */
- if (cave_have_flag_grid(c_ptr, flag))
+ if (cave_have_flag_grid(g_ptr, flag))
{
- /* Detect secrets */
disclose_grid(y, x);
-
- /* Hack -- Memorize */
- c_ptr->info |= (CAVE_MARK);
-
+ g_ptr->info |= (CAVE_MARK);
lite_spot(y, x);
-
detect = TRUE;
}
}
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
/* Scan objects */
- for (i = 1; i < o_max; i++)
+ for (i = 1; i < current_floor_ptr->o_max; i++)
{
- object_type *o_ptr = &o_list[i];
-
- /* Skip dead objects */
- if (!o_ptr->k_idx) continue;
+ object_type *o_ptr = ¤t_floor_ptr->o_list[i];
- /* Skip held objects */
- if (o_ptr->held_m_idx) continue;
+ if (!OBJECT_IS_VALID(o_ptr)) continue;
+ if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
y = o_ptr->iy;
x = o_ptr->ix;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
/* Scan objects */
- for (i = 1; i < o_max; i++)
+ for (i = 1; i < current_floor_ptr->o_max; i++)
{
- object_type *o_ptr = &o_list[i];
+ object_type *o_ptr = ¤t_floor_ptr->o_list[i];
- /* Skip dead objects */
- if (!o_ptr->k_idx) continue;
-
- /* Skip held objects */
- if (o_ptr->held_m_idx) continue;
+ if (!OBJECT_IS_VALID(o_ptr)) continue;
+ if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
y = o_ptr->iy;
x = o_ptr->ix;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
/* Scan all objects */
- for (i = 1; i < o_max; i++)
+ for (i = 1; i < current_floor_ptr->o_max; i++)
{
- object_type *o_ptr = &o_list[i];
-
- /* Skip dead objects */
- if (!o_ptr->k_idx) continue;
+ object_type *o_ptr = ¤t_floor_ptr->o_list[i];
- /* Skip held objects */
- if (o_ptr->held_m_idx) continue;
+ if (!OBJECT_IS_VALID(o_ptr)) continue;
+ if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
y = o_ptr->iy;
x = o_ptr->ix;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
bool obvious = FALSE;
-
/* Mark all (nearby) monsters */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
-
- /* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ if (!monster_is_valid(m_ptr)) continue;
y = m_ptr->fy;
x = m_ptr->fx;
if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
/* Mark the monster */
- m_ptr->mflag |= (MFLAG_TEMP);
+ m_ptr->mflag |= (MFLAG_LOS);
}
/* Affect all marked monsters */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
/* Skip unmarked monsters */
- if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
+ if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
/* Remove mark */
- m_ptr->mflag &= ~(MFLAG_TEMP);
+ m_ptr->mflag &= ~(MFLAG_LOS);
y = m_ptr->fy;
x = m_ptr->fx;
if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
int k = 3 * creature_ptr->lev;
if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
- if (set_poisoned(0)) ident = TRUE;
- if (set_afraid(0)) ident = TRUE;
- if (hp_player(50)) ident = TRUE;
+ if (set_poisoned(p_ptr, 0)) ident = TRUE;
+ if (set_afraid(p_ptr, 0)) ident = TRUE;
+ if (hp_player(p_ptr, 50)) ident = TRUE;
if (set_stun(0)) ident = TRUE;
if (set_cut(0)) ident = TRUE;
return ident;
bool speed = FALSE;
/* Aggravate everyone nearby */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
-
- /* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip aggravating monster (or player) */
if (i == who) continue;
bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
{
int msec = delay_factor * delay_factor * delay_factor;
- monster_type *m_ptr = &m_list[m_idx];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
bool resist = FALSE;
if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
else if (m_idx == p_ptr->riding) resist = TRUE;
- else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
+ else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out) resist = TRUE;
else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
bool result = FALSE;
/* Prevent genocide in quest levels */
- if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+ if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out)
{
msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
return (FALSE);
while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
/* Delete the monsters of that "type" */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip "wrong" monsters */
if (r_ptr->d_char != typ) continue;
bool result = FALSE;
/* Prevent mass genocide in quest levels */
- if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+ if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out)
{
return (FALSE);
}
/* Delete the (nearby) monsters */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
-
- /* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
+ if (!monster_is_valid(m_ptr)) continue;
/* Skip distant monsters */
if (m_ptr->cdis > MAX_SIGHT) continue;
bool result = FALSE;
/* Prevent mass genocide in quest levels */
- if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+ if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->phase_out)
{
return (FALSE);
}
/* Delete the (nearby) monsters */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
Term->scr->cv = 1;
/* Probe all (nearby) monsters */
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Paranoia -- Skip dead monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
/* Require line of sight */
if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
return (probe);
}
-
-
-/*!
- * @brief *破壊*処理を行う / The spell of destruction
- * @param y1 破壊の中心Y座標
- * @param x1 破壊の中心X座標
- * @param r 破壊の半径
- * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
- * @return 効力があった場合TRUEを返す
- * @details
- * <pre>
- * This spell "deletes" monsters (instead of "killing" them).
- *
- * Later we may use one function for both "destruction" and
- * "earthquake" by using the "full" to select "destruction".
- * </pre>
- */
-bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
-{
- POSITION y, x;
- int k, t;
- grid_type *c_ptr;
- bool flag = FALSE;
-
- /* Prevent destruction of quest levels and town */
- if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
- {
- return (FALSE);
- }
-
- /* Lose monster light */
- if (!in_generate) clear_mon_lite();
-
- /* Big area of affect */
- for (y = (y1 - r); y <= (y1 + r); y++)
- {
- for (x = (x1 - r); x <= (x1 + r); x++)
- {
- /* Skip illegal grids */
- if (!in_bounds(y, x)) continue;
-
- /* Extract the distance */
- k = distance(y1, x1, y, x);
-
- /* Stay in the circle of death */
- if (k > r) continue;
- c_ptr = &cave[y][x];
-
- /* Lose room and vault */
- c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-
- /* Lose light and knowledge */
- c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
-
- if (!in_generate) /* Normal */
- {
- /* Lose unsafety */
- c_ptr->info &= ~(CAVE_UNSAFE);
-
- /* Hack -- Notice player affect */
- if (player_bold(y, x))
- {
- /* Hurt the player later */
- flag = TRUE;
-
- /* Do not hurt this grid */
- continue;
- }
- }
-
- /* Hack -- Skip the epicenter */
- if ((y == y1) && (x == x1)) continue;
-
- if (c_ptr->m_idx)
- {
- monster_type *m_ptr = &m_list[c_ptr->m_idx];
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- if (in_generate) /* In generation */
- {
- /* Delete the monster (if any) */
- delete_monster(y, x);
- }
- else if (r_ptr->flags1 & RF1_QUESTOR)
- {
- /* Heal the monster */
- m_ptr->hp = m_ptr->maxhp;
-
- /* Try to teleport away quest monsters */
- if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
- }
- else
- {
- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
- {
- GAME_TEXT m_name[MAX_NLEN];
-
- monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
- do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
- }
-
- /* Delete the monster (if any) */
- delete_monster(y, x);
- }
- }
-
- /* During generation, destroyed artifacts are "preserved" */
- if (preserve_mode || in_generate)
- {
- OBJECT_IDX this_o_idx, next_o_idx = 0;
-
- /* Scan all objects in the grid */
- for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
- {
- object_type *o_ptr;
- o_ptr = &o_list[this_o_idx];
-
- /* Acquire next object */
- next_o_idx = o_ptr->next_o_idx;
-
- /* Hack -- Preserve unknown artifacts */
- if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
- {
- /* Mega-Hack -- Preserve the artifact */
- a_info[o_ptr->name1].cur_num = 0;
-
- if (in_generate && cheat_peek)
- {
- GAME_TEXT o_name[MAX_NLEN];
- object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
- msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
- }
- }
- else if (in_generate && cheat_peek && o_ptr->art_name)
- {
- msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
- "One of the random artifacts was *destroyed* during generation."));
- }
- }
- }
-
- delete_object(y, x);
-
- /* Destroy "non-permanent" grids */
- if (!cave_perma_grid(c_ptr))
- {
- /* Wall (or floor) type */
- t = randint0(200);
-
- if (!in_generate) /* Normal */
- {
- if (t < 20)
- {
- /* Create granite wall */
- cave_set_feat(y, x, feat_granite);
- }
- else if (t < 70)
- {
- /* Create quartz vein */
- cave_set_feat(y, x, feat_quartz_vein);
- }
- else if (t < 100)
- {
- /* Create magma vein */
- cave_set_feat(y, x, feat_magma_vein);
- }
- else
- {
- /* Create floor */
- cave_set_feat(y, x, feat_ground_type[randint0(100)]);
- }
- }
- else /* In generation */
- {
- if (t < 20)
- {
- /* Create granite wall */
- place_extra_grid(c_ptr);
- }
- else if (t < 70)
- {
- /* Create quartz vein */
- c_ptr->feat = feat_quartz_vein;
- }
- else if (t < 100)
- {
- /* Create magma vein */
- c_ptr->feat = feat_magma_vein;
- }
- else
- {
- /* Create floor */
- place_floor_grid(c_ptr);
- }
-
- /* Clear garbage of hidden trap or door */
- c_ptr->mimic = 0;
- }
- }
- }
- }
-
- if (!in_generate)
- {
- /* Process "re-glowing" */
- for (y = (y1 - r); y <= (y1 + r); y++)
- {
- for (x = (x1 - r); x <= (x1 + r); x++)
- {
- /* Skip illegal grids */
- if (!in_bounds(y, x)) continue;
-
- /* Extract the distance */
- k = distance(y1, x1, y, x);
-
- /* Stay in the circle of death */
- if (k > r) continue;
- c_ptr = &cave[y][x];
-
- if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
- else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
- {
- DIRECTION i;
- POSITION yy, xx;
- grid_type *cc_ptr;
-
- for (i = 0; i < 9; i++)
- {
- yy = y + ddy_ddd[i];
- xx = x + ddx_ddd[i];
- if (!in_bounds2(yy, xx)) continue;
- cc_ptr = &cave[yy][xx];
- if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
- {
- c_ptr->info |= CAVE_GLOW;
- break;
- }
- }
- }
- }
- }
-
- /* Hack -- Affect player */
- if (flag)
- {
- msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
-
- /* Blind the player */
- if (!p_ptr->resist_blind && !p_ptr->resist_lite)
- {
- /* Become blind */
- (void)set_blind(p_ptr->blind + 10 + randint1(10));
- }
- }
-
- forget_flow();
-
- /* Mega-Hack -- Forget the view and lite */
- p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
- p_ptr->redraw |= (PR_MAP);
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- if (p_ptr->special_defense & NINJA_S_STEALTH)
- {
- if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
- }
- }
-
- /* Success */
- return (TRUE);
-}
-
-
-/*!
- * @brief 地震処理(サブルーチン) /
- * Induce an "earthquake" of the given radius at the given location.
- * @return 効力があった場合TRUEを返す
- * @param cy 中心Y座標
- * @param cx 中心X座標
- * @param r 効果半径
- * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
- * @details
- * <pre>
- *
- * This will turn some walls into floors and some floors into walls.
- *
- * The player will take damage and "jump" into a safe grid if possible,
- * otherwise, he will "tunnel" through the rubble instantaneously.
- *
- * Monsters will take damage, and "jump" into a safe grid if possible,
- * otherwise they will be "buried" in the rubble, disappearing from
- * the level in the same way that they do when genocided.
- *
- * Note that thus the player and monsters (except eaters of walls and
- * passers through walls) will never occupy the same grid as a wall.
- * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
- * for a single turn, unless that monster can pass_walls or kill_walls.
- * This has allowed massive simplification of the "monster" code.
- * </pre>
- */
-bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
-{
- DIRECTION i;
- int t;
- POSITION y, x, yy, xx, dy, dx;
- int damage = 0;
- int sn = 0;
- POSITION sy = 0, sx = 0;
- bool hurt = FALSE;
- grid_type *c_ptr;
- bool map[32][32];
-
- /* Prevent destruction of quest levels and town */
- if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
- {
- return (FALSE);
- }
-
- /* Paranoia -- Enforce maximum range */
- if (r > 12) r = 12;
-
- /* Clear the "maximal blast" area */
- for (y = 0; y < 32; y++)
- {
- for (x = 0; x < 32; x++)
- {
- map[y][x] = FALSE;
- }
- }
-
- /* Check around the epicenter */
- for (dy = -r; dy <= r; dy++)
- {
- for (dx = -r; dx <= r; dx++)
- {
- /* Extract the location */
- yy = cy + dy;
- xx = cx + dx;
-
- /* Skip illegal grids */
- if (!in_bounds(yy, xx)) continue;
-
- /* Skip distant grids */
- if (distance(cy, cx, yy, xx) > r) continue;
- c_ptr = &cave[yy][xx];
-
- /* Lose room and vault / Lose light and knowledge */
- c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
- c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
-
- /* Skip the epicenter */
- if (!dx && !dy) continue;
-
- /* Skip most grids */
- if (randint0(100) < 85) continue;
-
- /* Damage this grid */
- map[16+yy-cy][16+xx-cx] = TRUE;
-
- /* Hack -- Take note of player damage */
- if (player_bold(yy, xx)) hurt = TRUE;
- }
- }
-
- /* First, affect the player (if necessary) */
- if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
- {
- /* Check around the player */
- for (i = 0; i < 8; i++)
- {
- /* Access the location */
- y = p_ptr->y + ddy_ddd[i];
- x = p_ptr->x + ddx_ddd[i];
-
- /* Skip non-empty grids */
- if (!cave_empty_bold(y, x)) continue;
-
- /* Important -- Skip "quake" grids */
- if (map[16+y-cy][16+x-cx]) continue;
-
- if (cave[y][x].m_idx) continue;
-
- /* Count "safe" grids */
- sn++;
-
- /* Randomize choice */
- if (randint0(sn) > 0) continue;
-
- /* Save the safe location */
- sy = y; sx = x;
- }
-
- /* Random message */
- switch (randint1(3))
- {
- case 1:
- {
- msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
- break;
- }
- case 2:
- {
- msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
- break;
- }
- default:
- {
- msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
- break;
- }
- }
-
- /* Hurt the player a lot */
- if (!sn)
- {
- /* Message and damage */
- msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
- damage = 200;
- }
-
- /* Destroy the grid, and push the player to safety */
- else
- {
- /* Calculate results */
- switch (randint1(3))
- {
- case 1:
- {
- msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
- damage = 0;
- break;
- }
- case 2:
- {
- msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
- damage = damroll(10, 4);
- (void)set_stun(p_ptr->stun + randint1(50));
- break;
- }
- case 3:
- {
- msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
- damage = damroll(10, 4);
- (void)set_stun(p_ptr->stun + randint1(50));
- break;
- }
- }
-
- /* Move the player to the safe location */
- (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
- }
-
- /* Important -- no wall on player */
- map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
-
- if (damage)
- {
- concptr killer;
-
- if (m_idx)
- {
- GAME_TEXT m_name[MAX_NLEN];
- monster_type *m_ptr = &m_list[m_idx];
-
- /* Get the monster's real name */
- monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
-
- killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
- }
- else
- {
- killer = _("地震", "an earthquake");
- }
-
- take_hit(DAMAGE_ATTACK, damage, killer, -1);
- }
- }
-
- /* Examine the quaked region */
- for (dy = -r; dy <= r; dy++)
- {
- for (dx = -r; dx <= r; dx++)
- {
- /* Extract the location */
- yy = cy + dy;
- xx = cx + dx;
-
- /* Skip unaffected grids */
- if (!map[16+yy-cy][16+xx-cx]) continue;
- c_ptr = &cave[yy][xx];
-
- if (c_ptr->m_idx == p_ptr->riding) continue;
-
- /* Process monsters */
- if (c_ptr->m_idx)
- {
- monster_type *m_ptr = &m_list[c_ptr->m_idx];
- monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
- /* Quest monsters */
- if (r_ptr->flags1 & RF1_QUESTOR)
- {
- /* No wall on quest monsters */
- map[16+yy-cy][16+xx-cx] = FALSE;
-
- continue;
- }
-
- /* Most monsters cannot co-exist with rock */
- if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
- !(r_ptr->flags2 & (RF2_PASS_WALL)))
- {
- GAME_TEXT m_name[MAX_NLEN];
-
- /* Assume not safe */
- sn = 0;
-
- /* Monster can move to escape the wall */
- if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
- {
- /* Look for safety */
- for (i = 0; i < 8; i++)
- {
- y = yy + ddy_ddd[i];
- x = xx + ddx_ddd[i];
-
- /* Skip non-empty grids */
- if (!cave_empty_bold(y, x)) continue;
-
- /* Hack -- no safety on glyph of warding */
- if (is_glyph_grid(&cave[y][x])) continue;
- if (is_explosive_rune_grid(&cave[y][x])) continue;
-
- /* ... nor on the Pattern */
- if (pattern_tile(y, x)) continue;
-
- /* Important -- Skip "quake" grids */
- if (map[16+y-cy][16+x-cx]) continue;
-
- if (cave[y][x].m_idx) continue;
- if (player_bold(y, x)) continue;
-
- /* Count "safe" grids */
- sn++;
-
- /* Randomize choice */
- if (randint0(sn) > 0) continue;
-
- /* Save the safe grid */
- sy = y; sx = x;
- }
- }
-
- monster_desc(m_name, m_ptr, 0);
-
- /* Scream in pain */
- if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
-
- /* Take damage from the quake */
- damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
-
- /* Monster is certainly awake */
- (void)set_monster_csleep(c_ptr->m_idx, 0);
-
- /* Apply damage directly */
- m_ptr->hp -= damage;
-
- /* Delete (not kill) "dead" monsters */
- if (m_ptr->hp < 0)
- {
- if (!ignore_unview || is_seen(m_ptr))
- msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
-
- if (c_ptr->m_idx)
- {
- if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
- {
- char m2_name[MAX_NLEN];
-
- monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
- do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
- }
- }
-
- delete_monster(yy, xx);
-
- /* No longer safe */
- sn = 0;
- }
-
- /* Hack -- Escape from the rock */
- if (sn)
- {
- IDX m_idx_aux = cave[yy][xx].m_idx;
-
- /* Update the old location */
- cave[yy][xx].m_idx = 0;
-
- /* Update the new location */
- cave[sy][sx].m_idx = m_idx_aux;
-
- /* Move the monster */
- m_ptr->fy = sy;
- m_ptr->fx = sx;
-
- update_monster(m_idx, TRUE);
- lite_spot(yy, xx);
- lite_spot(sy, sx);
- }
- }
- }
- }
- }
-
- /* Lose monster light */
- clear_mon_lite();
-
- /* Examine the quaked region */
- for (dy = -r; dy <= r; dy++)
- {
- for (dx = -r; dx <= r; dx++)
- {
- /* Extract the location */
- yy = cy + dy;
- xx = cx + dx;
-
- /* Skip unaffected grids */
- if (!map[16+yy-cy][16+xx-cx]) continue;
-
- c_ptr = &cave[yy][xx];
-
- /* Paranoia -- never affect player */
-/* if (player_bold(yy, xx)) continue; */
-
- /* Destroy location (if valid) */
- if (cave_valid_bold(yy, xx))
- {
- delete_object(yy, xx);
-
- /* Wall (or floor) type */
- t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
-
- /* Granite */
- if (t < 20)
- {
- /* Create granite wall */
- cave_set_feat(yy, xx, feat_granite);
- }
-
- /* Quartz */
- else if (t < 70)
- {
- /* Create quartz vein */
- cave_set_feat(yy, xx, feat_quartz_vein);
- }
-
- /* Magma */
- else if (t < 100)
- {
- /* Create magma vein */
- cave_set_feat(yy, xx, feat_magma_vein);
- }
-
- /* Floor */
- else
- {
- /* Create floor */
- cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
- }
- }
- }
- }
-
- /* Process "re-glowing" */
- for (dy = -r; dy <= r; dy++)
- {
- for (dx = -r; dx <= r; dx++)
- {
- /* Extract the location */
- yy = cy + dy;
- xx = cx + dx;
-
- /* Skip illegal grids */
- if (!in_bounds(yy, xx)) continue;
-
- /* Skip distant grids */
- if (distance(cy, cx, yy, xx) > r) continue;
- c_ptr = &cave[yy][xx];
-
- if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
- else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
- {
- DIRECTION ii;
- POSITION yyy, xxx;
- grid_type *cc_ptr;
-
- for (ii = 0; ii < 9; ii++)
- {
- yyy = yy + ddy_ddd[ii];
- xxx = xx + ddx_ddd[ii];
- if (!in_bounds2(yyy, xxx)) continue;
- cc_ptr = &cave[yyy][xxx];
- if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
- {
- c_ptr->info |= CAVE_GLOW;
- break;
- }
- }
- }
- }
- }
-
- /* Mega-Hack -- Forget the view and lite */
- p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
- p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
- if (p_ptr->special_defense & NINJA_S_STEALTH)
- {
- if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
- }
-
- /* Success */
- return (TRUE);
-}
-
-/*!
- * @brief 地震処理(プレイヤーの中心発動) /
- * Induce an "earthquake" of the given radius at the given location.
- * @return 効力があった場合TRUEを返す
- * @param cy 中心Y座標
- * @param cx 中心X座標
- * @param r 効果半径
- */
-bool earthquake(POSITION cy, POSITION cx, POSITION r)
-{
- return earthquake_aux(cy, cx, r, 0);
-}
-
/*!
* @brief ペット爆破処理 /
* @return なし
MONSTER_IDX i;
bool okay = TRUE;
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
if (m_ptr->nickname) okay = FALSE;
}
if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
return;
}
- for (i = 1; i < m_max; i++)
+ for (i = 1; i < current_floor_ptr->m_max; i++)
{
HIT_POINT dam;
- monster_type *m_ptr = &m_list[i];
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
monster_race *r_ptr;
if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
int i;
/* Clear them all */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- POSITION y = temp_y[i];
- POSITION x = temp_x[i];
+ POSITION y = tmp_pos.y[i];
+ POSITION x = tmp_pos.x[i];
- grid_type *c_ptr = &cave[y][x];
+ grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* No longer in the array */
- c_ptr->info &= ~(CAVE_TEMP);
+ g_ptr->info &= ~(CAVE_TEMP);
/* Update only non-CAVE_GLOW grids */
- /* if (c_ptr->info & (CAVE_GLOW)) continue; */
+ /* if (g_ptr->info & (CAVE_GLOW)) continue; */
/* Perma-Lite */
- c_ptr->info |= (CAVE_GLOW);
+ g_ptr->info |= (CAVE_GLOW);
/* Process affected monsters */
- if (c_ptr->m_idx)
+ if (g_ptr->m_idx)
{
- int chance = 25;
- monster_type *m_ptr = &m_list[c_ptr->m_idx];
+ PERCENTAGE chance = 25;
+ monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- update_monster(c_ptr->m_idx, FALSE);
+ update_monster(g_ptr->m_idx, FALSE);
/* Stupid monsters rarely wake up */
if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
{
/* Wake up! */
- (void)set_monster_csleep(c_ptr->m_idx, 0);
+ (void)set_monster_csleep(g_ptr->m_idx, 0);
/* Notice the "waking up" */
if (m_ptr->ml)
}
/* None left */
- temp_n = 0;
+ tmp_pos.n = 0;
}
int i;
/* Clear them all */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- POSITION y = temp_y[i];
- POSITION x = temp_x[i];
+ POSITION y = tmp_pos.y[i];
+ POSITION x = tmp_pos.x[i];
int j;
- grid_type *c_ptr = &cave[y][x];
- bool do_dark = !is_mirror_grid(c_ptr);
+ grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ bool do_dark = !is_mirror_grid(g_ptr);
/* No longer in the array */
- c_ptr->info &= ~(CAVE_TEMP);
+ g_ptr->info &= ~(CAVE_TEMP);
/* Darken the grid */
if (do_dark)
{
- if (dun_level || !is_daytime())
+ if (current_floor_ptr->dun_level || !is_daytime())
{
for (j = 0; j < 9; j++)
{
if (in_bounds2(by, bx))
{
- grid_type *cc_ptr = &cave[by][bx];
+ grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
{
if (!do_dark) continue;
}
- c_ptr->info &= ~(CAVE_GLOW);
+ g_ptr->info &= ~(CAVE_GLOW);
/* Hack -- Forget "boring" grids */
- if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
+ if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
{
/* Forget the grid */
- if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
+ if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
note_spot(y, x);
}
/* Process affected monsters */
- if (c_ptr->m_idx)
+ if (g_ptr->m_idx)
{
- update_monster(c_ptr->m_idx, FALSE);
+ update_monster(g_ptr->m_idx, FALSE);
}
lite_spot(y, x);
}
/* None left */
- temp_n = 0;
+ tmp_pos.n = 0;
}
/*!
- * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
* @param y 部屋内のy座標1点
* @param x 部屋内のx座標1点
* @param only_room 部屋内地形のみをチェック対象にするならば TRUE
*/
static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
{
- grid_type *c_ptr;
-
- /* Get the grid */
- c_ptr = &cave[y][x];
+ grid_type *g_ptr;
+ g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* Avoid infinite recursion */
- if (c_ptr->info & (CAVE_TEMP)) return;
+ if (g_ptr->info & (CAVE_TEMP)) return;
/* Do not "leave" the current room */
- if (!(c_ptr->info & (CAVE_ROOM)))
+ if (!(g_ptr->info & (CAVE_ROOM)))
{
if (only_room) return;
}
/* Paranoia -- verify space */
- if (temp_n == TEMP_MAX) return;
+ if (tmp_pos.n == TEMP_MAX) return;
/* Mark the grid as "seen" */
- c_ptr->info |= (CAVE_TEMP);
+ g_ptr->info |= (CAVE_TEMP);
/* Add it to the "seen" set */
- temp_y[temp_n] = y;
- temp_x[temp_n] = x;
- temp_n++;
+ tmp_pos.y[tmp_pos.n] = y;
+ tmp_pos.x[tmp_pos.n] = x;
+ tmp_pos.n++;
}
/*!
}
/*!
- * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
* @param y 指定Y座標
* @param x 指定X座標
* @return なし
/*!
- * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
+ * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
* @param y 指定Y座標
* @param x 指定X座標
* @return なし
cave_temp_lite_room_aux(y1, x1);
/* While grids are in the queue, add their neighbors */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- x = temp_x[i], y = temp_y[i];
+ x = tmp_pos.x[i], y = tmp_pos.y[i];
/* Walls get lit, but stop light */
if (!cave_pass_lite_bold(y, x)) continue;
if (p_ptr->special_defense & NINJA_S_STEALTH)
{
- if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
+ if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
}
}
cave_temp_unlite_room_aux(y1, x1);
/* Spread, breadth first */
- for (i = 0; i < temp_n; i++)
+ for (i = 0; i < tmp_pos.n; i++)
{
- x = temp_x[i], y = temp_y[i];
+ x = tmp_pos.x[i], y = tmp_pos.y[i];
/* Walls get dark, but stop darkness */
if (!cave_pass_dark_bold(y, x)) continue;
{
BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
- /* Hack -- Message */
if (!p_ptr->blind)
{
msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
bool teleport_swap(DIRECTION dir)
{
POSITION tx, ty;
- grid_type* c_ptr;
+ grid_type* g_ptr;
monster_type* m_ptr;
monster_race* r_ptr;
tx = p_ptr->x + ddx[dir];
ty = p_ptr->y + ddy[dir];
}
- c_ptr = &cave[ty][tx];
+ g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
if (p_ptr->anti_tele)
{
return FALSE;
}
- if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
+ if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
{
msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
return FALSE;
}
- if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
+ if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
{
msg_print(_("失敗した。", "Failed to swap."));
return FALSE;
}
- m_ptr = &m_list[c_ptr->m_idx];
+ m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
r_ptr = &r_info[m_ptr->r_idx];
- (void)set_monster_csleep(c_ptr->m_idx, 0);
+ (void)set_monster_csleep(g_ptr->m_idx, 0);
if (r_ptr->flagsr & RFR_RES_TELE)
{
if (!(*count))
{
msg_print(_("地面が揺れた...", "The ground trembles..."));
- earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
+ earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10), 0);
if (!one_in_(6)) break;
}
case 30: case 31:
(*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
if (!one_in_(6)) break;
case 7: case 8: case 9: case 18:
- (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
+ (*count) += summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
if (!one_in_(6)) break;
case 10: case 11: case 12:
msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
{
msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
if (p_ptr->free_act)
- set_paralyzed(p_ptr->paralyzed + randint1(3));
+ set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(3));
else
- set_paralyzed(p_ptr->paralyzed + randint1(13));
+ set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(13));
stop_ty = TRUE;
}
if (!one_in_(6)) break;
case 21: case 22: case 23:
- (void)do_dec_stat(randint0(6));
+ (void)do_dec_stat(p_ptr, randint0(6));
if (!one_in_(6)) break;
case 24:
msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
/*
* Only summon Cyberdemons deep in the dungeon.
*/
- if ((dun_level > 65) && !stop_ty)
+ if ((current_floor_ptr->dun_level > 65) && !stop_ty)
{
(*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
stop_ty = TRUE;
{
do
{
- (void)do_dec_stat(i);
+ (void)do_dec_stat(p_ptr, i);
}
while (one_in_(2));
if (!pet) mode |= PM_NO_PET;
- summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
+ summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level);
- for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
+ for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++)
{
- switch (randint1(25) + (dun_level / 20))
+ switch (randint1(25) + (current_floor_ptr->dun_level / 20))
{
case 1: case 2:
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
break;
case 3: case 4:
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
break;
case 5: case 6:
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
break;
case 7: case 8:
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
break;
case 9: case 10:
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
break;
case 11: case 12:
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
break;
case 13: case 14:
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
break;
case 15: case 16:
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
break;
case 17:
if (can_pet) break;
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
break;
case 18: case 19:
if (can_pet) break;
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
break;
case 20: case 21:
if (!can_pet) mode |= PM_ALLOW_UNIQUE;
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
break;
case 22: case 23:
if (!can_pet) mode |= PM_ALLOW_UNIQUE;
- count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
break;
case 24:
- count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
break;
default:
if (!can_pet) mode |= PM_ALLOW_UNIQUE;
- count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode, '\0');
+ count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
}
}
}
else if (randint1(100) > 30)
{
- earthquake(p_ptr->y, p_ptr->x, 1);
+ earthquake(p_ptr->y, p_ptr->x, 1, 0);
}
else
{
ty = target_row;
}
- if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
+ if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx;
path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
project_length = 0;
int ny = GRID_Y(path_g[i]);
int nx = GRID_X(path_g[i]);
- if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
+ if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0))
{
ty = ny;
tx = nx;
continue;
}
- if (!cave[ny][nx].m_idx)
+ if (!current_floor_ptr->grid_array[ny][nx].m_idx)
{
if (tm_idx)
{
/* Move player before updating the monster */
if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
- update_monster(cave[ny][nx].m_idx, TRUE);
+ update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
/* Found a monster */
- m_ptr = &m_list[cave[ny][nx].m_idx];
+ m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx];
- if (tm_idx != cave[ny][nx].m_idx)
+ if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx)
{
#ifdef JP
msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
{
POSITION x, y;
- for (x = 0; x < cur_wid; x++)
+ for (x = 0; x < current_floor_ptr->width; x++)
{
- for (y = 0; y < cur_hgt; y++)
+ for (y = 0; y < current_floor_ptr->height; y++)
{
- if (is_mirror_grid(&cave[y][x]))
+ if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
{
remove_mirror(y, x);
if (explode)
sound(SOUND_EVIL);
/* Decrease all stats (permanently) */
- (void)dec_stat(A_STR, 50, TRUE);
- (void)dec_stat(A_INT, 50, TRUE);
- (void)dec_stat(A_WIS, 50, TRUE);
- (void)dec_stat(A_DEX, 50, TRUE);
- (void)dec_stat(A_CON, 50, TRUE);
- (void)dec_stat(A_CHR, 50, TRUE);
+ (void)dec_stat(p_ptr, A_STR, 50, TRUE);
+ (void)dec_stat(p_ptr, A_INT, 50, TRUE);
+ (void)dec_stat(p_ptr, A_WIS, 50, TRUE);
+ (void)dec_stat(p_ptr, A_DEX, 50, TRUE);
+ (void)dec_stat(p_ptr, A_CON, 50, TRUE);
+ (void)dec_stat(p_ptr, A_CHR, 50, TRUE);
/* Lose some experience (permanently) */
p_ptr->exp -= (p_ptr->exp / 4);
aggravate_monsters(0);
break;
case 26:
- earthquake(p_ptr->y, p_ptr->x, 5);
+ earthquake(p_ptr->y, p_ptr->x, 5, 0);
break;
case 27:
case 28:
- (void)gain_random_mutation(0);
+ (void)gain_mutation(p_ptr, 0);
break;
case 29:
case 30:
case 35:
while (counter++ < 8)
{
- (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET), '\0');
+ (void)summon_specific(0, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
}
break;
case 36:
if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
/* Stopped by monsters */
- if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
+ if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
/* Save the new location */
x = nx;
else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
else if (die < 104)
{
- earthquake(p_ptr->y, p_ptr->x, 12);
+ earthquake(p_ptr->y, p_ptr->x, 12, 0);
}
else if (die < 106)
{
dispel_monsters(150);
slow_monsters(plev);
sleep_monsters(plev);
- hp_player(300);
+ hp_player(p_ptr, 300);
}
}
msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
"Oh no! Mouldering forms rise from the earth around you!"));
- (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
+ (void)summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
chg_virtue(V_UNLIFE, 1);
}
else if (die < 14)
{
msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
- set_afraid(p_ptr->afraid + randint1(4) + 4);
+ set_afraid(p_ptr, p_ptr->afraid + randint1(4) + 4);
}
else if (die < 26)
{
msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
"Your head is invaded by a horde of gibbering spectral voices..."));
- set_confused(p_ptr->confused + randint1(4) + 4);
+ set_confused(p_ptr, p_ptr->confused + randint1(4) + 4);
}
else if (die < 31)
{
}
else if (die < 104)
{
- earthquake(p_ptr->y, p_ptr->x, 12);
+ earthquake(p_ptr->y, p_ptr->x, 12, 0);
}
else if (die < 106)
{
dispel_monsters(150);
slow_monsters(plev);
sleep_monsters(plev);
- hp_player(300);
+ hp_player(p_ptr, 300);
}
if (die < 31)
else if (die < 14)
{
msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
- summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
+ summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
}
else if (die < 18)
{
else if (die < 26)
{
msg_print(_("《愚者》だ。", "It's the Fool."));
- do_dec_stat(A_INT);
- do_dec_stat(A_WIS);
+ do_dec_stat(p_ptr, A_INT);
+ do_dec_stat(p_ptr, A_WIS);
}
else if (die < 30)
{
msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
- trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
+ trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
}
else if (die < 33)
{
else if (die < 42)
{
msg_print(_("《正義》だ。", "It's Justice."));
- set_blessed(p_ptr->lev, FALSE);
+ set_blessed(p_ptr, p_ptr->lev, FALSE);
}
else if (die < 47)
{
{
msg_print(_("《塔》だ。", "It's the Tower."));
- earthquake(p_ptr->y, p_ptr->x, 5);
+ earthquake(p_ptr->y, p_ptr->x, 5, 0);
}
else if (die < 82)
{
msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
- trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
+ trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
}
else if (die < 84)
{
msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
- trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
+ trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
}
else if (die < 86)
{
msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
- trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
+ trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
}
else if (die < 88)
{
msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
- trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
+ trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
}
else if (die < 96)
{
else if (die < 111)
{
msg_print(_("《審判》だ。", "It's the Judgement."));
- roll_hitdice(0L);
+ roll_hitdice(p_ptr, 0L);
lose_all_mutations();
}
else if (die < 120)
*/
void stop_mouth(void)
{
- if (music_singing_any()) stop_singing();
+ if (music_singing_any()) stop_singing(p_ptr);
if (hex_spelling_any()) stop_hex_spell_all();
}
DIRECTION dir;
POSITION x, y;
int dummy;
- grid_type *c_ptr;
+ grid_type *g_ptr;
if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
{
if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
y = p_ptr->y + ddy[dir];
x = p_ptr->x + ddx[dir];
- c_ptr = &cave[y][x];
+ g_ptr = ¤t_floor_ptr->grid_array[y][x];
stop_mouth();
- if (!(c_ptr->m_idx))
+ if (!(g_ptr->m_idx))
{
msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
return FALSE;
{
if (p_ptr->food < PY_FOOD_FULL)
/* No heal if we are "full" */
- (void)hp_player(dummy);
+ (void)hp_player(p_ptr, dummy);
else
msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
y = p_ptr->y + ddy[dir];
x = p_ptr->x + ddx[dir];
- if (cave[y][x].m_idx)
+ if (current_floor_ptr->grid_array[y][x].m_idx)
{
py_attack(y, x, 0);
if (randint0(p_ptr->skill_dis) < 7)
}
/*!
-* @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
+* @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the p_ptr->inventory_list (or on the floor)
* @return なし
* @note
* currently this function allows pseudo-id of any object,
q = _("どのアイテムを調べますか?", "Meditate on which item? ");
s = _("調べるアイテムがありません。", "You have nothing appropriate.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+ o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
if (!o_ptr) return (FALSE);
/* It is fully known, no information needed */
}
else
{
- grid_type *c_ptr = &cave[creature_ptr->y][creature_ptr->x];
- feature_type *f_ptr = &f_info[c_ptr->feat];
+ grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
+ feature_type *f_ptr = &f_info[g_ptr->feat];
if (!have_flag(f_ptr->flags, FF_PROJECT) ||
(!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
if (!get_rep_dir(&dir, FALSE)) return FALSE;
y = creature_ptr->y + ddy[dir];
x = creature_ptr->x + ddx[dir];
- if (cave[y][x].m_idx)
+ if (current_floor_ptr->grid_array[y][x].m_idx)
{
if (one_in_(3))
msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
"Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
py_attack(y, x, 0);
- if (cave[y][x].m_idx)
+ if (current_floor_ptr->grid_array[y][x].m_idx)
{
handle_stuff();
py_attack(y, x, 0);
if (creature_ptr->csp >= creature_ptr->lev / 5)
{
creature_ptr->csp -= creature_ptr->lev / 5;
- hp_player(creature_ptr->lev);
+ hp_player(p_ptr, creature_ptr->lev);
}
else
{
msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
return FALSE;
}
- if (is_mirror_grid(&cave[creature_ptr->y][creature_ptr->x]))
+ if (is_mirror_grid(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
{
msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
DIRECTION dir;
POSITION y = 0, x = 0;
int i;
- grid_type *c_ptr;
+ grid_type *g_ptr;
for (i = 0; i < 6; i++)
{
dir = randint0(8);
y = creature_ptr->y + ddy_ddd[dir];
x = creature_ptr->x + ddx_ddd[dir];
- c_ptr = &cave[y][x];
+ g_ptr = ¤t_floor_ptr->grid_array[y][x];
/* Hack -- attack monsters */
- if (c_ptr->m_idx)
+ if (g_ptr->m_idx)
py_attack(y, x, 0);
else
{
}
if (!do_riding(TRUE)) return TRUE;
- m_ptr = &m_list[creature_ptr->riding];
+ m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding];
r_ptr = &r_info[m_ptr->r_idx];
monster_desc(m_name, m_ptr, 0);
msg_format(_("%sに乗った。", "You ride on %s."), m_name);
if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
- && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
+ && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->phase_out
&& !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
&& (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
{
{
msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
rakuba(1, TRUE);
-
- /* Paranoia */
/* 落馬処理に失敗してもとにかく乗馬解除 */
creature_ptr->riding = 0;
}