* Attempt to move the monster at least "dis/2" grids away.
* But allow variation to prevent infinite loops.
*/
-bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
+bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
{
POSITION oy, ox, d, i, min;
int tries = 0;
bool look = TRUE;
- monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
if (!monster_is_valid(m_ptr)) return (FALSE);
oy = m_ptr->fy;
min = dis / 2;
if ((mode & TELEPORT_DEC_VALOUR) &&
- (((p_ptr->chp * 10) / p_ptr->mhp) > 5) &&
- (4+randint1(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
+ (((caster_ptr->chp * 10) / caster_ptr->mhp) > 5) &&
+ (4+randint1(5) < ((caster_ptr->chp * 10) / caster_ptr->mhp)))
{
- chg_virtue(V_VALOUR, -1);
+ chg_virtue(caster_ptr, V_VALOUR, -1);
}
/* Look until done */
}
/* Ignore illegal locations */
- if (!in_bounds(ny, nx)) continue;
+ if (!in_bounds(caster_ptr->current_floor_ptr, ny, nx)) continue;
if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue;
/* No teleporting into vaults and such */
- if (!(p_ptr->inside_quest || p_ptr->inside_arena))
- if (current_floor_ptr->grid_array[ny][nx].info & CAVE_ICKY) continue;
+ 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 */
look = FALSE;
sound(SOUND_TPOTHER);
/* Update the old location */
- current_floor_ptr->grid_array[oy][ox].m_idx = 0;
+ caster_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
/* Update the new location */
- current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
+ caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
/* Move the monster */
m_ptr->fy = ny;
/* 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);
if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
- p_ptr->update |= (PU_MON_LITE);
+ caster_ptr->update |= (PU_MON_LITE);
return (TRUE);
}
int attempts = 500;
POSITION dis = 2;
bool look = TRUE;
- monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
if(!m_ptr->r_idx) return;
/* "Skill" test */
}
/* Ignore illegal locations */
- if (!in_bounds(ny, nx)) continue;
+ if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue;
if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue;
/* No teleporting into vaults and such */
- /* if (current_floor_ptr->grid_array[ny][nx].info & (CAVE_ICKY)) continue; */
+ /* if (p_ptr->current_floor_ptr->grid_array[ny][nx].info & (CAVE_ICKY)) continue; */
/* This grid looks good */
look = FALSE;
sound(SOUND_TPOTHER);
/* Update the old location */
- current_floor_ptr->grid_array[oy][ox].m_idx = 0;
+ p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
/* Update the new location */
- current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
+ p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
/* Move the monster */
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);
* </pre>
*/
-bool teleport_player_aux(POSITION dis, BIT_FLAGS mode)
+bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode)
{
int candidates_at[MAX_TELEPORT_DISTANCE + 1];
int total_candidates, cur_candidates;
POSITION y = 0, x = 0;
int min, pick, i;
- int left = MAX(1, p_ptr->x - dis);
- int right = MIN(current_floor_ptr->width - 2, p_ptr->x + dis);
- int top = MAX(1, p_ptr->y - dis);
- int bottom = MIN(current_floor_ptr->height - 2, p_ptr->y + dis);
+ int left = MAX(1, creature_ptr->x - dis);
+ int right = MIN(creature_ptr->current_floor_ptr->width - 2, creature_ptr->x + dis);
+ int top = MAX(1, creature_ptr->y - dis);
+ int bottom = MIN(creature_ptr->current_floor_ptr->height - 2, creature_ptr->y + dis);
- if (p_ptr->wild_mode) return FALSE;
+ if (creature_ptr->wild_mode) return FALSE;
- if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
+ if (creature_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
{
msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
return FALSE;
if (!cave_player_teleportable_bold(y, x, mode)) continue;
/* Calculate distance */
- d = distance(p_ptr->y, p_ptr->x, y, x);
+ d = distance(creature_ptr->y, creature_ptr->x, y, x);
/* Skip too far locations */
if (d > dis) continue;
if (!cave_player_teleportable_bold(y, x, mode)) continue;
/* Calculate distance */
- d = distance(p_ptr->y, p_ptr->x, y, x);
+ d = distance(creature_ptr->y, creature_ptr->x, y, x);
/* Skip too far locations */
if (d > dis) continue;
if (!pick) break;
}
- if (player_bold(y, x)) return FALSE;
+ if (player_bold(creature_ptr, y, x)) return FALSE;
sound(SOUND_TELEPORT);
#ifdef JP
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
- msg_format("『こっちだぁ、%s』", p_ptr->name);
+ if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
+ msg_format("『こっちだぁ、%s』", creature_ptr->name);
#endif
- (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+ (void)move_player_effect(creature_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
return TRUE;
}
* @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(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 = 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 = ¤t_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);
}
}
}
POSITION oy = p_ptr->y;
POSITION ox = p_ptr->x;
- if (!teleport_player_aux(dis, TELEPORT_PASSIVE)) return;
+ if (!teleport_player_aux(p_ptr, dis, TELEPORT_PASSIVE)) 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 = current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
+ MONSTER_IDX tmp_m_idx = p_ptr->current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
/* A monster except your mount or caster may follow */
if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx))
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[tmp_m_idx];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[tmp_m_idx];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
/*
* This function allows teleporting into vaults (!)
* </pre>
*/
-void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
+void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode)
{
POSITION y, x;
POSITION dis = 0, ctr = 0;
- if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
+ if (creature_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
{
msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
return;
{
y = (POSITION)rand_spread(ny, dis);
x = (POSITION)rand_spread(nx, dis);
- if (in_bounds(y, x)) break;
+ if (in_bounds(creature_ptr->current_floor_ptr, y, x)) break;
}
/* Accept any grid when wizard mode */
- if (p_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!current_floor_ptr->grid_array[y][x].m_idx || (current_floor_ptr->grid_array[y][x].m_idx == p_ptr->riding))) break;
+ if (current_world_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx || (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx == creature_ptr->riding))) break;
/* Accept teleportable floor grids */
if (cave_player_teleportable_bold(y, x, mode)) break;
}
sound(SOUND_TELEPORT);
- (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+ (void)move_player_effect(creature_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
}
void teleport_away_followable(MONSTER_IDX m_idx)
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
POSITION oldfy = m_ptr->fy;
POSITION oldfx = m_ptr->fx;
bool old_ml = m_ptr->ml;
POSITION old_cdis = m_ptr->cdis;
- teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
+ teleport_away(p_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L);
- if (old_ml && (old_cdis <= MAX_SIGHT) && !current_world_ptr->timewalk_m_idx && !p_ptr->phase_out && los(p_ptr->y, p_ptr->x, oldfy, oldfx))
+ if (old_ml && (old_cdis <= MAX_SIGHT) && !current_world_ptr->timewalk_m_idx && !p_ptr->phase_out && los(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, oldfy, oldfx))
{
bool follow = FALSE;
{
if (one_in_(3))
{
- teleport_player(200, TELEPORT_PASSIVE);
+ teleport_player(p_ptr, 200, TELEPORT_PASSIVE);
msg_print(_("失敗!", "Failed!"));
}
- else teleport_player_to(m_ptr->fy, m_ptr->fx, 0L);
+ else teleport_player_to(p_ptr, m_ptr->fy, m_ptr->fx, 0L);
p_ptr->energy_need += ENERGY_NEED();
}
}
GAME_TEXT m_name[MAX_NLEN];
if (!target_set(TARGET_KILL)) return FALSE;
- target_m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
+ target_m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
if (!target_m_idx) return TRUE;
- if (!player_has_los_bold(target_row, target_col)) return TRUE;
- if (!projectable(creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE;
- m_ptr = ¤t_floor_ptr->m_list[target_m_idx];
+ if (!player_has_los_bold(p_ptr, target_row, target_col)) return TRUE;
+ if (!projectable(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE;
+ m_ptr = &p_ptr->current_floor_ptr->m_list[target_m_idx];
r_ptr = &r_info[m_ptr->r_idx];
monster_desc(m_name, m_ptr, 0);
msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name);
{
msg_format(_("しかし効果がなかった!", "%^s is unaffected!"), m_name);
}
- else teleport_level(target_m_idx);
+ else teleport_level(creature_ptr, target_m_idx);
return TRUE;
}
* @param m_idx テレポートの対象となるモンスターID(0ならばプレイヤー) / If m_idx <= 0, target is player.
* @return なし
*/
-void teleport_level(MONSTER_IDX m_idx)
+void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx)
{
- bool go_up;
+ bool go_up;
GAME_TEXT m_name[160];
- bool see_m = TRUE;
+ bool see_m = TRUE;
if (m_idx <= 0) /* To player */
{
}
else /* To monster */
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
/* Get the monster name (or "it") */
monster_desc(m_name, m_ptr, 0);
return;
}
- if ((m_idx <= 0) && p_ptr->anti_tele) /* To player */
+ if ((m_idx <= 0) && creature_ptr->anti_tele) /* To player */
{
msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
return;
if (randint0(100) < 50) go_up = TRUE;
else go_up = FALSE;
- if ((m_idx <= 0) && p_ptr->wizard)
+ if ((m_idx <= 0) && current_world_ptr->wizard)
{
if (get_check("Force to go up? ")) go_up = TRUE;
else if (get_check("Force to go down? ")) go_up = FALSE;
}
/* Down only */
- if ((ironman_downward && (m_idx <= 0)) || (current_floor_ptr->dun_level <= d_info[p_ptr->dungeon_idx].mindepth))
+ if ((ironman_downward && (m_idx <= 0)) || (creature_ptr->current_floor_ptr->dun_level <= d_info[creature_ptr->dungeon_idx].mindepth))
{
#ifdef JP
if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name);
#endif
if (m_idx <= 0) /* To player */
{
- if (!current_floor_ptr->dun_level)
+ if (!creature_ptr->current_floor_ptr->dun_level)
{
- p_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon;
- p_ptr->oldpy = p_ptr->y;
- p_ptr->oldpx = p_ptr->x;
+ creature_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : creature_ptr->recall_dungeon;
+ creature_ptr->oldpy = creature_ptr->y;
+ creature_ptr->oldpx = creature_ptr->x;
}
- if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
+ if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, 1, NULL);
if (autosave_l) do_cmd_save_game(TRUE);
- if (!current_floor_ptr->dun_level)
+ if (!creature_ptr->current_floor_ptr->dun_level)
{
- current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].mindepth;
+ creature_ptr->current_floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].mindepth;
prepare_change_floor_mode(CFM_RAND_PLACE);
}
else
{
prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
}
- p_ptr->leaving = TRUE;
+ creature_ptr->leaving = TRUE;
}
}
/* Up only */
- else if (quest_number(current_floor_ptr->dun_level) || (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth))
+ else if (quest_number(creature_ptr->current_floor_ptr->dun_level) || (creature_ptr->current_floor_ptr->dun_level >= d_info[creature_ptr->dungeon_idx].maxdepth))
{
#ifdef JP
if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name);
if (m_idx <= 0) /* To player */
{
- if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
+ if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, -1, NULL);
if (autosave_l) do_cmd_save_game(TRUE);
prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
leave_quest_check();
- p_ptr->inside_quest = 0;
- p_ptr->leaving = TRUE;
+ creature_ptr->current_floor_ptr->inside_quest = 0;
+ creature_ptr->leaving = TRUE;
}
}
else if (go_up)
if (m_idx <= 0) /* To player */
{
- if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
+ if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, -1, NULL);
if (autosave_l) do_cmd_save_game(TRUE);
prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
- p_ptr->leaving = TRUE;
+ creature_ptr->leaving = TRUE;
}
}
else
if (m_idx <= 0) /* To player */
{
/* Never reach this code on the surface */
- /* if (!current_floor_ptr->dun_level) p_ptr->dungeon_idx = p_ptr->recall_dungeon; */
- if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
+ /* if (!creature_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = creature_ptr->recall_dungeon; */
+ if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, 1, NULL);
if (autosave_l) do_cmd_save_game(TRUE);
prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
- p_ptr->leaving = TRUE;
+ creature_ptr->leaving = TRUE;
}
}
/* Monster level teleportation is simple deleting now */
if (m_idx > 0)
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
+ monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
check_quest_completion(m_ptr);
char m2_name[MAX_NLEN];
monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
- do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
+ exe_write_diary(creature_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
}
delete_monster_idx(m_idx);
*/
/* 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 (current_floor_ptr->dun_level && (max_dlv[p_ptr->dungeon_idx] > 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? ")))
{
- max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
+ max_dlv[p_ptr->dungeon_idx] = p_ptr->current_floor_ptr->dun_level;
if (record_maxdepth)
- do_cmd_write_nikki(NIKKI_TRUMP, p_ptr->dungeon_idx, _("帰還のときに", "when recall from dungeon"));
+ exe_write_diary(p_ptr, NIKKI_TRUMP, p_ptr->dungeon_idx, _("帰還のときに", "when recall from dungeon"));
}
}
if (!creature_ptr->word_recall)
{
- if (!current_floor_ptr->dun_level)
+ if (!p_ptr->current_floor_ptr->dun_level)
{
DUNGEON_IDX select_dungeon;
select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14);
creature_ptr->recall_dungeon = select_dungeon;
max_dlv[creature_ptr->recall_dungeon] = ((amt > d_info[select_dungeon].maxdepth) ? d_info[select_dungeon].maxdepth : ((amt < d_info[select_dungeon].mindepth) ? d_info[select_dungeon].mindepth : amt));
if (record_maxdepth)
- do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower"));
+ exe_write_diary(p_ptr, NIKKI_TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower"));
msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
(int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]);
/* Default */
- sprintf(tmp_val, "%d", (int)MAX(current_floor_ptr->dun_level, 1));
+ sprintf(tmp_val, "%d", (int)MAX(p_ptr->current_floor_ptr->dun_level, 1));
/* Ask for a level */
if (get_string(ppp, tmp_val, 10))
max_dlv[select_dungeon] = dummy;
if (record_maxdepth)
- do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall"));
+ exe_write_diary(p_ptr, NIKKI_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall"));
/* Accept request */
#ifdef JP
msg_format("%sの帰還レベルを %d 階にセット。", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
* @return 劣化処理に関するメッセージが発せられた場合はTRUEを返す /
* Return "TRUE" if the player notices anything
*/
-bool apply_disenchant(BIT_FLAGS mode)
+bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode)
{
- int t = 0;
+ int t = 0;
object_type *o_ptr;
GAME_TEXT o_name[MAX_NLEN];
int to_h, to_d, to_a, pval;
case 8: t = INVEN_FEET; break;
}
- o_ptr = &p_ptr->inventory_list[t];
+ o_ptr = &target_ptr->inventory_list[t];
/* No item, nothing happens */
if (!o_ptr->k_idx) return (FALSE);
((o_ptr->number != 1) ? "were" : "was"));
#endif
- chg_virtue(V_HARMONY, 1);
- chg_virtue(V_ENCHANT, -2);
- p_ptr->update |= (PU_BONUS);
- p_ptr->window |= (PW_EQUIP | PW_PLAYER);
+ chg_virtue(target_ptr, V_HARMONY, 1);
+ chg_virtue(target_ptr, V_ENCHANT, -2);
+ target_ptr->update |= (PU_BONUS);
+ target_ptr->window |= (PW_EQUIP | PW_PLAYER);
- calc_android_exp();
+ calc_android_exp(target_ptr);
}
return (TRUE);
/*!
* @brief 虚無招来によるフロア中の全壁除去処理 /
* Vanish all walls in this floor
+ * @params floor_ptr 対象となるフロアの対象ポインタ
+ * @params subject_ptr 現象を主観するクリーチャーの参照ポインタ
* @return 実際に処理が反映された場合TRUE
*/
-static bool vanish_dungeon(void)
+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)) || !current_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;
}
/* Scan all normal grids */
- for (y = 1; y < current_floor_ptr->height - 1; y++)
+ for (y = 1; y < floor_ptr->height - 1; y++)
{
- for (x = 1; x < current_floor_ptr->width - 1; x++)
+ for (x = 1; x < floor_ptr->width - 1; x++)
{
- g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ g_ptr = &floor_ptr->grid_array[y][x];
/* Seeing true feature code (ignore mimic) */
f_ptr = &f_info[g_ptr->feat];
/* Lose room and vault */
g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
- m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
+ m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
/* Awake monster */
if (g_ptr->m_idx && MON_CSLEEP(m_ptr))
}
/* Special boundary walls -- Top and bottom */
- for (x = 0; x < current_floor_ptr->width; x++)
+ for (x = 0; x < floor_ptr->width; x++)
{
- g_ptr = ¤t_floor_ptr->grid_array[0][x];
+ g_ptr = &floor_ptr->grid_array[0][x];
f_ptr = &f_info[g_ptr->mimic];
/* Lose room and vault */
if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
}
- g_ptr = ¤t_floor_ptr->grid_array[current_floor_ptr->height - 1][x];
+ g_ptr = &floor_ptr->grid_array[floor_ptr->height - 1][x];
f_ptr = &f_info[g_ptr->mimic];
/* Lose room and vault */
}
/* Special boundary walls -- Left and right */
- for (y = 1; y < (current_floor_ptr->height - 1); y++)
+ for (y = 1; y < (floor_ptr->height - 1); y++)
{
- g_ptr = ¤t_floor_ptr->grid_array[y][0];
+ g_ptr = &floor_ptr->grid_array[y][0];
f_ptr = &f_info[g_ptr->mimic];
/* Lose room and vault */
if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
}
- g_ptr = ¤t_floor_ptr->grid_array[y][current_floor_ptr->width - 1];
+ g_ptr = &floor_ptr->grid_array[y][floor_ptr->width - 1];
f_ptr = &f_info[g_ptr->mimic];
/* Lose room and vault */
}
/* 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;
}
/*!
* @brief 虚無招来処理 /
* @return なし
+ * @details
+ * Sorry, it becomes not (void)...
*/
-void call_the_(void)
+void call_the_void(player_type *caster_ptr)
{
int i;
grid_type *g_ptr;
for (i = 0; i < 9; i++)
{
- g_ptr = ¤t_floor_ptr->grid_array[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]];
+ g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->y + ddy_ddd[i]][caster_ptr->x + ddx_ddd[i]];
if (!cave_have_flag_grid(g_ptr, FF_PROJECT))
{
}
/* Prevent destruction of quest levels and town */
- else if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !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()) 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
{
- if (destroy_area(p_ptr->y, p_ptr->x, 15 + p_ptr->lev + randint0(11), FALSE))
+ if (destroy_area(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, 15 + caster_ptr->lev + randint0(11), FALSE))
msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses..."));
else
msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles."));
}
- take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1);
+ take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1);
}
}
* @param require_los 射線の通りを要求するならばTRUE
* @return なし
*/
-void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
+void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los)
{
POSITION ty, tx;
OBJECT_IDX i;
GAME_TEXT o_name[MAX_NLEN];
/* Check to see if an object is already there */
- if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx)
+ if (caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].o_idx)
{
msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something."));
return;
tx = target_col;
ty = target_row;
- if (distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE)
+ if (distance(caster_ptr->y, caster_ptr->x, ty, tx) > MAX_RANGE)
{
msg_print(_("そんなに遠くにある物は取れません!", "You can't fetch something that far away!"));
return;
}
- g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
+ g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
/* We need an item to fetch */
if (!g_ptr->o_idx)
/* We need to see the item */
if (require_los)
{
- if (!player_has_los_bold(ty, tx))
+ if (!player_has_los_bold(p_ptr, ty, tx))
{
msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location."));
return;
}
- else if (!projectable(p_ptr->y, p_ptr->x, ty, tx))
+ else if (!projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, ty, tx))
{
msg_print(_("そこは壁の向こうです。", "You have no direct line of sight to that location."));
return;
}
else
{
- ty = p_ptr->y;
- tx = p_ptr->x;
+ ty = caster_ptr->y;
+ tx = caster_ptr->x;
do
{
ty += ddy[dir];
tx += ddx[dir];
- g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
+ g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
- if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) ||
+ if ((distance(caster_ptr->y, caster_ptr->x, ty, tx) > MAX_RANGE) ||
!cave_have_flag_bold(ty, tx, FF_PROJECT)) return;
}
while (!g_ptr->o_idx);
}
- o_ptr = ¤t_floor_ptr->o_list[g_ptr->o_idx];
+ o_ptr = &caster_ptr->current_floor_ptr->o_list[g_ptr->o_idx];
if (o_ptr->weight > wgt)
{
i = g_ptr->o_idx;
g_ptr->o_idx = o_ptr->next_o_idx;
- current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */
+ caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].o_idx = i; /* 'move' it */
o_ptr->next_o_idx = 0;
- o_ptr->iy = p_ptr->y;
- o_ptr->ix = p_ptr->x;
+ o_ptr->iy = caster_ptr->y;
+ o_ptr->ix = caster_ptr->x;
object_desc(o_name, o_ptr, OD_NAME_ONLY);
msg_format(_("%^sがあなたの足元に飛んできた。", "%^s flies through the air to your feet."), o_name);
- note_spot(p_ptr->y, p_ptr->x);
- p_ptr->redraw |= PR_MAP;
+ note_spot(caster_ptr->y, caster_ptr->x);
+ caster_ptr->redraw |= PR_MAP;
}
/*!
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;
* will not be uncursed.
* </pre>
*/
-static int remove_curse_aux(int all)
+static int remove_curse_aux(player_type *creature_ptr, int all)
{
int i, cnt = 0;
/* Attempt to uncurse items being worn */
for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
- object_type *o_ptr = &p_ptr->inventory_list[i];
+ object_type *o_ptr = &creature_ptr->inventory_list[i];
if (!o_ptr->k_idx) continue;
/* Uncursed already */
o_ptr->ident |= (IDENT_SENSE);
o_ptr->feeling = FEEL_NONE;
- p_ptr->update |= (PU_BONUS);
- p_ptr->window |= (PW_EQUIP);
+ creature_ptr->update |= (PU_BONUS);
+ creature_ptr->window |= (PW_EQUIP);
/* Count the uncursings */
cnt++;
* Remove most curses
* @return 解呪に成功した装備数
*/
-int remove_curse(void)
+int remove_curse(player_type *caster_ptr)
{
- return (remove_curse_aux(FALSE));
+ return (remove_curse_aux(caster_ptr, FALSE));
}
/*!
* Remove all curses
* @return 解呪に成功した装備数
*/
-int remove_all_curse(void)
+int remove_all_curse(player_type *caster_ptr)
{
- return (remove_curse_aux(TRUE));
+ return (remove_curse_aux(caster_ptr, TRUE));
}
q = _("どのアイテムを金に変えますか?", "Turn which item to gold? ");
s = _("金に変えられる物がありません。", "You have nothing to current_world_ptr->game_turn to gold.");
- o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
+ o_ptr = choose_object(p_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
if (!o_ptr) return (FALSE);
/* See how many items */
q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
s = _("強化できるアイテムがない。", "You have nothing to enchant.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+ o_ptr = choose_object(p_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));
{
if (flush_failure) flush();
msg_print(_("強化に失敗した。", "The enchantment failed."));
- if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
+ if (one_in_(3)) chg_virtue(p_ptr, V_ENCHANT, -1);
}
else
{
if (record_rand_art)
{
object_desc(o_name, o_ptr, OD_NAME_ONLY);
- do_cmd_write_nikki(NIKKI_ART_SCROLL, 0, o_name);
+ exe_write_diary(p_ptr, NIKKI_ART_SCROLL, 0, o_name);
}
- chg_virtue(V_ENCHANT, 1);
+ chg_virtue(p_ptr, V_ENCHANT, 1);
}
- calc_android_exp();
+ calc_android_exp(p_ptr);
/* Something happened */
return (TRUE);
if (!(o_ptr->ident & (IDENT_MENTAL)))
{
if (object_is_artifact(o_ptr) || one_in_(5))
- chg_virtue(V_KNOWLEDGE, 1);
+ chg_virtue(p_ptr, V_KNOWLEDGE, 1);
}
object_aware(o_ptr);
object_desc(o_name, o_ptr, OD_NAME_ONLY);
if(record_fix_art && !old_known && object_is_fixed_artifact(o_ptr))
- do_cmd_write_nikki(NIKKI_ART, 0, o_name);
+ exe_write_diary(p_ptr, NIKKI_ART, 0, o_name);
if(record_rand_art && !old_known && o_ptr->art_name)
- do_cmd_write_nikki(NIKKI_ART, 0, o_name);
+ exe_write_diary(p_ptr, NIKKI_ART, 0, o_name);
return old_known;
}
s = _("鑑定するべきアイテムがない。", "You have nothing to identify.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+ o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
if (!o_ptr) return (FALSE);
old_known = identify_item(o_ptr);
q = _("どれを使いますか?", "Use which item? ");
s = _("使えるものがありません。", "You have nothing you can use.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+ o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
if (!o_ptr) return (FALSE);
msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
o_ptr->inscription = inscription;
if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
}
- calc_android_exp();
+ calc_android_exp(p_ptr);
/* Something happened */
return TRUE;
s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+ o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
if (!o_ptr) return (FALSE);
old_known = identify_item(o_ptr);
q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
- o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
+ o_ptr = choose_object(p_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
if (!o_ptr) return (FALSE);
/* Get the object kind. */
/*!
- * @brief ã\83\97ã\83¬ã\82¤ã\83¤ã\83¼ã\81®全既知呪文を表示する /
+ * @brief ã\82¯ã\83ªã\83¼ã\83\81ã\83£ã\83¼全既知呪文を表示する /
* Hack -- Display all known spells in a window
+ * @param caster_ptr 術者の参照ポインタ
* return なし
* @details
* Need to analyze size of the window.
* Need more color coding.
*/
-void display_spell_list(void)
+void display_spell_list(player_type *caster_ptr)
{
int i, j;
TERM_LEN y, x;
clear_from(0);
/* They have too many spells to list */
- if (p_ptr->pclass == CLASS_SORCERER) return;
- if (p_ptr->pclass == CLASS_RED_MAGE) return;
+ if (caster_ptr->pclass == CLASS_SORCERER) return;
+ if (caster_ptr->pclass == CLASS_RED_MAGE) return;
- if (p_ptr->pclass == CLASS_SNIPER)
+ if (caster_ptr->pclass == CLASS_SNIPER)
{
- display_snipe_list();
+ display_snipe_list(caster_ptr);
return;
}
/* mind.c type classes */
- if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
- (p_ptr->pclass == CLASS_BERSERKER) ||
- (p_ptr->pclass == CLASS_NINJA) ||
- (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
- (p_ptr->pclass == CLASS_FORCETRAINER))
+ if ((caster_ptr->pclass == CLASS_MINDCRAFTER) ||
+ (caster_ptr->pclass == CLASS_BERSERKER) ||
+ (caster_ptr->pclass == CLASS_NINJA) ||
+ (caster_ptr->pclass == CLASS_MIRROR_MASTER) ||
+ (caster_ptr->pclass == CLASS_FORCETRAINER))
{
PERCENTAGE minfail = 0;
- PLAYER_LEVEL plev = p_ptr->lev;
+ PLAYER_LEVEL plev = caster_ptr->lev;
PERCENTAGE chance = 0;
mind_type spell;
char comment[80];
put_str(_("名前", "Name"), y, x + 5);
put_str(_("Lv MP 失率 効果", "Lv Mana Fail Info"), y, x + 35);
- switch(p_ptr->pclass)
+ switch(caster_ptr->pclass)
{
case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
chance = spell.fail;
/* Reduce failure rate by "effective" level adjustment */
- chance -= 3 * (p_ptr->lev - spell.min_lev);
+ chance -= 3 * (caster_ptr->lev - spell.min_lev);
/* Reduce failure rate by INT/WIS adjustment */
- chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
+ chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
if (!use_hp)
{
/* Not enough mana to cast */
- if (spell.mana_cost > p_ptr->csp)
+ if (spell.mana_cost > caster_ptr->csp)
{
- chance += 5 * (spell.mana_cost - p_ptr->csp);
+ chance += 5 * (spell.mana_cost - caster_ptr->csp);
a = TERM_ORANGE;
}
}
else
{
/* Not enough hp to cast */
- if (spell.mana_cost > p_ptr->chp)
+ if (spell.mana_cost > caster_ptr->chp)
{
chance += 100;
a = TERM_RED;
}
/* Extract the minimum failure rate */
- minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
+ minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]];
/* Minimum failure rate */
if (chance < minfail) chance = minfail;
/* Stunning makes spells harder */
- if (p_ptr->stun > 50) chance += 25;
- else if (p_ptr->stun) chance += 15;
+ if (caster_ptr->stun > 50) chance += 25;
+ else if (caster_ptr->stun) chance += 15;
/* Always a 5 percent chance of working */
if (chance > 95) chance = 95;
}
/* Cannot read spellbooks */
- if (REALM_NONE == p_ptr->realm1) return;
+ if (REALM_NONE == caster_ptr->realm1) return;
/* Normal spellcaster with books */
/* Scan books */
- for (j = 0; j < ((p_ptr->realm2 > REALM_NONE) ? 2 : 1); j++)
+ for (j = 0; j < ((caster_ptr->realm2 > REALM_NONE) ? 2 : 1); j++)
{
int n = 0;
byte a = TERM_WHITE;
/* Access the spell */
- if (!is_magic((j < 1) ? p_ptr->realm1 : p_ptr->realm2))
+ if (!is_magic((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2))
{
- s_ptr = &technic_info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - MIN_TECHNIC][i % 32];
+ s_ptr = &technic_info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - MIN_TECHNIC][i % 32];
}
else
{
- s_ptr = &mp_ptr->info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - 1][i % 32];
+ s_ptr = &mp_ptr->info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - 1][i % 32];
}
- strcpy(name, do_spell((j < 1) ? p_ptr->realm1 : p_ptr->realm2, i % 32, SPELL_NAME));
+ strcpy(name, exe_spell(caster_ptr, (j < 1) ? caster_ptr->realm1 : caster_ptr->realm2, i % 32, SPELL_NAME));
/* Illegible */
if (s_ptr->slevel >= 99)
/* Forgotten */
else if ((j < 1) ?
- ((p_ptr->spell_forgotten1 & (1L << i))) :
- ((p_ptr->spell_forgotten2 & (1L << (i % 32)))))
+ ((caster_ptr->spell_forgotten1 & (1L << i))) :
+ ((caster_ptr->spell_forgotten2 & (1L << (i % 32)))))
{
/* Forgotten */
a = TERM_ORANGE;
/* Unknown */
else if (!((j < 1) ?
- (p_ptr->spell_learned1 & (1L << i)) :
- (p_ptr->spell_learned2 & (1L << (i % 32)))))
+ (caster_ptr->spell_learned1 & (1L << i)) :
+ (caster_ptr->spell_learned2 & (1L << (i % 32)))))
{
/* Unknown */
a = TERM_RED;
/* Untried */
else if (!((j < 1) ?
- (p_ptr->spell_worked1 & (1L << i)) :
- (p_ptr->spell_worked2 & (1L << (i % 32)))))
+ (caster_ptr->spell_worked1 & (1L << i)) :
+ (caster_ptr->spell_worked2 & (1L << (i % 32)))))
{
/* Untried */
a = TERM_YELLOW;
* @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);
}
* @param use_realm 魔法領域ID
* @return 失敗率(%)
*/
-PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm)
+PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm)
{
PERCENTAGE chance, minfail;
const magic_type *s_ptr;
chance = s_ptr->sfail;
/* Reduce failure rate by "effective" level adjustment */
- chance -= 3 * (p_ptr->lev - s_ptr->slevel);
+ chance -= 3 * (caster_ptr->lev - s_ptr->slevel);
/* Reduce failure rate by INT/WIS adjustment */
- chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
+ chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
- if (p_ptr->riding)
- chance += (MAX(r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0));
+ if (caster_ptr->riding)
+ chance += (MAX(r_info[caster_ptr->current_floor_ptr->m_list[caster_ptr->riding].r_idx].level - caster_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0));
/* Extract mana consumption rate */
need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
/* Not enough mana to cast */
- if (need_mana > p_ptr->csp)
+ if (need_mana > caster_ptr->csp)
{
- chance += 5 * (need_mana - p_ptr->csp);
+ chance += 5 * (need_mana - caster_ptr->csp);
}
- if ((use_realm != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
+ if ((use_realm != caster_ptr->realm1) && ((caster_ptr->pclass == CLASS_MAGE) || (caster_ptr->pclass == CLASS_PRIEST))) chance += 5;
/* Extract the minimum failure rate */
- minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
+ minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]];
/*
* Non mage/priest characters never get too good
}
/* Hack -- Priest prayer penalty for "edged" weapons -DGK */
- if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[0]) chance += 25;
- if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[1]) chance += 25;
+ 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)
{
case REALM_NATURE:
- if ((p_ptr->align > 50) || (p_ptr->align < -50)) chance += penalty;
+ if ((caster_ptr->align > 50) || (caster_ptr->align < -50)) chance += penalty;
break;
case REALM_LIFE: case REALM_CRUSADE:
- if (p_ptr->align < -20) chance += penalty;
+ if (caster_ptr->align < -20) chance += penalty;
break;
case REALM_DEATH: case REALM_DAEMON: case REALM_HEX:
- if (p_ptr->align > 20) chance += penalty;
+ if (caster_ptr->align > 20) chance += penalty;
break;
}
if (chance < minfail) chance = minfail;
/* Stunning makes spells harder */
- if (p_ptr->stun > 50) chance += 25;
- else if (p_ptr->stun) chance += 15;
+ if (caster_ptr->stun > 50) chance += 25;
+ else if (caster_ptr->stun) chance += 15;
/* Always a 5 percent chance of working */
if (chance > 95) chance = 95;
- if ((use_realm == p_ptr->realm1) || (use_realm == p_ptr->realm2)
- || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
+ 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);
}
* @brief 呪文情報の表示処理 /
* Print a list of spells (for browsing or casting or viewing)
* @param target_spell 呪文ID
+ * @param caster_ptr 術者の参照ポインタ
* @param spells 表示するスペルID配列の参照ポインタ
* @param num 表示するスペルの数(spellsの要素数)
* @param y 表示メッセージ左上Y座標
* @param use_realm 魔法領域ID
* @return なし
*/
-void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y, TERM_LEN x, REALM_IDX use_realm)
+void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y, TERM_LEN x, REALM_IDX use_realm)
{
int i;
SPELL_IDX spell;
char buf[256];
bool max = FALSE;
- if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && p_ptr->wizard)
+ if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && current_world_ptr->wizard)
msg_print(_("警告! print_spell が領域なしに呼ばれた", "Warning! print_spells called with null realm"));
/* Title the list */
put_str(_("名前", "Name"), y, x + 5);
put_str(buf, y, x + 29);
- if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
- else if (use_realm == p_ptr->realm1) increment = 0;
- else if (use_realm == p_ptr->realm2) increment = 32;
+ if ((caster_ptr->pclass == CLASS_SORCERER) || (caster_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
+ else if (use_realm == caster_ptr->realm1) increment = 0;
+ else if (use_realm == caster_ptr->realm2) increment = 32;
/* Dump the spells */
for (i = 0; i < num; i++)
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);
if (!increment && (exp_level == EXP_LEVEL_MASTER)) max = TRUE;
else if ((increment == 32) && (exp_level >= EXP_LEVEL_EXPERT)) max = TRUE;
else if (s_ptr->slevel >= 99) max = TRUE;
- else if ((p_ptr->pclass == CLASS_RED_MAGE) && (exp_level >= EXP_LEVEL_SKILLED)) max = TRUE;
+ else if ((caster_ptr->pclass == CLASS_RED_MAGE) && (exp_level >= EXP_LEVEL_SKILLED)) max = TRUE;
strncpy(ryakuji, exp_level_str[exp_level], 4);
ryakuji[3] = ']';
/* XXX XXX Could label spells above the players level */
/* Get extra info */
- strcpy(info, do_spell(use_realm, spell, SPELL_INFO));
+ strcpy(info, exe_spell(caster_ptr, use_realm, spell, SPELL_INFO));
/* Use that info */
comment = info;
line_attr = TERM_WHITE;
/* Analyze the spell */
- if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
+ if ((caster_ptr->pclass == CLASS_SORCERER) || (caster_ptr->pclass == CLASS_RED_MAGE))
{
- if (s_ptr->slevel > p_ptr->max_plv)
+ if (s_ptr->slevel > caster_ptr->max_plv)
{
comment = _("未知", "unknown");
line_attr = TERM_L_BLUE;
}
- else if (s_ptr->slevel > p_ptr->lev)
+ else if (s_ptr->slevel > caster_ptr->lev)
{
comment = _("忘却", "forgotten");
line_attr = TERM_YELLOW;
}
}
- else if ((use_realm != p_ptr->realm1) && (use_realm != p_ptr->realm2))
+ else if ((use_realm != caster_ptr->realm1) && (use_realm != caster_ptr->realm2))
{
comment = _("未知", "unknown");
line_attr = TERM_L_BLUE;
}
- else if ((use_realm == p_ptr->realm1) ?
- ((p_ptr->spell_forgotten1 & (1L << spell))) :
- ((p_ptr->spell_forgotten2 & (1L << spell))))
+ else if ((use_realm == caster_ptr->realm1) ?
+ ((caster_ptr->spell_forgotten1 & (1L << spell))) :
+ ((caster_ptr->spell_forgotten2 & (1L << spell))))
{
comment = _("忘却", "forgotten");
line_attr = TERM_YELLOW;
}
- else if (!((use_realm == p_ptr->realm1) ?
- (p_ptr->spell_learned1 & (1L << spell)) :
- (p_ptr->spell_learned2 & (1L << spell))))
+ else if (!((use_realm == caster_ptr->realm1) ?
+ (caster_ptr->spell_learned1 & (1L << spell)) :
+ (caster_ptr->spell_learned2 & (1L << spell))))
{
comment = _("未知", "unknown");
line_attr = TERM_L_BLUE;
}
- else if (!((use_realm == p_ptr->realm1) ?
- (p_ptr->spell_worked1 & (1L << spell)) :
- (p_ptr->spell_worked2 & (1L << spell))))
+ else if (!((use_realm == caster_ptr->realm1) ?
+ (caster_ptr->spell_worked1 & (1L << spell)) :
+ (caster_ptr->spell_worked2 & (1L << spell))))
{
comment = _("未経験", "untried");
line_attr = TERM_L_GREEN;
if (use_realm == REALM_HISSATSU)
{
strcat(out_val, format("%-25s %2d %4d",
- do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
+ exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), /* realm, spell */
s_ptr->slevel, need_mana));
}
else
{
strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%% %s",
- do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
+ exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), /* realm, spell */
(max ? '!' : ' '), ryakuji,
- s_ptr->slevel, need_mana, spell_chance(spell, use_realm), comment));
+ s_ptr->slevel, need_mana, spell_chance(caster_ptr, spell, use_realm), comment));
}
c_prt(line_attr, out_val, y + i + 1, x);
}
for (i = 0; i < 1000; i++)
{
/* Pick a new race, using a level calculation */
- r = get_mon_num((current_floor_ptr->dun_level + r_ptr->level) / 2 + 5);
+ r = get_mon_num((p_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5);
/* Handle failure */
if (!r) break;
* @param x 指定のX座標
* @return 実際に変身したらTRUEを返す
*/
-bool polymorph_monster(POSITION y, POSITION x)
+bool polymorph_monster(player_type *caster_ptr, POSITION y, POSITION x)
{
- grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
- monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
+ grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
+ monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
bool polymorphed = FALSE;
MONRACE_IDX new_r_idx;
MONRACE_IDX old_r_idx = m_ptr->r_idx;
bool targeted = (target_who == g_ptr->m_idx) ? TRUE : FALSE;
- bool health_tracked = (p_ptr->health_who == g_ptr->m_idx) ? TRUE : FALSE;
+ bool health_tracked = (caster_ptr->health_who == g_ptr->m_idx) ? TRUE : FALSE;
monster_type back_m;
- if (p_ptr->inside_arena || p_ptr->phase_out) return (FALSE);
+ if (caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out) return (FALSE);
- if ((p_ptr->riding == g_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE);
+ if ((caster_ptr->riding == g_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE);
/* Memorize the monster before polymorphing */
back_m = *m_ptr;
/* Create a new monster (no groups) */
if (place_monster_aux(0, y, x, new_r_idx, mode))
{
- current_floor_ptr->m_list[hack_m_idx_ii].nickname = back_m.nickname;
- current_floor_ptr->m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx;
- current_floor_ptr->m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx;
+ caster_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = back_m.nickname;
+ caster_ptr->current_floor_ptr->m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx;
+ caster_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx;
/* Success */
polymorphed = TRUE;
/* Placing the new monster failed */
if (place_monster_aux(0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN)))
{
- current_floor_ptr->m_list[hack_m_idx_ii] = back_m;
+ caster_ptr->current_floor_ptr->m_list[hack_m_idx_ii] = back_m;
/* Re-initialize monster process */
mproc_init();
{
for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
- object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
+ object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
/* Held by new monster */
{
for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
- next_o_idx = current_floor_ptr->o_list[this_o_idx].next_o_idx;
+ next_o_idx = caster_ptr->current_floor_ptr->o_list[this_o_idx].next_o_idx;
delete_object_idx(this_o_idx);
}
}
(!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;
}
else
{
- teleport_player_to(y, x, 0L);
+ teleport_player_to(p_ptr, y, x, 0L);
/* Success */
return TRUE;
* @param power 基本効力
* @return ターンを消費した場合TRUEを返す
*/
-bool eat_magic(int power)
+bool eat_magic(player_type *caster_ptr, int power)
{
object_type *o_ptr;
object_kind *k_ptr;
q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? ");
s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain.");
- o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
+ o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
if (!o_ptr) return FALSE;
k_ptr = &k_info[o_ptr->k_idx];
}
else
{
- p_ptr->csp += lev;
+ caster_ptr->csp += lev;
o_ptr->timeout += k_ptr->pval;
}
}
{
if (o_ptr->pval > 0)
{
- p_ptr->csp += lev / 2;
+ caster_ptr->csp += lev / 2;
o_ptr->pval --;
/* XXX Hack -- unstack if necessary */
/* Unstack the used item */
o_ptr->number--;
- p_ptr->total_weight -= q_ptr->weight;
+ caster_ptr->total_weight -= q_ptr->weight;
item = inven_carry(q_ptr);
msg_print(_("杖をまとめなおした。", "You unstack your staff."));
/*** Determine Seriousness of Failure ***/
/* Mages recharge objects more safely. */
- if (IS_WIZARD_CLASS(p_ptr))
+ if (IS_WIZARD_CLASS(caster_ptr))
{
/* 10% chance to blow up one rod, otherwise draining. */
if (o_ptr->tval == TV_ROD)
msg_format(_("乱暴な魔法のために%sが何本か壊れた!", "Wild magic consumes your %s!"), o_name);
}
- /* Reduce and describe p_ptr->inventory_list */
+ /* Reduce and describe caster_ptr->inventory_list */
if (item >= 0)
{
inven_item_increase(item, -1);
else
msg_format(_("乱暴な魔法のために%sが壊れた!", "Wild magic consumes your %s!"), o_name);
- /* Reduce and describe p_ptr->inventory_list */
+ /* Reduce and describe caster_ptr->inventory_list */
if (item >= 0)
{
inven_item_increase(item, -999);
}
}
- if (p_ptr->csp > p_ptr->msp)
+ if (caster_ptr->csp > caster_ptr->msp)
{
- p_ptr->csp = p_ptr->msp;
+ caster_ptr->csp = caster_ptr->msp;
}
- p_ptr->redraw |= (PR_MANA);
- p_ptr->update |= (PU_COMBINE | PU_REORDER);
- p_ptr->window |= (PW_INVEN);
+ caster_ptr->redraw |= (PR_MANA);
+ caster_ptr->update |= (PU_COMBINE | PU_REORDER);
+ caster_ptr->window |= (PW_INVEN);
return TRUE;
}
* @param px プレイヤーX座標
* @return なし
*/
-void massacre(void)
+void massacre(player_type *caster_ptr)
{
POSITION x, y;
grid_type *g_ptr;
for (dir = 0; dir < 8; dir++)
{
- y = p_ptr->y + ddy_ddd[dir];
- x = p_ptr->x + ddx_ddd[dir];
- g_ptr = ¤t_floor_ptr->grid_array[y][x];
- m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
+ y = caster_ptr->y + ddy_ddd[dir];
+ x = caster_ptr->x + ddx_ddd[dir];
+ g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
+ m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
/* Hack -- attack monsters */
if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))
- py_attack(y, x, 0);
+ py_attack(caster_ptr, y, x, 0);
}
}
-bool eat_lock(void)
+bool eat_lock(player_type *caster_ptr)
{
POSITION x, y;
grid_type *g_ptr;
DIRECTION dir;
if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
- y = p_ptr->y + ddy[dir];
- x = p_ptr->x + ddx[dir];
- g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ y = caster_ptr->y + ddy[dir];
+ x = caster_ptr->x + ddx[dir];
+ g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
f_ptr = &f_info[g_ptr->feat];
mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
}
else if (g_ptr->m_idx)
{
- monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
+ monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
msg_print(_("何かが邪魔しています!", "There's something in the way!"));
- if (!m_ptr->ml || !is_pet(m_ptr)) py_attack(y, x, 0);
+ if (!m_ptr->ml || !is_pet(m_ptr)) py_attack(caster_ptr, y, x, 0);
}
else if (have_flag(f_ptr->flags, FF_TREE))
{
}
else if (have_flag(f_ptr->flags, FF_DOOR) || have_flag(f_ptr->flags, FF_CAN_DIG))
{
- (void)set_food(p_ptr->food + 3000);
+ (void)set_food(caster_ptr, caster_ptr->food + 3000);
}
else if (have_flag(f_ptr->flags, FF_MAY_HAVE_GOLD) || have_flag(f_ptr->flags, FF_HAS_GOLD))
{
- (void)set_food(p_ptr->food + 5000);
+ (void)set_food(caster_ptr, caster_ptr->food + 5000);
}
else
{
msg_format(_("この%sはとてもおいしい!", "This %s is very filling!"), f_name + mimic_f_ptr->name);
- (void)set_food(p_ptr->food + 10000);
+ (void)set_food(caster_ptr, caster_ptr->food + 10000);
}
/* Destroy the wall */
cave_alter_feat(y, x, FF_HURT_ROCK);
- (void)move_player_effect(y, x, MPE_DONT_PICKUP);
+ (void)move_player_effect(caster_ptr, y, x, MPE_DONT_PICKUP);
return TRUE;
}
-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()) 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 (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 = current_floor_ptr->grid_array[y][x].m_idx;
- monster_type *m_ptr = ¤t_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(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);
- current_floor_ptr->grid_array[oy][ox].m_idx = 0;
- 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);
}
}
}
bool booze(player_type *creature_ptr)
{
bool ident = FALSE;
- if (creature_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1);
+ if (creature_ptr->pclass != CLASS_MONK) chg_virtue(p_ptr, V_HARMONY, -1);
else if (!creature_ptr->resist_conf) creature_ptr->special_attack |= ATTACK_SUIKEN;
if (!creature_ptr->resist_conf)
{
if (one_in_(13) && (creature_ptr->pclass != CLASS_MONK))
{
ident = TRUE;
- if (one_in_(3)) lose_all_info();
- else wiz_dark();
- (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
- wiz_dark();
+ if (one_in_(3)) lose_all_info(p_ptr);
+ else wiz_dark(creature_ptr);
+ (void)teleport_player_aux(creature_ptr, 100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
+ wiz_dark(creature_ptr);
msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head..."));
msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing, or how you got here!"));
}
bool detonation(player_type *creature_ptr)
{
msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
- take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);
- (void)set_stun(creature_ptr->stun + 75);
- (void)set_cut(creature_ptr->cut + 5000);
+ take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);
+ (void)set_stun(p_ptr, creature_ptr->stun + 75);
+ (void)set_cut(p_ptr,creature_ptr->cut + 5000);
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 = ¤t_floor_ptr->m_list[m_idx];
- grid_type *g_ptr = ¤t_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(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(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) : 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->exp / 160);
- else lose_exp(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;
}
} while (one_in_(5));
}
-
-bool fire_crimson(void)
+/*!
+ * @brief クリムゾンを発射する / Fire Crimson, evoluting gun.
+ @ @param shooter_ptr 射撃を行うクリーチャー参照
+ * @return キャンセルした場合 false.
+ * @details
+ * Need to analyze size of the window.
+ * Need more color coding.
+ */
+bool fire_crimson(player_type *shooter_ptr)
{
int num = 1;
int i;
if (!get_aim_dir(&dir)) return FALSE;
/* Use the given direction */
- tx = p_ptr->x + 99 * ddx[dir];
- ty = p_ptr->y + 99 * ddy[dir];
+ tx = shooter_ptr->x + 99 * ddx[dir];
+ ty = shooter_ptr->y + 99 * ddy[dir];
/* Hack -- Use an actual "target" */
if ((dir == 5) && target_okay())
ty = target_row;
}
- if (p_ptr->pclass == CLASS_ARCHER)
+ if (shooter_ptr->pclass == CLASS_ARCHER)
{
/* Extra shot at level 10 */
- if (p_ptr->lev >= 10) num++;
+ if (shooter_ptr->lev >= 10) num++;
/* Extra shot at level 30 */
- if (p_ptr->lev >= 30) num++;
+ if (shooter_ptr->lev >= 30) num++;
/* Extra shot at level 45 */
- if (p_ptr->lev >= 45) num++;
+ if (shooter_ptr->lev >= 45) num++;
}
for (i = 0; i < num; i++)
- project(0, p_ptr->lev / 20 + 1, ty, tx, p_ptr->lev*p_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
+ project(0, shooter_ptr->lev / 20 + 1, ty, tx, shooter_ptr->lev*shooter_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
return TRUE;
}
* @brief 町間のテレポートを行うメインルーチン。
* @return テレポート処理を決定したか否か
*/
-bool tele_town(void)
+bool tele_town(player_type *caster_ptr)
{
int i;
POSITION x, y;
int num = 0;
- if (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;
}