X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fdungeon.c;h=59760b35d576d061417f2e787ab4ce536bf225e3;hb=5d766bc7de7eb9fe0e1b63192f849715d615b3b3;hp=a69684bf79f7ca1530a89fe5b682dc7eec0530cf;hpb=99b8af2463b5a700099feefa998ce456fa5d7072;p=hengband%2Fhengband.git diff --git a/src/dungeon.c b/src/dungeon.c index a69684bf7..59760b35d 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -11,95 +11,31 @@ */ #include "angband.h" - -#define TY_CURSE_CHANCE 200 /*!<太å¤ã®æ¨å¿µã®1ã¿ã¼ã³æ¯ã®çºå確ç(1/n)*/ -#define CHAINSWORD_NOISE 100 /*!<ãã§ã³ã½ã¼ã®1ã¿ã¼ã³æ¯ã®çºå確ç(1/n)*/ +#include "cmd-activate.h" +#include "cmd-eat.h" +#include "cmd-item.h" +#include "cmd-magiceat.h" +#include "cmd-quaff.h" +#include "cmd-read.h" +#include "cmd-usestaff.h" +#include "cmd-zaprod.h" +#include "cmd-zapwand.h" +#include "cmd-pet.h" +#include "floor-events.h" +#include "object-curse.h" +#include "store.h" +#include "monsterrace-hook.h" static bool load = TRUE; /*!<ãã¼ãå¦çä¸ã®åå²ãã©ã°*/ static int wild_regen = 20; /*!<åºåããã移åæã®èªç¶å復å¦çã«ã¦ã³ã¿ï¼åºåããã1ãã¹æ¯ã«20åå¦çãåºæ¬ã¨ããï¼*/ /*! - * @brief é度æ¬ä¼¼éå®ã®å¤æå¦ç / Return a "feeling" (or NULL) about an item. Method 1 (Heavy). - * @param o_ptr æ¬ä¼¼éå®ãè¡ããªãã¸ã§ã¯ãã®åç §ãã¤ã³ã¿ã - * @return æ¬ä¼¼éå®çµæã®IDãè¿ãã - */ -static byte value_check_aux1(object_type *o_ptr) -{ - /* Artifacts */ - if (object_is_artifact(o_ptr)) - { - /* Cursed/Broken */ - if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_TERRIBLE; - - /* Normal */ - return FEEL_SPECIAL; - } - - /* Ego-Items */ - if (object_is_ego(o_ptr)) - { - /* Cursed/Broken */ - if (object_is_cursed(o_ptr) || object_is_broken(o_ptr)) return FEEL_WORTHLESS; - - /* Normal */ - return FEEL_EXCELLENT; - } - - /* Cursed items */ - if (object_is_cursed(o_ptr)) return FEEL_CURSED; - - /* Broken items */ - if (object_is_broken(o_ptr)) return FEEL_BROKEN; - - if ((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) return FEEL_AVERAGE; - - /* Good "armor" bonus */ - if (o_ptr->to_a > 0) return FEEL_GOOD; - - /* Good "weapon" bonus */ - if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_GOOD; - - /* Default to "average" */ - return FEEL_AVERAGE; -} - -/*! - * @brief 軽度æ¬ä¼¼éå®ã®å¤æå¦ç / Return a "feeling" (or NULL) about an item. Method 2 (Light). - * @param o_ptr æ¬ä¼¼éå®ãè¡ããªãã¸ã§ã¯ãã®åç §ãã¤ã³ã¿ã - * @return æ¬ä¼¼éå®çµæã®IDãè¿ãã - */ -static byte value_check_aux2(object_type *o_ptr) -{ - /* Cursed items (all of them) */ - if (object_is_cursed(o_ptr)) return FEEL_CURSED; - - /* Broken items (all of them) */ - if (object_is_broken(o_ptr)) return FEEL_BROKEN; - - /* Artifacts -- except cursed/broken ones */ - if (object_is_artifact(o_ptr)) return FEEL_UNCURSED; - - /* Ego-Items -- except cursed/broken ones */ - if (object_is_ego(o_ptr)) return FEEL_UNCURSED; - - /* Good armor bonus */ - if (o_ptr->to_a > 0) return FEEL_UNCURSED; - - /* Good weapon bonuses */ - if (o_ptr->to_h + o_ptr->to_d > 0) return FEEL_UNCURSED; - - /* No feeling */ - return FEEL_NONE; -} - - -/*! * @brief æ¬ä¼¼éå®ãå®éã«è¡ãå¤å®ãåæ ãã * @param slot æ¬ä¼¼éå®ãè¡ããã¬ã¤ã¤ã¼ã®ææãªã¹ãID * @param heavy é度ã®æ¬ä¼¼éå®ãè¡ããªãã°TRUE * @return ãªã */ -static void sense_inventory_aux(int slot, bool heavy) +static void sense_inventory_aux(INVENTORY_IDX slot, bool heavy) { byte feel; object_type *o_ptr = &inventory[slot]; @@ -167,7 +103,7 @@ static void sense_inventory_aux(int slot, bool heavy) } /* Stop everything */ - if (disturb_minor) disturb(0, 0); + if (disturb_minor) disturb(FALSE, FALSE); /* Get an object description */ object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); @@ -176,8 +112,8 @@ static void sense_inventory_aux(int slot, bool heavy) if (slot >= INVEN_RARM) { #ifdef JP -msg_format("%s%s(%c)ã¯%sã¨ããæãããã...", -describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]); + msg_format("%s%s(%c)ã¯%sã¨ããæãããã...", + describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]); #else msg_format("You feel the %s (%c) you are %s %s %s...", o_name, index_to_label(slot), describe_use(slot), @@ -191,8 +127,8 @@ describe_use(slot),o_name, index_to_label(slot),game_inscriptions[feel]); else { #ifdef JP -msg_format("ã¶ãã¯ã®ä¸ã®%s(%c)ã¯%sã¨ããæãããã...", -o_name, index_to_label(slot),game_inscriptions[feel]); + msg_format("ã¶ãã¯ã®ä¸ã®%s(%c)ã¯%sã¨ããæãããã...", + o_name, index_to_label(slot),game_inscriptions[feel]); #else msg_format("You feel the %s (%c) in your pack %s %s...", o_name, index_to_label(slot), @@ -214,7 +150,6 @@ o_name, index_to_label(slot),game_inscriptions[feel]); /* Combine / Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); - /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP); } @@ -235,9 +170,9 @@ o_name, index_to_label(slot),game_inscriptions[feel]); */ static void sense_inventory1(void) { - int i; - int plev = p_ptr->lev; - bool heavy = FALSE; + INVENTORY_IDX i; + PLAYER_LEVEL plev = p_ptr->lev; + bool heavy = FALSE; object_type *o_ptr; @@ -260,7 +195,6 @@ static void sense_inventory1(void) /* Heavy sensing */ heavy = TRUE; - /* Done */ break; } @@ -272,7 +206,6 @@ static void sense_inventory1(void) /* Heavy sensing */ heavy = TRUE; - /* Done */ break; } @@ -284,7 +217,6 @@ static void sense_inventory1(void) /* Very bad (light) sensing */ if (0 != randint0(240000L / (plev + 5))) return; - /* Done */ break; } @@ -294,7 +226,6 @@ static void sense_inventory1(void) /* Good (light) sensing */ if (0 != randint0(10000L / (plev * plev + 40))) return; - /* Done */ break; } @@ -307,7 +238,6 @@ static void sense_inventory1(void) /* Heavy sensing */ heavy = TRUE; - /* Done */ break; } @@ -319,7 +249,6 @@ static void sense_inventory1(void) /* Changed! */ heavy = TRUE; - /* Done */ break; } @@ -332,7 +261,6 @@ static void sense_inventory1(void) /* Heavy sensing */ heavy = TRUE; - /* Done */ break; } @@ -342,7 +270,6 @@ static void sense_inventory1(void) /* Bad sensing */ if (0 != randint0(75000L / (plev * plev + 40))) return; - /* Done */ break; } @@ -354,7 +281,6 @@ static void sense_inventory1(void) /* Bad sensing */ if (0 != randint0(55000L / (plev * plev + 40))) return; - /* Done */ break; } @@ -366,7 +292,6 @@ static void sense_inventory1(void) /* Changed! */ heavy = TRUE; - /* Done */ break; } @@ -376,7 +301,6 @@ static void sense_inventory1(void) /* Okay sensing */ if (0 != randint0(20000L / (plev * plev + 40))) return; - /* Done */ break; } @@ -388,7 +312,6 @@ static void sense_inventory1(void) /* Heavy sensing */ heavy = TRUE; - /* Done */ break; } @@ -397,7 +320,6 @@ static void sense_inventory1(void) /* Bad sensing */ if (0 != randint0(65000L / (plev * plev + 40))) return; - /* Done */ break; } case CLASS_BERSERKER: @@ -405,7 +327,6 @@ static void sense_inventory1(void) /* Heavy sensing */ heavy = TRUE; - /* Done */ break; } } @@ -473,8 +394,8 @@ static void sense_inventory1(void) */ static void sense_inventory2(void) { - int i; - int plev = p_ptr->lev; + INVENTORY_IDX i; + PLAYER_LEVEL plev = p_ptr->lev; object_type *o_ptr; @@ -506,7 +427,6 @@ static void sense_inventory2(void) /* Very bad (light) sensing */ if (0 != randint0(240000L / (plev + 5))) return; - /* Done */ break; } @@ -518,7 +438,6 @@ static void sense_inventory2(void) /* Bad sensing */ if (0 != randint0(95000L / (plev * plev + 40))) return; - /* Done */ break; } @@ -531,7 +450,6 @@ static void sense_inventory2(void) /* Good sensing */ if (0 != randint0(20000L / (plev * plev + 40))) return; - /* Done */ break; } @@ -545,7 +463,6 @@ static void sense_inventory2(void) /* Good sensing */ if (0 != randint0(9000L / (plev * plev + 40))) return; - /* Done */ break; } @@ -554,7 +471,6 @@ static void sense_inventory2(void) /* Good sensing */ if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return; - /* Done */ break; } } @@ -600,8 +516,8 @@ static void sense_inventory2(void) */ static void pattern_teleport(void) { - int min_level = 0; - int max_level = 99; + DEPTH min_level = 0; + DEPTH max_level = 99; /* Ask for level */ if (get_check(_("ä»ã®éã«ãã¬ãã¼ããã¾ããï¼", "Teleport level? "))) @@ -628,16 +544,16 @@ static void pattern_teleport(void) } /* Prompt */ - sprintf(ppp, _("ãã¬ãã¼ãå :(%d-%d)", "Teleport to level (%d-%d): "), min_level, max_level); + sprintf(ppp, _("ãã¬ãã¼ãå :(%d-%d)", "Teleport to level (%d-%d): "), (int)min_level, (int)max_level); /* Default */ - sprintf(tmp_val, "%d", dun_level); + sprintf(tmp_val, "%d", (int)dun_level); /* Ask for a level */ if (!get_string(ppp, tmp_val, 10)) return; /* Extract request */ - command_arg = atoi(tmp_val); + command_arg = (COMMAND_ARG)atoi(tmp_val); } else if (get_check(_("é常ãã¬ãã¼ãï¼", "Normal teleport? "))) { @@ -650,10 +566,10 @@ static void pattern_teleport(void) } /* Paranoia */ - if (command_arg < min_level) command_arg = min_level; + if (command_arg < min_level) command_arg = (COMMAND_ARG)min_level; /* Paranoia */ - if (command_arg > max_level) command_arg = max_level; + if (command_arg > max_level) command_arg = (COMMAND_ARG)max_level; /* Accept request */ msg_format(_("%d éã«ãã¬ãã¼ããã¾ããã", "You teleport to dungeon level %d."), command_arg); @@ -686,7 +602,8 @@ static void pattern_teleport(void) */ static void wreck_the_pattern(void) { - int to_ruin = 0, r_y, r_x; + int to_ruin = 0; + POSITION r_y, r_x; int pattern_type = f_info[cave[p_ptr->y][p_ptr->x].feat].subtype; if (pattern_type == PATTERN_TILE_WRECKED) @@ -738,20 +655,10 @@ static bool pattern_effect(void) switch (pattern_type) { case PATTERN_TILE_END: - (void)set_poisoned(0); (void)set_image(0); - (void)set_stun(0); - (void)set_cut(0); - (void)set_blind(0); - (void)set_afraid(0); - (void)do_res_stat(A_STR); - (void)do_res_stat(A_INT); - (void)do_res_stat(A_WIS); - (void)do_res_stat(A_DEX); - (void)do_res_stat(A_CON); - (void)do_res_stat(A_CHR); + (void)restore_all_status(); (void)restore_level(); - (void)hp_player(1000); + (void)cure_critical_wounds(1000); cave_set_feat(p_ptr->y, p_ptr->x, feat_pattern_old); msg_print(_("ããã¿ã¼ã³ãã®ãã®é¨åã¯ä»ã®é¨åããå¼·åã§ãªãããã ã", "This section of the Pattern looks less powerful.")); @@ -796,9 +703,9 @@ static bool pattern_effect(void) */ static void regenhp(int percent) { - s32b new_chp; + HIT_POINT new_chp; u32b new_chp_frac; - s32b old_chp; + HIT_POINT old_chp; if (p_ptr->special_defense & KATA_KOUKIJIN) return; if (p_ptr->action == ACTION_HAYAGAKE) return; @@ -831,12 +738,8 @@ static void regenhp(int percent) /* Notice changes */ if (old_chp != p_ptr->chp) { - /* Redraw */ p_ptr->redraw |= (PR_HP); - - /* Window stuff */ p_ptr->window |= (PW_PLAYER); - wild_regen = 20; } } @@ -848,9 +751,9 @@ static void regenhp(int percent) * @param regen_amount å復é * @return ãªã */ -static void regenmana(int upkeep_factor, int regen_amount) +static void regenmana(MANA_POINT upkeep_factor, MANA_POINT regen_amount) { - s32b old_csp = p_ptr->csp; + MANA_POINT old_csp = p_ptr->csp; s32b regen_rate = regen_amount * 100 - upkeep_factor * PY_REGEN_NORMAL; /* @@ -881,7 +784,7 @@ static void regenmana(int upkeep_factor, int regen_amount) else if (regen_rate > 0) { /* (percent/100) is the Regen factor in unit (1/2^16) */ - s32b new_mana = 0; + MANA_POINT new_mana = 0; u32b new_mana_frac = (p_ptr->msp * regen_rate / 100 + PY_REGEN_MNBASE); /* Convert the unit (1/2^16) to (1/2^32) */ @@ -920,17 +823,11 @@ static void regenmana(int upkeep_factor, int regen_amount) } } - - /* Redraw mana */ if (old_csp != p_ptr->csp) { - /* Redraw */ p_ptr->redraw |= (PR_MANA); - - /* Window stuff */ p_ptr->window |= (PW_PLAYER); p_ptr->window |= (PW_SPELL); - wild_regen = 20; } } @@ -942,7 +839,7 @@ static void regenmana(int upkeep_factor, int regen_amount) */ static void regenmagic(int regen_amount) { - s32b new_mana; + MANA_POINT new_mana; int i; int dev = 30; int mult = (dev + adj_mag_mana[p_ptr->stat_ind[A_INT]]); /* x1 to x2 speed bonus for recharging */ @@ -983,7 +880,7 @@ static void regenmagic(int regen_amount) /*! * @brief 100ã²ã¼ã ã¿ã¼ã³æ¯ã®ã¢ã³ã¹ã¿ã¼ã®HPèªç¶å復å¦ç / Regenerate the monsters (once per 100 game turns) * @return ãªã - * @note XXX XXX XXX Should probably be done during monster turns. + * @note Should probably be done during monster turns. */ static void regen_monsters(void) { @@ -1030,7 +927,7 @@ static void regen_monsters(void) /*! * @brief 30ã²ã¼ã ã¿ã¼ã³æ¯ã®ãã¼ã«ä¸ã¢ã³ã¹ã¿ã¼ã®HPèªç¶å復å¦ç / Regenerate the captured monsters (once per 30 game turns) * @return ãªã - * @note XXX XXX XXX Should probably be done during monster turns. + * @note Should probably be done during monster turns. */ static void regen_captured_monsters(void) { @@ -1064,7 +961,7 @@ static void regen_captured_monsters(void) if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2; /* Hack -- Regenerate */ - o_ptr->xtra4 += frac; + o_ptr->xtra4 += (XTRA16)frac; /* Do not over-regenerate */ if (o_ptr->xtra4 > o_ptr->xtra5) o_ptr->xtra4 = o_ptr->xtra5; @@ -1075,8 +972,6 @@ static void regen_captured_monsters(void) { /* Combine pack */ p_ptr->notice |= (PN_COMBINE); - - /* Window stuff */ p_ptr->window |= (PW_INVEN); p_ptr->window |= (PW_EQUIP); wild_regen = 20; @@ -1093,7 +988,6 @@ static void notice_lite_change(object_type *o_ptr) /* Hack -- notice interesting fuel steps */ if ((o_ptr->xtra4 < 100) || (!(o_ptr->xtra4 % 100))) { - /* Window stuff */ p_ptr->window |= (PW_EQUIP); } @@ -1107,7 +1001,7 @@ static void notice_lite_change(object_type *o_ptr) /* The light is now out */ else if (o_ptr->xtra4 == 0) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("æãããæ¶ãã¦ãã¾ã£ãï¼", "Your light has gone out!")); /* Recalculate torch radius */ @@ -1123,7 +1017,7 @@ static void notice_lite_change(object_type *o_ptr) if ((o_ptr->xtra4 < 50) && (!(o_ptr->xtra4 % 5)) && (turn % (TURNS_PER_TICK*2))) { - if (disturb_minor) disturb(0, 1); + if (disturb_minor) disturb(FALSE, TRUE); msg_print(_("æãããå¾®ãã«ãªã£ã¦ãã¦ããã", "Your light is growing faint.")); } } @@ -1131,7 +1025,7 @@ static void notice_lite_change(object_type *o_ptr) /* The light is getting dim */ else if ((o_ptr->xtra4 < 100) && (!(o_ptr->xtra4 % 10))) { - if (disturb_minor) disturb(0, 1); + if (disturb_minor) disturb(FALSE, TRUE); msg_print(_("æãããå¾®ãã«ãªã£ã¦ãã¦ããã", "Your light is growing faint.")); } } @@ -1211,127 +1105,6 @@ void leave_tower_check(void) } } -/*! - * @brief è¶ è½åè ã®ãµã¤ã³ã¡ããªã¼å¦ç/ Forcibly pseudo-identify an object in the inventory (or on the floor) - * @return ãªã - * @todo mind.cã«ãã®é¢æ°ã移åãããã¹ãã - * @note - * currently this function allows pseudo-id of any object, - * including silly ones like potions & scrolls, which always - * get '{average}'. This should be changed, either to stop such - * items from being pseudo-id'd, or to allow psychometry to - * detect whether the unidentified potion/scroll/etc is - * good (Cure Light Wounds, Restore Strength, etc) or - * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc). - */ -bool psychometry(void) -{ - int item; - object_type *o_ptr; - char o_name[MAX_NLEN]; - byte feel; - cptr q, s; - bool okay = FALSE; - - item_tester_no_ryoute = TRUE; - /* Get an item */ - q = _("ã©ã®ã¢ã¤ãã ã調ã¹ã¾ããï¼", "Meditate on which item? "); - s = _("調ã¹ãã¢ã¤ãã ãããã¾ããã", "You have nothing appropriate."); - - if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); - - /* Get the item (in the pack) */ - if (item >= 0) - { - o_ptr = &inventory[item]; - } - - /* Get the item (on the floor) */ - else - { - o_ptr = &o_list[0 - item]; - } - - /* It is fully known, no information needed */ - if (object_is_known(o_ptr)) - { - msg_print(_("ä½ãæ°ãããã¨ã¯å¤ããªãã£ãã", "You cannot find out anything more about that.")); - return TRUE; - } - - /* Check for a feeling */ - feel = value_check_aux1(o_ptr); - - /* Get an object description */ - object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY)); - - /* Skip non-feelings */ - if (!feel) - { - msg_format(_("%sããã¯ç¹ã«å¤ãã£ãäºã¯æãã¨ããªãã£ãã", "You do not perceive anything unusual about the %s."), o_name); - return TRUE; - } - -#ifdef JP -msg_format("%sã¯%sã¨ããæãããã...", - o_name, game_inscriptions[feel]); -#else - msg_format("You feel that the %s %s %s...", - o_name, ((o_ptr->number == 1) ? "is" : "are"), - game_inscriptions[feel]); -#endif - - - /* We have "felt" it */ - o_ptr->ident |= (IDENT_SENSE); - - /* "Inscribe" it */ - o_ptr->feeling = feel; - - /* Player touches it */ - o_ptr->marked |= OM_TOUCHED; - - /* Combine / Reorder the pack (later) */ - p_ptr->notice |= (PN_COMBINE | PN_REORDER); - - /* Window stuff */ - p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); - - /* Valid "tval" codes */ - switch (o_ptr->tval) - { - case TV_SHOT: - case TV_ARROW: - case TV_BOLT: - case TV_BOW: - case TV_DIGGING: - case TV_HAFTED: - case TV_POLEARM: - case TV_SWORD: - case TV_BOOTS: - case TV_GLOVES: - case TV_HELM: - case TV_CROWN: - case TV_SHIELD: - case TV_CLOAK: - case TV_SOFT_ARMOR: - case TV_HARD_ARMOR: - case TV_DRAG_ARMOR: - case TV_CARD: - case TV_RING: - case TV_AMULET: - case TV_LITE: - case TV_FIGURINE: - okay = TRUE; - break; - } - - /* Auto-inscription/destroy */ - autopick_alter_item(item, (bool)(okay && destroy_feeling)); - - /* Something happened */ - return (TRUE); -} /*! * @brief !!ãå»ãã ééå ·ã®æéçµéã«ããåå å¡«ãç¥ãããå¦ç / If player has inscribed the object with "!!", let him know when it's recharged. -LM- @@ -1369,7 +1142,7 @@ static void recharged_notice(object_type *o_ptr) msg_format("Your %s is recharged.", o_name); #endif - disturb(0, 0); + disturb(FALSE, FALSE); /* Done. */ return; @@ -1388,12 +1161,12 @@ static void check_music(void) { const magic_type *s_ptr; int spell; - s32b need_mana; + MANA_POINT need_mana; u32b need_mana_frac; /* Music singed by player */ if (p_ptr->pclass != CLASS_BARD) return; - if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return; + if (!SINGING_SONG_EFFECT(p_ptr) && !INTERUPTING_SONG_EFFECT(p_ptr)) return; if (p_ptr->anti_magic) { @@ -1401,7 +1174,7 @@ static void check_music(void) return; } - spell = p_ptr->magic_num2[0]; + spell = SINGING_SONG_ID(p_ptr); s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell]; need_mana = mod_need_mana(s_ptr->smana, spell, REALM_MUSIC); @@ -1420,10 +1193,10 @@ static void check_music(void) s64b_sub(&(p_ptr->csp), &(p_ptr->csp_frac), need_mana, need_mana_frac); p_ptr->redraw |= PR_MANA; - if (p_ptr->magic_num1[1]) + if (INTERUPTING_SONG_EFFECT(p_ptr)) { - p_ptr->magic_num1[0] = p_ptr->magic_num1[1]; - p_ptr->magic_num1[1] = 0; + SINGING_SONG_EFFECT(p_ptr) = INTERUPTING_SONG_EFFECT(p_ptr); + INTERUPTING_SONG_EFFECT(p_ptr) = MUSIC_NONE; msg_print(_("æãåéããã", "You restart singing.")); p_ptr->action = ACTION_SING; @@ -1432,11 +1205,8 @@ static void check_music(void) /* Redraw map and status bar */ p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE); - - /* Update monsters */ p_ptr->update |= (PU_MONSTERS); - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); } } @@ -1459,7 +1229,7 @@ static void check_music(void) * @return 該å½ã®åªããä¸ã¤ã§ããã£ãå ´åã«ã©ã³ãã ã«é¸ã°ããè£ ååã®ãªãã¸ã§ã¯ãæ§é ä½åç §ãã¤ã³ã¿ãè¿ãã\n * åªãããªãå ´åNULLãè¿ãã */ -static object_type *choose_cursed_obj_name(u32b flag) +static object_type *choose_cursed_obj_name(BIT_FLAGS flag) { int i; int choices[INVEN_TOTAL-INVEN_RARM]; @@ -1493,8 +1263,8 @@ static object_type *choose_cursed_obj_name(u32b flag) (flag == TRC_FAST_DIGEST) || (flag == TRC_SLOW_REGEN) ) { - u32b cf; - u32b flgs[TR_FLAG_SIZE]; + u32b cf = 0L; + BIT_FLAGS flgs[TR_FLAG_SIZE]; object_flags(o_ptr, flgs); switch (flag) { @@ -1526,6 +1296,70 @@ static object_type *choose_cursed_obj_name(u32b flag) return (&inventory[choices[randint0(number)]]); } +static void process_world_aux_digestion(void) +{ + if (!p_ptr->inside_battle) + { + /* Digest quickly when gorged */ + if (p_ptr->food >= PY_FOOD_MAX) + { + /* Digest a lot of food */ + (void)set_food(p_ptr->food - 100); + } + + /* Digest normally -- Every 50 game turns */ + else if (!(turn % (TURNS_PER_TICK * 5))) + { + /* Basic digestion rate based on speed */ + int digestion = SPEED_TO_ENERGY(p_ptr->pspeed); + + /* Regeneration takes more food */ + if (p_ptr->regenerate) + digestion += 20; + if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) + digestion += 20; + if (p_ptr->cursed & TRC_FAST_DIGEST) + digestion += 30; + + /* Slow digestion takes less food */ + if (p_ptr->slow_digest) + digestion -= 5; + + /* Minimal digestion */ + if (digestion < 1) digestion = 1; + /* Maximal digestion */ + if (digestion > 100) digestion = 100; + + /* Digest some food */ + (void)set_food(p_ptr->food - digestion); + } + + + /* Getting Faint */ + if ((p_ptr->food < PY_FOOD_FAINT)) + { + /* Faint occasionally */ + if (!p_ptr->paralyzed && (randint0(100) < 10)) + { + msg_print(_("ãã¾ãã«ãç©ºè ¹ã§æ°çµ¶ãã¦ãã¾ã£ãã", "You faint from the lack of food.")); + disturb(TRUE, TRUE); + + /* Hack -- faint (bypass free action) */ + (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5)); + } + + /* Starve to death (slowly) */ + if (p_ptr->food < PY_FOOD_STARVE) + { + /* Calculate damage */ + HIT_POINT dam = (PY_FOOD_STARVE - p_ptr->food) / 10; + + if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("ç©ºè ¹", "starvation"), -1); + } + } + } +} + /*! * @brief 10ã²ã¼ã ã¿ã¼ã³ãé²è¡ãããã¨ã«ãã¬ã¤ã¤ã¼ã®HPã¨MPã®å¢æ¸å¦çãè¡ãã * / Handle timed damage and regeneration every 10 game turns @@ -1546,14 +1380,13 @@ static void process_world_aux_hp_and_sp(void) /* Take damage from poison */ if (p_ptr->poisoned && !IS_INVULN()) { - /* Take damage */ take_hit(DAMAGE_NOESCAPE, 1, _("æ¯", "poison"), -1); } /* Take damage from cuts */ if (p_ptr->cut && !IS_INVULN()) { - int dam; + HIT_POINT dam; /* Mortal wound or Deep Gash */ if (p_ptr->cut > 1000) @@ -1593,11 +1426,9 @@ static void process_world_aux_hp_and_sp(void) dam = 1; } - /* Take damage */ take_hit(DAMAGE_NOESCAPE, dam, _("è´å½å·", "a fatal wound"), -1); } - /* (Vampires) Take damage from sunlight */ if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE)) { @@ -1605,10 +1436,8 @@ static void process_world_aux_hp_and_sp(void) { if ((cave[p_ptr->y][p_ptr->x].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) { - /* Take damage */ msg_print(_("æ¥å ãããªãã®ã¢ã³ãããã®èä½ãç¼ãç¦ãããï¼", "The sun's rays scorch your undead flesh!")); take_hit(DAMAGE_NOESCAPE, 1, _("æ¥å ", "sunlight"), -1); - cave_no_regen = TRUE; } } @@ -1649,11 +1478,10 @@ static void process_world_aux_hp_and_sp(void) if (damage) { - if (prace_is_(RACE_ENT)) damage += damage / 3; - if (p_ptr->resist_fire) damage = damage / 3; - if (IS_OPPOSE_FIRE()) damage = damage / 3; - - if (p_ptr->levitation) damage = damage / 5; + if(prace_is_(RACE_ENT)) damage += damage / 3; + if(p_ptr->resist_fire) damage = damage / 3; + if(IS_OPPOSE_FIRE()) damage = damage / 3; + if(p_ptr->levitation) damage = damage / 5; damage = damage / 100 + (randint0(100) < (damage % 100)); @@ -1674,12 +1502,165 @@ static void process_world_aux_hp_and_sp(void) } } + if (have_flag(f_ptr->flags, FF_COLD_PUDDLE) && !IS_INVULN() && !p_ptr->immune_cold) + { + int damage = 0; + + if (have_flag(f_ptr->flags, FF_DEEP)) + { + damage = 6000 + randint0(4000); + } + else if (!p_ptr->levitation) + { + damage = 3000 + randint0(2000); + } + + if (damage) + { + if (p_ptr->resist_cold) damage = damage / 3; + if (IS_OPPOSE_COLD()) damage = damage / 3; + if (p_ptr->levitation) damage = damage / 5; + + damage = damage / 100 + (randint0(100) < (damage % 100)); + + if (p_ptr->levitation) + { + msg_print(_("å·æ°ã«è¦ãããï¼", "The cold engulfs you!")); + take_hit(DAMAGE_NOESCAPE, damage, format(_("%sã®ä¸ã«æµ®éãããã¡ã¼ã¸", "flying over %s"), + f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name), -1); + } + else + { + cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name; + msg_format(_("%sã«åããï¼", "The %s frostbites you!"), name); + take_hit(DAMAGE_NOESCAPE, damage, name, -1); + } + + cave_no_regen = TRUE; + } + } + + if (have_flag(f_ptr->flags, FF_ELEC_PUDDLE) && !IS_INVULN() && !p_ptr->immune_elec) + { + int damage = 0; + + if (have_flag(f_ptr->flags, FF_DEEP)) + { + damage = 6000 + randint0(4000); + } + else if (!p_ptr->levitation) + { + damage = 3000 + randint0(2000); + } + + if (damage) + { + if (p_ptr->resist_elec) damage = damage / 3; + if (IS_OPPOSE_ELEC()) damage = damage / 3; + if (p_ptr->levitation) damage = damage / 5; + + damage = damage / 100 + (randint0(100) < (damage % 100)); + + if (p_ptr->levitation) + { + msg_print(_("é»æãåããï¼", "The electric shocks you!")); + take_hit(DAMAGE_NOESCAPE, damage, format(_("%sã®ä¸ã«æµ®éãããã¡ã¼ã¸", "flying over %s"), + f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name), -1); + } + else + { + cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name; + msg_format(_("%sã«æé»ããï¼", "The %s shocks you!"), name); + take_hit(DAMAGE_NOESCAPE, damage, name, -1); + } + + cave_no_regen = TRUE; + } + } + + if (have_flag(f_ptr->flags, FF_ACID_PUDDLE) && !IS_INVULN() && !p_ptr->immune_acid) + { + int damage = 0; + + if (have_flag(f_ptr->flags, FF_DEEP)) + { + damage = 6000 + randint0(4000); + } + else if (!p_ptr->levitation) + { + damage = 3000 + randint0(2000); + } + + if (damage) + { + if (p_ptr->resist_acid) damage = damage / 3; + if (IS_OPPOSE_ACID()) damage = damage / 3; + if (p_ptr->levitation) damage = damage / 5; + + damage = damage / 100 + (randint0(100) < (damage % 100)); + + if (p_ptr->levitation) + { + msg_print(_("é ¸ãé£ã³æ£ã£ãï¼", "The acid melt you!")); + take_hit(DAMAGE_NOESCAPE, damage, format(_("%sã®ä¸ã«æµ®éãããã¡ã¼ã¸", "flying over %s"), + f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name), -1); + } + else + { + cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name; + msg_format(_("%sã«æº¶ããããï¼", "The %s melts you!"), name); + take_hit(DAMAGE_NOESCAPE, damage, name, -1); + } + + cave_no_regen = TRUE; + } + } + + if (have_flag(f_ptr->flags, FF_POISON_PUDDLE) && !IS_INVULN()) + { + int damage = 0; + + if (have_flag(f_ptr->flags, FF_DEEP)) + { + damage = 6000 + randint0(4000); + } + else if (!p_ptr->levitation) + { + damage = 3000 + randint0(2000); + } + + if (damage) + { + if (p_ptr->resist_pois) damage = damage / 3; + if (IS_OPPOSE_POIS()) damage = damage / 3; + if (p_ptr->levitation) damage = damage / 5; + + damage = damage / 100 + (randint0(100) < (damage % 100)); + + if (p_ptr->levitation) + { + msg_print(_("æ¯æ°ãå¸ãè¾¼ãã ï¼", "The gas poisons you!")); + take_hit(DAMAGE_NOESCAPE, damage, format(_("%sã®ä¸ã«æµ®éãããã¡ã¼ã¸", "flying over %s"), + f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name), -1); + if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 1); + } + else + { + cptr name = f_name + f_info[get_feat_mimic(&cave[p_ptr->y][p_ptr->x])].name; + msg_format(_("%sã«æ¯ãããï¼", "The %s poisons you!"), name); + take_hit(DAMAGE_NOESCAPE, damage, name, -1); + if (p_ptr->resist_pois) (void)set_poisoned(p_ptr->poisoned + 3); + } + + cave_no_regen = TRUE; + } + } + if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) && !p_ptr->levitation && !p_ptr->can_swim) { if (p_ptr->total_weight > weight_limit()) { - /* Take damage */ msg_print(_("溺ãã¦ããï¼", "You are drowning!")); take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), _("溺ã", "drowning"), -1); cave_no_regen = TRUE; @@ -1688,7 +1669,7 @@ static void process_world_aux_hp_and_sp(void) if (p_ptr->riding) { - int damage; + HIT_POINT damage; if ((r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_AURA_FIRE) && !p_ptr->immune_fire) { damage = r_info[m_list[p_ptr->riding].r_idx].level / 2; @@ -1726,11 +1707,9 @@ static void process_world_aux_hp_and_sp(void) */ if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_CAN_FLY)) { - if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && - ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall)) + if (!IS_INVULN() && !p_ptr->wraith_form && !p_ptr->kabenuke && ((p_ptr->chp > (p_ptr->lev / 5)) || !p_ptr->pass_wall)) { cptr dam_desc; - cave_no_regen = TRUE; if (p_ptr->pass_wall) @@ -2208,13 +2187,11 @@ static void process_world_aux_mutation(void) /* No effect on the global map */ if (p_ptr->wild_mode) return; - if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000)) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("ã¦ã¬ã¡ã¡ã¢ï¼", "RAAAAGHH!")); msg_print(_("æ¿æã®çºä½ã«è¥²ãããï¼", "You feel a fit of rage coming over you!")); - (void)set_shero(10 + randint1(p_ptr->lev), FALSE); (void)set_afraid(0); } @@ -2223,7 +2200,7 @@ static void process_world_aux_mutation(void) { if (!p_ptr->resist_fear) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("ã¨ã¦ãæã... ã¨ã¦ãæãï¼", "It's so dark... so scary!")); set_afraid(p_ptr->afraid + 13 + randint1(26)); } @@ -2231,12 +2208,9 @@ static void process_world_aux_mutation(void) if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88)) { - if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && - !p_ptr->anti_tele) + if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) && !p_ptr->anti_tele) { - disturb(0, 1); - - /* Teleport player */ + disturb(FALSE, TRUE); msg_print(_("ããªãã®ä½ç½®ã¯çªç¶ã²ãããã«ä¸ç¢ºå®ã«ãªã£ã...", "Your position suddenly seems very uncertain...")); msg_print(NULL); teleport_player(40, TELEPORT_PASSIVE); @@ -2247,7 +2221,7 @@ static void process_world_aux_mutation(void) { if (!p_ptr->resist_conf && !p_ptr->resist_chaos) { - disturb(0, 1); + disturb(FALSE, TRUE); p_ptr->redraw |= PR_EXTRA; msg_print(_("ãã²ãããã¼ãã¼ã¨ã²ã¦ãããããµã...ããã¯ï¼", "You feel a SSSCHtupor cOmINg over yOu... *HIC*!")); } @@ -2284,7 +2258,7 @@ static void process_world_aux_mutation(void) { if (!p_ptr->resist_chaos) { - disturb(0, 1); + disturb(FALSE, TRUE); p_ptr->redraw |= PR_EXTRA; (void)set_image(p_ptr->image + randint0(50) + 20); } @@ -2292,10 +2266,8 @@ static void process_world_aux_mutation(void) if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13)) { - disturb(0, 1); - + disturb(FALSE, TRUE); msg_print(_("ãã¥ã¼ã¼ãï¼ãã£ã¨ã", "BRRAAAP! Oops.")); - msg_print(NULL); fire_ball(GF_POIS, 0, p_ptr->lev, 3); } @@ -2304,7 +2276,7 @@ static void process_world_aux_mutation(void) !p_ptr->anti_magic && one_in_(9000)) { int dire = 0; - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("éæ³ã®ã¨ãã«ã®ã¼ãçªç¶ããªãã®ä¸ã«æµãè¾¼ãã§ããï¼ã¨ãã«ã®ã¼ã解æ¾ããªããã°ãªããªãï¼", "Magical energy flows through you! You must release it!")); @@ -2314,26 +2286,24 @@ static void process_world_aux_mutation(void) fire_ball(GF_MANA, dire, p_ptr->lev * 2, 3); } - if ((p_ptr->muta2 & MUT2_ATT_DEMON) && - !p_ptr->anti_magic && (randint1(6666) == 666)) + if ((p_ptr->muta2 & MUT2_ATT_DEMON) && !p_ptr->anti_magic && (randint1(6666) == 666)) { bool pet = one_in_(6); - u32b mode = PM_ALLOW_GROUP; + BIT_FLAGS mode = PM_ALLOW_GROUP; if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); - if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, - dun_level, SUMMON_DEMON, mode)) + if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, mode)) { msg_print(_("ããªãã¯ãã¼ã¢ã³ãå¼ãå¯ããï¼", "You have attracted a demon!")); - disturb(0, 1); + disturb(FALSE, TRUE); } } if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000)) { - disturb(0, 1); + disturb(FALSE, TRUE); if (one_in_(2)) { msg_print(_("ç²¾åçã§ãªããªã£ãæ°ãããã", "You feel less energetic.")); @@ -2364,7 +2334,7 @@ static void process_world_aux_mutation(void) } if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000)) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("çªç¶ã»ã¨ãã©å¤ç¬ã«ãªã£ãæ°ãããã", "You suddenly feel almost lonely.")); banish_monsters(100); @@ -2425,11 +2395,10 @@ static void process_world_aux_mutation(void) unlite_area(50, 10); } - if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && - !p_ptr->anti_magic && one_in_(7000)) + if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) && !p_ptr->anti_magic && one_in_(7000)) { bool pet = one_in_(3); - u32b mode = PM_ALLOW_GROUP; + BIT_FLAGS mode = PM_ALLOW_GROUP; if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); @@ -2437,14 +2406,13 @@ static void process_world_aux_mutation(void) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_ANIMAL, mode)) { msg_print(_("åç©ãå¼ãå¯ããï¼", "You have attracted an animal!")); - disturb(0, 1); + disturb(FALSE, TRUE); } } - if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && - !p_ptr->anti_magic && one_in_(8000)) + if ((p_ptr->muta2 & MUT2_RAW_CHAOS) && !p_ptr->anti_magic && one_in_(8000)) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("å¨ãã®ç©ºéãæªãã§ããæ°ãããï¼", "You feel the world warping around you!")); msg_print(NULL); @@ -2457,7 +2425,7 @@ static void process_world_aux_mutation(void) } if ((p_ptr->muta2 & MUT2_WRAITH) && !p_ptr->anti_magic && one_in_(3000)) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("éç©è³ªåããï¼", "You feel insubstantial!")); msg_print(NULL); @@ -2469,7 +2437,7 @@ static void process_world_aux_mutation(void) } if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000)) { - int which_stat = randint0(6); + int which_stat = randint0(A_MAX); int sustained = FALSE; switch (which_stat) @@ -2499,17 +2467,16 @@ static void process_world_aux_mutation(void) if (!sustained) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("èªåãè¡°å¼±ãã¦ããã®ãåããï¼", "You can feel yourself wasting away!")); msg_print(NULL); (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3)); } } - if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && - !p_ptr->anti_magic && one_in_(3000)) + if ((p_ptr->muta2 & MUT2_ATT_DRAGON) && !p_ptr->anti_magic && one_in_(3000)) { bool pet = one_in_(5); - u32b mode = PM_ALLOW_GROUP; + BIT_FLAGS mode = PM_ALLOW_GROUP; if (pet) mode |= PM_FORCE_PET; else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET); @@ -2517,11 +2484,10 @@ static void process_world_aux_mutation(void) if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, dun_level, SUMMON_DRAGON, mode)) { msg_print(_("ãã©ã´ã³ãå¼ãå¯ããï¼", "You have attracted a dragon!")); - disturb(0, 1); + disturb(FALSE, TRUE); } } - if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && - one_in_(3000)) + if ((p_ptr->muta2 & MUT2_WEIRD_MIND) && !p_ptr->anti_magic && one_in_(3000)) { if (p_ptr->tim_esp > 0) { @@ -2534,10 +2500,9 @@ static void process_world_aux_mutation(void) set_tim_esp(p_ptr->lev, FALSE); } } - if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && - one_in_(9000)) + if ((p_ptr->muta2 & MUT2_NAUSEA) && !p_ptr->slow_digest && one_in_(9000)) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("èãçæ£ããé£äºã失ã£ãï¼", "Your stomach roils, and you lose your lunch!")); msg_print(NULL); set_food(PY_FOOD_WEAK); @@ -2545,8 +2510,7 @@ static void process_world_aux_mutation(void) if (hex_spelling_any()) stop_hex_spell_all(); } - if ((p_ptr->muta2 & MUT2_WALK_SHAD) && - !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena) + if ((p_ptr->muta2 & MUT2_WALK_SHAD) && !p_ptr->anti_magic && one_in_(12000) && !p_ptr->inside_arena) { alter_reality(); } @@ -2554,12 +2518,12 @@ static void process_world_aux_mutation(void) if ((p_ptr->muta2 & MUT2_WARNING) && one_in_(1000)) { int danger_amount = 0; - int monster; + MONSTER_IDX monster; for (monster = 0; monster < m_max; monster++) { - monster_type *m_ptr = &m_list[monster]; - monster_race *r_ptr = &r_info[m_ptr->r_idx]; + monster_type *m_ptr = &m_list[monster]; + monster_race *r_ptr = &r_info[m_ptr->r_idx]; /* Paranoia -- Skip dead monsters */ if (!m_ptr->r_idx) continue; @@ -2583,61 +2547,51 @@ static void process_world_aux_mutation(void) else msg_print(_("å¯ããæ°ãããã", "You feel lonely.")); } - if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && - one_in_(5000)) + + if ((p_ptr->muta2 & MUT2_INVULN) && !p_ptr->anti_magic && one_in_(5000)) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("ç¡æµãªæ°ãããï¼", "You feel invincible!")); msg_print(NULL); (void)set_invuln(randint1(8) + 8, FALSE); } + if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000)) { - int wounds = p_ptr->mhp - p_ptr->chp; + MANA_POINT wounds = (MANA_POINT)(p_ptr->mhp - p_ptr->chp); if (wounds > 0) { - int healing = p_ptr->csp; - - if (healing > wounds) - { - healing = wounds; - } + HIT_POINT healing = p_ptr->csp; + if (healing > wounds) healing = wounds; hp_player(healing); p_ptr->csp -= healing; - - /* Redraw mana */ - p_ptr->redraw |= (PR_MANA); + p_ptr->redraw |= (PR_HP | PR_MANA); } } - if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && - one_in_(4000)) + + if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic && one_in_(4000)) { - int wounds = p_ptr->msp - p_ptr->csp; + HIT_POINT wounds = (HIT_POINT)(p_ptr->msp - p_ptr->csp); if (wounds > 0) { - int healing = p_ptr->chp; - - if (healing > wounds) - { - healing = wounds; - } + HIT_POINT healing = p_ptr->chp; + if (healing > wounds) healing = wounds; p_ptr->csp += healing; - - /* Redraw mana */ - p_ptr->redraw |= (PR_MANA); + p_ptr->redraw |= (PR_HP | PR_MANA); take_hit(DAMAGE_LOSELIFE, healing, _("é ã«æã£ãè¡", "blood rushing to the head"), -1); } } + if ((p_ptr->muta2 & MUT2_DISARM) && one_in_(10000)) { - int slot = 0; + INVENTORY_IDX slot = 0; object_type *o_ptr = NULL; - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("足ããã¤ãã¦è»¢ãã ï¼", "You trip over your own feet!")); take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), _("転å", "tripping"), -1); @@ -2658,13 +2612,13 @@ static void process_world_aux_mutation(void) o_ptr = &inventory[INVEN_LARM]; slot = INVEN_LARM; } - if (slot && !object_is_cursed(o_ptr)) { msg_print(_("æ¦å¨ãè½ã¨ãã¦ãã¾ã£ãï¼", "You drop your weapon!")); inven_drop(slot, 1); } } + } /*! @@ -2689,7 +2643,7 @@ static void process_world_aux_curse(void) /* Scan the equipment with random teleport ability */ for (i = INVEN_RARM; i < INVEN_TOTAL; i++) { - u32b flgs[TR_FLAG_SIZE]; + BIT_FLAGS flgs[TR_FLAG_SIZE]; o_ptr = &inventory[i]; /* Skip non-objects */ @@ -2714,14 +2668,14 @@ static void process_world_aux_curse(void) msg_format(_("%sããã¬ãã¼ãã®è½åãçºåããããã¨ãã¦ããã", "Your %s is activating teleportation."), o_name); if (get_check_strict(_("ãã¬ãã¼ããã¾ããï¼", "Teleport? "), CHECK_OKAY_CANCEL)) { - disturb(0, 1); + disturb(FALSE, TRUE); teleport_player(50, 0L); } else { msg_format(_("%sã«{.}(ããªãªã)ã¨éãå»ãã¨çºåãæå¶ã§ãã¾ãã", "You can inscribe {.} on your %s to disable random teleportation. "), o_name); - disturb(1, 1); + disturb(TRUE, TRUE); } } /* Make a chainsword noise */ @@ -2739,19 +2693,18 @@ static void process_world_aux_curse(void) (void)activate_ty_curse(FALSE, &count); } /* Handle experience draining */ - if (p_ptr->prace != RACE_ANDROID && - ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4))) + if (p_ptr->prace != RACE_ANDROID && ((p_ptr->cursed & TRC_DRAIN_EXP) && one_in_(4))) { - p_ptr->exp -= (p_ptr->lev+1)/2; + p_ptr->exp -= (p_ptr->lev + 1) / 2; if (p_ptr->exp < 0) p_ptr->exp = 0; - p_ptr->max_exp -= (p_ptr->lev+1)/2; + p_ptr->max_exp -= (p_ptr->lev + 1) / 2; if (p_ptr->max_exp < 0) p_ptr->max_exp = 0; check_experience(); } /* Add light curse (Later) */ if ((p_ptr->cursed & TRC_ADD_L_CURSE) && one_in_(2000)) { - u32b new_curse; + BIT_FLAGS new_curse; object_type *o_ptr; o_ptr = choose_cursed_obj_name(TRC_ADD_L_CURSE); @@ -2774,7 +2727,7 @@ static void process_world_aux_curse(void) /* Add heavy curse (Later) */ if ((p_ptr->cursed & TRC_ADD_H_CURSE) && one_in_(2000)) { - u32b new_curse; + BIT_FLAGS new_curse; object_type *o_ptr; o_ptr = choose_cursed_obj_name(TRC_ADD_H_CURSE); @@ -2803,7 +2756,7 @@ static void process_world_aux_curse(void) object_desc(o_name, choose_cursed_obj_name(TRC_CALL_ANIMAL), (OD_OMIT_PREFIX | OD_NAME_ONLY)); msg_format(_("%sãåç©ãå¼ãå¯ããï¼", "Your %s have attracted an animal!"), o_name); - disturb(0, 1); + disturb(FALSE, TRUE); } } /* Call demon */ @@ -2815,7 +2768,7 @@ static void process_world_aux_curse(void) object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DEMON), (OD_OMIT_PREFIX | OD_NAME_ONLY)); msg_format(_("%sãæªéãå¼ãå¯ããï¼", "Your %s have attracted a demon!"), o_name); - disturb(0, 1); + disturb(FALSE, TRUE); } } /* Call dragon */ @@ -2828,7 +2781,7 @@ static void process_world_aux_curse(void) object_desc(o_name, choose_cursed_obj_name(TRC_CALL_DRAGON), (OD_OMIT_PREFIX | OD_NAME_ONLY)); msg_format(_("%sããã©ã´ã³ãå¼ãå¯ããï¼", "Your %s have attracted an dragon!"), o_name); - disturb(0, 1); + disturb(FALSE, TRUE); } } /* Call undead */ @@ -2841,14 +2794,14 @@ static void process_world_aux_curse(void) object_desc(o_name, choose_cursed_obj_name(TRC_CALL_UNDEAD), (OD_OMIT_PREFIX | OD_NAME_ONLY)); msg_format(_("%sãæ»éãå¼ãå¯ããï¼", "Your %s have attracted an undead!"), o_name); - disturb(0, 1); + disturb(FALSE, TRUE); } } if ((p_ptr->cursed & TRC_COWARDICE) && one_in_(1500)) { if (!p_ptr->resist_fear) { - disturb(0, 1); + disturb(FALSE, TRUE); msg_print(_("ã¨ã¦ãæã... ã¨ã¦ãæãï¼", "It's so dark... so scary!")); set_afraid(p_ptr->afraid + 13 + randint1(26)); } @@ -2856,7 +2809,7 @@ static void process_world_aux_curse(void) /* Teleport player */ if ((p_ptr->cursed & TRC_TELEPORT) && one_in_(200) && !p_ptr->anti_tele) { - disturb(0, 1); + disturb(FALSE, TRUE); /* Teleport player */ teleport_player(40, TELEPORT_PASSIVE); @@ -2894,19 +2847,11 @@ static void process_world_aux_curse(void) if (o_ptr->name1 == ART_JUDGE) { -#ifdef JP if (object_is_known(o_ptr)) - msg_print("ã審å¤ã®å®ç³ãã¯ããªãã®ä½åãå¸åããï¼"); + msg_print(_("ã審å¤ã®å®ç³ãã¯ããªãã®ä½åãå¸åããï¼", "The Jewel of Judgement drains life from you!")); else - msg_print("ãªã«ããããªãã®ä½åãå¸åããï¼"); - take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "審å¤ã®å®ç³", -1); -#else - if (object_is_known(o_ptr)) - msg_print("The Jewel of Judgement drains life from you!"); - else - msg_print("Something drains life from you!"); - take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), "the Jewel of Judgement", -1); -#endif + msg_print(_("ãªã«ããããªãã®ä½åãå¸åããï¼", "Something drains life from you!")); + take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev, 50), _("審å¤ã®å®ç³", "the Jewel of Judgement"), -1); } } } @@ -2949,7 +2894,6 @@ static void process_world_aux_recharge(void) /* Notice changes */ if (changed) { - /* Window stuff */ p_ptr->window |= (PW_EQUIP); wild_regen = 20; } @@ -2971,8 +2915,8 @@ static void process_world_aux_recharge(void) if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout)) { /* Determine how many rods are charging. */ - int temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval; - if (temp > o_ptr->number) temp = o_ptr->number; + TIME_EFFECT temp = (o_ptr->timeout + (k_ptr->pval - 1)) / k_ptr->pval; + if (temp > o_ptr->number) temp = (TIME_EFFECT)o_ptr->number; /* Decrease timeout by that number. */ o_ptr->timeout -= temp; @@ -2998,7 +2942,6 @@ static void process_world_aux_recharge(void) /* Notice changes */ if (changed) { - /* Window stuff */ p_ptr->window |= (PW_INVEN); wild_regen = 20; } @@ -3016,7 +2959,7 @@ static void process_world_aux_recharge(void) if ((o_ptr->tval == TV_ROD) && (o_ptr->timeout)) { /* Charge it */ - o_ptr->timeout -= o_ptr->number; + o_ptr->timeout -= (TIME_EFFECT)o_ptr->number; /* Boundary control. */ if (o_ptr->timeout < 0) o_ptr->timeout = 0; @@ -3052,13 +2995,12 @@ static void process_world_aux_movement(void) if (!p_ptr->word_recall) { /* Disturbing! */ - disturb(0, 1); + disturb(FALSE, TRUE); /* Determine the level */ if (dun_level || p_ptr->inside_quest || p_ptr->enter_dungeon) { - msg_print(_("ä¸ã«å¼ã£å¼µããããããæããããï¼", - "You feel yourself yanked upwards!")); + msg_print(_("ä¸ã«å¼ã£å¼µããããããæããããï¼", "You feel yourself yanked upwards!")); if (dungeon_type) p_ptr->recall_dungeon = dungeon_type; if (record_stair) @@ -3076,8 +3018,7 @@ static void process_world_aux_movement(void) } else { - msg_print(_("ä¸ã«å¼ãããéããããæããããï¼", - "You feel yourself yanked downwards!")); + msg_print(_("ä¸ã«å¼ãããéããããæããããï¼", "You feel yourself yanked downwards!")); dungeon_type = p_ptr->recall_dungeon; @@ -3150,7 +3091,6 @@ static void process_world_aux_movement(void) } } - /* Sound */ sound(SOUND_TPLEVEL); } } @@ -3171,7 +3111,7 @@ static void process_world_aux_movement(void) if (!p_ptr->alter_reality) { /* Disturbing! */ - disturb(0, 1); + disturb(FALSE, TRUE); /* Determine the level */ if (!quest_number(dun_level) && dun_level) @@ -3192,7 +3132,6 @@ static void process_world_aux_movement(void) msg_print(_("ä¸çãå°ãã®éå¤åããããã ã", "The world seems to change for a moment!")); } - /* Sound */ sound(SOUND_TPLEVEL); } } @@ -3205,11 +3144,11 @@ static void process_world_aux_movement(void) * @param m_idx é£æ¥æ°ã調ã¹ããã¢ã³ã¹ã¿ã¼ã®ID * @return é£æ¥ãã¦ããã¢ã³ã¹ã¿ã¼ã®æ° */ -static int get_monster_crowd_number(int m_idx) +static int get_monster_crowd_number(MONSTER_IDX m_idx) { monster_type *m_ptr = &m_list[m_idx]; - int my = m_ptr->fy; - int mx = m_ptr->fx; + POSITION my = m_ptr->fy; + POSITION mx = m_ptr->fx; int i; int count = 0; @@ -3243,7 +3182,7 @@ static byte get_dungeon_feeling(void) { const int base = 10; int rating = 0; - int i; + IDX i; /* Hack -- no feeling in the town */ if (!dun_level) return 0; @@ -3328,7 +3267,7 @@ static byte get_dungeon_feeling(void) /* Artifacts */ if (object_is_artifact(o_ptr)) { - s32b cost = object_value_real(o_ptr); + PRICE cost = object_value_real(o_ptr); delta += 10 * base; if (cost > 10000L) delta += 10 * base; @@ -3340,27 +3279,16 @@ static byte get_dungeon_feeling(void) } if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base; - if (o_ptr->tval == TV_SHIELD && - o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base; - if (o_ptr->tval == TV_GLOVES && - o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base; - if (o_ptr->tval == TV_BOOTS && - o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base; - if (o_ptr->tval == TV_HELM && - o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base; - if (o_ptr->tval == TV_RING && - o_ptr->sval == SV_RING_SPEED && - !object_is_cursed(o_ptr)) delta += 25 * base; - if (o_ptr->tval == TV_RING && - o_ptr->sval == SV_RING_LORDLY && - !object_is_cursed(o_ptr)) delta += 15 * base; - if (o_ptr->tval == TV_AMULET && - o_ptr->sval == SV_AMULET_THE_MAGI && - !object_is_cursed(o_ptr)) delta += 15 * base; + if (o_ptr->tval == TV_SHIELD && o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base; + if (o_ptr->tval == TV_GLOVES && o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base; + if (o_ptr->tval == TV_BOOTS && o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base; + if (o_ptr->tval == TV_HELM && o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base; + if (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_SPEED && !object_is_cursed(o_ptr)) delta += 25 * base; + if (o_ptr->tval == TV_RING && o_ptr->sval == SV_RING_LORDLY && !object_is_cursed(o_ptr)) delta += 15 * base; + if (o_ptr->tval == TV_AMULET && o_ptr->sval == SV_AMULET_THE_MAGI && !object_is_cursed(o_ptr)) delta += 15 * base; /* Out-of-depth objects */ - if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) && - k_ptr->level > dun_level) + if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) && k_ptr->level > dun_level) { /* Rating increase */ delta += (k_ptr->level - dun_level) * base; @@ -3435,8 +3363,7 @@ static void update_dungeon_feeling(void) /* Update the level indicator */ p_ptr->redraw |= (PR_DEPTH); - /* Disturb */ - if (disturb_minor) disturb(0, 0); + if (disturb_minor) disturb(FALSE, FALSE); } /*! @@ -3520,7 +3447,7 @@ static void process_world(void) p_ptr->energy_need = 0; battle_monsters(); } - else if (turn - old_turn == 150*TURNS_PER_TICK) + else if (turn - old_turn == 150 * TURNS_PER_TICK) { msg_print(_("ç³ãåãããã¾ãããããã®åè² ã¯å¼ãåãã¨ããã¦ããã ãã¾ãã", "This battle have ended in a draw.")); p_ptr->au += kakekin; @@ -3543,13 +3470,11 @@ static void process_world(void) /* Warning */ if (closing_flag <= 2) { - /* Disturb */ - disturb(0, 1); + disturb(FALSE, TRUE); /* Count warnings */ closing_flag++; - /* Message */ msg_print(_("ã¢ã³ã°ãã³ãã¸ã®éãéãããã£ã¦ãã¾ã...", "The gates to ANGBAND are closing...")); msg_print(_("ã²ã¼ã ãçµäºãããã»ã¼ãããããã¦ä¸ããã", "Please finish up and/or save your game.")); @@ -3558,7 +3483,6 @@ static void process_world(void) /* Slam the gate */ else { - /* Message */ msg_print(_("ä»ãã¢ã³ã°ãã³ãã¸ã®éãéãããã¾ããã", "The gates to ANGBAND are now closed.")); /* Stop playing */ @@ -3595,94 +3519,9 @@ static void process_world(void) /* Check for dawn */ dawn = (!(turn % (TURNS_PER_TICK * TOWN_DAWN))); - /* Day breaks */ - if (dawn) - { - int y, x; - - /* Message */ - msg_print(_("å¤ãæããã", "The sun has risen.")); - - if (!p_ptr->wild_mode) - { - /* Hack -- Scan the town */ - for (y = 0; y < cur_hgt; y++) - { - for (x = 0; x < cur_wid; x++) - { - /* Get the cave grid */ - cave_type *c_ptr = &cave[y][x]; - - /* Assume lit */ - c_ptr->info |= (CAVE_GLOW); - - /* Hack -- Memorize lit grids if allowed */ - if (view_perma_grids) c_ptr->info |= (CAVE_MARK); - - /* Hack -- Notice spot */ - note_spot(y, x); - } - } - } - } - - /* Night falls */ - else - { - int y, x; - - /* Message */ - msg_print(_("æ¥ãæ²ãã ã", "The sun has fallen.")); - - if (!p_ptr->wild_mode) - { - /* Hack -- Scan the town */ - for (y = 0; y < cur_hgt; y++) - { - for (x = 0; x < cur_wid; x++) - { - /* Get the cave grid */ - cave_type *c_ptr = &cave[y][x]; - - /* Feature code (applying "mimic" field) */ - feature_type *f_ptr = &f_info[get_feat_mimic(c_ptr)]; - - if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) && - !have_flag(f_ptr->flags, FF_ENTRANCE)) - { - /* Assume dark */ - c_ptr->info &= ~(CAVE_GLOW); - - if (!have_flag(f_ptr->flags, FF_REMEMBER)) - { - /* Forget the normal floor grid */ - c_ptr->info &= ~(CAVE_MARK); - - /* Hack -- Notice spot */ - note_spot(y, x); - } - } - } - - /* Glow deep lava and building entrances */ - glow_deep_lava_and_bldg(); - } - } - } - - /* Update the monsters */ - p_ptr->update |= (PU_MONSTERS | PU_MON_LITE); + if (dawn) day_break(); + else night_falls(); - /* Redraw map */ - p_ptr->redraw |= (PR_MAP); - - /* Window stuff */ - p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); - - if (p_ptr->special_defense & NINJA_S_STEALTH) - { - if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE); - } } } @@ -3697,7 +3536,8 @@ static void process_world(void) /* Sometimes, shuffle the shop-keepers */ if (one_in_(STORE_SHUFFLE)) { - int n, i; + int n; + FEAT_IDX i; /* Pick a random shop (except home and museum) */ do @@ -3721,7 +3561,6 @@ static void process_world(void) /* Verify store type */ if (f_ptr->subtype == n) { - /* Message */ if (cheat_xtra) msg_format(_("%sã®åºä¸»ãã·ã£ããã«ãã¾ãã", "Shuffle a Shopkeeper of %s."), f_name + f_ptr->name); /* Shuffle it */ @@ -3746,8 +3585,8 @@ static void process_world(void) } /* Hack -- Check for creature regeneration */ - if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters(); - if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters(); + if (!(turn % (TURNS_PER_TICK * 10)) && !p_ptr->inside_battle) regen_monsters(); + if (!(turn % (TURNS_PER_TICK * 3))) regen_captured_monsters(); if (!p_ptr->leaving) { @@ -3773,16 +3612,17 @@ static void process_world(void) /* * Nightmare mode activates the TY_CURSE at midnight - * * Require exact minute -- Don't activate multiple times in a minute */ + if (ironman_nightmare && (min != prev_min)) { + /* Every 15 minutes after 11:00 pm */ if ((hour == 23) && !(min % 15)) { /* Disturbing */ - disturb(0, 1); + disturb(FALSE, TRUE); switch (min / 15) { @@ -3807,82 +3647,33 @@ static void process_world(void) /* TY_CURSE activates at midnight! */ if (!hour && !min) { - int count = 0; - disturb(1, 1); + disturb(TRUE, TRUE); msg_print(_("é ãã§éãä½åãé³´ããæ»ãã ãããªéããã®ä¸ã¸æ¶ãã¦ãã£ãã", "A distant bell tolls many times, fading into an deathly silence.")); - activate_ty_curse(FALSE, &count); - } - } - - - /*** Check the Food, and Regenerate ***/ - - if (!p_ptr->inside_battle) - { - /* Digest quickly when gorged */ - if (p_ptr->food >= PY_FOOD_MAX) - { - /* Digest a lot of food */ - (void)set_food(p_ptr->food - 100); - } - - /* Digest normally -- Every 50 game turns */ - else if (!(turn % (TURNS_PER_TICK*5))) - { - /* Basic digestion rate based on speed */ - int digestion = SPEED_TO_ENERGY(p_ptr->pspeed); - - /* Regeneration takes more food */ - if (p_ptr->regenerate) - digestion += 20; - if (p_ptr->special_defense & (KAMAE_MASK | KATA_MASK)) - digestion += 20; - if (p_ptr->cursed & TRC_FAST_DIGEST) - digestion += 30; - - /* Slow digestion takes less food */ - if (p_ptr->slow_digest) - digestion -= 5; - /* Minimal digestion */ - if (digestion < 1) digestion = 1; - /* Maximal digestion */ - if (digestion > 100) digestion = 100; - - /* Digest some food */ - (void)set_food(p_ptr->food - digestion); - } - - - /* Getting Faint */ - if ((p_ptr->food < PY_FOOD_FAINT)) - { - /* Faint occasionally */ - if (!p_ptr->paralyzed && (randint0(100) < 10)) + if (p_ptr->wild_mode) { - /* Message */ - msg_print(_("ãã¾ãã«ãç©ºè ¹ã§æ°çµ¶ãã¦ãã¾ã£ãã", "You faint from the lack of food.")); - disturb(1, 1); + /* Go into large wilderness view */ + p_ptr->oldpy = randint1(MAX_HGT - 2); + p_ptr->oldpx = randint1(MAX_WID - 2); + change_wild_mode(); - /* Hack -- faint (bypass free action) */ - (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5)); - } + /* Give first move to monsters */ + p_ptr->energy_use = 100; - /* Starve to death (slowly) */ - if (p_ptr->food < PY_FOOD_STARVE) - { - /* Calculate damage */ - int dam = (PY_FOOD_STARVE - p_ptr->food) / 10; - - /* Take damage */ - if (!IS_INVULN()) take_hit(DAMAGE_LOSELIFE, dam, _("ç©ºè ¹", "starvation"), -1); + /* HACk -- set the encouter flag for the wilderness generation */ + generate_encounter = TRUE; } + + invoking_midnight_curse = TRUE; } } + /* Check the Food */ + process_world_aux_digestion(); + /* Process timed damage and regeneration */ process_world_aux_hp_and_sp(); @@ -4039,20 +3830,16 @@ extern void do_cmd_borg(void); /*! * @brief ãã¬ã¤ã¤ã¼ããåããå ¥åã³ãã³ãã®åå²å¦çã * / Parse and execute the current command Give "Warning" on illegal commands. - * @todo XXX XXX XXX Make some "blocks" + * @todo Make some "blocks" * @return ãªã */ static void process_command(void) { - int old_now_message = now_message; - -#ifdef ALLOW_REPEAT /* TNB */ + COMMAND_CODE old_now_message = now_message; /* Handle repeating the last command */ repeat_check(); -#endif /* ALLOW_REPEAT -- TNB */ - now_message = 0; /* Sniper */ @@ -4091,8 +3878,6 @@ static void process_command(void) p_ptr->wizard = TRUE; msg_print(_("ã¦ã£ã¶ã¼ãã¢ã¼ãçªå ¥ã", "Wizard mode on.")); } - - /* Update monsters */ p_ptr->update |= (PU_MONSTERS); /* Redraw "title" */ @@ -4217,32 +4002,14 @@ static void process_command(void) /* Move (usually pick up things) */ case ';': { -#ifdef ALLOW_EASY_DISARM /* TNB */ - do_cmd_walk(FALSE); - -#else /* ALLOW_EASY_DISARM -- TNB */ - - do_cmd_walk(always_pickup); - -#endif /* ALLOW_EASY_DISARM -- TNB */ - break; } /* Move (usually do not pick up) */ case '-': { -#ifdef ALLOW_EASY_DISARM /* TNB */ - do_cmd_walk(TRUE); - -#else /* ALLOW_EASY_DISARM -- TNB */ - - do_cmd_walk(!always_pickup); - -#endif /* ALLOW_EASY_DISARM -- TNB */ - break; } @@ -4552,10 +4319,7 @@ static void process_command(void) /* Throw an item */ case 'v': { - if (!p_ptr->wild_mode) - { - do_cmd_throw(); - } + if (!p_ptr->wild_mode) do_cmd_throw(1, FALSE, -1); break; } @@ -4938,7 +4702,7 @@ static void process_command(void) * @param r_idx å¤å®ãããã¢ã³ã¹ã¿ã¼ç¨®æã®ID * @return é£ãã対象ãªãã°TRUEãè¿ã */ -static bool monster_tsuri(int r_idx) +static bool monster_tsuri(MONRACE_IDX r_idx) { monster_race *r_ptr = &r_info[r_idx]; @@ -4961,22 +4725,19 @@ static void pack_overflow(void) object_type *o_ptr; /* Is auto-destroy done? */ - notice_stuff(); + handle_stuff(); if (!inventory[INVEN_PACK].k_idx) return; /* Access the slot to be dropped */ o_ptr = &inventory[INVEN_PACK]; /* Disturbing */ - disturb(0, 1); + disturb(FALSE, TRUE); /* Warning */ msg_print(_("ã¶ãã¯ããã¢ã¤ãã ãããµããï¼", "Your pack overflows!")); - - /* Describe */ object_desc(o_name, o_ptr, 0); - /* Message */ msg_format(_("%s(%c)ãè½ã¨ããã", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK)); /* Drop it (carefully) near the player */ @@ -4987,10 +4748,6 @@ static void pack_overflow(void) inven_item_describe(INVEN_PACK); inven_item_optimize(INVEN_PACK); - /* Handle "p_ptr->notice" */ - notice_stuff(); - - /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */ handle_stuff(); } } @@ -5034,7 +4791,7 @@ static void process_upkeep_with_speed(void) */ static void process_player(void) { - int i; + IDX i; /*** Apply energy ***/ @@ -5046,6 +4803,13 @@ static void process_player(void) hack_mutation = FALSE; } + if (invoking_midnight_curse) + { + int count = 0; + activate_ty_curse(FALSE, &count); + invoking_midnight_curse = FALSE; + } + if (p_ptr->inside_battle) { for(i = 1; i < m_max; i++) @@ -5054,11 +4818,8 @@ static void process_player(void) if (!m_ptr->r_idx) continue; - /* Hack -- Detect monster */ m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW); - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); } prt_time(); } @@ -5079,7 +4840,7 @@ static void process_player(void) if (resting < 0) { /* Basic resting */ - if (resting == -1) + if (resting == COMMAND_ARG_REST_FULL_HEALING) { /* Stop resting */ if ((p_ptr->chp == p_ptr->mhp) && @@ -5090,7 +4851,7 @@ static void process_player(void) } /* Complete resting */ - else if (resting == -2) + else if (resting == COMMAND_ARG_REST_UNTIL_DONE) { /* Stop resting */ if ((p_ptr->chp == p_ptr->mhp) && @@ -5109,20 +4870,19 @@ static void process_player(void) if (p_ptr->action == ACTION_FISH) { - /* Delay */ Term_xtra(TERM_XTRA_DELAY, 10); if (one_in_(1000)) { - int r_idx; + MONRACE_IDX r_idx; bool success = FALSE; get_mon_num_prep(monster_tsuri,NULL); r_idx = get_mon_num(dun_level ? dun_level : wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].level); msg_print(NULL); if (r_idx && one_in_(2)) { - int y, x; - y = p_ptr->y+ddy[tsuri_dir]; - x = p_ptr->x+ddx[tsuri_dir]; + POSITION y, x; + y = p_ptr->y + ddy[p_ptr->fishing_dir]; + x = p_ptr->x + ddx[p_ptr->fishing_dir]; if (place_monster_aux(0, y, x, r_idx, PM_NO_KAGE)) { char m_name[80]; @@ -5135,7 +4895,7 @@ static void process_player(void) { msg_print(_("é¤ã ãé£ããã¦ãã¾ã£ãï¼ãã£ãï½ï¼", "Damn! The fish stole your bait!")); } - disturb(0, 1); + disturb(FALSE, TRUE); } } @@ -5151,11 +4911,9 @@ static void process_player(void) /* Check for a key */ if (inkey()) { - /* Flush input */ - flush(); + flush(); /* Flush input */ - /* Disturb */ - disturb(0, 1); + disturb(FALSE, TRUE); /* Hack -- Show a Message */ msg_print(_("ä¸æãã¾ããã", "Canceled.")); @@ -5174,8 +4932,6 @@ static void process_player(void) /* Recover fully */ (void)set_monster_csleep(p_ptr->riding, 0); - - /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); msg_format(_("%^sãèµ·ãããã", "You have waked %s up."), m_name); } @@ -5187,11 +4943,7 @@ static void process_player(void) (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1))) { char m_name[80]; - - /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); - - /* Dump a message */ msg_format(_("%^sãæ¦æ§ç¶æ ããç«ã¡ç´ãããã", "%^s is no longer stunned."), m_name); } } @@ -5203,11 +4955,7 @@ static void process_player(void) (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1))) { char m_name[80]; - - /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); - - /* Dump a message */ msg_format(_("%^sãæ··ä¹±ç¶æ ããç«ã¡ç´ãããã", "%^s is no longer confused."), m_name); } } @@ -5215,15 +4963,11 @@ static void process_player(void) if (MON_MONFEAR(m_ptr)) { /* Hack -- Recover from fear */ - if (set_monster_monfear(p_ptr->riding, + if(set_monster_monfear(p_ptr->riding, (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1))) { char m_name[80]; - - /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); - - /* Dump a message */ msg_format(_("%^sãææããç«ã¡ç´ãããã", "%^s is no longer fear."), m_name); } } @@ -5239,13 +4983,10 @@ static void process_player(void) { (void)set_lightspeed(p_ptr->lightspeed - 1, TRUE); } - if ((p_ptr->pclass == CLASS_FORCETRAINER) && (p_ptr->magic_num1[0])) + if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI) { - if (p_ptr->magic_num1[0] < 40) - { - p_ptr->magic_num1[0] = 0; - } - else p_ptr->magic_num1[0] -= 40; + if(P_PTR_KI < 40) P_PTR_KI = 0; + else P_PTR_KI -= 40; p_ptr->update |= (PU_BONUS); } if (p_ptr->action == ACTION_LEARN) @@ -5255,7 +4996,6 @@ static void process_player(void) /* Convert the unit (1/2^16) to (1/2^32) */ s64b_LSHIFT(cost, cost_frac, 16); - if (s64b_cmp(p_ptr->csp, p_ptr->csp_frac, cost, cost_frac) < 0) { @@ -5298,10 +5038,6 @@ static void process_player(void) p_ptr->counter = FALSE; now_damaged = FALSE; - /* Handle "p_ptr->notice" */ - notice_stuff(); - - /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */ handle_stuff(); /* Place the cursor on the player */ @@ -5310,19 +5046,15 @@ static void process_player(void) /* Refresh (optional) */ if (fresh_before) Term_fresh(); - /* Hack -- Pack Overflow */ pack_overflow(); - /* Hack -- cancel "lurking browse mode" */ if (!command_new) command_see = FALSE; - /* Assume free turn */ p_ptr->energy_use = 0; - if (p_ptr->inside_battle) { /* Place the cursor on the player */ @@ -5337,7 +5069,6 @@ static void process_player(void) /* Paralyzed or Knocked Out */ else if (p_ptr->paralyzed || (p_ptr->stun >= 100)) { - /* Take a turn */ p_ptr->energy_use = 100; } @@ -5356,14 +5087,12 @@ static void process_player(void) p_ptr->redraw |= (PR_STATE); } - /* Take a turn */ p_ptr->energy_use = 100; } /* Fishing */ else if (p_ptr->action == ACTION_FISH) { - /* Take a turn */ p_ptr->energy_use = 100; } @@ -5389,11 +5118,8 @@ static void process_player(void) /* Count this execution */ command_rep--; - /* Redraw the state */ p_ptr->redraw |= (PR_STATE); - - /* Redraw stuff */ - redraw_stuff(); + handle_stuff(); /* Hack -- Assume messages were seen */ msg_flag = FALSE; @@ -5528,9 +5254,7 @@ static void process_player(void) /* Assume invisible */ m_ptr->ml = FALSE; - - /* Update the monster */ - update_mon(i, FALSE); + update_monster(i, FALSE); if (p_ptr->health_who == i) p_ptr->redraw |= (PR_HEALTH); if (p_ptr->riding == i) p_ptr->redraw |= (PR_UHEALTH); @@ -5563,13 +5287,10 @@ static void process_player(void) if (world_player && (p_ptr->energy_need > - 1000)) { - /* Redraw map */ - p_ptr->redraw |= (PR_MAP); - /* Update monsters */ + p_ptr->redraw |= (PR_MAP); p_ptr->update |= (PU_MONSTERS); - /* Window stuff */ p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); msg_print(_("ãæã¯åãã ãâ¦ã", "You feel time flowing around you once more.")); @@ -5603,9 +5324,15 @@ static void process_player(void) /*! * @brief ç¾å¨ãã¬ã¤ã¤ã¼ããããã³ã¸ã§ã³ã®å ¨ä½å¦ç / Interact with the current dungeon level. * @return ãªã - * @note + * @details + *
+ * ãã®é¢æ°ããç¾å¨ã®é層ãåºãããã¬ã¤ã¤ã¼ããã£ã©ãæ»ã¬ã + * ã²ã¼ã ãçµäºãããã®ããããã¾ã§ã«ã¼ãããã + *
+ ** This function will not exit until the level is completed,\n * the user dies, or the game is terminated.\n + *
*/ static void dungeon(bool load_game) { @@ -5615,7 +5342,7 @@ static void dungeon(bool load_game) base_level = dun_level; /* Reset various flags */ - hack_mind = FALSE; + is_loading_now = FALSE; /* Not leaving */ p_ptr->leaving = FALSE; @@ -5648,8 +5375,7 @@ static void dungeon(bool load_game) repair_objects = TRUE; - /* Disturb */ - disturb(1, 1); + disturb(TRUE, TRUE); /* Get index of current quest (if any) */ quest_num = quest_number(dun_level); @@ -5683,29 +5409,23 @@ static void dungeon(bool load_game) /* Verify the panel */ verify_panel(); - /* Flush messages */ - msg_print(NULL); + msg_erase(); /* Enter "xtra" mode */ character_xtra = TRUE; - /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER | PW_MONSTER | PW_OVERHEAD | PW_DUNGEON); /* Redraw dungeon */ p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_EQUIPPY); - /* Redraw map */ p_ptr->redraw |= (PR_MAP); - /* Update stuff */ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); /* Update lite/view */ p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE | PU_TORCH); - - /* Update monsters */ p_ptr->update |= (PU_MONSTERS | PU_DISTANCE | PU_FLOW); /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */ @@ -5714,16 +5434,8 @@ static void dungeon(bool load_game) /* Leave "xtra" mode */ character_xtra = FALSE; - /* Update stuff */ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); - - /* Combine / Reorder the pack */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); - - /* Handle "p_ptr->notice" */ - notice_stuff(); - - /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */ handle_stuff(); /* Refresh */ @@ -5747,8 +5459,8 @@ static void dungeon(bool load_game) } } - if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) - p_ptr->magic_num1[0] = MUSIC_DETECT; + if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) > MUSIC_DETECT)) + SINGING_SONG_EFFECT(p_ptr) = MUSIC_DETECT; /* Hack -- notice death or departure */ if (!p_ptr->playing || p_ptr->is_dead) return; @@ -5783,7 +5495,7 @@ static void dungeon(bool load_game) /* Reset the object generation level */ object_level = base_level; - hack_mind = TRUE; + is_loading_now = TRUE; if (p_ptr->energy_need > 0 && !p_ptr->inside_battle && (dun_level || p_ptr->leaving_dungeon || p_ptr->inside_arena)) @@ -5811,15 +5523,10 @@ static void dungeon(bool load_game) /* Hack -- Compress the object list occasionally */ if (o_cnt + 32 < o_max) compact_objects(0); - /* Process the player */ process_player(); - process_upkeep_with_speed(); - /* Handle "p_ptr->notice" */ - notice_stuff(); - /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */ handle_stuff(); @@ -5835,10 +5542,6 @@ static void dungeon(bool load_game) /* Process all of the monsters */ process_monsters(); - /* Handle "p_ptr->notice" */ - notice_stuff(); - - /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */ handle_stuff(); /* Hack -- Hilite the player */ @@ -5850,14 +5553,9 @@ static void dungeon(bool load_game) /* Hack -- Notice death or departure */ if (!p_ptr->playing || p_ptr->is_dead) break; - /* Process the world */ process_world(); - /* Handle "p_ptr->notice" */ - notice_stuff(); - - /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */ handle_stuff(); /* Hack -- Hilite the player */ @@ -5869,9 +5567,6 @@ static void dungeon(bool load_game) /* Hack -- Notice death or departure */ if (!p_ptr->playing || p_ptr->is_dead) break; - /* Handle "leaving" */ - if (p_ptr->leaving) break; - /* Count game turns */ turn++; @@ -5883,6 +5578,9 @@ static void dungeon(bool load_game) prevent_turn_overflow(); + /* Handle "leaving" */ + if (p_ptr->leaving) break; + if (wild_regen) wild_regen--; } @@ -6016,7 +5714,8 @@ void extract_option_vars(void) */ void determine_bounty_uniques(void) { - int i, j, tmp; + int i, j; + MONRACE_IDX tmp; monster_race *r_ptr; get_mon_num_prep(NULL, NULL); @@ -6110,7 +5809,7 @@ void determine_today_mon(bool conv_old) */ void play_game(bool new_game) { - int i; + MONSTER_IDX i; bool load_game = TRUE; bool init_random_seed = FALSE; @@ -6163,7 +5862,6 @@ void play_game(bool new_game) /* Attempt to load */ if (!load_player()) { - /* Oops */ quit(_("ã»ã¼ããã¡ã¤ã«ãå£ãã¦ãã¾ã", "broken savefile")); } @@ -6179,15 +5877,13 @@ void play_game(bool new_game) if (!get_check_strict(_("å¾ æ©ãã¦ããã¹ã³ã¢ç»é²ãä»è¡ãªãã¾ããï¼", "Do you register score now? "), CHECK_NO_HISTORY)) quit(0); - /* Update stuff */ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS); - /* Update stuff */ - update_stuff(); + handle_stuff(); p_ptr->is_dead = TRUE; - start_time = time(NULL); + start_time = (u32b)time(NULL); /* No suspending now */ signals_ignore_tstp(); @@ -6201,6 +5897,9 @@ void play_game(bool new_game) /* Open the high score file, for reading/writing */ highscore_fd = fd_open(buf, O_RDWR); + /* çºåæ¶å¤±ãã°å¯¾ç(#38205) Init the wilderness */ + process_dungeon_file("w_info.txt", 0, 0, max_wild_y, max_wild_x); + /* Handle score, show Top scores */ success = send_world_score(TRUE); @@ -6457,15 +6156,9 @@ void play_game(bool new_game) /* React to changes */ Term_xtra(TERM_XTRA_REACT, 0); - /* Window stuff */ p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER); - - /* Window stuff */ p_ptr->window |= (PW_MESSAGE | PW_OVERHEAD | PW_DUNGEON | PW_MONSTER | PW_OBJECT); - - /* Window stuff */ - window_stuff(); - + handle_stuff(); /* Set or clear "rogue_like_commands" if requested */ if (arg_force_original) rogue_like_commands = FALSE; @@ -6479,7 +6172,7 @@ void play_game(bool new_game) if (new_game && ((p_ptr->pclass == CLASS_CAVALRY) || (p_ptr->pclass == CLASS_BEASTMASTER))) { monster_type *m_ptr; - int pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE); + IDX pet_r_idx = ((p_ptr->pclass == CLASS_CAVALRY) ? MON_HORSE : MON_YASE_HORSE); monster_race *r_ptr = &r_info[pet_r_idx]; place_monster_aux(0, p_ptr->y, p_ptr->x - 1, pet_r_idx, (PM_FORCE_PET | PM_NO_KAGE)); @@ -6503,13 +6196,10 @@ void play_game(bool new_game) /* Process the level */ dungeon(load_game); - /* Handle "p_ptr->notice" */ - notice_stuff(); /* Hack -- prevent "icky" message */ character_xtra = TRUE; - /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */ handle_stuff(); character_xtra = FALSE; @@ -6538,7 +6228,6 @@ void play_game(bool new_game) if (!p_ptr->is_dead) wipe_m_list(); - /* XXX XXX XXX */ msg_print(NULL); load_game = FALSE; @@ -6579,25 +6268,24 @@ void play_game(bool new_game) /* Mark savefile */ p_ptr->noscore |= 0x0001; - /* Message */ msg_print(_("ã¦ã£ã¶ã¼ãã¢ã¼ãã«å¿µãéããæ»ã欺ããã", "You invoke wizard mode and cheat death.")); msg_print(NULL); - /* Restore hit points */ - p_ptr->chp = p_ptr->mhp; - p_ptr->chp_frac = 0; + (void)life_stream(FALSE, FALSE); if (p_ptr->pclass == CLASS_MAGIC_EATER) { - for (i = 0; i < EATER_EXT*2; i++) + int magic_idx; + for (magic_idx = 0; magic_idx < EATER_EXT*2; magic_idx++) { - p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE; + p_ptr->magic_num1[magic_idx] = p_ptr->magic_num2[magic_idx]*EATER_CHARGE; } - for (; i < EATER_EXT*3; i++) + for (; magic_idx < EATER_EXT*3; magic_idx++) { - p_ptr->magic_num1[i] = 0; + p_ptr->magic_num1[magic_idx] = 0; } } + /* Restore spell points */ p_ptr->csp = p_ptr->msp; p_ptr->csp_frac = 0; @@ -6605,7 +6293,6 @@ void play_game(bool new_game) /* Hack -- cancel recall */ if (p_ptr->word_recall) { - /* Message */ msg_print(_("å¼µãã¤ãã大æ°ãæµãå»ã£ã...", "A tension leaves the air around you...")); msg_print(NULL); @@ -6622,22 +6309,12 @@ void play_game(bool new_game) p_ptr->redraw |= (PR_STATUS); } - /* Note cause of death XXX XXX XXX */ + /* Note cause of death */ (void)strcpy(p_ptr->died_from, _("æ»ã®æ¬ºã", "Cheating death")); /* Do not die */ p_ptr->is_dead = FALSE; - /* Hack -- Healing */ - (void)set_blind(0); - (void)set_confused(0); - (void)set_poisoned(0); - (void)set_afraid(0); - (void)set_paralyzed(0); - (void)set_image(0); - (void)set_stun(0); - (void)set_cut(0); - /* Hack -- Prevent starvation */ (void)set_food(PY_FOOD_MAX - 1);