OSDN Git Service

refactor lite flags
[hengband/hengband.git] / src / effects.c
index bea7728..45b3861 100644 (file)
@@ -87,6 +87,16 @@ void set_action(int typ)
 #else
                                msg_print("You are no longer walking extremely fast.");
 #endif
+                               energy_use = 100;
+                               break;
+                       }
+                       case ACTION_SPELL:
+                       {
+#ifdef JP
+                               msg_print("¼öʸ¤Î±Ó¾§¤òÃæÃǤ·¤¿¡£");
+#else
+                               msg_print("You stopped spelling all spells.");
+#endif
                                break;
                        }
                }
@@ -96,6 +106,7 @@ void set_action(int typ)
 
        /* If we are requested other action, stop singing */
        if (prev_typ == ACTION_SING) stop_singing();
+       if (prev_typ == ACTION_SPELL) stop_hex_spell();
 
        switch (p_ptr->action)
        {
@@ -182,6 +193,7 @@ void reset_tim_flags(void)
        p_ptr->tim_sh_fire = 0;
        p_ptr->tim_sh_holy = 0;
        p_ptr->tim_eyeeye = 0;
+       p_ptr->magicdef = 0;
        p_ptr->resist_magic = 0;
        p_ptr->tsuyoshi = 0;
        p_ptr->kabenuke = 0;
@@ -232,6 +244,93 @@ void reset_tim_flags(void)
 }
 
 
+void dispel_player(void)
+{
+       (void)set_fast(0, TRUE);
+       (void)set_lightspeed(0, TRUE);
+       (void)set_slow(0, TRUE);
+       (void)set_shield(0, TRUE);
+       (void)set_blessed(0, TRUE);
+       (void)set_tsuyoshi(0, TRUE);
+       (void)set_hero(0, TRUE);
+       (void)set_shero(0, TRUE);
+       (void)set_protevil(0, TRUE);
+       (void)set_invuln(0, TRUE);
+       (void)set_wraith_form(0, TRUE);
+       (void)set_kabenuke(0, TRUE);
+       (void)set_tim_res_nether(0, TRUE);
+       (void)set_tim_res_time(0, TRUE);
+       /* by henkma */
+       (void)set_tim_reflect(0,TRUE);
+       (void)set_multishadow(0,TRUE);
+       (void)set_dustrobe(0,TRUE);
+
+       (void)set_tim_invis(0, TRUE);
+       (void)set_tim_infra(0, TRUE);
+       (void)set_tim_esp(0, TRUE);
+       (void)set_tim_regen(0, TRUE);
+       (void)set_tim_stealth(0, TRUE);
+       (void)set_tim_levitation(0, TRUE);
+       (void)set_tim_sh_touki(0, TRUE);
+       (void)set_tim_sh_fire(0, TRUE);
+       (void)set_tim_sh_holy(0, TRUE);
+       (void)set_tim_eyeeye(0, TRUE);
+       (void)set_magicdef(0, TRUE);
+       (void)set_resist_magic(0, TRUE);
+       (void)set_oppose_acid(0, TRUE);
+       (void)set_oppose_elec(0, TRUE);
+       (void)set_oppose_fire(0, TRUE);
+       (void)set_oppose_cold(0, TRUE);
+       (void)set_oppose_pois(0, TRUE);
+       (void)set_ultimate_res(0, TRUE);
+       (void)set_mimic(0, 0, TRUE);
+       (void)set_ele_attack(0, 0);
+       (void)set_ele_immune(0, 0);
+
+       /* Cancel glowing hands */
+       if (p_ptr->special_attack & ATTACK_CONFUSE)
+       {
+               p_ptr->special_attack &= ~(ATTACK_CONFUSE);
+#ifdef JP
+               msg_print("¼ê¤Îµ±¤­¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
+#else
+               msg_print("Your hands stop glowing.");
+#endif
+       }
+
+       if (music_singing_any() || hex_spelling_any())
+       {
+#ifdef JP
+               cptr str = (music_singing_any()) ? "²Î" : "¼öʸ";
+#else
+               cptr str = (music_singing_any()) ? "singing" : "spelling";
+#endif
+               p_ptr->magic_num1[1] = p_ptr->magic_num1[0];
+               p_ptr->magic_num1[0] = 0;
+#ifdef JP
+               msg_format("%s¤¬ÅÓÀڤ줿¡£", str);
+#else
+               msg_format("Your %s is interrupted.", str);
+#endif
+               p_ptr->action = ACTION_NONE;
+
+               /* Recalculate bonuses */
+               p_ptr->update |= (PU_BONUS | PU_HP);
+
+               /* Redraw map */
+               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);
+
+               p_ptr->energy_need += ENERGY_NEED();
+       }
+}
+
+
 /*
  * Set "p_ptr->tim_mimic", and "p_ptr->mimic_form",
  * notice observable changes
@@ -289,8 +388,7 @@ bool set_mimic(int v, int p, bool do_dec)
                return (FALSE);
 
        /* Disturb */
