/* Purpose: Mindcrafter code */
/*
- * 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.
*/
#include "angband.h"
-#define TECHNIC_HISSATSU (REALM_HISSATSU - MIN_TECHNIC - 1)
+#define TECHNIC_HISSATSU (REALM_HISSATSU - MIN_TECHNIC)
/*
* Allow user to choose a mindcrafter power.
}
/* Build a prompt (accept all spells) */
+ (void) strnfmt(out_val, 78,
#ifdef JP
-(void) strnfmt(out_val, 78, "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò»È¤¤¤Þ¤¹¤«¡©",
+ "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò»È¤¤¤Þ¤¹¤«¡©",
#else
- (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
+ "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
#endif
- p, I2A(0), "abcdefghijklmnopqrstuvwxyz012345"[num-1], p);
+ p, I2A(0), "abcdefghijklmnopqrstuvwxyz012345"[num-1], p);
if (use_menu) screen_save();
/* Get a spell from the user */
- choice= always_show_list ? ESCAPE:1 ;
- while (!flag)
- {
+ choice= always_show_list ? ESCAPE:1 ;
+ while (!flag)
+ {
if(choice==ESCAPE) choice = ' ';
else if( !get_com(out_val, &choice, FALSE) )break;
{
screen_load();
return (FALSE);
- break;
}
case '8':
{
menu_line += 31;
if (menu_line > 32) menu_line -= 32;
- } while(!(spell_learned1 & (1L << (menu_line-1))));
+ } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
break;
}
{
menu_line++;
if (menu_line > 32) menu_line -= 32;
- } while(!(spell_learned1 & (1L << (menu_line-1))));
+ } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
break;
}
reverse = TRUE;
}
else menu_line+=16;
- while(!(spell_learned1 & (1L << (menu_line-1))))
+ while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))))
{
if (reverse)
{
if (spell.slevel > PY_MAX_LEVEL) continue;
line++;
- if (!(spell_learned1 >> i)) break;
+ if (!(p_ptr->spell_learned1 >> i)) break;
/* Access the spell */
if (spell.slevel > plev) continue;
- if (!(spell_learned1 & (1L << i))) continue;
+ if (!(p_ptr->spell_learned1 & (1L << i))) continue;
if (use_menu)
{
if (i == (menu_line-1))
/* Dump the spell --(-- */
strcat(psi_desc, format(" %-18s%2d %3d",
- spell_names[technic2magic(REALM_HISSATSU)-1][i],
- spell.slevel, spell.smana));
+ spell_names[technic2magic(REALM_HISSATSU)-1][i],
+ spell.slevel, spell.smana));
prt(psi_desc, y + (line%17) + (line >= 17), x+(line/17)*30);
prt("", y + (line%17) + (line >= 17) + 1, x+(line/17)*30);
}
}
/* Totally Illegal */
- if ((i < 0) || (i >= 32) || !(spell_learned1 & (1 << sentaku[i])))
+ if ((i < 0) || (i >= 32) || !(p_ptr->spell_learned1 & (1 << sentaku[i])))
{
bell();
continue;
/* Prompt */
#ifdef JP
-(void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡©", spell_names[technic2magic(REALM_HISSATSU)-1][j]);
+ (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡©", spell_names[technic2magic(REALM_HISSATSU)-1][j]);
#else
(void)strnfmt(tmp_val, 78, "Use %s? ", spell_names[technic2magic(REALM_HISSATSU)-1][j]);
#endif
if (redraw) screen_load();
/* Show choices */
- if (show_choices)
- {
- /* Update */
- p_ptr->window |= (PW_SPELL);
+ p_ptr->window |= (PW_SPELL);
+
+ /* Window stuff */
+ window_stuff();
- /* Window stuff */
- window_stuff();
- }
/* Abort if needed */
if (!flag) return (FALSE);
case 0:
project_length = 2;
if (!get_aim_dir(&dir)) return FALSE;
- project_hook(GF_ATTACK, dir, HISSATSU_2, PROJECT_STOP | PROJECT_KILL | PROJECT_NO_REF);
+ project_hook(GF_ATTACK, dir, HISSATSU_2, PROJECT_STOP | PROJECT_KILL);
break;
case 1:
py_attack(y, x, 0);
- if (!player_can_enter(cave[y][x].feat) || is_trap(cave[y][x].feat))
+ if (!player_can_enter(cave[y][x].feat, 0) || is_trap(cave[y][x].feat))
break;
y += ddy[dir];
x += ddx[dir];
- if (player_can_enter(cave[y][x].feat) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
+ if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
{
int oy, ox;
verify_panel();
/* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
/* Update the monsters */
p_ptr->update |= (PU_DISTANCE);
update_mon(m_idx, TRUE);
lite_spot(oy, ox);
lite_spot(ty, tx);
+
+ if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+ p_ptr->update |= (PU_MON_LITE);
}
}
break;
if (cave[y][x].m_idx)
py_attack(y, x, HISSATSU_HAGAN);
- /* Non-walls (etc) */
- if (cave_floor_bold(y, x)) break;
-
- /* Permanent walls */
- if (cave[y][x].feat >= FEAT_PERM_EXTRA) break;
-
- if (cave[y][x].feat < FEAT_DOOR_HEAD) break;
-
- /* Forget the wall */
- cave[y][x].info &= ~(CAVE_MARK);
+ if (!have_flag(f_flags_bold(y, x), FF_HURT_ROCK)) break;
/* Destroy the feature */
- cave[y][x].feat = floor_type[randint0(100)];
- cave[y][x].info &= ~(CAVE_MASK);
- cave[y][x].info |= CAVE_FLOOR;
+ cave_alter_feat(y, x, FF_HURT_ROCK);
/* Update some things */
p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
- lite_spot(y, x);
-
break;
}
case 13:
break;
}
case 18:
- project_length = 5;
- if (!get_aim_dir(&dir)) return FALSE;
- project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL | PROJECT_NO_REF);
-
- break;
+ return rush_attack(NULL);
case 19: /* Whirlwind Attack */
{
int y = 0, x = 0;
/* Hack -- attack monsters */
if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
{
- if (r_info[m_list[c_ptr->m_idx].r_idx].flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING))
+ if (!monster_living(&r_info[m_ptr->r_idx]))
{
char m_name[80];
- monster_desc(m_name, &m_list[c_ptr->m_idx], 0);
+ monster_desc(m_name, m_ptr, 0);
#ifdef JP
msg_format("%s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤¤¡ª", m_name);
#else
case 21:
{
int total_damage = 0, basedam, i;
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
object_type *o_ptr;
if (!get_aim_dir(&dir)) return FALSE;
#ifdef JP
o_ptr = &inventory[INVEN_RARM+i];
basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
damage = o_ptr->to_d * 100;
- object_flags(o_ptr, &f1, &f2, &f3);
- if (o_ptr->name1 == ART_VORPAL_BLADE)
+ object_flags(o_ptr, flgs);
+ if ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
{
/* vorpal blade */
basedam *= 5;
basedam /= 3;
}
- else if (object_known_p(o_ptr) && (f1 & TR1_VORPAL))
+ else if (have_flag(flgs, TR_VORPAL))
{
/* vorpal flag only */
basedam *= 11;
int i;
if (!get_rep_dir2(&dir)) return FALSE;
if (dir == 5) return FALSE;
- y = py + ddy[dir];
- x = px + ddx[dir];
for (i = 0; i < 3; i++)
{
+ int oy, ox;
+ int ny, nx;
+ int m_idx;
+ monster_type *m_ptr;
+
+ y = py + ddy[dir];
+ x = px + ddx[dir];
+
if (cave[y][x].m_idx)
py_attack(y, x, HISSATSU_3DAN);
else
#endif
return FALSE;
}
+
if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
{
return TRUE;
}
- if (cave[y][x].m_idx)
- {
- int oy, ox;
- int ny = y + ddy[dir];
- int nx = x + ddx[dir];
- int m_idx = cave[y][x].m_idx;
- monster_type *m_ptr = &m_list[m_idx];
- if (cave_empty_bold(ny, nx))
- {
- cave[y][x].m_idx = 0;
- cave[ny][nx].m_idx = m_idx;
- m_ptr->fy = ny;
- m_ptr->fx = nx;
- update_mon(m_idx, TRUE);
+ /* Monster is dead? */
+ if (!cave[y][x].m_idx) break;
- /* Save the old location */
- oy = py;
- ox = px;
+ ny = y + ddy[dir];
+ nx = x + ddx[dir];
+ m_idx = cave[y][x].m_idx;
+ m_ptr = &m_list[m_idx];
- /* Move the player */
- py = y;
- px = x;
+ /* Monster cannot move back? */
+ if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0)) continue;
- if (p_ptr->riding)
- {
- int tmp;
- tmp = cave[py][px].m_idx;
- cave[py][px].m_idx = cave[oy][ox].m_idx;
- cave[oy][ox].m_idx = tmp;
- m_list[p_ptr->riding].fy = py;
- m_list[p_ptr->riding].fx = px;
- update_mon(cave[py][px].m_idx, TRUE);
- }
+ cave[y][x].m_idx = 0;
+ cave[ny][nx].m_idx = m_idx;
+ m_ptr->fy = ny;
+ m_ptr->fx = nx;
- forget_flow();
+ update_mon(m_idx, TRUE);
- /* Redraw the old spot */
- lite_spot(oy, ox);
+ /* Player can move forward? */
+ if (player_can_enter(cave[y][x].feat, 0))
+ {
+ /* Save the old location */
+ oy = py;
+ ox = px;
- /* Redraw the new spot */
- lite_spot(py, px);
+ /* Move the player */
+ py = y;
+ px = x;
- /* Redraw the new spot */
- lite_spot(ny, nx);
+ if (p_ptr->riding)
+ {
+ cave[oy][ox].m_idx = cave[py][px].m_idx;
+ cave[py][px].m_idx = p_ptr->riding;
+ m_list[p_ptr->riding].fy = py;
+ m_list[p_ptr->riding].fx = px;
+ update_mon(p_ptr->riding, TRUE);
+ }
- /* Check for new panel (redraw map) */
- verify_panel();
+ forget_flow();
- /* Update stuff */
- p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
+ /* Redraw the old spot */
+ lite_spot(oy, ox);
- /* Update the monsters */
- p_ptr->update |= (PU_DISTANCE);
+ /* Redraw the new spot */
+ lite_spot(py, px);
+ }
- /* Window stuff */
- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+ /* Redraw the old spot */
+ lite_spot(y, x);
- /* Handle stuff XXX XXX XXX */
- handle_stuff();
+ /* Redraw the new spot */
+ lite_spot(ny, nx);
- if (i < 2) msg_print(NULL);
- y += ddy[dir];
- x += ddx[dir];
- }
- }
- else break;
+ /* Check for new panel (redraw map) */
+ verify_panel();
+
+ /* Update stuff */
+ p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE);
+
+ /* Update the monsters */
+ p_ptr->update |= (PU_DISTANCE);
+
+ /* Window stuff */
+ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
+
+ /* Handle stuff */
+ handle_stuff();
+
+ /* -more- */
+ if (i < 2) msg_print(NULL);
}
break;
}
}
case 26:
{
+#define NEED_MANA_PER_MONSTER 8
bool new = TRUE;
- int count = 0;
+ bool mdeath;
+ /* int count = 0; currently unused */
do
{
- project_length = 5;
- if (!get_aim_dir(&dir)) break;
+ if (!rush_attack(&mdeath)) break;
if (new)
+ {
+ /* Reserve needed mana point */
p_ptr->csp -= technic_info[TECHNIC_HISSATSU][26].smana;
+ new = FALSE;
+ }
else
- p_ptr->csp -= 8;
- new = FALSE;
- if (!project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL | PROJECT_NO_REF)) break;
- count++;
+ p_ptr->csp -= NEED_MANA_PER_MONSTER;
+ if (!mdeath) break;
+ /* count++; currently unused */
command_dir = 0;
p_ptr->redraw |= PR_MANA;
handle_stuff();
- } while (p_ptr->csp > 8);
+ }
+ while (p_ptr->csp > NEED_MANA_PER_MONSTER);
if (new) return FALSE;
+
+ /* Restore reserved mana */
+ p_ptr->csp += technic_info[TECHNIC_HISSATSU][26].smana;
break;
+
+#undef NEED_MANA_PER_MONSTER
}
case 27:
{
if (!tgt_pt(&x, &y)) return FALSE;
- if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
- (distance(y, x, py, px) > MAX_SIGHT / 2) ||
+ if (!cave_teleportable_bold(y, x, TELEPORT_ALLOW_DEEP | TELEPORT_ALLOW_OBJECT | TELEPORT_REQUIRE_PROJECT) ||
+ (cave[y][x].info & CAVE_ICKY) ||
+ (distance(y, x, py, px) > MAX_SIGHT / 2) ||
!projectable(py, px, y, x))
{
#ifdef JP
if (p_ptr->anti_tele)
{
#ifdef JP
-msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
+ msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
#else
msg_print("A mysterious force prevents you from teleporting!");
#endif
break;
}
- project(0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL | PROJECT_NO_REF, -1);
+ project(0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL, -1);
teleport_player_to(y, x, TRUE);
break;
}
{
int total_damage = 0, basedam, i;
int y, x;
- u32b f1, f2, f3;
+ u32b flgs[TR_FLAG_SIZE];
object_type *o_ptr;
if (!get_rep_dir2(&dir)) return FALSE;
o_ptr = &inventory[INVEN_RARM+i];
basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
damage = o_ptr->to_d * 100;
- object_flags(o_ptr, &f1, &f2, &f3);
- if (o_ptr->name1 == ART_VORPAL_BLADE)
+ object_flags(o_ptr, flgs);
+ if ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD))
{
/* vorpal blade */
- basedam *= 786;
- basedam /= 500;
+ basedam *= 5;
+ basedam /= 3;
}
- else if (object_known_p(o_ptr) && (f1 & TR1_VORPAL))
+ else if (have_flag(flgs, TR_VORPAL))
{
/* vorpal flag only */
- basedam *= 609;
- basedam /= 500;
+ basedam *= 11;
+ basedam /= 9;
}
damage += basedam;
damage += p_ptr->to_d[i] * 100;
#ifdef JP
take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "·Ä±Àµ´Ç¦·õ¤ò»È¤Ã¤¿¾×·â", -1);
#else
- take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "reaction of your attack", -1); /*nanka*/
+ take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "exhaustion on using Keiun-Kininken", -1);
#endif
break;
}
i = inkey();
prt("", 0, 0);
if (i != '@') return FALSE;
- if (total_winner)
+ if (p_ptr->total_winner)
{
take_hit(DAMAGE_FORCE, 9999, "Seppuku", -1);
- total_winner = TRUE;
+ p_ptr->total_winner = TRUE;
}
else
{
return;
}
- if (!spell_learned1)
+ if (!p_ptr->spell_learned1)
{
#ifdef JP
msg_print("²¿¤âµ»¤òÃΤé¤Ê¤¤¡£");
#else
- msg_print("You don't know any martial arts.");
+ msg_print("You don't know any special attacks.");
#endif
return;
for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
{
- if (spell_learned1 & (1L << i)) continue;
+ if (p_ptr->spell_learned1 & (1L << i)) continue;
if (technic_info[TECHNIC_HISSATSU][i].slevel > p_ptr->lev) continue;
- spell_learned1 |= (1L << i);
- spell_worked1 |= (1L << i);
+ p_ptr->spell_learned1 |= (1L << i);
+ p_ptr->spell_worked1 |= (1L << i);
#ifdef JP
msg_format("%s¤Îµ»¤ò³Ð¤¨¤¿¡£", spell_names[technic2magic(REALM_HISSATSU)-1][i]);
#else
for (j = 0; j < 64; j++)
{
/* Stop at the first empty space */
- if (spell_order[j] == 99) break;
+ if (p_ptr->spell_order[j] == 99) break;
}
- spell_order[j] = i;
+ p_ptr->spell_order[j] = i;
gain = TRUE;
}
+
+ /* No gain ... */
if (!gain)
#ifdef JP
msg_print("²¿¤â³Ð¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
msg_print("You were not able to learn any special attacks.");
#endif
+ /* Take a turn */
+ else
+ energy_use = 100;
+
p_ptr->update |= (PU_SPELLS);
}