*/
#include "angband.h"
+#include "core.h"
+#include "util.h"
+#include "main/sound-definitions-table.h"
+#include "gameterm.h"
+
#include "player-status.h"
+#include "cmd-basic.h"
+#include "snipe.h"
+#include "monsterrace.h"
+#include "view/display-main-window.h"
#define MAX_SNIPE_POWERS 16
-/*! スナイパー技能情報のtypedef */
-typedef struct snipe_power snipe_power;
-
/*! スナイパー技能情報の構造体 */
-struct snipe_power
+typedef struct snipe_power
{
PLAYER_LEVEL min_lev;
MANA_POINT mana_cost;
concptr name;
-};
+} snipe_power;
/*! スナイパー技能の解説メッセージ */
static concptr const snipe_tips[MAX_SNIPE_POWERS] =
* @brief スナイパーの集中度加算
* @return 常にTRUEを返す
*/
-static bool snipe_concentrate(void)
+static bool snipe_concentrate(player_type *creature_ptr)
{
- if ((int)p_ptr->concent < (2 + (p_ptr->lev + 5) / 10)) p_ptr->concent++;
+ if ((int)creature_ptr->concent < (2 + (creature_ptr->lev + 5) / 10)) creature_ptr->concent++;
- msg_format(_("集中した。(集中度 %d)", "You concentrate deeply. (lvl %d)"), p_ptr->concent);
- reset_concent = FALSE;
+ msg_format(_("集中した。(集中度 %d)", "You concentrate deeply. (lvl %d)"), creature_ptr->concent);
+ creature_ptr->reset_concent = FALSE;
- p_ptr->update |= (PU_BONUS | PU_MONSTERS);
- p_ptr->redraw |= (PR_STATUS);
- return (TRUE);
+ creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
+ creature_ptr->redraw |= (PR_STATUS);
+ return TRUE;
}
/*!
* @param msg TRUEならばメッセージを表示する
* @return なし
*/
-void reset_concentration(bool msg)
+void reset_concentration(player_type *creature_ptr, bool msg)
{
if (msg)
{
msg_print(_("集中力が途切れてしまった。", "Stop concentrating."));
}
- p_ptr->concent = 0;
- reset_concent = FALSE;
+ creature_ptr->concent = 0;
+ creature_ptr->reset_concent = FALSE;
- p_ptr->update |= (PU_BONUS | PU_MONSTERS);
- p_ptr->redraw |= (PR_STATUS);
+ creature_ptr->update |= (PU_BONUS | PU_MONSTERS);
+ creature_ptr->redraw |= (PR_STATUS);
}
/*!
* @param tdam 算出中のダメージ
* @return 集中度修正を加えたダメージ
*/
-int boost_concentration_damage(int tdam)
+int boost_concentration_damage(player_type *creature_ptr, int tdam)
{
- tdam *= (10 + p_ptr->concent);
+ tdam *= (10 + creature_ptr->concent);
tdam /= 10;
return (tdam);
* @brief スナイパーの技能リストを表示する
* @return なし
*/
-void display_snipe_list(void)
+void display_snipe_list(player_type *sniper_ptr)
{
int i;
TERM_LEN y = 1;
TERM_LEN x = 1;
- PLAYER_LEVEL plev = p_ptr->lev;
- snipe_power spell;
- char psi_desc[80];
+ PLAYER_LEVEL plev = sniper_ptr->lev;
+ snipe_power spell;
+ char psi_desc[80];
/* Display a list of spells */
prt("", y, x);
/* Access the available spell */
spell = snipe_powers[i];
if (spell.min_lev > plev) continue;
- if (spell.mana_cost > (int)p_ptr->concent) continue;
+ if (spell.mana_cost > (int)sniper_ptr->concent) continue;
sprintf(psi_desc, " %c) %-30s%2d %4d",
I2A(i), spell.name, spell.min_lev, spell.mana_cost);
* when you run it. It's probably easy to fix but I haven't tried,\n
* sorry.\n
*/
-static int get_snipe_power(COMMAND_CODE *sn, bool only_browse)
+static int get_snipe_power(player_type *sniper_ptr, COMMAND_CODE *sn, bool only_browse)
{
COMMAND_CODE i;
- int num = 0;
+ int num = 0;
TERM_LEN y = 1;
TERM_LEN x = 20;
- PLAYER_LEVEL plev = p_ptr->lev;
- int ask;
- char choice;
- char out_val[160];
- concptr p = _("射撃術", "power");
- snipe_power spell;
- bool flag, redraw;
+ PLAYER_LEVEL plev = sniper_ptr->lev;
+ int ask;
+ char choice;
+ char out_val[160];
+ concptr p = _("射撃術", "power");
+ snipe_power spell;
+ bool flag, redraw;
repeat_push(*sn);
if (repeat_pull(sn))
{
/* Verify the spell */
- if ((snipe_powers[*sn].min_lev <= plev) && (snipe_powers[*sn].mana_cost <= (int)p_ptr->concent))
+ if ((snipe_powers[*sn].min_lev <= plev) && (snipe_powers[*sn].mana_cost <= (int)sniper_ptr->concent))
{
/* Success */
- return (TRUE);
+ return TRUE;
}
}
- /* Nothing chosen yet */
flag = FALSE;
-
- /* No redraw yet */
redraw = FALSE;
for (i = 0; i < MAX_SNIPE_POWERS; i++)
{
if ((snipe_powers[i].min_lev <= plev) &&
- ((only_browse) || (snipe_powers[i].mana_cost <= (int)p_ptr->concent)))
+ ((only_browse) || (snipe_powers[i].mana_cost <= (int)sniper_ptr->concent)))
{
num = i;
}
/* Access the spell */
spell = snipe_powers[i];
if (spell.min_lev > plev) continue;
- if (!only_browse && (spell.mana_cost > (int)p_ptr->concent)) continue;
+ if (!only_browse && (spell.mana_cost > (int)sniper_ptr->concent)) continue;
/* Dump the spell --(-- */
if (only_browse)
/* Totally Illegal */
if ((i < 0) || (i > num) ||
- (!only_browse &&(snipe_powers[i].mana_cost > (int)p_ptr->concent)))
+ (!only_browse &&(snipe_powers[i].mana_cost > (int)sniper_ptr->concent)))
{
bell();
continue;
}
if (redraw && !only_browse) screen_load();
- p_ptr->window |= (PW_SPELL);
- handle_stuff();
+ sniper_ptr->window |= (PW_SPELL);
+ handle_stuff(sniper_ptr);
/* Abort if needed */
- if (!flag) return (FALSE);
+ if (!flag) return FALSE;
/* Save the choice */
(*sn) = i;
repeat_push(*sn);
/* Success */
- return (TRUE);
+ return TRUE;
}
+
/*!
* @brief スナイバー技能のスレイ倍率計算を行う /
* Calcurate magnification of snipe technics
* @param m_ptr 目標となるモンスターの構造体参照ポインタ
* @return スレイの倍率(/10倍)
*/
-MULTIPLY tot_dam_aux_snipe(MULTIPLY mult, monster_type *m_ptr, SPELL_IDX snipe_type)
+MULTIPLY tot_dam_aux_snipe(player_type *sniper_ptr, MULTIPLY mult, monster_type *m_ptr, SPELL_IDX snipe_type)
{
monster_race *r_ptr = &r_info[m_ptr->r_idx];
bool seen = is_seen(m_ptr);
case SP_LITE:
if (r_ptr->flags3 & (RF3_HURT_LITE))
{
- MULTIPLY n = 20 + p_ptr->concent;
+ MULTIPLY n = 20 + sniper_ptr->concent;
if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
if (mult < n) mult = n;
}
}
else
{
- MULTIPLY n = 15 + (p_ptr->concent * 3);
+ MULTIPLY n = 15 + (sniper_ptr->concent * 3);
if (mult < n) mult = n;
}
break;
}
else
{
- MULTIPLY n = 15 + (p_ptr->concent * 3);
+ MULTIPLY n = 15 + (sniper_ptr->concent * 3);
if (mult < n) mult = n;
}
break;
}
else
{
- MULTIPLY n = 18 + (p_ptr->concent * 4);
+ MULTIPLY n = 18 + (sniper_ptr->concent * 4);
if (mult < n) mult = n;
}
break;
case SP_KILL_WALL:
if (r_ptr->flags3 & RF3_HURT_ROCK)
{
- MULTIPLY n = 15 + (p_ptr->concent * 2);
+ MULTIPLY n = 15 + (sniper_ptr->concent * 2);
if (seen) r_ptr->r_flags3 |= RF3_HURT_ROCK;
if (mult < n) mult = n;
}
else if (r_ptr->flags3 & RF3_NONLIVING)
{
- MULTIPLY n = 15 + (p_ptr->concent * 2);
+ MULTIPLY n = 15 + (sniper_ptr->concent * 2);
if (seen) r_ptr->r_flags3 |= RF3_NONLIVING;
if (mult < n) mult = n;
}
case SP_EVILNESS:
if (r_ptr->flags3 & RF3_GOOD)
{
- MULTIPLY n = 15 + (p_ptr->concent * 4);
+ MULTIPLY n = 15 + (sniper_ptr->concent * 4);
if (seen) r_ptr->r_flags3 |= RF3_GOOD;
if (mult < n) mult = n;
}
case SP_HOLYNESS:
if (r_ptr->flags3 & RF3_EVIL)
{
- MULTIPLY n = 12 + (p_ptr->concent * 3);
+ MULTIPLY n = 12 + (sniper_ptr->concent * 3);
if (seen) r_ptr->r_flags3 |= RF3_EVIL;
if (r_ptr->flags3 & (RF3_HURT_LITE))
{
- n += (p_ptr->concent * 3);
+ n += (sniper_ptr->concent * 3);
if (seen) r_ptr->r_flags3 |= (RF3_HURT_LITE);
}
if (mult < n) mult = n;
* @param spell 発動する特殊技能のID
* @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
*/
-static bool cast_sniper_spell(int spell)
+static bool cast_sniper_spell(player_type *sniper_ptr, int spell)
{
- object_type *o_ptr = &inventory[INVEN_BOW];
+ object_type *o_ptr = &sniper_ptr->inventory_list[INVEN_BOW];
SPELL_IDX snipe_type = SP_NONE;
if (o_ptr->tval != TV_BOW)
{
msg_print(_("弓を装備していない!", "You wield no bow!"));
- return (FALSE);
+ return FALSE;
}
/* spell code */
switch (spell)
{
case 0: /* Concentration */
- if (!snipe_concentrate()) return (FALSE);
- take_turn(p_ptr, 100);
- return (TRUE);
+ if (!snipe_concentrate(sniper_ptr)) return FALSE;
+ take_turn(sniper_ptr, 100);
+ return TRUE;
case 1: snipe_type = SP_LITE; break;
case 2: snipe_type = SP_AWAY; break;
case 3: snipe_type = SP_KILL_TRAP; break;
}
command_cmd = 'f';
- do_cmd_fire(snipe_type);
+ do_cmd_fire(sniper_ptr, snipe_type);
- return (is_fired);
+ return (sniper_ptr->is_fired);
}
/*!
* @brief スナイパー技能コマンドのメインルーチン /
* @return なし
*/
-void do_cmd_snipe(void)
+void do_cmd_snipe(player_type *sniper_ptr)
{
COMMAND_CODE n = 0;
- bool cast;
+ bool cast;
- if(cmd_limit_confused(p_ptr)) return;
- if(cmd_limit_image(p_ptr)) return;
- if(cmd_limit_stun(p_ptr)) return;
+ if(cmd_limit_confused(sniper_ptr)) return;
+ if(cmd_limit_image(sniper_ptr)) return;
+ if(cmd_limit_stun(sniper_ptr)) return;
- if (!get_snipe_power(&n, FALSE)) return;
+ if (!get_snipe_power(sniper_ptr, &n, FALSE)) return;
sound(SOUND_SHOOT);
-
- /* Cast the spell */
- cast = cast_sniper_spell(n);
+ cast = cast_sniper_spell(sniper_ptr, n);
if (!cast) return;
- p_ptr->redraw |= (PR_HP | PR_MANA);
-
- p_ptr->window |= (PW_PLAYER);
- p_ptr->window |= (PW_SPELL);
+ sniper_ptr->redraw |= (PR_HP | PR_MANA);
+ sniper_ptr->window |= (PW_PLAYER);
+ sniper_ptr->window |= (PW_SPELL);
}
/*!
* @brief スナイパー技能コマンドの表示 /
* @return なし
*/
-void do_cmd_snipe_browse(void)
+void do_cmd_snipe_browse(player_type *sniper_ptr)
{
COMMAND_CODE n = 0;
int j, line;
screen_save();
- while(1)
+ while (TRUE)
{
- if (!get_snipe_power(&n, TRUE))
+ if (!get_snipe_power(sniper_ptr, &n, TRUE))
{
screen_load();
return;