OSDN Git Service

経験値を吸い取る能力(TRC_DRAIN_EXP)がアンドロイドの強化度も吸い取って不気味だったので、アンドロイドでは無効になるように修正。
[hengbandforosx/hengbandosx.git] / src / dungeon.c
index 53bcd66..955eeea 100644 (file)
@@ -198,7 +198,8 @@ o_name, index_to_label(slot),game_inscriptions[feel]);
        /* Auto-inscription/destroy */
        idx = is_autopick(o_ptr);
        auto_inscribe_item(slot, idx);
-       auto_destroy_item(slot, idx, FALSE);
+        if (destroy_feeling)
+                auto_destroy_item(slot, idx, FALSE);
 
        /* Combine / Reorder the pack (later) */
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
@@ -615,7 +616,11 @@ if (get_check("¾
                        else if (dun_level == 100)
                                max_level = 100;
                }
-               else max_level = d_info[dungeon_type].maxdepth;
+               else
+                {
+                        max_level = d_info[dungeon_type].maxdepth;
+                        min_level = d_info[dungeon_type].mindepth;
+                }
 
                /* Prompt */
 #ifdef JP
@@ -668,6 +673,14 @@ msg_format("%d 
        /* Change level */
        dun_level = command_arg;
 
+       leave_quest_check();
+
+       if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL);
+
+       p_ptr->inside_quest = 0;
+       p_ptr->leftbldg = FALSE;
+       energy_use = 0;
+
        /* Leaving */
        p_ptr->leaving = TRUE;
 }
@@ -1331,7 +1344,7 @@ static void gere_music(s32b music)
                 case MUSIC_DETECT:
                 case MUSIC_DETECT+1:
                 case MUSIC_DETECT+2:
-                       detect_traps(DETECT_RAD_DEFAULT);
+                       detect_traps(DETECT_RAD_DEFAULT, TRUE);
                        detect_doors(DETECT_RAD_DEFAULT);
                        detect_stairs(DETECT_RAD_DEFAULT);
                        if ((p_ptr->lev > 14)  && (music  < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
@@ -1394,9 +1407,9 @@ static void check_music(void)
         if(p_ptr->pclass != CLASS_BARD) return;
         if(!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return;
 
-        s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC - 1][p_ptr->magic_num2[0]];
+        s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][p_ptr->magic_num2[0]];
 
-       shouhimana = (s_ptr->smana*(3800-spell_exp[p_ptr->magic_num2[0]])+2399);
+       shouhimana = (s_ptr->smana*(3800-p_ptr->spell_exp[p_ptr->magic_num2[0]])+2399);
        if(p_ptr->dec_mana)
                shouhimana *= 3;
        else shouhimana *= 4;
@@ -1441,14 +1454,14 @@ static void check_music(void)
                        p_ptr->redraw |= (PR_STATUS);
                }
         }