-       if (disturb_state)
-               disturb(0, 0);
+       if (disturb_state) disturb(0, 1);
 
        /* Redraw title */
        p_ptr->redraw |= (PR_BASIC | PR_STATUS);
@@ -465,6 +563,12 @@ msg_print("
                                p_ptr->action = ACTION_NONE;
                        }
 
+                       /* Sniper */
+                       if (p_ptr->concent) reset_concentration(TRUE);
+
+                       /* Hex */
+                       if (hex_spelling_any()) stop_hex_spell_all();
+
                        notice = TRUE;
                        p_ptr->counter = FALSE;
                        chg_virtue(V_HARMONY, -1);
@@ -671,6 +775,12 @@ msg_print("
                        msg_print("You are paralyzed!");
 #endif
 
+                       /* Sniper */
+                       if (p_ptr->concent) reset_concentration(TRUE);
+
+                       /* Hex */
+                       if (hex_spelling_any()) stop_hex_spell_all();
+
                        p_ptr->counter = FALSE;
                        notice = TRUE;
                }
@@ -741,6 +851,9 @@ msg_print("
                        msg_print("Oh, wow! Everything looks so cosmic now!");
 #endif
 
+                       /* Sniper */
+                       if (p_ptr->concent) reset_concentration(TRUE);
+
                        p_ptr->counter = FALSE;
                        notice = TRUE;
                }
