*/
#include "angband.h"
+#include "core.h"
+#include "util.h"
+
+#include "mind.h"
+
+#include "floor.h"
#include "melee.h"
-#include "projection.h"
+#include "spells.h"
#include "spells-summon.h"
#include "avatar.h"
+#include "player-move.h"
#include "player-status.h"
+#include "player-class.h"
#include "spells-status.h"
#include "cmd-spell.h"
+#include "spells-floor.h"
+#include "feature.h"
+#include "grid.h"
+#include "cmd-basic.h"
+#include "monster-status.h"
+#include "player-effects.h"
+#include "player-damage.h"
+#include "view-mainwindow.h"
+#include "targeting.h"
+#include "realm-song.h"
/*! 特殊技能の一覧テーブル */
mind_power const mind_powers[5] =
int num = 0;
TERM_LEN y = 1;
TERM_LEN x = 10;
- int minfail = 0;
+ PERCENTAGE minfail = 0;
PLAYER_LEVEL plev = p_ptr->lev;
- int chance = 0;
+ PERCENTAGE chance = 0;
int ask = TRUE;
char choice;
char out_val[160];
/* No redraw yet */
redraw = FALSE;
- for (i = 0; i < MAX_MIND_POWERS; i++)
+ for (i = 0; i < MAX_MIND_POWERS; i++)
{
- if (mind_ptr->info[i].min_lev <= plev)
- {
- num++;
- }
+ if (mind_ptr->info[i].min_lev <= plev)
+ {
+ num++;
+ }
}
- /* Build a prompt (accept all spells) */
- if (only_browse)
+ /* Build a prompt (accept all spells) */
+ if (only_browse)
{
- (void) strnfmt(out_val, 78,
- _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
- p, I2A(0), I2A(num - 1), p);
+ (void)strnfmt(out_val, 78,
+ _("(%^s %c-%c, '*'で一覧, ESC) どの%sについて知りますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
+ p, I2A(0), I2A(num - 1), p);
}
else
{
- (void) strnfmt(out_val, 78,
- _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
- p, I2A(0), I2A(num - 1), p);
+ (void)strnfmt(out_val, 78,
+ _("(%^s %c-%c, '*'で一覧, ESC) どの%sを使いますか?", "(%^ss %c-%c, *=List, ESC=exit) Use which %s? "),
+ p, I2A(0), I2A(num - 1), p);
}
if (use_menu && !only_browse) screen_save();
- /* Get a spell from the user */
- choice= (always_show_list || use_menu) ? ESCAPE:1 ;
+ choice = (always_show_list || use_menu) ? ESCAPE : 1;
+
while (!flag)
{
if(choice==ESCAPE) choice = ' ';
{
char psi_desc[80];
bool has_weapon[2];
-
- /* Show list */
redraw = TRUE;
if (!only_browse && !use_menu) screen_save();
static bool cast_mindcrafter_spell(int spell)
{
int b = 0;
- int dir;
+ DIRECTION dir;
TIME_EFFECT t;
PLAYER_LEVEL plev = p_ptr->lev;
break;
case 6:
/* Character Armour */
- set_shield((TIME_EFFECT)plev, FALSE);
- if (plev > 14) set_oppose_acid((TIME_EFFECT)plev, FALSE);
- if (plev > 19) set_oppose_fire((TIME_EFFECT)plev, FALSE);
- if (plev > 24) set_oppose_cold((TIME_EFFECT)plev, FALSE);
- if (plev > 29) set_oppose_elec((TIME_EFFECT)plev, FALSE);
- if (plev > 34) set_oppose_pois((TIME_EFFECT)plev, FALSE);
+ set_shield(p_ptr, (TIME_EFFECT)plev, FALSE);
+ if (plev > 14) set_oppose_acid(p_ptr, (TIME_EFFECT)plev, FALSE);
+ if (plev > 19) set_oppose_fire(p_ptr, (TIME_EFFECT)plev, FALSE);
+ if (plev > 24) set_oppose_cold(p_ptr, (TIME_EFFECT)plev, FALSE);
+ if (plev > 29) set_oppose_elec(p_ptr, (TIME_EFFECT)plev, FALSE);
+ if (plev > 34) set_oppose_pois(p_ptr, (TIME_EFFECT)plev, FALSE);
break;
case 7:
/* Psychometry */
break;
case 9:
/* Adrenaline */
- set_afraid(0);
+ set_afraid(p_ptr, 0);
set_stun(0);
/*
*/
if (!IS_FAST() || !IS_HERO())
{
- hp_player(plev);
+ hp_player(p_ptr, plev);
}
t = 10 + randint1((plev * 3) / 2);
- set_hero(t, FALSE);
+ set_hero(p_ptr, t, FALSE);
/* Haste */
- (void)set_fast(t, FALSE);
+ (void)set_fast(p_ptr, t, FALSE);
break;
case 10:
/* Telekinesis */
(void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
break;
case 2:
- set_tim_levitation(randint1(30) + 30 + boost / 5, FALSE);
+ set_tim_levitation(p_ptr, randint1(30) + 30 + boost / 5, FALSE);
break;
case 3:
project_length = plev / 8 + 3;
fire_beam(GF_MISSILE, dir, damroll(5 + ((plev - 1) / 5) + boost / 10, 5));
break;
case 4:
- set_resist_magic(randint1(20) + 20 + boost / 5, FALSE);
+ set_resist_magic(p_ptr, randint1(20) + 20 + boost / 5, FALSE);
break;
case 5:
msg_print(_("気を練った。", "You improved the Force."));
else return TRUE;
break;
case 6:
- set_tim_sh_touki(randint1(plev / 2) + 15 + boost / 7, FALSE);
+ set_tim_sh_touki(p_ptr, randint1(plev / 2) + 15 + boost / 7, FALSE);
break;
case 7:
return shock_power();
MONSTER_IDX m_idx;
if (!target_set(TARGET_KILL)) return FALSE;
- m_idx = grid_array[target_row][target_col].m_idx;
+ m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
if (!m_idx) break;
if (!player_has_los_bold(target_row, target_col)) break;
if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
bool success = FALSE;
for (i = 0; i < 1 + boost/100; i++)
- if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_PHANTOM, PM_FORCE_PET, '\0'))
+ if (summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_PHANTOM, PM_FORCE_PET))
success = TRUE;
if (success)
{
fire_beam(GF_MANA, dir, damroll(10 + (plev / 2) + boost * 3 / 10, 15));
break;
case 13:
- set_lightspeed(randint1(16) + 16 + boost / 20, FALSE);
+ set_lightspeed(p_ptr, randint1(16) + 16 + boost / 20, FALSE);
break;
default:
msg_print(_("なに?", "Zap?"));
{
POSITION x, y;
int val = 0;
- for (x = 0; x < cur_wid; x++) {
- for (y = 0; y < cur_hgt; y++) {
- if (is_mirror_grid(&grid_array[y][x])) val++;
+ for (x = 0; x < current_floor_ptr->width; x++) {
+ for (y = 0; y < current_floor_ptr->height; y++) {
+ if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) val++;
}
}
return val;
*/
static bool cast_mirror_spell(int spell)
{
- int dir;
+ DIRECTION dir;
PLAYER_LEVEL plev = p_ptr->lev;
- int tmp;
+ int tmp;
TIME_EFFECT t;
- int x, y;
+ POSITION x, y;
/* spell code */
switch (spell)
{
/* mirror of seeing */
case 0:
- tmp = is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) ? 4 : 0;
+ tmp = is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 0;
if (plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT);
if (plev + tmp > 18)detect_monsters_invis(DETECT_RAD_DEFAULT);
if (plev + tmp > 28)set_tim_esp((TIME_EFFECT)plev, FALSE);
break;
case 2:
if (!get_aim_dir(&dir)) return FALSE;
- if (plev > 9 && is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x])) {
+ if (plev > 9 && is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])) {
fire_beam(GF_LITE, dir, damroll(3 + ((plev - 1) / 5), 4));
}
else {
break;
/* robe of dust */
case 6:
- set_dustrobe(20 + randint1(20), FALSE);
+ set_dustrobe(p_ptr, 20 + randint1(20), FALSE);
break;
/* banishing mirror */
case 7:
break;
/* mirror sleeping */
case 9:
- for (x = 0; x < cur_wid; x++) {
- for (y = 0; y < cur_hgt; y++) {
- if (is_mirror_grid(&grid_array[y][x])) {
+ for (x = 0; x < current_floor_ptr->width; x++) {
+ for (y = 0; y < current_floor_ptr->height; y++) {
+ if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) {
project(0, 2, y, x, (HIT_POINT)plev, GF_OLD_SLEEP, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
}
}
/* shield of water */
case 12:
t = 20 + randint1(20);
- set_shield(t, FALSE);
- if (plev > 31)set_tim_reflect(t, FALSE);
- if (plev > 39)set_resist_magic(t, FALSE);
+ set_shield(p_ptr, t, FALSE);
+ if (plev > 31)set_tim_reflect(p_ptr, t, FALSE);
+ if (plev > 39)set_resist_magic(p_ptr, t, FALSE);
break;
/* super ray */
case 13:
break;
/* illusion light */
case 14:
- tmp = is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) ? 4 : 3;
+ tmp = is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) ? 4 : 3;
slow_monsters(plev);
stun_monsters(plev*tmp);
confuse_monsters(plev*tmp);
break;
/* mirror shift */
case 15:
- if (!is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x])) {
+ if (!is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x])) {
msg_print(_("鏡の国の場所がわからない!", "You cannot find out where is the world of mirror!"));
break;
}
return recall_player(p_ptr, randint0(21) + 15);
/* multi-shadow */
case 18:
- set_multishadow(6 + randint1(6), FALSE);
+ set_multishadow(p_ptr, 6 + randint1(6), FALSE);
break;
/* binding field */
case 19:
break;
/* mirror of Ruffnor */
case 20:
- (void)set_invuln(randint1(4) + 4, FALSE);
+ (void)set_invuln(p_ptr, randint1(4) + 4, FALSE);
break;
default:
msg_print(_("なに?", "Zap?"));
y = p_ptr->y + ddy[dir];
x = p_ptr->x + ddx[dir];
- if (!grid_array[y][x].m_idx)
+ if (!current_floor_ptr->grid_array[y][x].m_idx)
{
msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
return FALSE;
py_attack(y, x, 0);
- if (!player_can_enter(grid_array[y][x].feat, 0) || is_trap(grid_array[y][x].feat))
+ if (!player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(current_floor_ptr->grid_array[y][x].feat))
break;
y += ddy[dir];
x += ddx[dir];
- if (player_can_enter(grid_array[y][x].feat, 0) && !is_trap(grid_array[y][x].feat) && !grid_array[y][x].m_idx)
+ if (player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(current_floor_ptr->grid_array[y][x].feat) && !current_floor_ptr->grid_array[y][x].m_idx)
{
msg_print(NULL);
(void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
break;
}
case 3:
- earthquake(p_ptr->y, p_ptr->x, 8+randint0(5));
+ earthquake(p_ptr->y, p_ptr->x, 8+randint0(5), 0);
break;
case 4:
massacre();
case 7:
return ident_spell(FALSE);
case 8:
- set_tim_levitation(randint1(20) + 20, FALSE);
+ set_tim_levitation(p_ptr, randint1(20) + 20, FALSE);
break;
case 9:
fire_ball(GF_FIRE, 0, 50+plev, plev/10+2);
teleport_player(30, 0L);
- set_oppose_fire((TIME_EFFECT)plev, FALSE);
+ set_oppose_fire(p_ptr, (TIME_EFFECT)plev, FALSE);
break;
case 10:
return rush_attack(NULL);
for (slot = 0; slot < INVEN_PACK; slot++)
{
- if (inventory[slot].tval == TV_SPIKE) break;
+ if (p_ptr->inventory_list[slot].tval == TV_SPIKE) break;
}
if (slot == INVEN_PACK)
{
/* Gives a multiplier of 2 at first, up to 3 at 40th */
do_cmd_throw(1, FALSE, slot);
- take_turn(p_ptr, 100);;
+ take_turn(p_ptr, 100);
}
break;
}
POSITION ty, tx;
if (!target_set(TARGET_KILL)) return FALSE;
- m_idx = grid_array[target_row][target_col].m_idx;
+ m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
if (!m_idx) break;
if (m_idx == p_ptr->riding) break;
if (!player_has_los_bold(target_row, target_col)) break;
if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
- m_ptr = &m_list[m_idx];
+ m_ptr = ¤t_floor_ptr->m_list[m_idx];
monster_desc(m_name, m_ptr, 0);
msg_format(_("%sを引き戻した。", "You pull back %s."), m_name);
path_n = project_path(path_g, MAX_RANGE, target_row, target_col, p_ptr->y, p_ptr->x, 0);
{
POSITION ny = GRID_Y(path_g[i]);
POSITION nx = GRID_X(path_g[i]);
- grid_type *c_ptr = &grid_array[ny][nx];
+ grid_type *g_ptr = ¤t_floor_ptr->grid_array[ny][nx];
if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
- !(c_ptr->info & CAVE_OBJECT) &&
+ !(g_ptr->info & CAVE_OBJECT) &&
!pattern_tile(ny, nx))
{
ty = ny;
}
}
/* Update the old location */
- grid_array[target_row][target_col].m_idx = 0;
+ current_floor_ptr->grid_array[target_row][target_col].m_idx = 0;
/* Update the new location */
- grid_array[ty][tx].m_idx = (s16b)m_idx;
+ current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
/* Move the monster */
- m_ptr->fy = (byte_hack)ty;
- m_ptr->fx = (byte_hack)tx;
+ m_ptr->fy = ty;
+ m_ptr->fx = tx;
/* Wake the monster up */
(void)set_monster_csleep(m_idx, 0);
{
/* Auto-Recall if possible and visible */
if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
-
- /* Track a new monster */
health_track(m_idx);
}
explosive_rune();
break;
case 16:
- (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
- set_oppose_acid((TIME_EFFECT)plev, FALSE);
+ (void)set_kabenuke(p_ptr, randint1(plev/2) + plev/2, FALSE);
+ set_oppose_acid(p_ptr, (TIME_EFFECT)plev, FALSE);
break;
case 17:
fire_ball(GF_POIS, 0, 75+plev*2/3, plev/5+2);
break;
}
case 19:
- set_multishadow(6+randint1(6), FALSE);
+ set_multishadow(p_ptr, 6+randint1(6), FALSE);
break;
default:
msg_print(_("なに?", "Zap?"));
{
SPELL_IDX n = 0;
int b = 0;
- int chance;
- int minfail = 0;
+ PERCENTAGE chance;
+ PERCENTAGE minfail = 0;
PLAYER_LEVEL plev = p_ptr->lev;
int old_csp = p_ptr->csp;
mind_type spell;
if (cmd_limit_confused(p_ptr)) return;
- /* get power */
if (!get_mind_power(&n, FALSE)) return;
#ifdef JP
else if (b < 15)
{
msg_print(_("奇妙な光景が目の前で踊っている...", "Weird visions seem to dance before your eyes..."));
- set_image(p_ptr->image + 5 + randint1(10));
+ set_image(p_ptr, p_ptr->image + 5 + randint1(10));
}
else if (b < 45)
{
msg_print(_("あなたの頭は混乱した!", "Your brain is addled!"));
- set_confused(p_ptr->confused + randint1(8));
+ set_confused(p_ptr, p_ptr->confused + randint1(8));
}
else if (b < 90)
{
else if (b < 96)
{
msg_print(_("まわりのものがキラキラ輝いている!", "Your brain is addled!"));
- set_image(p_ptr->image + 5 + randint1(10));
+ set_image(p_ptr, p_ptr->image + 5 + randint1(10));
}
else
{
switch(use_mind)
{
case MIND_MINDCRAFTER:
- /* Cast the spell */
+
cast = cast_mindcrafter_spell(n);
break;
case MIND_KI:
- /* Cast the spell */
+
cast = cast_force_spell(n);
break;
case MIND_BERSERKER:
- /* Cast the spell */
+
cast = cast_berserk_spell(n);
break;
case MIND_MIRROR_MASTER:
- /* Cast the spell */
- if( is_mirror_grid(&grid_array[p_ptr->y][p_ptr->x]) )on_mirror = TRUE;
+
+ if( is_mirror_grid(¤t_floor_ptr->grid_array[p_ptr->y][p_ptr->x]) )on_mirror = TRUE;
cast = cast_mirror_spell(n);
break;
case MIND_NINJUTSU:
- /* Cast the spell */
+
cast = cast_ninja_spell(n);
break;
default:
}
- take_turn(p_ptr, 100);;
/* teleport from mirror costs small energy */
- if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER )
+ if(on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER)
+ {
+ if( n==3 || n==5 || n==7 || n==16 ) take_turn(p_ptr, 50);
+ }
+ else
{
- if( n==3 || n==5 || n==7 || n==16 ) p_ptr->energy_use = 50;
+ take_turn(p_ptr, 100);
}
if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU))
msg_format(_("%sを集中しすぎて気を失ってしまった!", "You faint from the effort!"),p);
/* Hack -- Bypass free action */
- (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
+ (void)set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(5 * oops + 1));
/* Damage WIS (possibly permanently) */
if (randint0(100) < 50)
msg_print(_("自分の精神を攻撃してしまった!", "You have damaged your mind!"));
/* Reduce constitution */
- (void)dec_stat(A_WIS, 15 + randint1(10), perm);
+ (void)dec_stat(p_ptr, A_WIS, 15 + randint1(10), perm);
}
}
p_ptr->redraw |= (PR_MANA);
while(1)
{
- /* get power */
if (!get_mind_power(&n, TRUE))
{
screen_load();