/* File: mind.c */
-/* 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.
*/
+/* Purpose: Mindcrafter code */
+
#include "angband.h"
#include "mindtips.h"
#ifdef ALLOW_REPEAT /* TNB */
- /* Get the spell, if available */
- if (repeat_pull(sn))
+ /* Get the spell, if available */
+ if (repeat_pull(sn))
{
- /* Verify the spell */
- if (mind_ptr->info[*sn].min_lev <= plev)
- {
- /* Success */
- return (TRUE);
- }
+ /* Hack -- If requested INVEN_FORCE(1111), pull again */
+ if (*sn == INVEN_FORCE) repeat_pull(sn);
+
+ /* Verify the spell */
+ if (mind_ptr->info[*sn].min_lev <= plev)
+ {
+ /* Success */
+ return (TRUE);
+ }
}
#endif /* ALLOW_REPEAT -- TNB */
#else
(void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
#endif
- p, I2A(0), I2A(num - 1), p);
+ 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 ;
- while (!flag)
- {
+ choice= (always_show_list || use_menu) ? ESCAPE:1 ;
+ while (!flag)
+ {
if(choice==ESCAPE) choice = ' ';
else if( !get_com(out_val, &choice, TRUE) )break;
{
if (!only_browse) screen_load();
return (FALSE);
- break;
}
case '8':
if (redraw && !only_browse) 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);
{
chg_virtue(V_KNOWLEDGE, 1);
chg_virtue(V_ENLIGHTEN, 1);
- wiz_lite(FALSE, FALSE);
+ wiz_lite(FALSE);
}
else if (plev > 19)
map_area(DETECT_RAD_MAP);
b = detect_monsters_normal(DETECT_RAD_DEFAULT);
if (plev > 14) b |= detect_monsters_invis(DETECT_RAD_DEFAULT);
if (plev > 4) {
- b |= detect_traps(DETECT_RAD_DEFAULT);
+ b |= detect_traps(DETECT_RAD_DEFAULT, TRUE);
b |= detect_doors(DETECT_RAD_DEFAULT);
}
}
return psychometry();
else
return ident_spell(FALSE);
- break;
case 8:
/* Mindwave */
#ifdef JP
* Only heal when Adrenalin Channeling is not active. We check
* that by checking if the player isn't fast and 'heroed' atm.
*/
- if (!p_ptr->fast || !p_ptr->hero)
+ if (!IS_FAST() || !IS_HERO())
{
hp_player(plev);
}
int oy = y, ox = x;
int m_idx = cave[y][x].m_idx;
monster_type *m_ptr = &m_list[m_idx];
+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
char m_name[80];
monster_desc(m_name, m_ptr, 0);
- if (randint1(r_info[m_ptr->r_idx].level * 3 / 2) > randint0(dam / 2) + dam/2)
+ if (randint1(r_ptr->level * 3 / 2) > randint0(dam / 2) + dam/2)
{
#ifdef JP
msg_format("%s¤ÏÈô¤Ð¤µ¤ì¤Ê¤«¤Ã¤¿¡£", m_name);
update_mon(m_idx, TRUE);
lite_spot(oy, ox);
lite_spot(ty, tx);
+
+ if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+ p_ptr->update |= (PU_MON_LITE);
}
}
}
#else
msg_format("%^s is no longer invulnerable.", m_name);
#endif
+ m_ptr->energy_need += ENERGY_NEED();
}
if (m_ptr->fast)
{
bool success = FALSE;
for (i = 0; i < 1 + boost/100; i++)
- if (summon_specific(-1, py, px, plev, SUMMON_PHANTOM, FALSE, TRUE, TRUE, FALSE, FALSE))
+ if (summon_specific(-1, py, px, plev, SUMMON_PHANTOM, PM_FORCE_PET))
success = TRUE;
if (success)
{
int val=0;
for( x=0 ; x < cur_wid ; x++ ){
for( y=0 ; y < cur_hgt ; y++ ){
- if( cave[y][x].feat == FEAT_MIRROR )val++;
+ if (is_mirror_grid(&cave[y][x])) val++;
}
}
return val;
{
/* mirror of seeing */
case 0:
- tmp = cave[py][px].feat == FEAT_MIRROR ? 4 : 0;
+ tmp = is_mirror_grid(&cave[py][px]) ? 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(plev,FALSE);
break;
case 2:
if (!get_aim_dir(&dir)) return FALSE;
- if ( plev > 9 && cave[py][px].feat == FEAT_MIRROR ){
+ if ( plev > 9 && is_mirror_grid(&cave[py][px]) ) {
fire_beam(GF_LITE, dir,damroll(3+((plev-1)/5),4));
}
else {
case 9:
for(x=0;x<cur_wid;x++){
for(y=0;y<cur_hgt;y++){
- if(cave[y][x].feat == FEAT_MIRROR){
- project(0,2,y,x,plev,GF_OLD_SLEEP,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_REF|PROJECT_NO_HANGEKI),-1);
+ if (is_mirror_grid(&cave[y][x])) {
+ project(0,2,y,x,plev,GF_OLD_SLEEP,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_HANGEKI),-1);
}
}
}
break;
/* illusion light */
case 14:
- tmp = cave[py][px].feat == FEAT_MIRROR ? 4 : 3;
+ tmp = is_mirror_grid(&cave[py][px]) ? 4 : 3;
slow_monsters();
stun_monsters(plev*tmp);
confuse_monsters(plev*tmp);
break;
/* mirror shift */
case 15:
- if( cave[py][px].feat != FEAT_MIRROR ){
+ if( !is_mirror_grid(&cave[py][px]) ){
#ifdef JP
msg_print("¶À¤Î¹ñ¤Î¾ì½ê¤¬¤ï¤«¤é¤Ê¤¤¡ª");
#else
#else
msg_print("Go through the world of mirror...");
#endif
- return dimension_door();
+ return mirror_tunnel();
+
/* mirror of recall */
case 17:
- if(!word_of_recall())return FALSE;
- break;
+ return word_of_recall();
/* multi-shadow */
case 18:
set_multishadow(6+randint1(6),FALSE);
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);
case 1:
if (plev > 44)
{
- wiz_lite(FALSE, TRUE);
+ wiz_lite(TRUE);
}
detect_monsters_normal(DETECT_RAD_DEFAULT);
if (plev > 4)
{
- detect_traps(DETECT_RAD_DEFAULT);
+ detect_traps(DETECT_RAD_DEFAULT, TRUE);
detect_doors(DETECT_RAD_DEFAULT);
detect_stairs(DETECT_RAD_DEFAULT);
}
}
case 7:
return ident_spell(FALSE);
- break;
case 8:
set_tim_ffall(randint1(20) + 20, FALSE);
break;
set_oppose_fire(plev, FALSE);
break;
case 10:
- 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 11:
{
int i;
{
int ny = GRID_Y(path_g[i]);
int nx = GRID_X(path_g[i]);
-
+ cave_type *c_ptr = &cave[ny][nx];
+
if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
- cave[ny][nx].feat != FEAT_GLYPH &&
- cave[ny][nx].feat != FEAT_MINOR_GLYPH &&
- !(cave[ny][nx].feat >= FEAT_PATTERN_START &&
- cave[ny][nx].feat <= FEAT_PATTERN_XTRA2))
+ !(c_ptr->info & CAVE_OBJECT) &&
+ !pattern_tile(ny, nx))
{
ty = ny;
tx = nx;
/* Update the old location */
cave[target_row][target_col].m_idx = 0;
- /* Update the new location */
+ /* Update the new location */
cave[ty][tx].m_idx = m_idx;
/* Move the monster */
/* Redraw the new grid */
lite_spot(ty, tx);
- p_ptr->update |= (PU_MON_LITE);
+ if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+ p_ptr->update |= (PU_MON_LITE);
break;
}
int typ = one_in_(2) ? GF_FIRE : one_in_(3) ? GF_NETHER : GF_PLASMA;
int attempts = 1000;
- while(attempts--)
+ while (attempts--)
{
scatter(&y, &x, py, px, 4, 0);
- if ((y != py) || (x != px)) break;
+ if (!player_bold(y, x)) break;
}
project(0, 0, y, x, damroll(6 + plev / 8, 10), typ,
(PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
break;
case MIND_MIRROR_MASTER:
/* Cast the spell */
- if( cave[py][px].feat == FEAT_MIRROR )on_mirror = TRUE;
+ if( is_mirror_grid(&cave[py][px]) )on_mirror = TRUE;
cast = cast_mirror_spell(n);
break;
case MIND_NINJUTSU:
/* teleport from mirror costs small energy */
if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER )
{
- if( n==2 || n==4 || n==6 || n==15 )energy_use = 50;
+ if( n==3 || n==5 || n==7 || n==16 )energy_use = 50;
}
if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU))
Term_erase(12, 17, 255);
Term_erase(12, 16, 255);
- roff_to_buf( mind_tips[use_mind][n],62,temp);
+ roff_to_buf(mind_tips[use_mind][n], 62, temp, sizeof(temp));
for(j=0, line = 17;temp[j];j+=(1+strlen(&temp[j])))
{
prt(&temp[j], line, 15);
(void)inkey();
}
}
-
- screen_load();
}