@@ -771,11 +884,14 @@ msg_print("
        if (!notice) return (FALSE);
 
        /* Disturb */
-       if (disturb_state) disturb(0, 0);
+       if (disturb_state) disturb(0, 1);
 
        /* Redraw map */
        p_ptr->redraw |= (PR_MAP);
 
+       /* Update the health bar */
+       p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
+
        /* Update monsters */
        p_ptr->update |= (PU_MONSTERS);
 
@@ -870,6 +986,8 @@ bool set_lightspeed(int v, bool do_dec)
 
        if (p_ptr->is_dead) return FALSE;
 
+       if (p_ptr->wild_mode) v = 0;
+
        /* Open */
        if (v)
        {
@@ -3524,6 +3642,12 @@ msg_print("
                        p_ptr->action = ACTION_NONE;
                }
 
+               /* Sniper */
+               if (p_ptr->concent) reset_concentration(TRUE);
+
+               /* Hex */
+               if (hex_spelling_any()) stop_hex_spell_all();
+
                /* Notice */
                notice = TRUE;
        }
@@ -4803,7 +4927,7 @@ msg_print("
        if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
        {
                char effect_msg[80] = "";
-               int new_race, expfact, goalexpfact;
+               int new_race;
 
                /* Some form of racial polymorph... */
                power -= 10;
@@ -4894,21 +5018,11 @@ msg_print("
 
                }
 
-               /*
-                * Restrict the race choices by exp penalty so
-                * weak polymorph always means weak race
-                */
-               if (power < 0)
-                       goalexpfact = 100;
-               else
-                       goalexpfact = 100 + 3 * randint0(power);
-
                do
                {
                        new_race = randint0(MAX_RACES);
-                       expfact = race_info[new_race].r_exp;
                }
-               while (((new_race == p_ptr->prace) && (expfact > goalexpfact)) || (new_race == RACE_ANDROID));
+               while ((new_race == p_ptr->prace) || (new_race == RACE_ANDROID));
 
                change_race(new_race, effect_msg);
        }
@@ -5004,7 +5118,7 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
        if (damage_type != DAMAGE_USELIFE)
        {
                /* Disturb */
-               disturb(1, 0);
+               disturb(1, 1);
                if (auto_more)
                {
                        now_damaged = TRUE;
@@ -5040,8 +5154,7 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                        }
                }
 
-               /* Multishadow effects is determined by turn */
-               if (p_ptr->multishadow && (turn & 1))
+               if (CHECK_MULTISHADOW())
                {
                        if (damage_type == DAMAGE_FORCE)
                        {
@@ -5100,8 +5213,6 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
        /* Window stuff */
        p_ptr->window |= (PW_PLAYER);
 
-       handle_stuff();
-
        if (damage_type != DAMAGE_GENO && p_ptr->chp == 0)
        {
                chg_virtue(V_SACRIFICE, 1);
@@ -5123,6 +5234,8 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
 
                chg_virtue(V_SACRIFICE, 10);
 
+               handle_stuff();
+
                /* Leaving */
                p_ptr->leaving = TRUE;
 
@@ -5161,11 +5274,13 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                        }
                        else
                        {
+                               char dummy[1024];
 #ifdef JP
-                               sprintf(p_ptr->died_from, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "ĦÁü¾õÂÖ¤Ç" : "Ëãáã¾õÂÖ¤Ç", p_ptr->image ? "¸¸³Ð¤ËÏĤó¤À" : "", hit_from);
+                               sprintf(dummy, "%s%s%s", !p_ptr->paralyzed ? "" : p_ptr->free_act ? "ĦÁü¾õÂÖ¤Ç" : "Ëãáã¾õÂÖ¤Ç", p_ptr->image ? "¸¸³Ð¤ËÏĤó¤À" : "", hit_from);
 #else
-                               sprintf(p_ptr->died_from, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
+                               sprintf(dummy, "%s%s", hit_from, !p_ptr->paralyzed ? "" : " while helpless");
 #endif
+                               my_strcpy(p_ptr->died_from, dummy, sizeof p_ptr->died_from);
                        }
 
                        /* No longer a winner */
@@ -5181,7 +5296,7 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                        }
                        else
                        {
-                               char buf[10];
+                               char buf[20];
 
                                if (p_ptr->inside_arena)
 #ifdef JP
@@ -5270,11 +5385,21 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                                        get_rnd_line("death.txt", 0, death_message);
 #endif
                                }
+
+                               do
+                               {
 #ifdef JP
-                               while (!get_string(winning_seppuku ? "¼­À¤¤Î¶ç: " : "ÃÇËöËâ¤Î¶«¤Ó: ", death_message, 1024)) ;
+                                       while (!get_string(winning_seppuku ? "¼­À¤¤Î¶ç: " : "ÃÇËöËâ¤Î¶«¤Ó: ", death_message, 1024)) ;
 #else
-                               while (!get_string("Last word: ", death_message, 1024)) ;
+                                       while (!get_string("Last word: ", death_message, 1024)) ;
 #endif
+                               }
+#ifdef JP
+                               while (winning_seppuku && !get_check_strict("¤è¤í¤·¤¤¤Ç¤¹¤«¡©", CHECK_NO_HISTORY));
+#else
+                               while (winning_seppuku && !get_check_strict("Are you sure? ", CHECK_NO_HISTORY));
+#endif
+
                                if (death_message[0] == '\0')
                                {
 #ifdef JP
@@ -5348,6 +5473,8 @@ int take_hit(int damage_type, int damage, cptr hit_from, int monspell)
                return damage;
        }
 
+       handle_stuff();
+
        /* Hitpoint warning */
        if (p_ptr->chp < warning)
        {