#include "player-status.h"
#include "player-effects.h"
#include "player-skill.h"
+#include "player-inventory.h"
#include "realm-hex.h"
#include "grid.h"
#include "monsterrace.h"
#include "targeting.h"
#include "realm-song.h"
#include "view-mainwindow.h"
+#include "world.h"
#define MAX_KEEP 4 /*!<呪術の最大詠唱数 */
* @brief プレイヤーが詠唱中の全呪術を停止する
* @return なし
*/
-bool stop_hex_spell_all(void)
+bool stop_hex_spell_all(player_type *caster_ptr)
{
SPELL_IDX i;
for (i = 0; i < 32; i++)
{
- if (hex_spelling(i)) exe_spell(REALM_HEX, i, SPELL_STOP);
+ if (hex_spelling(i)) exe_spell(caster_ptr, REALM_HEX, i, SPELL_STOP);
}
- CASTING_HEX_FLAGS(p_ptr) = 0;
- CASTING_HEX_NUM(p_ptr) = 0;
+ CASTING_HEX_FLAGS(caster_ptr) = 0;
+ CASTING_HEX_NUM(caster_ptr) = 0;
- if (p_ptr->action == ACTION_SPELL) set_action(p_ptr, ACTION_NONE);
+ if (caster_ptr->action == ACTION_SPELL) set_action(caster_ptr, ACTION_NONE);
- p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
- p_ptr->redraw |= (PR_EXTRA | PR_HP | PR_MANA);
+ caster_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
+ caster_ptr->redraw |= (PR_EXTRA | PR_HP | PR_MANA);
return TRUE;
}
* @brief プレイヤーが詠唱中の呪術から一つを選んで停止する
* @return なし
*/
-bool stop_hex_spell(void)
+bool stop_hex_spell(player_type *caster_ptr)
{
int spell;
char choice = 0;
TERM_LEN x = 20;
int sp[MAX_KEEP];
- if (!hex_spelling_any(p_ptr))
+ if (!hex_spelling_any(caster_ptr))
{
msg_print(_("呪文を詠唱していません。", "You are casting no spell."));
return FALSE;
}
/* Stop all spells */
- else if ((CASTING_HEX_NUM(p_ptr) == 1) || (p_ptr->lev < 35))
+ else if ((CASTING_HEX_NUM(caster_ptr) == 1) || (caster_ptr->lev < 35))
{
- return stop_hex_spell_all();
+ return stop_hex_spell_all(caster_ptr);
}
else
{
strnfmt(out_val, 78, _("どの呪文の詠唱を中断しますか?(呪文 %c-%c, 'l'全て, ESC)", "Which spell do you stop casting? (Spell %c-%c, 'l' to all, ESC)"),
- I2A(0), I2A(CASTING_HEX_NUM(p_ptr) - 1));
+ I2A(0), I2A(CASTING_HEX_NUM(caster_ptr) - 1));
screen_save();
if (hex_spelling(spell))
{
Term_erase(x, y + n + 1, 255);
- put_str(format("%c) %s", I2A(n), exe_spell(REALM_HEX, spell, SPELL_NAME)), y + n + 1, x + 2);
+ put_str(format("%c) %s", I2A(n), exe_spell(caster_ptr, REALM_HEX, spell, SPELL_NAME)), y + n + 1, x + 2);
sp[n++] = spell;
}
}
if (choice == 'l') /* All */
{
screen_load();
- return stop_hex_spell_all();
+ return stop_hex_spell_all(caster_ptr);
}
- if ((choice < I2A(0)) || (choice > I2A(CASTING_HEX_NUM(p_ptr) - 1))) continue;
+ if ((choice < I2A(0)) || (choice > I2A(CASTING_HEX_NUM(caster_ptr) - 1))) continue;
flag = TRUE;
}
}
{
int n = sp[A2I(choice)];
- exe_spell(REALM_HEX, n, SPELL_STOP);
- CASTING_HEX_FLAGS(p_ptr) &= ~(1L << n);
- CASTING_HEX_NUM(p_ptr)--;
+ exe_spell(caster_ptr, REALM_HEX, n, SPELL_STOP);
+ CASTING_HEX_FLAGS(caster_ptr) &= ~(1L << n);
+ CASTING_HEX_NUM(caster_ptr)--;
}
- p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
- p_ptr->redraw |= (PR_EXTRA | PR_HP | PR_MANA);
+ caster_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
+ caster_ptr->redraw |= (PR_EXTRA | PR_HP | PR_MANA);
return flag;
}
* Upkeeping hex spells Called from dungeon.c
* @return なし
*/
-void check_hex(void)
+void check_hex(player_type *caster_ptr)
{
int spell;
MANA_POINT need_mana;
bool res = FALSE;
/* Spells spelled by player */
- if (p_ptr->realm1 != REALM_HEX) return;
- if (!CASTING_HEX_FLAGS(p_ptr) && !p_ptr->magic_num1[1]) return;
+ if (caster_ptr->realm1 != REALM_HEX) return;
+ if (!CASTING_HEX_FLAGS(caster_ptr) && !caster_ptr->magic_num1[1]) return;
- if (p_ptr->magic_num1[1])
+ if (caster_ptr->magic_num1[1])
{
- p_ptr->magic_num1[0] = p_ptr->magic_num1[1];
- p_ptr->magic_num1[1] = 0;
+ caster_ptr->magic_num1[0] = caster_ptr->magic_num1[1];
+ caster_ptr->magic_num1[1] = 0;
res = TRUE;
}
/* Stop all spells when anti-magic ability is given */
- if (p_ptr->anti_magic)
+ if (caster_ptr->anti_magic)
{
- stop_hex_spell_all();
+ stop_hex_spell_all(caster_ptr);
return;
}
/* Culcurates final mana cost */
need_mana_frac = 0;
s64b_div(&need_mana, &need_mana_frac, 0, 3); /* Divide by 3 */
- need_mana += (CASTING_HEX_NUM(p_ptr) - 1);
+ need_mana += (CASTING_HEX_NUM(caster_ptr) - 1);
/* Not enough mana */
- if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, need_mana, need_mana_frac) < 0)
+ if (s64b_cmp(caster_ptr->csp, caster_ptr->csp_frac, need_mana, need_mana_frac) < 0)
{
- stop_hex_spell_all();
+ stop_hex_spell_all(caster_ptr);
return;
}
/* Enough mana */
else
{
- s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac);
+ s64b_sub(&(caster_ptr->csp), &(caster_ptr->csp_frac), need_mana, need_mana_frac);
- p_ptr->redraw |= PR_MANA;
+ caster_ptr->redraw |= PR_MANA;
if (res)
{
msg_print(_("詠唱を再開した。", "You restart spelling."));
- p_ptr->action = ACTION_SPELL;
+ caster_ptr->action = ACTION_SPELL;
- p_ptr->update |= (PU_BONUS | PU_HP);
- p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
- p_ptr->update |= (PU_MONSTERS);
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+ caster_ptr->update |= (PU_BONUS | PU_HP);
+ caster_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
+ caster_ptr->update |= (PU_MONSTERS);
+ caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
}
}
s_ptr = &technic_info[REALM_HEX - MIN_TECHNIC][spell];
- if (p_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
- p_ptr->spell_exp[spell] += 5;
- else if(p_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
- { if (one_in_(2) && (current_floor_ptr->dun_level > 4) && ((current_floor_ptr->dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[spell] += 1; }
- else if(p_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
- { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > p_ptr->lev) && ((current_floor_ptr->dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
- else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
- { if (one_in_(5) && ((current_floor_ptr->dun_level + 5) > p_ptr->lev) && (current_floor_ptr->dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
+ if (caster_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER)
+ caster_ptr->spell_exp[spell] += 5;
+ else if(caster_ptr->spell_exp[spell] < SPELL_EXP_SKILLED)
+ { if (one_in_(2) && (caster_ptr->current_floor_ptr->dun_level > 4) && ((caster_ptr->current_floor_ptr->dun_level + 10) > caster_ptr->lev)) caster_ptr->spell_exp[spell] += 1; }
+ else if(caster_ptr->spell_exp[spell] < SPELL_EXP_EXPERT)
+ { if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && ((caster_ptr->current_floor_ptr->dun_level + 5) > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1; }
+ else if(caster_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
+ { if (one_in_(5) && ((caster_ptr->current_floor_ptr->dun_level + 5) > caster_ptr->lev) && (caster_ptr->current_floor_ptr->dun_level > s_ptr->slevel)) caster_ptr->spell_exp[spell] += 1; }
}
/* Do any effects of continual spells */
{
if (hex_spelling(spell))
{
- exe_spell(REALM_HEX, spell, SPELL_CONT);
+ exe_spell(caster_ptr, REALM_HEX, spell, SPELL_CONT);
}
}
}
* @brief プレイヤーの呪術詠唱枠がすでに最大かどうかを返す
* @return すでに全枠を利用しているならTRUEを返す
*/
-bool hex_spell_fully(void)
+bool hex_spell_fully(player_type *caster_ptr)
{
int k_max = 0;
- k_max = (p_ptr->lev / 15) + 1;
+ k_max = (caster_ptr->lev / 15) + 1;
k_max = MIN(k_max, MAX_KEEP);
- if (CASTING_HEX_NUM(p_ptr) < k_max) return FALSE;
+ if (CASTING_HEX_NUM(caster_ptr) < k_max) return FALSE;
return TRUE;
}
* @brief 一定ゲームターン毎に復讐処理の残り期間の判定を行う
* @return なし
*/
-void revenge_spell(void)
+void revenge_spell(player_type *caster_ptr)
{
- if (p_ptr->realm1 != REALM_HEX) return;
- if (HEX_REVENGE_TURN(p_ptr) <= 0) return;
+ if (caster_ptr->realm1 != REALM_HEX) return;
+ if (HEX_REVENGE_TURN(caster_ptr) <= 0) return;
- switch(HEX_REVENGE_TYPE(p_ptr))
+ switch(HEX_REVENGE_TYPE(caster_ptr))
{
- case 1: exe_spell(REALM_HEX, HEX_PATIENCE, SPELL_CONT); break;
- case 2: exe_spell(REALM_HEX, HEX_REVENGE, SPELL_CONT); break;
+ case 1: exe_spell(caster_ptr, REALM_HEX, HEX_PATIENCE, SPELL_CONT); break;
+ case 2: exe_spell(caster_ptr, REALM_HEX, HEX_REVENGE, SPELL_CONT); break;
}
}
*/
bool teleport_barrier(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];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!hex_spelling(HEX_ANTI_TELE)) return FALSE;
*/
bool magic_barrier(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];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!hex_spelling(HEX_ANTI_MAGIC)) return FALSE;
*/
bool multiply_barrier(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];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
if (!hex_spelling(HEX_ANTI_MULTI)) return FALSE;
{
msg_print(_("気分が良くなってくる。", "You feel better and better."));
}
- if (cast || cont) (void)cure_light_wounds(1, 10);
+ if (cast || cont) (void)cure_light_wounds(caster_ptr, 1, 10);
break;
case 2:
if (info) return info_damage(1, power, 0);
if (cast || cont)
{
- project_all_los(GF_POIS, randint1(power));
+ project_all_los(caster_ptr, GF_POIS, randint1(power));
}
break;
q = _("どれを呪いますか?", "Which weapon do you curse?");
s = _("武器を装備していない。", "You wield no weapons.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP), 0);
+ o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP), 0);
if (!o_ptr) return FALSE;
object_desc(o_name, o_ptr, OD_NAME_ONLY);
msg_print(_("我慢が解かれた!", "Time for end of patioence!"));
if (power)
{
- project(0, rad, caster_ptr->y, caster_ptr->x, power, GF_HELL_FIRE,
+ project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, power, GF_HELL_FIRE,
(PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
}
- if (caster_ptr->wizard)
+ if (current_world_ptr->wizard)
{
msg_format(_("%d点のダメージを返した。", "You return %d damages."), power);
}
{
msg_print(_("気分が良くなってくる。", "You feel better and better."));
}
- if (cast || cont) (void)cure_serious_wounds(2, 10);
+ if (cast || cont) (void)cure_serious_wounds(caster_ptr, 2, 10);
break;
case 10:
if (cast)
{
CASTING_HEX_FLAGS(caster_ptr) |= (1L << HEX_INHAIL);
- do_cmd_quaff_potion();
+ do_cmd_quaff_potion(p_ptr);
CASTING_HEX_FLAGS(caster_ptr) &= ~(1L << HEX_INHAIL);
add = FALSE;
}
if (info) return info_damage(1, power, 0);
if (cast || cont)
{
- project_all_los(GF_HYPODYNAMIA, randint1(power));
+ project_all_los(caster_ptr, GF_HYPODYNAMIA, randint1(power));
}
break;
{
msg_print(_("気分が良くなってくる。", "You feel better and better."));
}
- if (cast || cont) (void)cure_critical_wounds(damroll(4, 10));
+ if (cast || cont) (void)cure_critical_wounds(caster_ptr, damroll(4, 10));
break;
case 18:
q = _("どれを呪いますか?", "Which piece of armour do you curse?");
s = _("防具を装備していない。", "You wield no piece of armours.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP), 0);
+ o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP), 0);
if (!o_ptr) return FALSE;
o_ptr = &caster_ptr->inventory_list[item];
if ((!o_ptr->k_idx) || (!object_is_cursed(o_ptr)))
{
- exe_spell(REALM_HEX, spell, SPELL_STOP);
+ exe_spell(p_ptr, REALM_HEX, spell, SPELL_STOP);
CASTING_HEX_FLAGS(caster_ptr) &= ~(1L << spell);
CASTING_HEX_NUM(caster_ptr)--;
if (!SINGING_SONG_ID(caster_ptr)) set_action(caster_ptr, ACTION_NONE);
if (info) return info_damage(1, power, 0);
if (cast || cont)
{
- project_all_los(GF_PSI_DRAIN, randint1(power));
+ project_all_los(caster_ptr, GF_PSI_DRAIN, randint1(power));
}
break;
if (!flag)
{
- msg_format(_("%sの呪文の詠唱をやめた。", "Finish casting '%^s'."), exe_spell(REALM_HEX, HEX_RESTORE, SPELL_NAME));
+ msg_format(_("%sの呪文の詠唱をやめた。", "Finish casting '%^s'."), exe_spell(p_ptr, REALM_HEX, HEX_RESTORE, SPELL_NAME));
CASTING_HEX_FLAGS(caster_ptr) &= ~(1L << HEX_RESTORE);
if (cont) CASTING_HEX_NUM(caster_ptr)--;
if (CASTING_HEX_NUM(caster_ptr)) caster_ptr->action = ACTION_NONE;
q = _("どの装備品から吸収しますか?", "Which cursed equipment do you drain mana from?");
s = _("呪われたアイテムを装備していない。", "You have no cursed equipment.");
- o_ptr = choose_object(&item, q, s, (USE_EQUIP), 0);
+ o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP), 0);
if (!o_ptr) return FALSE;
object_flags(o_ptr, f);
int dy = y + ddy_ddd[dir];
int dx = x + ddx_ddd[dir];
if (dir == 5) continue;
- if (current_floor_ptr->grid_array[dy][dx].m_idx) flag = TRUE;
+ if (p_ptr->current_floor_ptr->grid_array[dy][dx].m_idx) flag = TRUE;
}
- if (!cave_empty_bold(y, x) || (current_floor_ptr->grid_array[y][x].info & CAVE_ICKY) ||
+ if (!cave_empty_bold(p_ptr->current_floor_ptr, y, x) || (p_ptr->current_floor_ptr->grid_array[y][x].info & CAVE_ICKY) ||
(distance(y, x, caster_ptr->y, caster_ptr->x) > plev + 2))
{
msg_print(_("そこには移動できない。", "Can not teleport to there."));
if (flag && randint0(plev * plev / 2))
{
- teleport_player_to(y, x, 0L);
+ teleport_player_to(caster_ptr, y, x, 0L);
}
else
{
msg_print(_("おっと!", "Oops!"));
- teleport_player(30, 0L);
+ teleport_player(caster_ptr, 30, 0L);
}
add = FALSE;
msg_print(_("復讐の時だ!", "Time to revenge!"));
} while (!get_aim_dir(&dir));
- fire_ball(GF_HELL_FIRE, dir, power, 1);
+ fire_ball(caster_ptr, GF_HELL_FIRE, dir, power, 1);
- if (caster_ptr->wizard)
+ if (current_world_ptr->wizard)
{
msg_format(_("%d点のダメージを返した。", "You return %d damages."), power);
}