/* File: spells3.c */
-/* Purpose: Spell code (part 3) */
-
/*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
*
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies. Other copyrights may also apply.
*/
+/* Purpose: Spell code (part 3) */
+
#include "angband.h"
/* Maximum number of tries for teleporting */
if (!cave_empty_bold(ny, nx)) continue;
/* Hack -- no teleport onto glyph of warding */
- if (cave[ny][nx].feat == FEAT_GLYPH) continue;
- if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
+ if (is_glyph_grid(&cave[ny][nx])) continue;
+ if (is_explosive_rune_grid(&cave[ny][nx])) continue;
/* ...nor onto the Pattern */
if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
/*
- * Teleport monster next to the player
+ * Teleport monster next to a grid near the given location
*/
-void teleport_to_player(int m_idx, int power)
+void teleport_monster_to(int m_idx, int ty, int tx, int power)
{
int ny, nx, oy, ox, d, i, min;
int attempts = 500;
/* Try several locations */
for (i = 0; i < 500; i++)
{
+ cave_type *c_ptr;
+
/* Pick a (possibly illegal) location */
while (1)
{
- ny = rand_spread(py, dis);
- nx = rand_spread(px, dis);
- d = distance(py, px, ny, nx);
+ ny = rand_spread(ty, dis);
+ nx = rand_spread(tx, dis);
+ d = distance(ty, tx, ny, nx);
if ((d >= min) && (d <= dis)) break;
}
/* Require "empty" floor space */
if (!cave_empty_bold(ny, nx)) continue;
+ c_ptr = &cave[ny][nx];
+
/* Hack -- no teleport onto glyph of warding */
- if (cave[ny][nx].feat == FEAT_GLYPH) continue;
- if (cave[ny][nx].feat == FEAT_MINOR_GLYPH) continue;
+ if (is_glyph_grid(c_ptr)) continue;
+ if (is_explosive_rune_grid(c_ptr)) continue;
/* ...nor onto the Pattern */
- if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
- (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) continue;
+ if ((c_ptr->feat >= FEAT_PATTERN_START) &&
+ (c_ptr->feat <= FEAT_PATTERN_XTRA2)) continue;
/* No teleporting into vaults and such */
- /* if (cave[ny][nx].info & (CAVE_ICKY)) continue; */
+ /* if (c_ptr->info & (CAVE_ICKY)) continue; */
/* This grid looks good */
look = FALSE;
int d, i, min, ox, oy;
int tries = 0;
- int xx = -1, yy = -1;
+ int xx, yy;
/* Initialize */
int y = py;
lite_spot(oy, ox);
/* Monsters with teleport ability may follow the player */
- while (xx < 2)
+ for (xx = -1; xx < 2; xx++)
{
- yy = -1;
-
- while (yy < 2)
+ for (yy = -1; yy < 2; yy++)
{
- if (xx == 0 && yy == 0)
- {
- /* Do nothing */
- }
- else
+ int tmp_m_idx = cave[oy+yy][ox+xx].m_idx;
+
+ /* A monster except your mount may follow */
+ if (tmp_m_idx && p_ptr->riding != tmp_m_idx)
{
- if (cave[oy+yy][ox+xx].m_idx)
+ monster_type *m_ptr = &m_list[tmp_m_idx];
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
+
+ /*
+ * The latter limitation is to avoid
+ * totally unkillable suckers...
+ */
+ if ((r_ptr->flags6 & RF6_TPORT) &&
+ !(r_ptr->flagsr & RFR_RES_TELE))
{
- if ((r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].flags6 & RF6_TPORT) &&
- !(r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].flags3 & RF3_RES_TELE))
- /*
- * The latter limitation is to avoid
- * totally unkillable suckers...
- */
- {
- if (!(m_list[cave[oy+yy][ox+xx].m_idx].csleep))
- teleport_to_player(cave[oy+yy][ox+xx].m_idx, r_info[m_list[cave[oy+yy][ox+xx].m_idx].r_idx].level);
- }
+ if (!m_ptr->csleep) teleport_monster_to(tmp_m_idx, py, px, r_ptr->level);
}
}
- yy++;
}
- xx++;
}
forget_flow();
{
if (cave_naked_bold(y, x) || (((cave[y][x].feat == FEAT_DEEP_LAVA) || (cave[y][x].feat == FEAT_DEEP_WATER)) && !cave[y][x].m_idx)) break;
}
- else if (cave_empty_bold(y, x) || ((y == py) && (x == px))) break;
+ else if (cave_empty_bold(y, x) || player_bold(y, x)) break;
/* Occasionally advance the distance */
if (++ctr > (4 * dis * dis + 4 * dis + 1))
/*
* Teleport the player one level up or down (random when legal)
+ * Note: If m_idx <= 0, target is player.
*/
-void teleport_player_level(void)
+void teleport_level(int m_idx)
{
- /* No effect in arena or quest */
- if (p_ptr->inside_arena || (p_ptr->inside_quest && !random_quest_number(dun_level)) ||
- (quest_number(dun_level) && (dun_level > 1) && ironman_downward))
+ bool go_up;
+ char m_name[160];
+ bool see_m = TRUE;
+
+ if (m_idx <= 0) /* To player */
+ {
+#ifdef JP
+ strcpy(m_name, "¤¢¤Ê¤¿");
+#else
+ strcpy(m_name, "you");
+#endif
+ }
+ else /* To monster */
+ {
+ monster_type *m_ptr = &m_list[m_idx];
+
+ /* Get the monster name (or "it") */
+ monster_desc(m_name, m_ptr, 0);
+
+ see_m = m_ptr->ml;
+ }
+
+ /* No effect in some case */
+ if (TELE_LEVEL_IS_INEFF(m_idx))
{
#ifdef JP
-msg_print("¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£");
+ if (see_m) msg_print("¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£");
#else
- msg_print("There is no effect.");
+ if (see_m) msg_print("There is no effect.");
#endif
return;
}
- if (p_ptr->anti_tele)
+ if ((m_idx <= 0) && p_ptr->anti_tele) /* To player */
{
#ifdef JP
-msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
+ msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
#else
msg_print("A mysterious force prevents you from teleporting!");
#endif
-
return;
}
- if (ironman_downward || (dun_level <= d_info[dungeon_type].mindepth))
+ /* Choose up or down */
+ if (randint0(100) < 50) go_up = TRUE;
+ else go_up = FALSE;
+
+ if ((m_idx <= 0) && p_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)) || (dun_level <= d_info[dungeon_type].mindepth))
{
#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£");
+ if (see_m) msg_format("%^s¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£", m_name);
#else
- msg_print("You sink through the floor.");
+ if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
#endif
- if (!dun_level)
+ if (m_idx <= 0) /* To player */
{
- dungeon_type = p_ptr->recall_dungeon;
- p_ptr->oldpy = py;
- p_ptr->oldpx = px;
- }
+ if (!dun_level)
+ {
+ dungeon_type = p_ptr->recall_dungeon;
+ p_ptr->oldpy = py;
+ p_ptr->oldpx = px;
+ }
- if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
+ if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
- if (autosave_l) do_cmd_save_game(TRUE);
+ if (autosave_l) do_cmd_save_game(TRUE);
- if (!dun_level)
- {
- dun_level = d_info[dungeon_type].mindepth;
- }
- else
- {
- dun_level++;
- }
+ if (!dun_level)
+ {
+ dun_level = d_info[dungeon_type].mindepth;
+ prepare_change_floor_mode(CFM_RAND_PLACE | CFM_CLEAR_ALL);
+ }
+ else
+ {
+ prepare_change_floor_mode(CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
+ }
- /* Leaving */
- p_ptr->leaving = TRUE;
+ /* Leaving */
+ p_ptr->leaving = TRUE;
+ }
}
+
+ /* Up only */
else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
{
#ifdef JP
-msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
+ if (see_m) msg_format("%^s¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£", m_name);
#else
- msg_print("You rise up through the ceiling.");
+ if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
#endif
- if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
-
- if (autosave_l) do_cmd_save_game(TRUE);
+ if (m_idx <= 0) /* To player */
+ {
+ if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
- dun_level--;
+ if (autosave_l) do_cmd_save_game(TRUE);
- if (!dun_level) dungeon_type = 0;
+ prepare_change_floor_mode(CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
- leave_quest_check();
+ leave_quest_check();
- /* Leaving */
- p_ptr->inside_quest = 0;
- p_ptr->leaving = TRUE;
+ /* Leaving */
+ p_ptr->inside_quest = 0;
+ p_ptr->leaving = TRUE;
+ }
}
- else if (randint0(100) < 50)
+ else if (go_up)
{
#ifdef JP
-msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
+ if (see_m) msg_format("%^s¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£", m_name);
#else
- msg_print("You rise up through the ceiling.");
+ if (see_m) msg_format("%^s rise%s up through the ceiling.", m_name, (m_idx <= 0) ? "" : "s");
#endif
- if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
-
- if (autosave_l) do_cmd_save_game(TRUE);
+ if (m_idx <= 0) /* To player */
+ {
+ if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
- dun_level--;
+ if (autosave_l) do_cmd_save_game(TRUE);
- if (!dun_level) dungeon_type = 0;
+ prepare_change_floor_mode(CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
- /* Leaving */
- p_ptr->leaving = TRUE;
+ /* Leaving */
+ p_ptr->leaving = TRUE;
+ }
}
else
{
#ifdef JP
-msg_print("¤¢¤Ê¤¿¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£");
+ if (see_m) msg_format("%^s¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤¯¡£", m_name);
#else
- msg_print("You sink through the floor.");
+ if (see_m) msg_format("%^s sink%s through the floor.", m_name, (m_idx <= 0) ? "" : "s");
#endif
- if (!dun_level) dungeon_type = p_ptr->recall_dungeon;
+ if (m_idx <= 0) /* To player */
+ {
+ /* Never reach this code on the surface */
+ /* if (!dun_level) dungeon_type = p_ptr->recall_dungeon; */
- if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
+ if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
- if (autosave_l) do_cmd_save_game(TRUE);
+ if (autosave_l) do_cmd_save_game(TRUE);
- dun_level++;
+ prepare_change_floor_mode(CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
- /* Leaving */
- p_ptr->leaving = TRUE;
+ /* Leaving */
+ p_ptr->leaving = TRUE;
+ }
}
- if (!dun_level && dungeon_type)
+ /* Monster level teleportation is simple deleting now */
+ if (m_idx > 0)
{
- p_ptr->leaving_dungeon = TRUE;
- p_ptr->wilderness_y = d_info[dungeon_type].dy;
- p_ptr->wilderness_x = d_info[dungeon_type].dx;
- p_ptr->recall_dungeon = dungeon_type;
- }
+ monster_type *m_ptr = &m_list[m_idx];
+
+ /* Check for quest completion */
+ check_quest_completion(m_ptr);
- if (!dun_level) dungeon_type = 0;
+ delete_monster_idx(m_idx);
+ }
/* Sound */
sound(SOUND_TPLEVEL);
select_dungeon = choose_dungeon("reset");
#endif
+ /* Ironman option */
+ if (ironman_downward)
+ {
+#ifdef JP
+ msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
+#else
+ msg_print("Nothing happens.");
+#endif
+
+ return TRUE;
+ }
+
if (!select_dungeon) return FALSE;
/* Prompt */
#ifdef JP
}
/* Teleport Level */
- teleport_player_level();
+ teleport_level(0);
break;
}
}
-bool item_tester_hook_weapon_nobow(object_type *o_ptr)
+static bool item_tester_hook_weapon_nobow(object_type *o_ptr)
{
switch (o_ptr->tval)
{
#ifdef JP
act = "¤Ï¿Í´Ö¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
#else
- act = "seems looking for human!";
+ act = "seems to be looking for humans!";
#endif
o_ptr->name2 = EGO_SLAY_HUMAN;
#ifdef JP
act = "¤ÏÅÅ·â¤Ëʤ¤ï¤ì¤¿¡ª";
#else
- act = "coverd with lightning!";
+ act = "covered with lightning!";
#endif
o_ptr->name2 = EGO_BRAND_ELEC;
#ifdef JP
act = "¤Ï¼Ù°¤Ê¤ë²øʪ¤òµá¤á¤Æ¤¤¤ë¡ª";
#else
- act = "seems looking for evil monster!";
+ act = "seems to be looking for evil monsters!";
#endif
o_ptr->name2 = EGO_SLAY_EVIL;
#ifdef JP
act = "¤Ï°ÛÀ¤³¦¤Î½»¿Í¤ÎÆùÂΤòµá¤á¤Æ¤¤¤ë¡ª";
#else
- act = "seems looking for demon!";
+ act = "seems to be looking for demons!";
#endif
o_ptr->name2 = EGO_SLAY_DEMON;
#ifdef JP
act = "¤Ï»Ó¤òµá¤á¤Æ¤¤¤ë¡ª";
#else
- act = "seems looking for undead!";
+ act = "seems to be looking for undead!";
#endif
o_ptr->name2 = EGO_SLAY_UNDEAD;
#ifdef JP
act = "¤Ïưʪ¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
#else
- act = "seems looking for animal!";
+ act = "seems to be looking for animals!";
#endif
o_ptr->name2 = EGO_SLAY_ANIMAL;
#ifdef JP
act = "¤Ï¥É¥é¥´¥ó¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
#else
- act = "seems looking for dragon!";
+ act = "seems to be looking for dragons!";
#endif
o_ptr->name2 = EGO_SLAY_DRAGON;
#ifdef JP
act = "¤Ï¥È¥í¥ë¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
#else
- act = "seems looking for troll!";
+ act = "seems to be looking for troll!s";
#endif
o_ptr->name2 = EGO_SLAY_TROLL;
#ifdef JP
act = "¤Ï¥ª¡¼¥¯¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
#else
- act = "seems looking for orc!";
+ act = "seems to be looking for orcs!";
#endif
o_ptr->name2 = EGO_SLAY_ORC;
#ifdef JP
act = "¤Ïµð¿Í¤Î·ì¤òµá¤á¤Æ¤¤¤ë¡ª";
#else
- act = "seems looking for giant!";
+ act = "seems to be looking for giants!";
#endif
o_ptr->name2 = EGO_SLAY_GIANT;
}
+/*
+ * Determine if a "feature" is a "vanishable"
+ * Non-permanent walls, trees, mountains, or doors
+ */
+#define vanishable_feat(F) \
+ ((!feat_floor(F) && (((F) < FEAT_PERM_EXTRA) || ((F) > FEAT_PERM_SOLID))) || \
+ ((F) == FEAT_OPEN) || ((F) == FEAT_BROKEN))
+
+/*
+ * Vanish all walls in this floor
+ */
+static bool vanish_dungeon(void)
+{
+ int y, x;
+ cave_type *c_ptr;
+ monster_type *m_ptr;
+ char m_name[80];
+ byte feat;
+
+ /* Prevent vasishing of quest levels and town */
+ if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
+ {
+ return FALSE;
+ }
+
+ /* Scan all normal grids */
+ for (y = 1; y < cur_hgt - 1; y++)
+ {
+ for (x = 1; x < cur_wid - 1; x++)
+ {
+ c_ptr = &cave[y][x];
+
+ /* Seeing true feature code (ignore mimic) */
+ feat = c_ptr->feat;
+
+ /* Lose room and vault */
+ c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+
+ /* Awake monster */
+ if (c_ptr->m_idx)
+ {
+ m_ptr = &m_list[c_ptr->m_idx];
+
+ /* Reset sleep counter */
+ m_ptr->csleep = 0;
+
+ if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+
+ /* Notice the "waking up" */
+ if (m_ptr->ml)
+ {
+ /* Acquire the monster name */
+ monster_desc(m_name, m_ptr, 0);
+
+ /* Dump a message */
+#ifdef JP
+ msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
+#else
+ msg_format("%^s wakes up.", m_name);
+#endif
+
+ /* Redraw the health bar */
+ if (p_ptr->health_who == c_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
+ if (p_ptr->riding == c_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
+ }
+ }
+
+ /* Process all walls, doors and patterns */
+ if (vanishable_feat(feat) || pattern_tile(y, x))
+ {
+ /* Create floor */
+ cave_set_feat(y, x, floor_type[randint0(100)]);
+ }
+ }
+ }
+
+ /* Special boundary walls -- Top and bottom */
+ for (x = 0; x < cur_wid; x++)
+ {
+ c_ptr = &cave[0][x];
+
+ /* Lose room and vault */
+ c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+
+ /* Set boundary mimic if needed */
+ if (c_ptr->mimic && vanishable_feat(c_ptr->mimic)) c_ptr->mimic = f_info[floor_type[randint0(100)]].mimic;
+
+ c_ptr = &cave[cur_hgt - 1][x];
+
+ /* Lose room and vault */
+ c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+
+ /* Set boundary mimic if needed */
+ if (c_ptr->mimic && vanishable_feat(c_ptr->mimic)) c_ptr->mimic = f_info[floor_type[randint0(100)]].mimic;
+ }
+
+ /* Special boundary walls -- Left and right */
+ for (y = 1; y < (cur_hgt - 1); y++)
+ {
+ c_ptr = &cave[y][0];
+
+ /* Lose room and vault */
+ c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+
+ /* Set boundary mimic if needed */
+ if (c_ptr->mimic && vanishable_feat(c_ptr->mimic)) c_ptr->mimic = f_info[floor_type[randint0(100)]].mimic;
+
+ c_ptr = &cave[y][cur_wid - 1];
+
+ /* Lose room and vault */
+ c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
+
+ /* Set boundary mimic if needed */
+ if (c_ptr->mimic && vanishable_feat(c_ptr->mimic)) c_ptr->mimic = f_info[floor_type[randint0(100)]].mimic;
+ }
+
+ /* Mega-Hack -- Forget the view and lite */
+ p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
+
+ /* Update stuff */
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
+
+ /* Update the monsters */
+ p_ptr->update |= (PU_MONSTERS);
+
+ /* Redraw map */
+ p_ptr->redraw |= (PR_MAP);
+
+ /* Window stuff */
+ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+
+ return TRUE;
+}
+
+
void call_the_(void)
{
int i;
+ int y, x;
+ bool do_call = TRUE;
- if (cave_floor_bold(py - 1, px - 1) &&
- cave_floor_bold(py - 1, px ) &&
- cave_floor_bold(py - 1, px + 1) &&
- cave_floor_bold(py , px - 1) &&
- cave_floor_bold(py , px + 1) &&
- cave_floor_bold(py + 1, px - 1) &&
- cave_floor_bold(py + 1, px ) &&
- cave_floor_bold(py + 1, px + 1))
+ for (i = 0; i < 9; i++)
+ {
+ y = py + ddy_ddd[i];
+ x = px + ddx_ddd[i];
+
+ if (!cave_floor_bold(y, x) && !boundary_floor_bold(y, x))
+ {
+ do_call = FALSE;
+ break;
+ }
+ }
+
+ if (do_call)
{
for (i = 1; i < 10; i++)
{
- if (i-5) fire_ball(GF_ROCKET, i, 175, 2);
+ if (i - 5) fire_ball(GF_ROCKET, i, 175, 2);
}
for (i = 1; i < 10; i++)
{
- if (i-5) fire_ball(GF_MANA, i, 175, 3);
+ if (i - 5) fire_ball(GF_MANA, i, 175, 3);
}
for (i = 1; i < 10; i++)
{
- if (i-5) fire_ball(GF_NUKE, i, 175, 4);
+ if (i - 5) fire_ball(GF_NUKE, i, 175, 4);
}
}
+
+ /* Prevent destruction of quest levels and town */
+ else if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
+ {
+#ifdef JP
+ msg_print("ÃÏÌ̤¬Íɤ줿¡£");
+#else
+ msg_print("The ground trembles.");
+#endif
+ }
+
else
{
#ifdef JP
-msg_format("¤¢¤Ê¤¿¤Ï%s¤òÊɤ˶᤹¤®¤ë¾ì½ê¤Ç¾§¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª",
-((mp_ptr->spell_book == TV_LIFE_BOOK) ? "µ§¤ê" : "¼öʸ"));
-msg_print("Â礤ÊÇúȯ²»¤¬¤¢¤Ã¤¿¡ª");
+ msg_format("¤¢¤Ê¤¿¤Ï%s¤òÊɤ˶᤹¤®¤ë¾ì½ê¤Ç¾§¤¨¤Æ¤·¤Þ¤Ã¤¿¡ª",
+ ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "µ§¤ê" : "¼öʸ"));
+ msg_print("Â礤ÊÇúȯ²»¤¬¤¢¤Ã¤¿¡ª");
#else
msg_format("You %s the %s too close to a wall!",
((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"),
msg_print("There is a loud explosion!");
#endif
-
- if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), TRUE))
+ if (one_in_(666))
+ {
#ifdef JP
-msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
+ if (!vanish_dungeon()) msg_print("¥À¥ó¥¸¥ç¥ó¤Ï°ì½ÖÀŤޤêÊ֤ä¿¡£");
#else
- msg_print("The dungeon collapses...");
+ if (!vanish_dungeon()) msg_print("The dungeon silences a moment.");
#endif
-
+ }
else
+ {
+ if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), FALSE))
#ifdef JP
-msg_print("¥À¥ó¥¸¥ç¥ó¤ÏÂ礤¯Íɤ줿¡£");
+ msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
#else
- msg_print("The dungeon trembles.");
+ msg_print("The dungeon collapses...");
#endif
+ else
+#ifdef JP
+ msg_print("¥À¥ó¥¸¥ç¥ó¤ÏÂ礤¯Íɤ줿¡£");
+#else
+ msg_print("The dungeon trembles.");
+#endif
+ }
#ifdef JP
-take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
+ take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
#else
take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "a suicidal Call the Void", -1);
#endif
-
}
}
void fetch(int dir, int wgt, bool require_los)
{
int ty, tx, i;
- bool flag;
cave_type *c_ptr;
object_type *o_ptr;
char o_name[MAX_NLEN];
/* Use a direction */
ty = py; /* Where to drop the item */
tx = px;
- flag = FALSE;
do
{
void alter_reality(void)
{
- if (!quest_number(dun_level) && dun_level)
+ /* Ironman option */
+ if (p_ptr->inside_arena || ironman_downward)
{
#ifdef JP
-msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
+ msg_print("²¿¤âµ¯¤³¤é¤Ê¤«¤Ã¤¿¡£");
#else
- msg_print("The world changes!");
+ msg_print("Nothing happens.");
#endif
+ return;
+ }
+ if (!p_ptr->alter_reality)
+ {
+ int turns = randint0(21) + 15;
- if (autosave_l) do_cmd_save_game(TRUE);
+ p_ptr->alter_reality = turns;
+#ifdef JP
+ msg_print("²ó¤ê¤Î·Ê¿§¤¬ÊѤï¤ê»Ï¤á¤¿...");
+#else
+ msg_print("The view around you begins to change...");
+#endif
- /* Leaving */
- p_ptr->leaving = TRUE;
+ p_ptr->redraw |= (PR_STATUS);
}
else
{
+ p_ptr->alter_reality = 0;
#ifdef JP
-msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
+ msg_print("·Ê¿§¤¬¸µ¤ËÌá¤Ã¤¿...");
#else
- msg_print("The world seems to change for a moment!");
+ msg_print("The view around you got back...");
#endif
+ p_ptr->redraw |= (PR_STATUS);
}
+ return;
}
}
/* Create a glyph */
- cave_set_feat(py, px, FEAT_GLYPH);
+ cave[py][px].info |= CAVE_OBJECT;
+ cave[py][px].mimic = f_info[FEAT_GLYPH].mimic;
+
+ /* Notice */
+ note_spot(py, px);
+
+ /* Redraw */
+ lite_spot(py, px);
return TRUE;
}
return FALSE;
}
- /* Create a glyph */
- cave_set_feat(py, px, FEAT_MIRROR);
+ /* Create a mirror */
+ cave[py][px].info |= CAVE_OBJECT;
+ cave[py][px].mimic = f_info[FEAT_MIRROR].mimic;
+
+ /* Turn on the light */
+ cave[py][px].info |= CAVE_GLOW;
+
+ /* Notice */
note_spot(py, px);
+
+ /* Redraw */
lite_spot(py, px);
return TRUE;
}
/* Create a glyph */
- cave_set_feat(py, px, FEAT_MINOR_GLYPH);
+ cave[py][px].info |= CAVE_OBJECT;
+ cave[py][px].mimic = f_info[FEAT_MINOR_GLYPH].mimic;
+
+ /* Notice */
+ note_spot(py, px);
+
+ /* Redraw */
+ lite_spot(py, px);
return TRUE;
}
}
-/*
- * Create stairs at the player location
- */
-void stair_creation(void)
-{
- /* XXX XXX XXX */
- if (!cave_valid_bold(py, px))
- {
-#ifdef JP
-msg_print("¾²¾å¤Î¥¢¥¤¥Æ¥à¤¬¼öʸ¤òÄ·¤ÍÊÖ¤·¤¿¡£");
-#else
- msg_print("The object resists the spell.");
-#endif
-
- return;
- }
-
- /* XXX XXX XXX */
- delete_object(py, px);
-
- /* Create a staircase */
- if (p_ptr->inside_arena || (p_ptr->inside_quest && (p_ptr->inside_quest < MIN_RANDOM_QUEST)) || p_ptr->inside_battle || !dun_level)
- {
- /* arena or quest */
-#ifdef JP
-msg_print("¸ú²Ì¤¬¤¢¤ê¤Þ¤»¤ó¡ª");
-#else
- msg_print("There is no effect!");
-#endif
-
- }
- else if (ironman_downward)
- {
- /* Town/wilderness or Ironman */
- cave_set_feat(py, px, FEAT_MORE);
- }
- else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
- {
- /* Quest level */
- cave_set_feat(py, px, FEAT_LESS);
- }
- else if (randint0(100) < 50)
- {
- cave_set_feat(py, px, FEAT_MORE);
- }
- else
- {
- cave_set_feat(py, px, FEAT_LESS);
- }
-}
-
/*
* Hook to specify "weapon"
return (FALSE);
}
-bool item_tester_hook_weapon2(object_type *o_ptr)
+static bool item_tester_hook_weapon2(object_type *o_ptr)
{
switch (o_ptr->tval)
{
}
-bool item_tester_hook_corpse(object_type *o_ptr)
-{
- switch (o_ptr->tval)
- {
- case TV_CORPSE:
- {
- return (TRUE);
- }
- }
-
- return (FALSE);
-}
-
-
/*
* Check if an object is weapon or armour (but not arrow, bolt, or shot)
*/
/*
* Check if an object is nameless weapon or armour
*/
-bool item_tester_hook_nameless_weapon_armour(object_type *o_ptr)
+static bool item_tester_hook_nameless_weapon_armour(object_type *o_ptr)
{
- if (o_ptr->name1 || o_ptr->art_name || o_ptr->name2 || o_ptr->xtra3)
- return FALSE;
-
switch (o_ptr->tval)
{
case TV_SWORD:
case TV_HELM:
case TV_BOOTS:
case TV_GLOVES:
- {
- return (TRUE);
- }
+ if (o_ptr->name1 || o_ptr->art_name || o_ptr->name2 || o_ptr->xtra3)
+ {
+ if (object_known_p(o_ptr)) return FALSE;
+ }
+ return TRUE;
}
- return (FALSE);
+ return FALSE;
}
/* Get an item */
#ifdef JP
-q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
-s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
+ q = "¤É¤Î¥¢¥¤¥Æ¥à¤ò¶¯²½¤·¤Þ¤¹¤«? ";
+ s = "¶¯²½¤Ç¤¤ë¥¢¥¤¥Æ¥à¤¬¤Ê¤¤¡£";
#else
q = "Enchant which item? ";
s = "You have nothing to enchant.";
/* Describe */
#ifdef JP
-msg_format("%s ¤ÏâÁ¤¤¸÷¤òȯ¤·¤¿¡ª",o_name);
+ msg_format("%s ¤ÏâÁ¤¤¸÷¤òȯ¤·¤¿¡ª",o_name);
#else
msg_format("%s %s radiate%s a blinding light!",
- ((item >= 0) ? "Your" : "The"), o_name,
- ((o_ptr->number > 1) ? "" : "s"));
+ ((item >= 0) ? "Your" : "The"), o_name,
+ ((o_ptr->number > 1) ? "" : "s"));
#endif
if (o_ptr->name1 || o_ptr->art_name)
{
#ifdef JP
-msg_format("%s¤Ï´û¤ËÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
- o_name );
+ msg_format("%s¤Ï´û¤ËÅÁÀâ¤Î¥¢¥¤¥Æ¥à¤Ç¤¹¡ª", o_name );
#else
msg_format("The %s %s already %s!",
o_name, ((o_ptr->number > 1) ? "are" : "is"),
else if (o_ptr->name2)
{
#ifdef JP
-msg_format("%s¤Ï´û¤Ë̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Ç¤¹¡ª",
- o_name );
+ msg_format("%s¤Ï´û¤Ë̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¤Ç¤¹¡ª", o_name );
#else
msg_format("The %s %s already %s!",
o_name, ((o_ptr->number > 1) ? "are" : "is"),
else if (o_ptr->xtra3)
{
#ifdef JP
-msg_format("%s¤Ï´û¤Ë¶¯²½¤µ¤ì¤Æ¤¤¤Þ¤¹¡ª",
- o_name );
+ msg_format("%s¤Ï´û¤Ë¶¯²½¤µ¤ì¤Æ¤¤¤Þ¤¹¡ª", o_name );
#else
msg_format("The %s %s already %s!",
o_name, ((o_ptr->number > 1) ? "are" : "is"),
- ((o_ptr->number > 1) ? "kaji items" : "an kaji item"));
+ ((o_ptr->number > 1) ? "customized items" : "a customized item"));
#endif
}
if (o_ptr->number > 1)
{
#ifdef JP
-msg_print("Ê£¿ô¤Î¥¢¥¤¥Æ¥à¤ËËâË¡¤ò¤«¤±¤ë¤À¤±¤Î¥¨¥Í¥ë¥®¡¼¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
-msg_format("%d ¸Ä¤Î%s¤¬²õ¤ì¤¿¡ª",(o_ptr->number)-1, o_name);
+ msg_print("Ê£¿ô¤Î¥¢¥¤¥Æ¥à¤ËËâË¡¤ò¤«¤±¤ë¤À¤±¤Î¥¨¥Í¥ë¥®¡¼¤Ï¤¢¤ê¤Þ¤»¤ó¡ª");
+ msg_format("%d ¸Ä¤Î%s¤¬²õ¤ì¤¿¡ª",(o_ptr->number)-1, o_name);
#else
msg_print("Not enough enough energy to enchant more than one object!");
msg_format("%d of your %s %s destroyed!",(o_ptr->number)-1, o_name, (o_ptr->number>2?"were":"was"));
/* Message */
#ifdef JP
-msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
+ msg_print("¶¯²½¤Ë¼ºÇÔ¤·¤¿¡£");
#else
msg_print("The enchantment failed.");
#endif
}
-bool item_tester_hook_identify(object_type *o_ptr)
+static bool item_tester_hook_identify(object_type *o_ptr)
{
return (bool)!object_known_p(o_ptr);
}
-bool item_tester_hook_identify_weapon_armour(object_type *o_ptr)
+static bool item_tester_hook_identify_weapon_armour(object_type *o_ptr)
{
if (object_known_p(o_ptr))
return FALSE;
/* Auto-inscription/destroy */
idx = is_autopick(o_ptr);
auto_inscribe_item(item, idx);
- if (!old_known) auto_destroy_item(item, idx);
+ if (destroy_identify && !old_known)
+ auto_destroy_item(item, idx);
/* Something happened */
return (TRUE);
/* Oops */
#ifdef JP
-msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
+ msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
#else
msg_print("There is a bright flash of light!");
#endif
-{
- byte iy = o_ptr->iy; /* Y-position on map, or zero */
- byte ix = o_ptr->ix; /* X-position on map, or zero */
- s16b next_o_idx= o_ptr->next_o_idx; /* Next object in stack (if any) */
- byte marked=o_ptr->marked; /* Object is marked */
- s16b weight = (o_ptr->number*o_ptr->weight);
-
- /* Wipe it clean */
- object_prep(o_ptr, o_ptr->k_idx);
-
- o_ptr->iy=iy;
- o_ptr->ix=ix;
- o_ptr->next_o_idx=next_o_idx;
- o_ptr->marked=marked;
- if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
-}
+ {
+ byte iy = o_ptr->iy; /* Y-position on map, or zero */
+ byte ix = o_ptr->ix; /* X-position on map, or zero */
+ s16b next_o_idx = o_ptr->next_o_idx; /* Next object in stack (if any) */
+ byte marked = o_ptr->marked; /* Object is marked */
+ s16b weight = o_ptr->number * o_ptr->weight;
+ u16b inscription = o_ptr->inscription;
+
+ /* Wipe it clean */
+ object_prep(o_ptr, o_ptr->k_idx);
+
+ o_ptr->iy = iy;
+ o_ptr->ix = ix;
+ o_ptr->next_o_idx = next_o_idx;
+ o_ptr->marked = marked;
+ o_ptr->inscription = inscription;
+ if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
+ }
calc_android_exp();
/* Something happened */
- return (TRUE);
+ return TRUE;
}
-bool item_tester_hook_identify_fully(object_type *o_ptr)
+static bool item_tester_hook_identify_fully(object_type *o_ptr)
{
return (bool)(!object_known_p(o_ptr) || !(o_ptr->ident & IDENT_MENTAL));
}
-bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr)
+static bool item_tester_hook_identify_fully_weapon_armour(object_type *o_ptr)
{
if (!item_tester_hook_identify_fully(o_ptr))
return FALSE;
}
/* Describe it fully */
- (void)identify_fully_aux(o_ptr);
+ (void)screen_object(o_ptr, TRUE);
/* Auto-inscription/destroy */
idx = is_autopick(o_ptr);
auto_inscribe_item(item, idx);
- if (!old_known) auto_destroy_item(item, idx);
+ if (destroy_identify && !old_known)
+ auto_destroy_item(item, idx);
/* Success */
return (TRUE);
{
int item;
object_type *o_ptr;
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
char o_name[MAX_NLEN];
cptr q, s;
object_desc(o_name, o_ptr, FALSE, 0);
/* Extract the flags */
- object_flags(o_ptr, &f1, &f2, &f3);
+ object_flags(o_ptr, flgs);
if (cursed_p(o_ptr))
{
* artifact weapon they find. Ego weapons and normal weapons
* can be blessed automatically.
*/
- if (f3 & TR3_BLESSED)
+ if (have_flag(flgs, TR_BLESSED))
{
#ifdef JP
msg_format("%s ¤Ï´û¤Ë½ËÊ¡¤µ¤ì¤Æ¤¤¤ë¡£",
((o_ptr->number > 1) ? "" : "s"));
#endif
- o_ptr->art_flags3 |= TR3_BLESSED;
+ add_flag(o_ptr->art_flags, TR_BLESSED);
o_ptr->discount = 99;
}
else
{
int item;
object_type *o_ptr;
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
char o_name[MAX_NLEN];
cptr q, s;
object_desc(o_name, o_ptr, FALSE, 0);
/* Extract the flags */
- object_flags(o_ptr, &f1, &f2, &f3);
+ object_flags(o_ptr, flgs);
if (o_ptr->k_idx && !artifact_p(o_ptr) && !ego_item_p(o_ptr) &&
- !o_ptr->art_name && !cursed_p(o_ptr) && (o_ptr->sval != SV_SHIELD_OF_DEFLECTION))
+ !o_ptr->art_name && !cursed_p(o_ptr) && (o_ptr->sval != SV_MIRROR_SHIELD))
{
#ifdef JP
msg_format("%s¤Ïµ±¤¤¤¿¡ª", o_name);
int radius = 2;
int dt = 0;
int dam = 0;
- bool ident = FALSE;
bool angry = FALSE;
object_kind *k_ptr = &k_info[k_idx];
case SV_POTION_SLOWNESS:
dt = GF_OLD_SLOW;
dam = 5;
- ident = TRUE;
angry = TRUE;
break;
case SV_POTION_POISON:
dt = GF_POIS;
dam = 3;
- ident = TRUE;
angry = TRUE;
break;
case SV_POTION_BLINDNESS:
dt = GF_DARK;
- ident = TRUE;
angry = TRUE;
break;
case SV_POTION_CONFUSION: /* Booze */
dt = GF_OLD_CONF;
- ident = TRUE;
angry = TRUE;
break;
case SV_POTION_SLEEP:
dt = GF_OLD_SLEEP;
angry = TRUE;
- ident = TRUE;
break;
case SV_POTION_RUINATION:
case SV_POTION_DETONATIONS:
dt = GF_SHARDS;
dam = damroll(25, 25);
angry = TRUE;
- ident = TRUE;
break;
case SV_POTION_DEATH:
dt = GF_DEATH_RAY; /* !! */
dam = k_ptr->level * 10;
angry = TRUE;
radius = 1;
- ident = TRUE;
break;
case SV_POTION_SPEED:
dt = GF_OLD_SPEED;
- ident = TRUE;
break;
case SV_POTION_CURE_LIGHT:
dt = GF_OLD_HEAL;
dam = damroll(2, 3);
- ident = TRUE;
break;
case SV_POTION_CURE_SERIOUS:
dt = GF_OLD_HEAL;
dam = damroll(4, 3);
- ident = TRUE;
break;
case SV_POTION_CURE_CRITICAL:
case SV_POTION_CURING:
dt = GF_OLD_HEAL;
dam = damroll(6, 3);
- ident = TRUE;
break;
case SV_POTION_HEALING:
dt = GF_OLD_HEAL;
dam = damroll(10, 10);
- ident = TRUE;
break;
case SV_POTION_RESTORE_EXP:
dt = GF_STAR_HEAL;
dam = 0;
radius = 1;
- ident = TRUE;
break;
case SV_POTION_LIFE:
dt = GF_STAR_HEAL;
dam = damroll(50, 50);
radius = 1;
- ident = TRUE;
break;
case SV_POTION_STAR_HEALING:
dt = GF_OLD_HEAL;
dam = damroll(50, 50);
radius = 1;
- ident = TRUE;
break;
case SV_POTION_RESTORE_MANA: /* MANA */
dt = GF_MANA;
dam = damroll(10, 10);
radius = 1;
- ident = TRUE;
break;
default:
/* Do nothing */ ;
{
int i, j;
int y, x;
- int use_realm1 = p_ptr->realm1 - 1;
- int use_realm2 = p_ptr->realm2 - 1;
int m[9];
magic_type *s_ptr;
char name[80];
/* Erase window */
clear_from(0);
- /* Warriors are illiterate */
- if (!mp_ptr->spell_book) return;
+ /* They have too many spells to list */
if (p_ptr->pclass == CLASS_SORCERER) return;
if (p_ptr->pclass == CLASS_RED_MAGE) return;
- /* Mindcrafter spell-list */
- if ((p_ptr->pclass == CLASS_MINDCRAFTER) || (p_ptr->pclass == CLASS_FORCETRAINER))
+ /* 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))
{
int i;
int y = 1;
char comment[80];
char psi_desc[80];
int use_mind;
+ bool use_hp = FALSE;
/* Display a list of spells */
prt("", y, x);
switch(p_ptr->pclass)
{
- case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
- case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
- default: use_mind = 0;break;
+ case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
+ case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
+ case CLASS_BERSERKER: use_mind = MIND_BERSERKER; use_hp = TRUE; break;
+ case CLASS_MIRROR_MASTER: use_mind = MIND_MIRROR_MASTER; break;
+ case CLASS_NINJA: use_mind = MIND_NINJUTSU; use_hp = TRUE; break;
+ default: use_mind = 0;break;
}
/* Dump the spells */
/* Reduce failure rate by INT/WIS adjustment */
chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
- /* Not enough mana to cast */
- if (spell.mana_cost > p_ptr->csp)
+ if (!use_hp)
{
- chance += 5 * (spell.mana_cost - p_ptr->csp);
- a = TERM_ORANGE;
+ /* Not enough mana to cast */
+ if (spell.mana_cost > p_ptr->csp)
+ {
+ chance += 5 * (spell.mana_cost - p_ptr->csp);
+ a = TERM_ORANGE;
+ }
+ }
+ else
+ {
+ /* Not enough hp to cast */
+ if (spell.mana_cost > p_ptr->chp)
+ {
+ chance += 100;
+ a = TERM_RED;
+ }
}
/* Extract the minimum failure rate */
return;
}
+ /* Cannot read spellbooks */
+ if (REALM_NONE == p_ptr->realm1) return;
+
/* Normal spellcaster with books */
/* Scan books */
- for (j = 0; j < ((use_realm2 > -1) ? 2 : 1); j++)
+ for (j = 0; j < ((p_ptr->realm2 > REALM_NONE) ? 2 : 1); j++)
{
int n = 0;
byte a = TERM_WHITE;
/* Access the spell */
- if (!is_magic((j < 1) ? use_realm1 : use_realm2))
+ if (!is_magic((j < 1) ? p_ptr->realm1 : p_ptr->realm2))
{
- s_ptr = &technic_info[(j < 1) ? use_realm1 : use_realm2 - MIN_TECHNIC][i % 32];
+ s_ptr = &technic_info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - MIN_TECHNIC][i % 32];
}
else
{
- s_ptr = &mp_ptr->info[(j < 1) ? use_realm1 : use_realm2][i % 32];
+ s_ptr = &mp_ptr->info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - 1][i % 32];
}
- strcpy(name, spell_names[technic2magic((j < 1) ? use_realm1+1 : use_realm2+1)-1][i % 32]);
+ strcpy(name, spell_names[technic2magic((j < 1) ? p_ptr->realm1 : p_ptr->realm2)-1][i % 32]);
/* Illegible */
if (s_ptr->slevel >= 99)
/* Forgotten */
else if ((j < 1) ?
- ((spell_forgotten1 & (1L << i))) :
- ((spell_forgotten2 & (1L << (i % 32)))))
+ ((p_ptr->spell_forgotten1 & (1L << i))) :
+ ((p_ptr->spell_forgotten2 & (1L << (i % 32)))))
{
/* Forgotten */
a = TERM_ORANGE;
/* Unknown */
else if (!((j < 1) ?
- (spell_learned1 & (1L << i)) :
- (spell_learned2 & (1L << (i % 32)))))
+ (p_ptr->spell_learned1 & (1L << i)) :
+ (p_ptr->spell_learned2 & (1L << (i % 32)))))
{
/* Unknown */
a = TERM_RED;
/* Untried */
else if (!((j < 1) ?
- (spell_worked1 & (1L << i)) :
- (spell_worked2 & (1L << (i % 32)))))
+ (p_ptr->spell_worked1 & (1L << i)) :
+ (p_ptr->spell_worked2 & (1L << (i % 32)))))
{
/* Untried */
a = TERM_YELLOW;
}
+/*
+ * Returns experience of a spell
+ */
+s16b experience_of_spell(int spell, int 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];
+ else return 0;
+}
+
+
+/*
+ * Modify mana consumption rate using spell exp and p_ptr->dec_mana
+ */
+int mod_need_mana(int need_mana, int spell, int realm)
+{
+#define MANA_CONST 2400
+#define MANA_DIV 4
+#define DEC_MANA_DIV 3
+
+ /* Realm magic */
+ if ((realm > REALM_NONE) && (realm <= MAX_REALM))
+ {
+ /*
+ * 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 *= p_ptr->dec_mana ? DEC_MANA_DIV : MANA_DIV;
+ need_mana /= MANA_CONST * MANA_DIV;
+ if (need_mana < 1) need_mana = 1;
+ }
+
+ /* Non-realm magic */
+ else
+ {
+ if (p_ptr->dec_mana) need_mana = (need_mana + 1) * DEC_MANA_DIV / MANA_DIV;
+ }
+
+#undef DEC_MANA_DIV
+#undef MANA_DIV
+#undef MANA_CONST
+
+ return need_mana;
+}
+
/*
* Returns spell chance of failure for spell -RAK-
*/
-s16b spell_chance(int spell, int realm)
+s16b spell_chance(int spell, int use_realm)
{
int chance, minfail;
magic_type *s_ptr;
- int shouhimana;
+ int need_mana;
int penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
/* Paranoia -- must be literate */
if (!mp_ptr->spell_book) return (100);
- if (realm+1 == REALM_HISSATSU) return 0;
+ if (use_realm == REALM_HISSATSU) return 0;
/* Access the spell */
- if (!is_magic(realm+1))
+ if (!is_magic(use_realm))
{
- s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
+ s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
}
else
{
- s_ptr = &mp_ptr->info[realm][spell];
+ s_ptr = &mp_ptr->info[use_realm - 1][spell];
}
/* Extract the base spell failure rate */
chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
if (p_ptr->riding)
- chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-skill_exp[GINOU_RIDING]/100-10,0));
-
- if (p_ptr->pclass == CLASS_SORCERER)
- shouhimana = s_ptr->smana*2200 + 2399;
- else if (p_ptr->pclass == CLASS_RED_MAGE)
- shouhimana = s_ptr->smana*2600 + 2399;
- else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
- shouhimana = (s_ptr->smana*(3800-spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)])+2399);
- else shouhimana = s_ptr->smana*3800;
- if(p_ptr->dec_mana)
- shouhimana *= 3;
- else shouhimana *= 4;
- shouhimana /= 9600;
- if(shouhimana < 1) shouhimana = 1;
+ chance += (MAX(r_info[m_list[p_ptr->riding].r_idx].level - p_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 (shouhimana > p_ptr->csp)
+ if (need_mana > p_ptr->csp)
{
- chance += 5 * (shouhimana - p_ptr->csp);
+ chance += 5 * (need_mana - p_ptr->csp);
}
chance += p_ptr->to_m_chance;
- if (((realm + 1) != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
+ if ((use_realm != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
/* Extract the minimum failure rate */
minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
else if (p_ptr->easy_spell) chance-=3;
else if (p_ptr->dec_mana) chance-=2;
- if ((realm+1 == REALM_NATURE) && ((p_ptr->align > 50) || (p_ptr->align < -50))) chance += penalty;
- if (((realm+1 == REALM_LIFE) || (realm+1 == REALM_HAJA)) && (p_ptr->align < -20)) chance += penalty;
- if (((realm+1 == REALM_DEATH) || (realm+1 == REALM_DAEMON)) && (p_ptr->align > 20)) chance += penalty;
+ if ((use_realm == REALM_NATURE) && ((p_ptr->align > 50) || (p_ptr->align < -50))) chance += penalty;
+ if (((use_realm == REALM_LIFE) || (use_realm == REALM_CRUSADE)) && (p_ptr->align < -20)) chance += penalty;
+ if (((use_realm == REALM_DEATH) || (use_realm == REALM_DAEMON)) && (p_ptr->align > 20)) chance += penalty;
/* Minimum failure rate */
if (chance < minfail) chance = minfail;
/* Always a 5 percent chance of working */
if (chance > 95) chance = 95;
- if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
+ if ((use_realm == p_ptr->realm1) || (use_realm == p_ptr->realm2)
+ || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
{
- if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1399) chance--;
- if(spell_exp[((p_ptr->realm1 == realm+1) ? spell: spell+32)]>1599) chance--;
+ s16b exp = experience_of_spell(spell, use_realm);
+ if (exp >= SPELL_EXP_EXPERT) chance--;
+ if (exp >= SPELL_EXP_MASTER) chance--;
}
if(p_ptr->dec_mana) chance--;
if (p_ptr->heavy_spell) chance += 5;
* The spell must be legible, not forgotten, and also, to cast,
* it must be known, and to study, it must not be known.
*/
-bool spell_okay(int spell, bool learned, bool study_pray, int realm)
+bool spell_okay(int spell, bool learned, bool study_pray, int use_realm)
{
magic_type *s_ptr;
/* Access the spell */
- if (!is_magic(realm+1))
+ if (!is_magic(use_realm))
{
- s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
+ s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
}
else
{
- s_ptr = &mp_ptr->info[realm][spell];
+ s_ptr = &mp_ptr->info[use_realm - 1][spell];
}
/* Spell is illegal */
if (s_ptr->slevel > p_ptr->lev) return (FALSE);
/* Spell is forgotten */
- if ((realm == p_ptr->realm2 - 1) ?
- (spell_forgotten2 & (1L << spell)) :
- (spell_forgotten1 & (1L << spell)))
+ if ((use_realm == p_ptr->realm2) ?
+ (p_ptr->spell_forgotten2 & (1L << spell)) :
+ (p_ptr->spell_forgotten1 & (1L << spell)))
{
/* Never okay */
return (FALSE);
if (p_ptr->pclass == CLASS_RED_MAGE) return (TRUE);
/* Spell is learned */
- if ((realm == p_ptr->realm2 - 1) ?
- (spell_learned2 & (1L << spell)) :
- (spell_learned1 & (1L << spell)))
+ if ((use_realm == p_ptr->realm2) ?
+ (p_ptr->spell_learned2 & (1L << spell)) :
+ (p_ptr->spell_learned1 & (1L << spell)))
{
/* Always true */
return (!study_pray);
* The strings in this function were extracted from the code in the
* functions "do_cmd_cast()" and "do_cmd_pray()" and may be dated.
*/
-static void spell_info(char *p, int spell, int realm)
+static void spell_info(char *p, int spell, int use_realm)
{
int plev = p_ptr->lev;
strcpy(p, "");
/* Analyze the spell */
- switch (realm)
+ switch (use_realm)
{
- case 0: /* Life */
+ case REALM_LIFE: /* Life */
switch (spell)
{
- case 1: sprintf(p, " %s2d10", s_heal); break;
- case 2: sprintf(p, " %s12+d12", s_dur); break;
- case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
- case 6: sprintf(p, " %s4d10", s_heal); break;
+ case 0: sprintf(p, " %s2d10", s_heal); break;
+ case 1: sprintf(p, " %s12+d12", s_dur); break;
+ case 2: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
+ case 3: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
+ case 5: sprintf(p, " %s4d10", s_heal); break;
+ case 9: sprintf(p, " %s%dd8", s_dam, 8 + ((plev - 1) / 5)); break;
case 10: sprintf(p, " %s8d10", s_heal); break;
- case 11: sprintf(p, " %s24+d24", s_dur); break;
- case 12: sprintf(p, " %s3d6+%d", s_dam, orb); break;
- case 13: sprintf(p, " %sd25+%d", s_dur, 3 * plev); break;
+ case 11: sprintf(p, " %s20+d20", s_dur); break;
case 14: sprintf(p, " %s300", s_heal); break;
- case 16: sprintf(p, " %sd%d", s_dam, plev); break;
- case 18: sprintf(p, " %sd%d", s_dam, 3 * plev); break;
- case 20: sprintf(p, " %sd%d", s_dam, 4 * plev); break;
-#ifdef JP
- case 22: sprintf(p, " »:d%d/²ó:1000", 4 * plev); break;
-#else
- case 22: sprintf(p, " d %d/h 1000", 4 * plev); break;
-#endif
- case 24: sprintf(p, " %s25+d25", s_dur); break;
- case 25: sprintf(p, " %s48+d48", s_dur); break;
- case 28: sprintf(p, " %s2000", s_heal); break;
-#ifdef JP
- case 30: sprintf(p, " ²ó300/»%d+250", plev * 4); break;
-#else
- case 30: sprintf(p, " h300/d%d+250", plev * 4); break;
-#endif
+ case 18: sprintf(p, " %sd%d", s_dam, 5 * plev); break;
+ case 20: sprintf(p, " %s%dd15", s_dam, 5 + ((plev - 1) / 3)); break;
+ case 21: sprintf(p, " %s15+d21", s_delay); break;
+ case 29: sprintf(p, " %s2000", s_heal); break;
case 31: sprintf(p, " %s%d+d%d", s_dur,(plev/2), (plev/2)); break;
}
break;
- case 1: /* Sorcery */
+ case REALM_SORCERY: /* Sorcery */
switch (spell)
{
case 1: sprintf(p, " %s10", s_range); break;
}
break;
- case 2: /* Nature */
+ case REALM_NATURE: /* Nature */
switch (spell)
{
#ifdef JP
}
break;
- case 3: /* Chaos */
+ case REALM_CHAOS: /* Chaos */
switch (spell)
{
case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
}
break;
- case 4: /* Death */
+ case REALM_DEATH: /* Death */
switch (spell)
{
case 1: sprintf(p, " %s%dd3", s_dam, (3 + ((plev - 1) / 5))); break;
}
break;
- case 5: /* Trump */
+ case REALM_TRUMP: /* Trump */
switch (spell)
{
case 0: sprintf(p, " %s10", s_range); break;
#ifdef JP
case 28: sprintf(p, " %s³Æ%d", s_dam, plev * 2); break;
#else
- case 28: sprintf(p, " dam %d each", plev * 2); break;
+ case 28: sprintf(p, " %s%d each", s_dam, plev * 2); break;
#endif
}
break;
- case 6: /* Arcane */
+ case REALM_ARCANE: /* Arcane */
switch (spell)
{
case 0: sprintf(p, " %s%dd3", s_dam, 3 + ((plev - 1) / 5)); break;
}
break;
- case 7: /* Craft */
+ case REALM_ENCHANT: /* Craft */
switch (spell)
{
case 0: sprintf(p, " %s100+d100", s_dur); break;
case 15: sprintf(p, " %s%d+d%d", s_dur, plev/2, plev/2); break;
case 16: sprintf(p, " %s25+d30", s_dur); break;
case 17: sprintf(p, " %s30+d20", s_dur); break;
- case 19: sprintf(p, " %s%d+d%d", s_dur, plev+20, plev); break;
+ case 19: sprintf(p, " %s%d+d%d", s_dur, plev, plev+20); break;
case 20: sprintf(p, " %s50+d50", s_dur); break;
case 23: sprintf(p, " %s20+d20", s_dur); break;
case 31: sprintf(p, " %s13+d13", s_dur); break;
}
break;
- case 8: /* Daemon */
+ case REALM_DAEMON: /* Daemon */
switch (spell)
{
case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
}
break;
- case 9: /* Haja *//* nanka */
+ case REALM_CRUSADE: /* Crusade */
switch (spell)
{
- case 1: sprintf(p, " %s2d10", s_heal); break;
- case 2: sprintf(p, " %s12+d12", s_dur); break;
- case 4: sprintf(p, " %s%d", s_dam, 10 + (plev / 2)); break;
- case 6: sprintf(p, " %s4d10", s_heal); break;
- case 10: sprintf(p, " %s8d10", s_heal); break;
- case 11: sprintf(p, " %s24+d24", s_dur); break;
- case 12: sprintf(p, " %s3d6+%d", s_dam, orb); break;
+ case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); break;
+ case 5: sprintf(p, " %s%d", s_range, 25+plev/2); break;
+#ifdef JP
+ case 6: sprintf(p, " %s³Æ%dd2", s_dam, 3+((plev-1)/9)); break;
+#else
+ case 6: sprintf(p, " %s%dd2 each", s_dam, 3+((plev-1)/9)); break;
+#endif
+ case 9: sprintf(p, " %s3d6+%d", s_dam, orb); break;
+ case 10: sprintf(p, " %sd%d", s_dam, plev); break;
+ case 12: sprintf(p, " %s24+d24", s_dur); break;
case 13: sprintf(p, " %sd25+%d", s_dur, 3 * plev); break;
- case 14: sprintf(p, " %s300", s_heal); break;
- case 16: sprintf(p, " %sd%d", s_dam, plev); break;
- case 18: sprintf(p, " %sd%d", s_dam, 3 * plev); break;
- case 20: sprintf(p, " %sd%d", s_dam, 4 * plev); break;
+ case 14: sprintf(p, " %s%d", s_dam, plev*5); break;
#ifdef JP
- case 22: sprintf(p, " »:d%d/²ó:1000", 4 * plev); break;
+ case 15: sprintf(p, " »:d%d/²ó:100", 6 * plev); break;
#else
- case 22: sprintf(p, " d %d/h 1000", 4 * plev); break;
+ case 15: sprintf(p, " dam:d%d/h100", 6 * plev); break;
#endif
+ case 18: sprintf(p, " %s18+d18", s_dur); break;
+ case 19: sprintf(p, " %sd%d", s_dam, 4 * plev); break;
+ case 20: sprintf(p, " %sd%d", s_dam, 4 * plev); break;
+ case 22: sprintf(p, " %s%d", s_dam, 2 * plev+100); break;
case 24: sprintf(p, " %s25+d25", s_dur); break;
- case 25: sprintf(p, " %s48+d48", s_dur); break;
- case 28: sprintf(p, " %s2000", s_heal); break;
+ case 28: sprintf(p, " %s10+d10", s_dur); break;
#ifdef JP
- case 30: sprintf(p, " ²ó300/»%d+250", plev * 4); break;
+ case 29: sprintf(p, " %s³Æ%d", s_dam, plev*3+25); break;
#else
- case 30: sprintf(p, " h300/d%d+250", plev * 4); break;
+ case 29: sprintf(p, " %s%d each", s_dam, plev*3+25); break;
+#endif
+#ifdef JP
+ case 30: sprintf(p, " ²ó100/»%d+%d", plev * 4, plev*11/2); break;
+#else
+ case 30: sprintf(p, " h100/dm%d+%d", plev * 4, plev*11/2); break;
#endif
- case 31: sprintf(p, " %s%d+d%d", s_dur,(plev/2), (plev/2)); break;
}
break;
- case 15: /* Music */
+ case REALM_MUSIC: /* Music */
switch (spell)
{
case 2 : sprintf(p, " %s%dd4", s_dam, 4 + ((plev - 1) / 5)); break;
break;
default:
#ifdef JP
- sprintf(p, "̤ÃΤΥ¿¥¤¥×: %d", realm);
+ sprintf(p, "̤ÃΤΥ¿¥¤¥×: %d", use_realm);
#else
- sprintf(p, "Unknown type: %d.", realm);
+ sprintf(p, "Unknown type: %d.", use_realm);
#endif
}
}
/*
* Print a list of spells (for browsing or casting or viewing)
*/
-void print_spells(int target_spell, byte *spells, int num, int y, int x, int realm)
+void print_spells(int target_spell, byte *spells, int num, int y, int x, int use_realm)
{
- int i, spell, shougou, increment = 64;
+ int i, spell, exp_level, increment = 64;
magic_type *s_ptr;
cptr comment;
char info[80];
char out_val[160];
byte line_attr;
- int shouhimana;
+ int need_mana;
char ryakuji[5];
char buf[256];
bool max = FALSE;
- if (((realm < 0) || (realm > MAX_REALM - 1)) && wizard)
+ if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && p_ptr->wizard)
#ifdef JP
msg_print("·Ù¹ð¡ª print_spell ¤¬Îΰè¤Ê¤·¤Ë¸Æ¤Ð¤ì¤¿");
#else
/* Title the list */
prt("", y, x);
- if (realm+1 == REALM_HISSATSU)
+ if (use_realm == REALM_HISSATSU)
#ifdef JP
strcpy(buf," Lv MP");
#else
#endif
if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
- else if ((realm + 1) == p_ptr->realm1) increment = 0;
- else if ((realm + 1) == p_ptr->realm2) increment = 32;
+ else if (use_realm == p_ptr->realm1) increment = 0;
+ else if (use_realm == p_ptr->realm2) increment = 32;
/* Dump the spells */
for (i = 0; i < num; i++)
spell = spells[i];
/* Access the spell */
- if (!is_magic(realm+1))
+ if (!is_magic(use_realm))
{
- s_ptr = &technic_info[realm - MIN_TECHNIC][spell];
+ s_ptr = &technic_info[use_realm - MIN_TECHNIC][spell];
}
else
{
- s_ptr = &mp_ptr->info[realm][spell];
+ s_ptr = &mp_ptr->info[use_realm - 1][spell];
}
- if (realm+1 == REALM_HISSATSU)
- shouhimana = s_ptr->smana;
+ if (use_realm == REALM_HISSATSU)
+ need_mana = s_ptr->smana;
else
{
- if (p_ptr->pclass == CLASS_SORCERER)
- shouhimana = s_ptr->smana*2200 + 2399;
- else if (p_ptr->pclass == CLASS_RED_MAGE)
- shouhimana = s_ptr->smana*2600 + 2399;
- else if ((realm+1 == p_ptr->realm1) || (realm+1 == p_ptr->realm2))
- shouhimana = (s_ptr->smana*(3800-spell_exp[(spell+increment)])+2399);
- else
- shouhimana = s_ptr->smana*3800+2399;
- if(p_ptr->dec_mana)
- shouhimana *= 3;
- else shouhimana *= 4;
- shouhimana /= 9600;
- if(shouhimana < 1) shouhimana = 1;
- }
+ s16b exp = experience_of_spell(spell, use_realm);
+
+ /* Extract mana consumption rate */
+ need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
- if ((increment == 64) || (s_ptr->slevel >= 99)) shougou = 0;
- else if (spell_exp[spell+increment]<900) shougou = 0;
- else if (spell_exp[spell+increment]<1200) shougou = 1;
- else if (spell_exp[spell+increment]<1400) shougou = 2;
- else if (spell_exp[spell+increment]<1600) shougou = 3;
- else shougou = 4;
- max = FALSE;
- if (!increment && (shougou == 4)) max = TRUE;
- else if ((increment == 32) && (shougou == 3)) max = TRUE;
- else if (s_ptr->slevel >= 99) max = TRUE;
- else if (p_ptr->pclass == CLASS_RED_MAGE) max = TRUE;
-
- strncpy(ryakuji,shougou_moji[shougou],4);
- ryakuji[3] = ']';
- ryakuji[4] = '\0';
+ if ((increment == 64) || (s_ptr->slevel >= 99)) exp_level = EXP_LEVEL_UNSKILLED;
+ else exp_level = spell_exp_level(exp);
+
+ max = FALSE;
+ 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;
+
+ strncpy(ryakuji, exp_level_str[exp_level], 4);
+ ryakuji[3] = ']';
+ ryakuji[4] = '\0';
+ }
if (use_menu && target_spell)
{
/* XXX XXX Could label spells above the players level */
/* Get extra info */
- spell_info(info, spell, realm);
+ spell_info(info, spell, use_realm);
/* Use that info */
comment = info;
line_attr = TERM_YELLOW;
}
}
- else if ((realm+1 != p_ptr->realm1) && (realm+1 != p_ptr->realm2))
+ else if ((use_realm != p_ptr->realm1) && (use_realm != p_ptr->realm2))
{
#ifdef JP
comment = " ̤ÃÎ";
line_attr = TERM_L_BLUE;
}
- else if ((realm + 1 == p_ptr->realm1) ?
- ((spell_forgotten1 & (1L << spell))) :
- ((spell_forgotten2 & (1L << spell))))
+ else if ((use_realm == p_ptr->realm1) ?
+ ((p_ptr->spell_forgotten1 & (1L << spell))) :
+ ((p_ptr->spell_forgotten2 & (1L << spell))))
{
#ifdef JP
comment = " ˺µÑ";
line_attr = TERM_YELLOW;
}
- else if (!((realm + 1 == p_ptr->realm1) ?
- (spell_learned1 & (1L << spell)) :
- (spell_learned2 & (1L << spell))))
+ else if (!((use_realm == p_ptr->realm1) ?
+ (p_ptr->spell_learned1 & (1L << spell)) :
+ (p_ptr->spell_learned2 & (1L << spell))))
{
#ifdef JP
comment = " ̤ÃÎ";
line_attr = TERM_L_BLUE;
}
- else if (!((realm + 1 == p_ptr->realm1) ?
- (spell_worked1 & (1L << spell)) :
- (spell_worked2 & (1L << spell))))
+ else if (!((use_realm == p_ptr->realm1) ?
+ (p_ptr->spell_worked1 & (1L << spell)) :
+ (p_ptr->spell_worked2 & (1L << spell))))
{
#ifdef JP
comment = " ̤·Ð¸³";
}
/* Dump the spell --(-- */
- if (realm+1 == REALM_HISSATSU)
+ if (use_realm == REALM_HISSATSU)
{
strcat(out_val, format("%-25s %2d %4d",
- spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
- s_ptr->slevel, shouhimana));
+ spell_names[technic2magic(use_realm)-1][spell], /* realm, spell */
+ s_ptr->slevel, need_mana));
}
else
{
strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%%%s",
- spell_names[technic2magic(realm+1)-1][spell], /* realm, spell */
+ spell_names[technic2magic(use_realm)-1][spell], /* realm, spell */
(max ? '!' : ' '), ryakuji,
- s_ptr->slevel, shouhimana, spell_chance(spell, realm), comment));
+ s_ptr->slevel, need_mana, spell_chance(spell, use_realm), comment));
}
c_prt(line_attr, out_val, y + i + 1, x);
}
case TV_ARCANE_BOOK:
case TV_ENCHANT_BOOK:
case TV_DAEMON_BOOK:
- case TV_HAJA_BOOK:
+ case TV_CRUSADE_BOOK:
case TV_MUSIC_BOOK:
case TV_HISSATSU_BOOK:
{
*/
int set_acid_destroy(object_type *o_ptr)
{
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
if (!hates_acid(o_ptr)) return (FALSE);
- object_flags(o_ptr, &f1, &f2, &f3);
- if (f3 & TR3_IGNORE_ACID) return (FALSE);
+ object_flags(o_ptr, flgs);
+ if (have_flag(flgs, TR_IGNORE_ACID)) return (FALSE);
return (TRUE);
}
*/
int set_elec_destroy(object_type *o_ptr)
{
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
if (!hates_elec(o_ptr)) return (FALSE);
- object_flags(o_ptr, &f1, &f2, &f3);
- if (f3 & TR3_IGNORE_ELEC) return (FALSE);
+ object_flags(o_ptr, flgs);
+ if (have_flag(flgs, TR_IGNORE_ELEC)) return (FALSE);
return (TRUE);
}
*/
int set_fire_destroy(object_type *o_ptr)
{
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
if (!hates_fire(o_ptr)) return (FALSE);
- object_flags(o_ptr, &f1, &f2, &f3);
- if (f3 & TR3_IGNORE_FIRE) return (FALSE);
+ object_flags(o_ptr, flgs);
+ if (have_flag(flgs, TR_IGNORE_FIRE)) return (FALSE);
return (TRUE);
}
*/
int set_cold_destroy(object_type *o_ptr)
{
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
if (!hates_cold(o_ptr)) return (FALSE);
- object_flags(o_ptr, &f1, &f2, &f3);
- if (f3 & TR3_IGNORE_COLD) return (FALSE);
+ object_flags(o_ptr, flgs);
+ if (have_flag(flgs, TR_IGNORE_COLD)) return (FALSE);
return (TRUE);
}
static int minus_ac(void)
{
object_type *o_ptr = NULL;
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
char o_name[MAX_NLEN];
object_desc(o_name, o_ptr, FALSE, 0);
/* Extract the flags */
- object_flags(o_ptr, &f1, &f2, &f3);
+ object_flags(o_ptr, flgs);
/* Object resists */
- if (f3 & TR3_IGNORE_ACID)
+ if (have_flag(flgs, TR_IGNORE_ACID))
{
#ifdef JP
msg_format("¤·¤«¤·%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª", o_name);
/*
* Hurt the player with Acid
*/
-void acid_dam(int dam, cptr kb_str, int monspell)
+int acid_dam(int dam, cptr kb_str, int monspell)
{
+ int get_damage;
int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
- bool double_resist = (p_ptr->oppose_acid || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
+ bool double_resist = IS_OPPOSE_ACID();
/* Total Immunity */
if (p_ptr->immune_acid || (dam <= 0))
{
learn_spell(monspell);
- return;
+ return 0;
}
/* Vulnerability (Ouch!) */
if (minus_ac()) dam = (dam + 1) / 2;
/* Take damage */
- take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
+ get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
/* Inventory damage */
if (!(double_resist && p_ptr->resist_acid))
inven_damage(set_acid_destroy, inv);
+ return get_damage;
}
/*
* Hurt the player with electricity
*/
-void elec_dam(int dam, cptr kb_str, int monspell)
+int elec_dam(int dam, cptr kb_str, int monspell)
{
+ int get_damage;
int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
- bool double_resist = (p_ptr->oppose_elec || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
+ bool double_resist = IS_OPPOSE_ELEC();
/* Total immunity */
if (p_ptr->immune_elec || (dam <= 0))
{
learn_spell(monspell);
- return;
+ return 0;
}
/* Vulnerability (Ouch!) */
if (p_ptr->muta3 & MUT3_VULN_ELEM) dam *= 2;
if (p_ptr->special_defense & KATA_KOUKIJIN) dam += dam / 3;
- if (p_ptr->prace == RACE_ANDROID) dam += dam / 3;
+ if (prace_is_(RACE_ANDROID)) dam += dam / 3;
/* Resist the damage */
if (p_ptr->resist_elec) dam = (dam + 2) / 3;
(void)do_dec_stat(A_DEX);
/* Take damage */
- take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
+ get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
/* Inventory damage */
if (!(double_resist && p_ptr->resist_elec))
inven_damage(set_elec_destroy, inv);
+
+ return get_damage;
}
/*
* Hurt the player with Fire
*/
-void fire_dam(int dam, cptr kb_str, int monspell)
+int fire_dam(int dam, cptr kb_str, int monspell)
{
+ int get_damage;
int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
- bool double_resist = (p_ptr->oppose_fire || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
+ bool double_resist = IS_OPPOSE_FIRE();
/* Totally immune */
if (p_ptr->immune_fire || (dam <= 0))
{
learn_spell(monspell);
- return;
+ return 0;
}
/* Vulnerability (Ouch!) */
(void)do_dec_stat(A_STR);
/* Take damage */
- take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
+ get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
/* Inventory damage */
if (!(double_resist && p_ptr->resist_fire))
inven_damage(set_fire_destroy, inv);
+
+ return get_damage;
}
/*
* Hurt the player with Cold
*/
-void cold_dam(int dam, cptr kb_str, int monspell)
+int cold_dam(int dam, cptr kb_str, int monspell)
{
+ int get_damage;
int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
- bool double_resist = (p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU));
+ bool double_resist = IS_OPPOSE_COLD();
/* Total immunity */
if (p_ptr->immune_cold || (dam <= 0))
{
learn_spell(monspell);
- return;
+ return 0;
}
/* Vulnerability (Ouch!) */
(void)do_dec_stat(A_STR);
/* Take damage */
- take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
+ get_damage=take_hit(DAMAGE_ATTACK, dam, kb_str, monspell);
/* Inventory damage */
if (!(double_resist && p_ptr->resist_cold))
inven_damage(set_cold_destroy, inv);
+
+ return get_damage;
}
/* Description */
object_desc(o_name, o_ptr, FALSE, 0);
- o_ptr->art_flags3 |= TR3_IGNORE_ACID;
+ add_flag(o_ptr->art_flags, TR_IGNORE_ACID);
if ((o_ptr->to_a < 0) && !cursed_p(o_ptr))
{
*/
bool curse_armor(void)
{
+ int i;
object_type *o_ptr;
char o_name[MAX_NLEN];
"¶²ÉݤΰŹõ¥ª¡¼¥é", "Ëɶñ", o_name);
#else
msg_format("A %s tries to %s, but your %s resists the effects!",
- "terrible black aura", "surround your armor", o_name);
+ "terrible black aura", "surround your armor", o_name);
#endif
}
o_ptr->ac = 0;
o_ptr->dd = 0;
o_ptr->ds = 0;
- o_ptr->art_flags1 = 0;
- o_ptr->art_flags2 = 0;
- o_ptr->art_flags3 = 0;
+
+ for (i = 0; i < TR_FLAG_SIZE; i++)
+ o_ptr->art_flags[i] = 0;
/* Curse it */
o_ptr->curse_flags = TRC_CURSED;
*/
bool curse_weapon(bool force, int slot)
{
+ int i;
+
object_type *o_ptr;
char o_name[MAX_NLEN];
"¶²ÉݤΰŹõ¥ª¡¼¥é", "Éð´ï", o_name);
#else
msg_format("A %s tries to %s, but your %s resists the effects!",
- "terrible black aura", "surround your weapon", o_name);
+ "terrible black aura", "surround your weapon", o_name);
#endif
}
o_ptr->ac = 0;
o_ptr->dd = 0;
o_ptr->ds = 0;
- o_ptr->art_flags1 = 0;
- o_ptr->art_flags2 = 0;
- o_ptr->art_flags3 = 0;
+
+ for (i = 0; i < TR_FLAG_SIZE; i++)
+ o_ptr->art_flags[i] = 0;
/* Curse it */
{
cave_type *c_ptr = &cave[y][x];
monster_type *m_ptr = &m_list[c_ptr->m_idx];
- bool friendly, pet;
bool polymorphed = FALSE;
int new_r_idx;
int old_r_idx = m_ptr->r_idx;
if (p_ptr->inside_arena || p_ptr->inside_battle) return (FALSE);
- if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG_KAGE)) return (FALSE);
+ if ((p_ptr->riding == c_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE);
/* Memorize the monster before polymorphing */
back_m = *m_ptr;
- /* Get the monsters attitude */
- friendly = is_friendly(m_ptr);
- pet = is_pet(m_ptr);
-
/* Pick a "new" monster race */
new_r_idx = poly_r_idx(old_r_idx);
/* Handle polymorph */
if (new_r_idx != old_r_idx)
{
+ u32b mode = 0L;
+
+ /* Get the monsters attitude */
+ if (is_friendly(m_ptr)) mode |= PM_FORCE_FRIENDLY;
+ if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
+ if (m_ptr->mflag2 & MFLAG2_NOPET) mode |= PM_NO_PET;
+
/* "Kill" the "old" monster */
delete_monster_idx(c_ptr->m_idx);
/* Create a new monster (no groups) */
- if (place_monster_aux(0, y, x, new_r_idx, FALSE, FALSE, friendly, pet, FALSE, (bool)(m_ptr->mflag2 & MFLAG_NOPET)))
+ if (place_monster_aux(0, y, x, new_r_idx, mode))
{
/* Success */
polymorphed = TRUE;
}
else
{
- monster_terrain_sensitive = FALSE;
-
/* Placing the new monster failed */
- place_monster_aux(0, y, x, old_r_idx, FALSE, FALSE, friendly, pet, TRUE, (bool)(m_ptr->mflag2 & MFLAG_NOPET));
- m_list[hack_m_idx_ii] = back_m;
-
- monster_terrain_sensitive = TRUE;
+ if (place_monster_aux(0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN)))
+ m_list[hack_m_idx_ii] = back_m;
}
if (targeted) target_who = hack_m_idx_ii;
#endif
/* Reduce rod stack maximum timeout, drain wands. */
- if (o_ptr->tval == TV_ROD) o_ptr->timeout -= k_ptr->pval;
- if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number;
+ if (o_ptr->tval == TV_ROD) o_ptr->timeout = MIN(o_ptr->timeout, k_ptr->pval * (o_ptr->number - 1));
+ else if (o_ptr->tval == TV_WAND) o_ptr->pval = o_ptr->pval * (o_ptr->number - 1) / o_ptr->number;
}
else
p_ptr->csp = p_ptr->msp;
}
+ /* Redraw mana and hp */
+ p_ptr->redraw |= (PR_MANA);
+
p_ptr->notice |= (PN_COMBINE | PN_REORDER);
p_ptr->window |= (PW_INVEN);
}
-bool summon_kin_player(bool pet, int level, int y, int x, bool group)
+bool summon_kin_player(int level, int y, int x, u32b mode)
{
+ bool pet = (bool)(mode & PM_FORCE_PET);
+ if (!pet) mode |= PM_NO_PET;
+
switch (p_ptr->mimic_form)
{
case MIMIC_NONE:
summon_kin_type = 'V';
break;
}
- return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, group, FALSE, pet, FALSE, (bool)(!pet));
+ return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);
}