/* File: cmd2.c */
-/* Purpose: Movement commands (part 2) */
-
/*
- * 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: Movement commands (part 2) */
+
#include "angband.h"
{
/* Success */
#ifdef JP
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
- msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
- else
- msg_print("¾å¤Î³¬¤ËÅФä¿¡£");
+ if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
+ msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
+ else
+ msg_print("¾å¤Î³¬¤ËÅФä¿¡£");
#else
msg_print("You enter the up staircase.");
#endif
-
leave_quest_check();
p_ptr->inside_quest = c_ptr->special;
p_ptr->oldpx = 0;
p_ptr->oldpy = 0;
+
+ /* End the command */
+ return;
}
- /* Normal up stairs */
- else if ((c_ptr->feat == FEAT_LESS) || (c_ptr->feat == FEAT_LESS_LESS))
+
+ /* Normal up stairs? */
+ if (c_ptr->feat != FEAT_LESS && c_ptr->feat != FEAT_LESS_LESS)
{
- if (!dun_level)
- {
- go_up = TRUE;
- }
- else
- {
- if (confirm_stairs)
- {
#ifdef JP
-if (get_check("ËÜÅö¤Ë¤³¤Î³¬¤òµî¤ê¤Þ¤¹¤«¡©"))
+ msg_print("¤³¤³¤Ë¤Ï¾å¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
#else
- if (get_check("Really leave the level? "))
+ msg_print("I see no up staircase here.");
#endif
- go_up = TRUE;
- }
- else
- {
- go_up = TRUE;
- }
- }
+ return;
+ }
+
+ if (!dun_level)
+ {
+ go_up = TRUE;
+ }
+ else
+ {
+ quest_type *q_ptr = &quest[p_ptr->inside_quest];
- if (go_up)
+ /* Confirm leaving from once only quest */
+ if (confirm_quest && p_ptr->inside_quest &&
+ (q_ptr->type == QUEST_TYPE_RANDOM ||
+ (q_ptr->flags & QUEST_FLAG_ONCE &&
+ q_ptr->status != QUEST_STATUS_COMPLETED)))
{
+#ifdef JP
+ msg_print("¤³¤Î³¬¤ò°ìÅÙµî¤ë¤ÈÆóÅÙ¤ÈÌá¤Ã¤ÆÍè¤é¤ì¤Þ¤»¤ó¡£");
+ if (get_check("ËÜÅö¤Ë¤³¤Î³¬¤òµî¤ê¤Þ¤¹¤«¡©")) go_up = TRUE;
+#else
+ msg_print("You can't come back here once you leave this floor.");
+ if (get_check("Really leave this floor? ")) go_up = TRUE;
+#endif
+ }
+ else
+ {
+ go_up = TRUE;
+ }
+ }
- /* Hack -- take a turn */
- energy_use = 100;
+ /* Cancel the command */
+ if (!go_up) return;
- if (autosave_l) do_cmd_save_game(TRUE);
+ /* Hack -- take a turn */
+ energy_use = 100;
- if (p_ptr->inside_quest)
- {
- if (quest[p_ptr->inside_quest].type != QUEST_TYPE_RANDOM) dun_level = 1;
+ if (autosave_l) do_cmd_save_game(TRUE);
- leave_quest_check();
+ if (p_ptr->inside_quest)
+ {
+ leave_quest_check();
- p_ptr->inside_quest = c_ptr->special;
- }
+ if (quest[leaving_quest].type != QUEST_TYPE_RANDOM)
+ {
+ p_ptr->inside_quest = c_ptr->special;
+ dun_level = 0;
+ }
+ else
+ {
+ p_ptr->inside_quest = 0;
+ }
- /* New depth */
- if (c_ptr->feat == FEAT_LESS_LESS)
- {
- /* Create a way back */
- create_down_stair = 2;
+ up_num = 0;
+ }
+ else
+ {
+ /* New depth */
+ if (c_ptr->feat == FEAT_LESS_LESS)
+ {
+ /* Create a way back */
+ prepare_change_floor_mode(CFM_UP | CFM_SHAFT);
- up_num += 2;
- }
- else
- {
- /* Create a way back */
- create_down_stair = 1;
+ up_num = 2;
+ }
+ else
+ {
+ /* Create a way back */
+ prepare_change_floor_mode(CFM_UP);
- up_num += 1;
- }
- if (!c_ptr->special && dungeon_type && ((dun_level - up_num + 1) > d_info[dungeon_type].mindepth) && one_in_(13))
- {
- up_num++;
-#ifdef JP
- if (c_ptr->feat == FEAT_LESS_LESS) msg_print("Ť¤¹£Æ»¤ò¾å¤Ã¤¿¡£");
- else msg_print("Ť¤³¬Ãʤò¾å¤Ã¤¿¡£");
-#else
- msg_print("These were very long stairs.");
-#endif
- msg_print(NULL);
- }
- if (dun_level-up_num+1 == d_info[dungeon_type].mindepth) up_num = dun_level;
-#ifdef JP
- if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "³¬Ãʤò¾å¤Ã¤¿");
-#else
- if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "go up the stairs to");
-#endif
- dun_level -= up_num;
+ up_num = 1;
+ }
+
+ /* Get out from current dungeon */
+ if (dun_level - up_num < d_info[dungeon_type].mindepth)
+ up_num = dun_level;
+ }
- /* Success */
#ifdef JP
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
- msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
- else if (0 == dun_level)
- msg_print("ÃϾå¤ËÌá¤Ã¤¿¡£");
- else
- msg_print("³¬Ãʤò¾å¤Ã¤Æ¿·¤¿¤Ê¤ë̵ܤؤȤòƧ¤ßÆþ¤ì¤¿¡£");
+ if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "³¬Ãʤò¾å¤Ã¤¿");
#else
- if (0 == dun_level)
- msg_print("You go back to the surface.");
- else
- msg_print("You enter a maze of up staircases.");
+ if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, "climbed up the stairs to");
#endif
-
- /* Leaving the dungeon to town */
- if (!dun_level && dungeon_type)
- {
- p_ptr->leaving_dungeon = TRUE;
- if (!vanilla_town && !lite_town)
- {
- 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;
-
- /* Leaving */
- p_ptr->leaving = TRUE;
- }
- }
- else
- {
+ /* Success */
#ifdef JP
- msg_print("¤³¤³¤Ë¤Ï¾å¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
+ if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
+ msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
+ else if (up_num == dun_level)
+ msg_print("ÃϾå¤ËÌá¤Ã¤¿¡£");
+ else
+ msg_print("³¬Ãʤò¾å¤Ã¤Æ¿·¤¿¤Ê¤ë̵ܤؤȤòƧ¤ßÆþ¤ì¤¿¡£");
#else
- msg_print("I see no up staircase here.");
+ if (up_num == dun_level)
+ msg_print("You go back to the surface.");
+ else
+ msg_print("You enter a maze of up staircases.");
#endif
- return;
- }
+ /* Leaving */
+ p_ptr->leaving = TRUE;
}
void do_cmd_go_down(void)
{
cave_type *c_ptr;
- bool go_down = FALSE;
bool fall_trap = FALSE;
int down_num = 0;
if (!get_check("Do you really get in this dungeon? ")) return;
#endif
}
- go_down = TRUE;
/* Save old player position */
p_ptr->oldpx = px;
p_ptr->oldpy = py;
dungeon_type = (byte)c_ptr->special;
}
- else
- {
- if (confirm_stairs)
- {
-#ifdef JP
-if (get_check("ËÜÅö¤Ë¤³¤Î³¬¤òµî¤ê¤Þ¤¹¤«¡©"))
-#else
- if (get_check("Really leave the level? "))
-#endif
- go_down = TRUE;
- }
- else
- {
- go_down = TRUE;
- }
- }
+ /* Hack -- take a turn */
+ energy_use = 100;
- if (go_down)
- {
+ if (autosave_l) do_cmd_save_game(TRUE);
- /* Hack -- take a turn */
- energy_use = 100;
+ /* Go down */
+ if (c_ptr->feat == FEAT_MORE_MORE) down_num += 2;
+ else down_num += 1;
- if (autosave_l) do_cmd_save_game(TRUE);
- /* Go down */
- if (c_ptr->feat == FEAT_MORE_MORE) down_num += 2;
- else down_num += 1;
- if (!quest_number(dun_level+down_num) && (dun_level < d_info[dungeon_type].maxdepth - 1 - down_num) && one_in_(13) && !fall_trap && dun_level && !ironman_downward)
- {
- down_num++;
+ if (!dun_level)
+ {
+ /* Enter the dungeon just now */
+ p_ptr->enter_dungeon = TRUE;
+ down_num = d_info[c_ptr->special].mindepth;
+ }
+
+ if (record_stair)
+ {
#ifdef JP
- if (c_ptr->feat == FEAT_MORE_MORE) msg_print("Ť¤¹£Æ»¤ò²¼¤ê¤¿¡£");
- else msg_print("Ť¤³¬Ãʤò²¼¤ê¤¿¡£");
+ if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "Í¸Í¤ËÍî¤Á¤¿");
+ else do_cmd_write_nikki(NIKKI_STAIR, down_num, "³¬Ãʤò²¼¤ê¤¿");
#else
- msg_print("These were very long stairs.");
+ if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "fell through a trap door");
+ else do_cmd_write_nikki(NIKKI_STAIR, down_num, "climbed down the stairs to");
#endif
- msg_print(NULL);
- }
- else if (!dun_level) down_num = d_info[c_ptr->special].mindepth;
- if (record_stair)
- {
+ }
+
+ if (fall_trap)
+ {
#ifdef JP
- if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "Í¸Í¤ËÍî¤Á¤¿");
- else do_cmd_write_nikki(NIKKI_STAIR, down_num, "³¬Ãʤò²¼¤ê¤¿");
+ msg_print("¤ï¤¶¤ÈÍ¸Í¤ËÍî¤Á¤¿¡£");
#else
- if (fall_trap) do_cmd_write_nikki(NIKKI_STAIR, down_num, "fall from trap door");
- else do_cmd_write_nikki(NIKKI_STAIR, down_num, "go down the stairs to");
+ msg_print("You deliberately jump through the trap door.");
#endif
- }
-
- if (fall_trap)
+ }
+ else
+ {
+ /* Success */
+ if(c_ptr->feat == FEAT_ENTRANCE)
{
- dun_level += down_num;
#ifdef JP
- msg_print("¤ï¤¶¤ÈÍ¸Í¤ËÍî¤Á¤¿¡£");
+ msg_format("%s¤ØÆþ¤Ã¤¿¡£", d_text + d_info[dungeon_type].text);
#else
- msg_print("You deliberately jump through the trap door.");
+ msg_format("You entered %s.", d_text + d_info[dungeon_type].text);
#endif
}
else
{
- /* Success */
- if(c_ptr->feat == FEAT_ENTRANCE)
- {
- dun_level = d_info[c_ptr->special].mindepth;
#ifdef JP
- msg_format("%s¤ØÆþ¤Ã¤¿¡£", d_text + d_info[dungeon_type].text);
-#else
- msg_format("You entered %s.", d_text + d_info[dungeon_type].text);
-#endif
- }
+ if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
+ msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
else
- {
- dun_level += down_num;
-#ifdef JP
- if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
- msg_print("¤Ê¤ó¤À¤³¤Î³¬Ãʤϡª");
- else
- msg_print("³¬Ãʤò²¼¤ê¤Æ¿·¤¿¤Ê¤ë̵ܤؤȤòƧ¤ßÆþ¤ì¤¿¡£");
+ msg_print("³¬Ãʤò²¼¤ê¤Æ¿·¤¿¤Ê¤ë̵ܤؤȤòƧ¤ßÆþ¤ì¤¿¡£");
#else
- msg_print("You enter a maze of down staircases.");
+ msg_print("You enter a maze of down staircases.");
#endif
- }
}
+ }
- /* Leaving */
- p_ptr->leaving = TRUE;
+ /* Leaving */
+ p_ptr->leaving = TRUE;
- if (!fall_trap)
+ if (fall_trap)
+ {
+ prepare_change_floor_mode(CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
+ }
+ else
+ {
+ if (c_ptr->feat == FEAT_MORE_MORE)
{
- if (c_ptr->feat == FEAT_MORE_MORE)
- {
- /* Create a way back */
- create_up_stair = 2;
- }
- else
- {
- /* Create a way back */
- create_up_stair = 1;
- }
+ /* Create a way back */
+ prepare_change_floor_mode(CFM_DOWN | CFM_SHAFT);
+ }
+ else
+ {
+ /* Create a way back */
+ prepare_change_floor_mode(CFM_DOWN);
}
}
}
int number;
bool small;
- bool great = FALSE;
+ u32b mode = AM_GOOD;
object_type forge;
object_type *q_ptr;
{
number = 5;
small = FALSE;
- great = TRUE;
+ mode |= AM_GREAT;
object_level = o_ptr->xtra3;
}
else
else
{
/* Make a good object */
- if (!make_object(q_ptr, TRUE, great)) continue;
+ if (!make_object(q_ptr, mode)) continue;
}
/* If chest scatters its contents, pick any floor square. */
msg_print("A puff of green gas surrounds you!");
#endif
- if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
+ if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
{
(void)set_poisoned(p_ptr->poisoned + 10 + randint1(20));
}
}
- /* No tunnelling through mountains */
- else if (feat == FEAT_MOUNTAIN)
- {
-#ifdef JP
- msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤!");
-#else
- msg_print("You can't tunnel through that!");
-#endif
-
- }
-
/* Map border (mimiccing Permanent wall) */
else if ((c_ptr->feat >= FEAT_PERM_EXTRA &&
c_ptr->feat <= FEAT_PERM_SOLID) ||
if (randint0(100) < (15 - dun_level/2))
{
/* Create a simple object */
- place_object(y, x, FALSE, FALSE);
+ place_object(y, x, 0L);
/* Observe new object */
if (player_can_see_bold(y, x))
/* Why are you sleeping when there's no need? WAKE UP!*/
if ((p_ptr->chp == p_ptr->mhp) &&
- (p_ptr->csp == p_ptr->msp) &&
- !p_ptr->blind && !p_ptr->confused &&
- !p_ptr->poisoned && !p_ptr->afraid &&
- !p_ptr->stun && !p_ptr->cut &&
- !p_ptr->slow && !p_ptr->paralyzed &&
- !p_ptr->image && !p_ptr->word_recall)
+ (p_ptr->csp == p_ptr->msp) &&
+ !p_ptr->blind && !p_ptr->confused &&
+ !p_ptr->poisoned && !p_ptr->afraid &&
+ !p_ptr->stun && !p_ptr->cut &&
+ !p_ptr->slow && !p_ptr->paralyzed &&
+ !p_ptr->image && !p_ptr->word_recall &&
+ !p_ptr->alter_reality)
chg_virtue(V_DILIGENCE, -1);
/* Save the rest code */
/* Actually "fire" the object */
bonus = (p_ptr->to_h_b + o_ptr->to_h + j_ptr->to_h);
if ((j_ptr->sval == SV_LIGHT_XBOW) || (j_ptr->sval == SV_HEAVY_XBOW))
- chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval])/400 + bonus) * BTH_PLUS_ADJ);
+ chance = (p_ptr->skill_thb + (p_ptr->weapon_exp[0][j_ptr->sval] / 400 + bonus) * BTH_PLUS_ADJ);
else
- chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval]-4000)/200 + bonus) * BTH_PLUS_ADJ);
+ chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + bonus) * BTH_PLUS_ADJ);
energy_use = bow_energy(j_ptr->sval);
tmul = bow_tmul(j_ptr->sval);
return;
}
- project_length = 0; /* reset to default */
/* Get local object */
q_ptr = &forge;
ty = target_row;
}
+ project_length = 0; /* reset to default */
/* Hack -- Handle stuff */
handle_stuff();
if (now_exp < s_info[p_ptr->pclass].w_max[0][j_ptr->sval])
{
int amount = 0;
- if (now_exp < 4000) amount = 80;
- else if (now_exp < 6000) amount = 25;
- else if ((now_exp < 7000) && (p_ptr->lev > 19)) amount = 10;
+ if (now_exp < SPELL_EXP_BEGINNER) amount = 80;
+ else if (now_exp < SPELL_EXP_SKILLED) amount = 25;
+ else if ((now_exp < SPELL_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 10;
else if (p_ptr->lev > 34) amount = 2;
p_ptr->weapon_exp[0][j_ptr->sval] += amount;
p_ptr->update |= (PU_BONUS);
if (p_ptr->riding)
{
- if (p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING] && ((p_ptr->skill_exp[GINOU_RIDING] - 1000) / 200 < r_info[m_list[p_ptr->riding].r_idx].level) && one_in_(2))
+ if ((p_ptr->skill_exp[GINOU_RIDING] < s_info[p_ptr->pclass].s_max[GINOU_RIDING])
+ && ((p_ptr->skill_exp[GINOU_RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < r_info[m_list[p_ptr->riding].r_idx].level)
+ && one_in_(2))
{
- p_ptr->skill_exp[GINOU_RIDING]+=1;
+ p_ptr->skill_exp[GINOU_RIDING] += 1;
p_ptr->update |= (PU_BONUS);
}
}
/* Get a direction (or cancel) */
if (!get_aim_dir(&dir)) return FALSE;
- project_length = 0; /* reset to default */
-
/* Predict the "target" location */
tx = px + 99 * ddx[dir];
ty = py + 99 * ddy[dir];
tx = target_col;
ty = target_row;
}
+
+ project_length = 0; /* reset to default */
}
if ((q_ptr->name1 == ART_MJOLLNIR) ||
inven_item_describe(item);
inven_item_optimize(item);
}
-
+
/* Reduce and describe floor item */
else
{
equiped_item = TRUE;
p_ptr->redraw |= (PR_EQUIPPY);
}
-
+
/* Take a turn */
energy_use = 100;