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) &&
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) &&
*/
void teleport_player_level(void)
{
+ bool go_up;
+
/* 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))
return;
}
+ /* Choose up or down */
+ if (randint0(100) < 50) go_up = TRUE;
+ else go_up = FALSE;
+
+ if (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 || (dun_level <= d_info[dungeon_type].mindepth))
{
#ifdef JP
if (!dun_level)
{
dun_level = d_info[dungeon_type].mindepth;
+ prepare_change_floor_mode(CFM_RAND_PLACE | CFM_CLEAR_ALL);
}
else
{
- dun_level++;
+ prepare_change_floor_mode(CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
}
/* Leaving */
p_ptr->leaving = TRUE;
}
+
+ /* Up only */
else if (quest_number(dun_level) || (dun_level >= d_info[dungeon_type].maxdepth))
{
#ifdef JP
if (autosave_l) do_cmd_save_game(TRUE);
- dun_level--;
-
- if (!dun_level) dungeon_type = 0;
+ prepare_change_floor_mode(CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
leave_quest_check();
p_ptr->inside_quest = 0;
p_ptr->leaving = TRUE;
}
- else if (randint0(100) < 50)
+ else if (go_up)
{
#ifdef JP
msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
if (autosave_l) do_cmd_save_game(TRUE);
- dun_level--;
-
- if (!dun_level) dungeon_type = 0;
+ prepare_change_floor_mode(CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
/* Leaving */
p_ptr->leaving = TRUE;
msg_print("You sink through the floor.");
#endif
- if (!dun_level) dungeon_type = p_ptr->recall_dungeon;
+ /* 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 (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;
}
- if (!dun_level && dungeon_type)
- {
- 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;
- }
-
- if (!dun_level) dungeon_type = 0;
-
/* Sound */
sound(SOUND_TPLEVEL);
}
#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;
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 = FEAT_GLYPH;
+
+ /* 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 = FEAT_MIRROR;
+
+ /* 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 = FEAT_MINOR_GLYPH;
+
+ /* 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"
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)
* This routine does *not* automatically combine objects.
* Returns TRUE if something was identified, else FALSE.
*/
-bool ident_spell(bool only_equip, bool wait_optimize)
+bool ident_spell(bool only_equip)
{
int item;
object_type *o_ptr;
/* Auto-inscription/destroy */
idx = is_autopick(o_ptr);
auto_inscribe_item(item, idx);
- if (!old_known) auto_destroy_item(item, idx, wait_optimize);
+ if (destroy_identify && !old_known)
+ auto_destroy_item(item, idx);
/* Something happened */
return (TRUE);
* Fully "identify" an object in the inventory -BEN-
* This routine returns TRUE if an item was identified.
*/
-bool identify_fully(bool only_equip, bool wait_optimize)
+bool identify_fully(bool only_equip)
{
int item;
object_type *o_ptr;
}
/* 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, wait_optimize);
+ 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))
{
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)
/*
* Returns experience of a spell
*/
-s16b experience_of_spell(int spell, int realm)
+s16b experience_of_spell(int spell, int use_realm)
{
if (p_ptr->pclass == CLASS_SORCERER) return 1600;
else if (p_ptr->pclass == CLASS_RED_MAGE) return 1200;
- else if (realm+1 == p_ptr->realm1) return p_ptr->spell_exp[spell];
- else if (realm+1 == p_ptr->realm2) return p_ptr->spell_exp[spell + 32];
+ 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;
}
/*
* 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;
/* 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 += (MAX(r_info[m_list[p_ptr->riding].r_idx].level-p_ptr->skill_exp[GINOU_RIDING]/100-10,0));
/* Extract mana consumption rate */
- shouhimana = s_ptr->smana*(3800 - experience_of_spell(spell, realm)) + 2399;
+ shouhimana = s_ptr->smana*(3800 - experience_of_spell(spell, use_realm)) + 2399;
if(p_ptr->dec_mana) shouhimana *= 3;
else shouhimana *= 4;
}
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_CRUSADE)) && (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))
{
- s16b exp = experience_of_spell(spell, realm);
+ s16b exp = experience_of_spell(spell, use_realm);
if(exp > 1399) chance--;
if(exp > 1599) chance--;
}
* 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) ?
+ if ((use_realm == p_ptr->realm2) ?
(p_ptr->spell_forgotten2 & (1L << spell)) :
(p_ptr->spell_forgotten1 & (1L << spell)))
{
if (p_ptr->pclass == CLASS_RED_MAGE) return (TRUE);
/* Spell is learned */
- if ((realm == p_ptr->realm2 - 1) ?
+ if ((use_realm == p_ptr->realm2) ?
(p_ptr->spell_learned2 & (1L << spell)) :
(p_ptr->spell_learned1 & (1L << spell)))
{
* 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 0: sprintf(p, " %s2d10", s_heal); 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;
}
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;
}
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: /* Crusade */
+ case REALM_CRUSADE: /* Crusade */
switch (spell)
{
case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5)); 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;
magic_type *s_ptr;
bool max = FALSE;
- if (((realm < 0) || (realm > MAX_REALM - 1)) && p_ptr->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)
+ if (use_realm == REALM_HISSATSU)
shouhimana = s_ptr->smana;
else
{
- s16b exp = experience_of_spell(spell, realm);
+ s16b exp = experience_of_spell(spell, use_realm);
/* Extract mana consumption rate */
shouhimana = s_ptr->smana*(3800 - exp) + 2399;
/* 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) ?
+ else if ((use_realm == p_ptr->realm1) ?
((p_ptr->spell_forgotten1 & (1L << spell))) :
((p_ptr->spell_forgotten2 & (1L << spell))))
{
line_attr = TERM_YELLOW;
}
- else if (!((realm + 1 == p_ptr->realm1) ?
+ else if (!((use_realm == p_ptr->realm1) ?
(p_ptr->spell_learned1 & (1L << spell)) :
(p_ptr->spell_learned2 & (1L << spell))))
{
line_attr = TERM_L_BLUE;
}
- else if (!((realm + 1 == p_ptr->realm1) ?
+ else if (!((use_realm == p_ptr->realm1) ?
(p_ptr->spell_worked1 & (1L << spell)) :
(p_ptr->spell_worked2 & (1L << spell))))
{
}
/* 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 */
+ spell_names[technic2magic(use_realm)-1][spell], /* realm, spell */
s_ptr->slevel, shouhimana));
}
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, shouhimana, spell_chance(spell, use_realm), comment));
}
c_prt(line_attr, out_val, y + i + 1, x);
}
*/
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));
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));
if (p_ptr->immune_elec || (dam <= 0))
{
learn_spell(monspell);
- return;
+ return 0;
}
/* Vulnerability (Ouch!) */
(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));
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));
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 */
else
{
/* Placing the new monster failed */
- 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 (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