if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue;
/* No teleporting into vaults and such */
- if (!(caster_ptr->inside_quest || caster_ptr->inside_arena))
+ if (!(caster_ptr->current_floor_ptr->inside_quest || caster_ptr->current_floor_ptr->inside_arena))
if (caster_ptr->current_floor_ptr->grid_array[ny][nx].info & CAVE_ICKY) continue;
/* This grid looks good */
/* Forget the counter target */
reset_target(m_ptr);
- update_monster(m_idx, TRUE);
+ update_monster(caster_ptr, m_idx, TRUE);
lite_spot(oy, ox);
lite_spot(ny, nx);
m_ptr->fy = ny;
m_ptr->fx = nx;
- update_monster(m_idx, TRUE);
+ update_monster(p_ptr, m_idx, TRUE);
lite_spot(oy, ox);
lite_spot(ny, nx);
* @param mode オプション
* @return なし
*/
-void teleport_player(POSITION dis, BIT_FLAGS mode)
+void teleport_player(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode)
{
POSITION yy, xx;
- POSITION oy = p_ptr->y;
- POSITION ox = p_ptr->x;
+ POSITION oy = creature_ptr->y;
+ POSITION ox = creature_ptr->x;
- if (!teleport_player_aux(p_ptr, dis, mode)) return;
+ if (!teleport_player_aux(creature_ptr, dis, mode)) return;
/* Monsters with teleport ability may follow the player */
for (xx = -1; xx < 2; xx++)
{
for (yy = -1; yy < 2; yy++)
{
- MONSTER_IDX tmp_m_idx = p_ptr->current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
+ MONSTER_IDX tmp_m_idx = creature_ptr->current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
/* A monster except your mount may follow */
- if (tmp_m_idx && (p_ptr->riding != tmp_m_idx))
+ if (tmp_m_idx && (creature_ptr->riding != tmp_m_idx))
{
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[tmp_m_idx];
+ monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[tmp_m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/*
if ((r_ptr->a_ability_flags2 & RF6_TPORT) &&
!(r_ptr->flagsr & RFR_RES_TELE))
{
- if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L);
+ if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, creature_ptr->y, creature_ptr->x, r_ptr->level, 0L);
}
}
}
{
if (one_in_(3))
{
- teleport_player(200, TELEPORT_PASSIVE);
+ teleport_player(p_ptr, 200, TELEPORT_PASSIVE);
msg_print(_("失敗!", "Failed!"));
}
else teleport_player_to(p_ptr, m_ptr->fy, m_ptr->fx, 0L);
prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
leave_quest_check();
- creature_ptr->inside_quest = 0;
+ creature_ptr->current_floor_ptr->inside_quest = 0;
creature_ptr->leaving = TRUE;
}
}
*/
/* Ironman option */
- if (creature_ptr->inside_arena || ironman_downward)
+ if (creature_ptr->current_floor_ptr->inside_arena || ironman_downward)
{
msg_print(_("何も起こらなかった。", "Nothing happens."));
return TRUE;
}
- if (p_ptr->current_floor_ptr->dun_level && (max_dlv[p_ptr->dungeon_idx] > p_ptr->current_floor_ptr->dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall)
+ if (p_ptr->current_floor_ptr->dun_level && (max_dlv[p_ptr->dungeon_idx] > p_ptr->current_floor_ptr->dun_level) && !creature_ptr->current_floor_ptr->inside_quest && !creature_ptr->word_recall)
{
if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? ")))
{
/*!
* @brief 虚無招来によるフロア中の全壁除去処理 /
* Vanish all walls in this floor
+ * @params floor_ptr 対象となるフロアの対象ポインタ
+ * @params subject_ptr 現象を主観するクリーチャーの参照ポインタ
* @return 実際に処理が反映された場合TRUE
*/
-static bool vanish_dungeon(floor_type *floor_ptr)
+static bool vanish_dungeon(floor_type *floor_ptr, player_type *subject_ptr)
{
POSITION y, x;
grid_type *g_ptr;
GAME_TEXT m_name[MAX_NLEN];
/* Prevent vasishing of quest levels and town */
- if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !floor_ptr->dun_level)
+ if ((subject_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(subject_ptr->current_floor_ptr->inside_quest)) || !floor_ptr->dun_level)
{
return FALSE;
}
}
/* 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);
+ subject_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
+ subject_ptr->redraw |= (PR_MAP);
+ subject_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
return TRUE;
}
}
/* Prevent destruction of quest levels and town */
- else if ((caster_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->inside_quest)) || !caster_ptr->current_floor_ptr->dun_level)
+ else if ((caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest)) || !caster_ptr->current_floor_ptr->dun_level)
{
msg_print(_("地面が揺れた。", "The ground trembles."));
}
if (one_in_(666))
{
- if (!vanish_dungeon(caster_ptr->current_floor_ptr)) msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon silences a moment."));
+ if (!vanish_dungeon(caster_ptr->current_floor_ptr, caster_ptr)) msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon silences a moment."));
}
else
{
void alter_reality(void)
{
/* Ironman option */
- if (p_ptr->inside_arena || ironman_downward)
+ if (p_ptr->current_floor_ptr->inside_arena || ironman_downward)
{
msg_print(_("何も起こらなかった。", "Nothing happens."));
return;
* @param use_realm 魔法領域
* @return 経験値
*/
-EXP experience_of_spell(SPELL_IDX spell, REALM_IDX use_realm)
+EXP experience_of_spell(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm)
{
- if (p_ptr->pclass == CLASS_SORCERER) return SPELL_EXP_MASTER;
- else if (p_ptr->pclass == CLASS_RED_MAGE) return SPELL_EXP_SKILLED;
- else if (use_realm == p_ptr->realm1) return p_ptr->spell_exp[spell];
- else if (use_realm == p_ptr->realm2) return p_ptr->spell_exp[spell + 32];
+ if (caster_ptr->pclass == CLASS_SORCERER) return SPELL_EXP_MASTER;
+ else if (caster_ptr->pclass == CLASS_RED_MAGE) return SPELL_EXP_SKILLED;
+ else if (use_realm == caster_ptr->realm1) return caster_ptr->spell_exp[spell];
+ else if (use_realm == caster_ptr->realm2) return caster_ptr->spell_exp[spell + 32];
else return 0;
}
* need_mana defaults if spell exp equals SPELL_EXP_EXPERT and !p_ptr->dec_mana.
* MANA_CONST is used to calculate need_mana effected from spell proficiency.
*/
- need_mana = need_mana * (MANA_CONST + SPELL_EXP_EXPERT - experience_of_spell(spell, realm)) + (MANA_CONST - 1);
+ need_mana = need_mana * (MANA_CONST + SPELL_EXP_EXPERT - experience_of_spell(p_ptr, spell, realm)) + (MANA_CONST - 1);
need_mana *= p_ptr->dec_mana ? DEC_MANA_DIV : MANA_DIV;
need_mana /= MANA_CONST * MANA_DIV;
if (need_mana < 1) need_mana = 1;
* @return 失敗率(%)
* @todo 統合を検討
*/
-PERCENTAGE mod_spell_chance_1(PERCENTAGE chance)
+PERCENTAGE mod_spell_chance_1(player_type *caster_ptr, PERCENTAGE chance)
{
- chance += p_ptr->to_m_chance;
+ chance += caster_ptr->to_m_chance;
- if (p_ptr->heavy_spell) chance += 20;
+ if (caster_ptr->heavy_spell) chance += 20;
- if (p_ptr->dec_mana && p_ptr->easy_spell) chance -= 4;
- else if (p_ptr->easy_spell) chance -= 3;
- else if (p_ptr->dec_mana) chance -= 2;
+ if (caster_ptr->dec_mana && caster_ptr->easy_spell) chance -= 4;
+ else if (caster_ptr->easy_spell) chance -= 3;
+ else if (caster_ptr->dec_mana) chance -= 2;
return chance;
}
* Note: variable "chance" cannot be negative.
* @todo 統合を検討
*/
-PERCENTAGE mod_spell_chance_2(PERCENTAGE chance)
+PERCENTAGE mod_spell_chance_2(player_type *caster_ptr, PERCENTAGE chance)
{
- if (p_ptr->dec_mana) chance--;
-
- if (p_ptr->heavy_spell) chance += 5;
-
+ if (caster_ptr->dec_mana) chance--;
+ if (caster_ptr->heavy_spell) chance += 5;
return MAX(chance, 0);
}
if (((caster_ptr->pclass == CLASS_PRIEST) || (caster_ptr->pclass == CLASS_SORCERER)) && caster_ptr->icky_wield[0]) chance += 25;
if (((caster_ptr->pclass == CLASS_PRIEST) || (caster_ptr->pclass == CLASS_SORCERER)) && caster_ptr->icky_wield[1]) chance += 25;
- chance = mod_spell_chance_1(chance);
+ chance = mod_spell_chance_1(caster_ptr, chance);
/* Goodness or evilness gives a penalty to failure rate */
switch (use_realm)
if ((use_realm == caster_ptr->realm1) || (use_realm == caster_ptr->realm2)
|| (caster_ptr->pclass == CLASS_SORCERER) || (caster_ptr->pclass == CLASS_RED_MAGE))
{
- EXP exp = experience_of_spell(spell, use_realm);
+ EXP exp = experience_of_spell(caster_ptr, spell, use_realm);
if (exp >= SPELL_EXP_EXPERT) chance--;
if (exp >= SPELL_EXP_MASTER) chance--;
}
/* Return the chance */
- return mod_spell_chance_2(chance);
+ return mod_spell_chance_2(caster_ptr, chance);
}
need_mana = s_ptr->smana;
else
{
- EXP exp = experience_of_spell(spell, use_realm);
+ EXP exp = experience_of_spell(caster_ptr, spell, use_realm);
/* Extract mana consumption rate */
need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
bool health_tracked = (caster_ptr->health_who == g_ptr->m_idx) ? TRUE : FALSE;
monster_type back_m;
- if (caster_ptr->inside_arena || caster_ptr->phase_out) return (FALSE);
+ if (caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out) return (FALSE);
if ((caster_ptr->riding == g_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE);
(!randint0(plev / 10 + 10)))
{
p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
- teleport_player((plev + 2) * 2, TELEPORT_PASSIVE);
+ teleport_player(p_ptr, (plev + 2) * 2, TELEPORT_PASSIVE);
/* Failed */
return FALSE;
}
-bool shock_power(void)
+bool shock_power(player_type *caster_ptr)
{
DIRECTION dir;
POSITION y, x;
HIT_POINT dam;
- PLAYER_LEVEL plev = p_ptr->lev;
+ PLAYER_LEVEL plev = caster_ptr->lev;
int boost = P_PTR_KI;
- if (heavy_armor(p_ptr)) boost /= 2;
+ if (heavy_armor(caster_ptr)) boost /= 2;
project_length = 1;
if (!get_aim_dir(&dir)) return FALSE;
- y = p_ptr->y + ddy[dir];
- x = p_ptr->x + ddx[dir];
+ y = caster_ptr->y + ddy[dir];
+ x = caster_ptr->x + ddx[dir];
dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8);
fire_beam(GF_MISSILE, dir, dam);
- if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+ if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
{
int i;
POSITION ty = y, tx = x;
POSITION oy = y, ox = x;
- MONSTER_IDX m_idx = p_ptr->current_floor_ptr->grid_array[y][x].m_idx;
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+ MONSTER_IDX m_idx = caster_ptr->current_floor_ptr->grid_array[y][x].m_idx;
+ monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
GAME_TEXT m_name[MAX_NLEN];
{
y += ddy[dir];
x += ddx[dir];
- if (cave_empty_bold(p_ptr->current_floor_ptr, y, x))
+ if (cave_empty_bold(caster_ptr->current_floor_ptr, y, x))
{
ty = y;
tx = x;
if ((ty != oy) || (tx != ox))
{
msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name);
- p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
- p_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
+ caster_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
+ caster_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
m_ptr->fy = ty;
m_ptr->fx = tx;
- update_monster(m_idx, TRUE);
+ update_monster(caster_ptr, m_idx, TRUE);
lite_spot(oy, ox);
lite_spot(ty, tx);
if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
- p_ptr->update |= (PU_MON_LITE);
+ caster_ptr->update |= (PU_MON_LITE);
}
}
}
return TRUE;
}
-void blood_curse_to_enemy(MONSTER_IDX m_idx)
+void blood_curse_to_enemy(player_type *caster_ptr, MONSTER_IDX m_idx)
{
- monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
- grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx];
+ monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
+ grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx];
BIT_FLAGS curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
int count = 0;
do
if (!count)
{
msg_print(_("地面が揺れた...", "The ground trembles..."));
- earthquake(p_ptr, m_ptr->fy, m_ptr->fx, 4 + randint0(4), 0);
+ earthquake(caster_ptr, m_ptr->fy, m_ptr->fx, 4 + randint0(4), 0);
if (!one_in_(6)) break;
}
case 3: case 4: case 5: case 6:
{
msg_print(_("空間が歪んだ!", "Space warps about you!"));
- if (m_ptr->r_idx) teleport_away(p_ptr, g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
+ if (m_ptr->r_idx) teleport_away(caster_ptr, g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
if (one_in_(13)) count += activate_hi_summon(m_ptr->fy, m_ptr->fx, TRUE);
if (!one_in_(6)) break;
}
if (pet) mode |= PM_FORCE_PET;
else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
- count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : p_ptr->current_floor_ptr->dun_level), 0, mode);
+ count += summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : caster_ptr->current_floor_ptr->dun_level), 0, mode);
if (!one_in_(6)) break;
}
case 23: case 24: case 25:
- if (p_ptr->hold_exp && (randint0(100) < 75)) break;
+ if (caster_ptr->hold_exp && (randint0(100) < 75)) break;
msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
- if (p_ptr->hold_exp) lose_exp(p_ptr, p_ptr->exp / 160);
- else lose_exp(p_ptr, p_ptr->exp / 16);
+ if (caster_ptr->hold_exp) lose_exp(caster_ptr, caster_ptr->exp / 160);
+ else lose_exp(caster_ptr, caster_ptr->exp / 16);
if (!one_in_(6)) break;
case 26: case 27: case 28:
{
{
do
{
- (void)do_dec_stat(p_ptr, i);
+ (void)do_dec_stat(caster_ptr, i);
} while (one_in_(2));
i++;
}
else
{
- (void)do_dec_stat(p_ptr, randint0(6));
+ (void)do_dec_stat(caster_ptr, randint0(6));
}
break;
}
* @brief 町間のテレポートを行うメインルーチン。
* @return テレポート処理を決定したか否か
*/
-bool tele_town(void)
+bool tele_town(player_type *caster_ptr)
{
int i;
POSITION x, y;
int num = 0;
- if (p_ptr->current_floor_ptr->dun_level)
+ if (caster_ptr->current_floor_ptr->dun_level)
{
msg_print(_("この魔法は地上でしか使えない!", "This spell can only be used on the surface!"));
return FALSE;
}
- if (p_ptr->inside_arena || p_ptr->phase_out)
+ if (caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out)
{
msg_print(_("この魔法は外でしか使えない!", "This spell can only be used outside!"));
return FALSE;
{
char buf[80];
- if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i - 1)))) continue;
+ if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == caster_ptr->town_num) || !(caster_ptr->visit & (1L << (i - 1)))) continue;
sprintf(buf, "%c) %-20s", I2A(i - 1), town_info[i].name);
prt(buf, 5 + i, 5);
return FALSE;
}
else if ((i < 'a') || (i > ('a' + max_towns - 2))) continue;
- else if (((i - 'a' + 1) == p_ptr->town_num) || ((i - 'a' + 1) == NO_TOWN) || ((i - 'a' + 1) == SECRET_TOWN) || !(p_ptr->visit & (1L << (i - 'a')))) continue;
+ else if (((i - 'a' + 1) == caster_ptr->town_num) || ((i - 'a' + 1) == NO_TOWN) || ((i - 'a' + 1) == SECRET_TOWN) || !(caster_ptr->visit & (1L << (i - 'a')))) continue;
break;
}
{
if (wilderness[y][x].town == (i - 'a' + 1))
{
- p_ptr->wilderness_y = y;
- p_ptr->wilderness_x = x;
+ caster_ptr->wilderness_y = y;
+ caster_ptr->wilderness_x = x;
}
}
}
- p_ptr->leaving = TRUE;
- p_ptr->leave_bldg = TRUE;
- p_ptr->teleport_town = TRUE;
+ caster_ptr->leaving = TRUE;
+ caster_ptr->leave_bldg = TRUE;
+ caster_ptr->teleport_town = TRUE;
screen_load();
return TRUE;
}