-       if (spell_exp[p_ptr->magic_num2[0]] < 900)
-               spell_exp[p_ptr->magic_num2[0]]+=5;
-       else if(spell_exp[p_ptr->magic_num2[0]] < 1200)
-               {if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) spell_exp[p_ptr->magic_num2[0]]+=1;}
-       else if(spell_exp[p_ptr->magic_num2[0]] < 1400)
-               {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) spell_exp[p_ptr->magic_num2[0]]+=1;}
-       else if(spell_exp[p_ptr->magic_num2[0]] < 1600)
-               {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) spell_exp[p_ptr->magic_num2[0]]+=1;}
+       if (p_ptr->spell_exp[p_ptr->magic_num2[0]] < 900)
+               p_ptr->spell_exp[p_ptr->magic_num2[0]]+=5;
+       else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1200)
+               {if (one_in_(2) && (dun_level > 4) && ((dun_level + 10) > p_ptr->lev)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
+       else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1400)
+               {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && ((dun_level + 5) > s_ptr->slevel)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
+       else if(p_ptr->spell_exp[p_ptr->magic_num2[0]] < 1600)
+               {if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[p_ptr->magic_num2[0]]+=1;}
 
         gere_music(p_ptr->magic_num1[0]);
 }
@@ -1633,7 +1646,7 @@ msg_print("
 
 
                                /* Stop playing */
-                               alive = FALSE;
+                               p_ptr->playing = FALSE;
 
                                /* Leaving */
                                p_ptr->leaving = TRUE;
@@ -1729,7 +1742,7 @@ msg_print("
                                                    (y == 0) || (y == cur_hgt-1))
                                                {
                                                        /* Forget the grid */
-                                                       c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
+                                                       if (!(c_ptr->info & CAVE_IN_MIRROR)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
 
                                                        /* Hack -- Notice spot */
                                                        note_spot(y, x);
@@ -2337,7 +2350,7 @@ msg_print("
                        regenmana(upkeep_regen/100);
 
 #ifdef TRACK_FRIENDS
-                       if (wizard)
+                       if (p_ptr->wizard)
                        {
 #ifdef JP
 msg_format("£Í£Ð²óÉü: %d/%d", upkeep_regen, regen_amount);
@@ -3382,7 +3395,8 @@ if (!get_rnd_line("chainswd_j.txt", 0, noise))
                        (void)activate_ty_curse(FALSE, &count);
                }
                /* Handle experience draining */
-               if ((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;
                        if (p_ptr->exp < 0) p_ptr->exp = 0;
@@ -3802,7 +3816,7 @@ msg_print("
 static bool enter_wizard_mode(void)
 {
        /* Ask first time */
-       if (!noscore)
+       if (!p_ptr->noscore)
        {
                /* Mention effects */
 #ifdef JP
@@ -3827,7 +3841,7 @@ if (!get_check("
                }
 
                /* Mark savefile */
-               noscore |= 0x0002;
+               p_ptr->noscore |= 0x0002;
        }
 
        /* Success */
@@ -3843,7 +3857,7 @@ if (!get_check("
 static bool enter_debug_mode(void)
 {
        /* Ask first time */
-       if (!noscore)
+       if (!p_ptr->noscore)
        {
                /* Mention effects */
 #ifdef JP
@@ -3873,7 +3887,7 @@ if (!get_check("
                do_cmd_write_nikki(NIKKI_BUNSHOU, 0, "give up sending score to use debug commands.");
 #endif
                /* Mark savefile */
-               noscore |= 0x0008;
+               p_ptr->noscore |= 0x0008;
        }
 
        /* Success */
@@ -3896,7 +3910,7 @@ extern void do_cmd_debug(void);
 static bool enter_borg_mode(void)
 {
        /* Ask first time */
-       if (!(noscore & 0x0010))
+       if (!(p_ptr->noscore & 0x0010))
        {
                /* Mention effects */
 #ifdef JP
@@ -3921,7 +3935,7 @@ if (!get_check("
                }
 
                /* Mark savefile */
-               noscore |= 0x0010;
+               p_ptr->noscore |= 0x0010;
        }
 
        /* Success */
@@ -3978,9 +3992,9 @@ static void process_command(void)
                /* Toggle Wizard Mode */
                case KTRL('W'):
                {
-                       if (wizard)
+                       if (p_ptr->wizard)
                        {
-                               wizard = FALSE;
+                               p_ptr->wizard = FALSE;
 #ifdef JP
 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É²ò½ü¡£");
 #else
@@ -3990,7 +4004,7 @@ msg_print("
                        }
                        else if (enter_wizard_mode())
                        {
-                               wizard = TRUE;
+                               p_ptr->wizard = TRUE;
 #ifdef JP
 msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥ÉÆÍÆþ¡£");
 #else
@@ -4203,21 +4217,21 @@ msg_print("
                /*** Stairs and Doors and Chests and Traps ***/
 
                /* Enter store */
-               case 253:
+               case SPECIAL_KEY_STORE:
                {
                        if (!p_ptr->wild_mode) do_cmd_store();
                        break;
                }
 
                /* Enter building -KMW- */
-               case 254:
+               case SPECIAL_KEY_BUILDING:
                {
                        if (!p_ptr->wild_mode) do_cmd_bldg();
                        break;
                }
 
                /* Enter quest level -KMW- */
-               case 255:
+               case SPECIAL_KEY_QUEST:
                {
                        if (!p_ptr->wild_mode) do_cmd_quest();
                        break;
@@ -4340,6 +4354,8 @@ msg_print("
                             ) do_cmd_mind_browse();
                        else if (p_ptr->pclass == CLASS_SMITH)
                                do_cmd_kaji(TRUE);
+                       else if (p_ptr->pclass == CLASS_MAGIC_EATER)
+                               do_cmd_magic_eater(TRUE);
                        else do_cmd_browse();
                        break;
                }
@@ -4363,7 +4379,7 @@ msg_print("
 #ifdef JP
                                        msg_print("¥À¥ó¥¸¥ç¥ó¤¬ËâË¡¤òµÛ¼ý¤·¤¿¡ª");
 #else
-                                       msg_print("The arena absorbs all attempted magic!");
+                                       msg_print("The dungeon absorbs all attempted magic!");
 #endif
                                        msg_print(NULL);
                                }
@@ -4439,7 +4455,7 @@ msg_print("
                                        else if (p_ptr->pclass == CLASS_IMITATOR)
                                                do_cmd_mane(FALSE);
                                        else if (p_ptr->pclass == CLASS_MAGIC_EATER)
-                                               do_cmd_magic_eater();
+                                               do_cmd_magic_eater(FALSE);
                                        else if (p_ptr->pclass == CLASS_SAMURAI)
                                                do_cmd_hissatsu();
                                        else if (p_ptr->pclass == CLASS_BLUE_MAGE)
@@ -4837,7 +4853,7 @@ msg_print("
 
                /* Save and quit */
                case KTRL('X'):
-               case 252:
+               case SPECIAL_KEY_QUIT:
                {
                        do_cmd_save_and_exit();
                        break;
@@ -5046,7 +5062,7 @@ msg_print("
 #ifdef JP
                                msg_print("±Â¤À¤±¿©¤ï¤ì¤Æ¤·¤Þ¤Ã¤¿¡ª¤¯¤Ã¤½¡Á¡ª");
 #else
-                               msg_print("Damn! The fish took a bait away!");
+                               msg_print("Damn!  The fish stole your bait!");
 #endif
                        }
                        disturb(0, 0);
@@ -5109,7 +5125,7 @@ msg_format("%^s
                        int d = 1;
 
                        /* Make a "saving throw" against stun */
-                       if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+                       if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
                        {
                                /* Recover fully */
                                d = m_ptr->stunned;
@@ -5149,7 +5165,7 @@ msg_format("%^s
                        int d = 1;
 
                        /* Make a "saving throw" against stun */
-                       if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+                       if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
                        {
                                /* Recover fully */
                                d = m_ptr->confused;
@@ -5189,7 +5205,7 @@ msg_format("%^s
                        int d = 1;
 
                        /* Make a "saving throw" against stun */
-                       if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+                       if (randint0(r_info[m_ptr->r_idx].level) < p_ptr->skill_exp[GINOU_RIDING])
                        {
                                /* Recover fully */
                                d = m_ptr->monfear;
@@ -5577,13 +5593,13 @@ msg_format("%s(%c)
                        }
                        if (p_ptr->pclass == CLASS_IMITATOR)
                        {
-                               if (mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
+                               if (p_ptr->mane_num > (p_ptr->lev > 44 ? 3 : p_ptr->lev > 29 ? 2 : 1))
                                {
-                                       mane_num--;
-                                       for (i = 0; i < mane_num; i++)
+                                       p_ptr->mane_num--;
+                                       for (i = 0; i < p_ptr->mane_num; i++)
                                        {
-                                               mane_spell[i] = mane_spell[i+1];
-                                               mane_dam[i] = mane_dam[i+1];
+                                               p_ptr->mane_spell[i] = p_ptr->mane_spell[i+1];
+                                               p_ptr->mane_dam[i] = p_ptr->mane_dam[i+1];
                                        }
                                }
                                new_mane = FALSE;
@@ -5620,7 +5636,7 @@ msg_format("%s(%c)
                }
 
                /* Hack -- notice death */
-               if (!alive || death)
+               if (!p_ptr->playing || p_ptr->is_dead)
                {
                        world_player = FALSE;
                        break;
@@ -5760,10 +5776,7 @@ static void dungeon(bool load_game)
        character_xtra = TRUE;
 
        /* Window stuff */
-       p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_SPELL | PW_PLAYER);
-
-       /* Window stuff */
-       p_ptr->window |= (PW_MONSTER);
+       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);
@@ -5771,14 +5784,14 @@ static void dungeon(bool load_game)
        /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
-       /* Window stuff */
-       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
        /* Update stuff */
        p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS);
 
-       /* Calculate torch radius */
-       p_ptr->update |= (PU_TORCH);
+       /* 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);
 
        /* Update stuff */
        update_stuff();
@@ -5789,16 +5802,6 @@ static void dungeon(bool load_game)
        /* Redraw stuff */
        window_stuff();
 
-       /* Update stuff */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_DISTANCE | PU_MON_LITE);
-       p_ptr->update |= (PU_MONSTERS);/*¼«Ê¬¤Ç¸÷¤Ã¤Æ¤¤¤ë¥â¥ó¥¹¥¿¡¼¤Î°Ù */
-
-       /* Update stuff */
-       update_stuff();
-
-       /* Redraw stuff */
-       redraw_stuff();
-
        /* Leave "xtra" mode */
        character_xtra = FALSE;
 
@@ -5848,7 +5851,7 @@ msg_print("
                p_ptr->magic_num1[0] = MUSIC_DETECT;
 
        /* Hack -- notice death or departure */
-       if (!alive || death) return;
+       if (!p_ptr->playing || p_ptr->is_dead) return;
 
        /* Print quest message if appropriate */
        if (!p_ptr->inside_quest && (dungeon_type == DUNGEON_ANGBAND))
@@ -5939,7 +5942,7 @@ msg_print("
                if (fresh_after) Term_fresh();
 
                /* Hack -- Notice death or departure */
-               if (!alive || death) break;
+               if (!p_ptr->playing || p_ptr->is_dead) break;
 
                /* Process all of the monsters */
                process_monsters();
@@ -5963,7 +5966,7 @@ msg_print("
                if (fresh_after) Term_fresh();
 
                /* Hack -- Notice death or departure */
-               if (!alive || death) break;
+               if (!p_ptr->playing || p_ptr->is_dead) break;
 
 
                /* Process the world */
@@ -5988,7 +5991,7 @@ msg_print("
                if (fresh_after) Term_fresh();
 
                /* Hack -- Notice death or departure */
-               if (!alive || death) break;
+               if (!p_ptr->playing || p_ptr->is_dead) break;
 
                /* Handle "leaving" */
                if (p_ptr->leaving) break;
@@ -6008,7 +6011,7 @@ msg_print("
        }
 
        /* Not save-and-quit and not dead? */
-       if (alive && !death)
+       if (p_ptr->playing && !p_ptr->is_dead)
        {
                for(num = 0; num < 21; num++)
                {
@@ -6229,7 +6232,7 @@ quit("
        }
 
        /* Report waited score */
-       if (wait_report_score)
+       if (p_ptr->wait_report_score)
        {
                char buf[1024];
                bool success;
@@ -6247,7 +6250,7 @@ quit("
                /* Update stuff */
                update_stuff();
 
-               death = TRUE;
+               p_ptr->is_dead = TRUE;
 
                start_time = time(NULL);
 
@@ -6258,7 +6261,7 @@ quit("
                character_icky = TRUE;
 
                /* Build the filename */
-               path_build(buf, 1024, ANGBAND_DIR_APEX, "scores.raw");
+               path_build(buf, sizeof(buf), ANGBAND_DIR_APEX, "scores.raw");
 
                /* Open the high score file, for reading/writing */
                highscore_fd = fd_open(buf, O_RDWR);
@@ -6281,7 +6284,7 @@ quit("
                }
                else
                {
-                       wait_report_score = FALSE;
+                       p_ptr->wait_report_score = FALSE;
                        top_twenty();
 #ifdef JP
                        if (!save_player()) msg_print("¥»¡¼¥Ö¼ºÇÔ¡ª");
@@ -6522,7 +6525,11 @@ prt("
 
 
        /* Hack -- Enter wizard mode */
-       if (arg_wizard && enter_wizard_mode()) wizard = TRUE;
+       if (arg_wizard)
+        {
+                if (enter_wizard_mode()) p_ptr->wizard = TRUE;
+                else if (p_ptr->is_dead) quit("Already dead.");
+        }
 
        /* Initialize the town-buildings if necessary */
        if (!dun_level && !p_ptr->inside_quest)
@@ -6559,7 +6566,7 @@ if (init_v_info()) quit("
 
 
        /* Start game */
-       alive = TRUE;
+       p_ptr->playing = TRUE;
 
        /* Reset the visual mappings */
        reset_visuals();
@@ -6585,7 +6592,7 @@ if (init_v_info()) quit("
        if (arg_force_roguelike) rogue_like_commands = TRUE;
 
        /* Hack -- Enforce "delayed death" */
-       if (p_ptr->chp < 0) death = TRUE;
+       if (p_ptr->chp < 0) p_ptr->is_dead = TRUE;
 
        if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
 
@@ -6640,11 +6647,11 @@ if (init_v_info()) quit("
                clear_mon_lite();
 
                /* Handle "quit and save" */
-               if (!alive && !death) break;
+               if (!p_ptr->playing && !p_ptr->is_dead) break;
 
                /* Erase the old cave */
                wipe_o_list();
-               if (!death) wipe_m_list();
+               if (!p_ptr->is_dead) wipe_m_list();
 
 
                /* XXX XXX XXX */
@@ -6653,7 +6660,7 @@ if (init_v_info()) quit("
                load_game = FALSE;
 
                /* Accidental Death */
-               if (alive && death)
+               if (p_ptr->playing && p_ptr->is_dead)
                {
                        if (p_ptr->inside_arena)
                        {
@@ -6662,7 +6669,7 @@ if (init_v_info()) quit("
                                        p_ptr->arena_number++;
                                else
                                        p_ptr->arena_number = 99;
-                               death = FALSE;
+                               p_ptr->is_dead = FALSE;
                                p_ptr->chp = 0;
                                p_ptr->chp_frac = 0;
                                p_ptr->exit_bldg = TRUE;
@@ -6672,9 +6679,9 @@ if (init_v_info()) quit("
                        {
                                /* Mega-Hack -- Allow player to cheat death */
 #ifdef JP
-if ((wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
+if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
 #else
-                               if ((wizard || cheat_live) && !get_check("Die? "))
+                               if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
 #endif
 
                                {
@@ -6685,7 +6692,7 @@ if ((wizard || cheat_live) && !get_check("
                                        p_ptr->age++;
 
                                        /* Mark savefile */
-                                       noscore |= 0x0001;
+                                       p_ptr->noscore |= 0x0001;
 
                                        /* Message */
 #ifdef JP
@@ -6748,14 +6755,14 @@ msg_print("ĥ
 
                                        /* Note cause of death XXX XXX XXX */
 #ifdef JP
-(void)strcpy(died_from, "»à¤Îµ½¤­");
+(void)strcpy(p_ptr->died_from, "»à¤Îµ½¤­");
 #else
-                                       (void)strcpy(died_from, "Cheating death");
+                                       (void)strcpy(p_ptr->died_from, "Cheating death");
 #endif
 
 
                                        /* Do not die */
-                                       death = FALSE;
+                                       p_ptr->is_dead = FALSE;
 
                                        dun_level = 0;
                                        p_ptr->inside_arena = FALSE;
@@ -6801,7 +6808,7 @@ msg_print("ĥ
                }
 
                /* Handle "death" */
-               if (death) break;
+               if (p_ptr->is_dead) break;
 
                /* Make a new level */
                generate_cave();