OSDN Git Service

モンスターのテレポートにも受動テレポートモードを与えた. 自分の意志に
[hengband/hengband.git] / src / mspells3.c
index feaf7d7..9af5efb 100644 (file)
@@ -418,13 +418,13 @@ cptr            p = "
        }
 
        /* Build a prompt (accept all spells) */
+       (void)strnfmt(out_val, 78, 
 #ifdef JP
-(void) strnfmt(out_val, 78, "(%c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò¾§¤¨¤Þ¤¹¤«¡©",
+                     "(%c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò¾§¤¨¤Þ¤¹¤«¡©",
 #else
-       (void)strnfmt(out_val, 78, "(%c-%c, *=List, ESC=exit) Use which %s? ",
+                     "(%c-%c, *=List, ESC=exit) Use which %s? ",
 #endif
-
-               I2A(0), I2A(num - 1), p);
+                     I2A(0), I2A(num - 1), p);
 
        if (use_menu) screen_save();
 
@@ -544,15 +544,10 @@ put_str("MP 
                                        if (plev > spell.level) chance -= 3 * (plev - spell.level);
                                        else chance += (spell.level - plev);
 
-                                       chance += p_ptr->to_m_chance;
-
                                        /* Reduce failure rate by INT/WIS adjustment */
                                        chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
 
-                                       if (p_ptr->heavy_spell) chance += 20;
-                                       if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
-                                       else if (p_ptr->easy_spell) chance-=3;
-                                       else if (p_ptr->dec_mana) chance-=2;
+                                       chance = mod_spell_chance_1(chance);
 
                                        need_mana = mod_need_mana(monster_powers[spellnum[i]].smana, 0, REALM_NONE);
 
@@ -575,9 +570,7 @@ put_str("MP 
                                        /* Always a 5 percent chance of working */
                                        if (chance > 95) chance = 95;
 
-                                       if(p_ptr->dec_mana) chance--;
-                                       if (p_ptr->heavy_spell) chance += 5;
-                                       chance = MAX(chance,0);
+                                       chance = mod_spell_chance_2(chance);
 
                                        /* Get info */
                                        learned_info(comment, spellnum[i]);
@@ -647,7 +640,7 @@ put_str("MP 
 
                        /* Prompt */
 #ifdef JP
-(void) strnfmt(tmp_val, 78, "%s¤ÎËâË¡¤ò¾§¤¨¤Þ¤¹¤«¡©", monster_powers[spellnum[i]].name);
+                       (void) strnfmt(tmp_val, 78, "%s¤ÎËâË¡¤ò¾§¤¨¤Þ¤¹¤«¡©", monster_powers[spellnum[i]].name);
 #else
                        (void)strnfmt(tmp_val, 78, "Use %s? ", monster_powers[spellnum[i]].name);
 #endif
@@ -665,14 +658,10 @@ put_str("MP 
        if (redraw) screen_load();
 
        /* Show choices */
-       if (show_choices)
-       {
-               /* Update */
-               p_ptr->window |= (PW_SPELL);
+       p_ptr->window |= (PW_SPELL);
 
-               /* Window stuff */
-               window_stuff();
-       }
+       /* Window stuff */
+       window_stuff();
 
        /* Abort if needed */
        if (!flag) return (FALSE);
@@ -741,38 +730,42 @@ msg_print("
                if (!target_set(TARGET_KILL)) return FALSE;
                if (!cave[target_row][target_col].m_idx) break;
                if (!los(py, px, target_row, target_col)) break;
+               if (!projectable(py, px, target_row, target_col)) break;
                m_ptr = &m_list[cave[target_row][target_col].m_idx];
                monster_desc(m_name, m_ptr, 0);
                if (m_ptr->invulner)
                {
                        m_ptr->invulner = 0;
+                       if (m_ptr->ml)
+                       {
 #ifdef JP
-msg_format("%s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ï¤Ê¤¤¡£", m_name);
+                               msg_format("%s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ï¤Ê¤¤¡£", m_name);
 #else
-                       msg_format("%^s is no longer invulnerable.", m_name);
+                               msg_format("%^s is no longer invulnerable.", m_name);
 #endif
+                               p_ptr->redraw |= (PR_HEALTH);
+                               if (p_ptr->riding == cave[target_row][target_col].m_idx) p_ptr->redraw |= (PR_UHEALTH);
+                       }
                        m_ptr->energy_need += ENERGY_NEED();
                }
                if (m_ptr->fast)
                {
                        m_ptr->fast = 0;
 #ifdef JP
-msg_format("%s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
+                       if (m_ptr->ml) msg_format("%s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
 #else
-                       msg_format("%^s is no longer fast.", m_name);
+                       if (m_ptr->ml) msg_format("%^s is no longer fast.", m_name);
 #endif
                }
                if (m_ptr->slow)
                {
                        m_ptr->slow = 0;
 #ifdef JP
-msg_format("%s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
+                       if (m_ptr->ml) msg_format("%s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
 #else
-                       msg_format("%^s is no longer slow.", m_name);
+                       if (m_ptr->ml) msg_format("%^s is no longer slow.", m_name);
 #endif
                }
-               p_ptr->redraw |= (PR_HEALTH);
-               if (p_ptr->riding == cave[target_row][target_col].m_idx) p_ptr->redraw |= (PR_UHEALTH);
 
                break;
        }
@@ -1358,10 +1351,10 @@ msg_print("̵
                (void)set_invuln(randint1(4) + 4, FALSE);
                break;
        case MS_BLINK:
-               teleport_player(10);
+               teleport_player(10, FALSE);
                break;
        case MS_TELEPORT:
-               teleport_player(plev * 5);
+               teleport_player(plev * 5, FALSE);
                break;
        case MS_WORLD:
                world_player = TRUE;
@@ -1397,6 +1390,7 @@ msg_print("̵
                if (!target_set(TARGET_KILL)) return FALSE;
                if (!cave[target_row][target_col].m_idx) break;
                if (!player_has_los_bold(target_row, target_col)) break;
+               if (!projectable(py, px, target_row, target_col)) break;
                m_ptr = &m_list[cave[target_row][target_col].m_idx];
                r_ptr = &r_info[m_ptr->r_idx];
                monster_desc(m_name, m_ptr, 0);
@@ -1431,7 +1425,7 @@ msg_format("%s
                msg_format("You command %s to return.", m_name);
 #endif
 
-               teleport_to_player(cave[target_row][target_col].m_idx, 100);
+               teleport_monster_to(cave[target_row][target_col].m_idx, py, px, 100, TRUE);
                break;
        }
        case MS_TELE_AWAY:
@@ -1450,6 +1444,7 @@ msg_format("%s
                target_m_idx = cave[target_row][target_col].m_idx;
                if (!target_m_idx) break;
                if (!los(py, px, target_row, target_col)) break;
+               if (!projectable(py, px, target_row, target_col)) break;
                m_ptr = &m_list[target_m_idx];
                r_ptr = &r_info[m_ptr->r_idx];
                monster_desc(m_name, m_ptr, 0);
@@ -1991,15 +1986,10 @@ if (!get_check("
        if (plev > spell.level) chance -= 3 * (plev - spell.level);
        else chance += (spell.level - plev);
 
-       chance += p_ptr->to_m_chance;
-
        /* Reduce failure rate by INT/WIS adjustment */
        chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
 
-       if (p_ptr->heavy_spell) chance += 20;
-       if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
-       else if (p_ptr->easy_spell) chance-=3;
-       else if (p_ptr->dec_mana) chance-=2;
+       chance = mod_spell_chance_1(chance);
 
        /* Not enough mana to cast */
        if (need_mana > p_ptr->csp)
@@ -2020,9 +2010,7 @@ if (!get_check("
        /* Always a 5 percent chance of working */
        if (chance > 95) chance = 95;
 
-       if(p_ptr->dec_mana) chance--;
-       if (p_ptr->heavy_spell) chance += 5;
-       chance = MAX(chance,0);
+       chance = mod_spell_chance_2(chance);
 
        /* Failed spell */
        if (randint0(100) < chance)
@@ -2109,6 +2097,7 @@ msg_print("
 void learn_spell(int monspell)
 {
        if (p_ptr->action != ACTION_LEARN) return;
+       if (monspell < 0) return; /* Paranoia */
        if (p_ptr->magic_num2[monspell]) return;
        if (p_ptr->confused || p_ptr->blind || p_ptr->image || p_ptr->stun || p_ptr->paralyzed) return;
        if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)