OSDN Git Service

[Feature] #38796 マーフォークが地形と浮遊状態に応じて加減速する仕様を追加。 / Speed of Merfolk changes by levitati...
authorDeskull <deskull@users.sourceforge.jp>
Sat, 15 Dec 2018 10:01:52 +0000 (19:01 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Sat, 15 Dec 2018 10:01:52 +0000 (19:01 +0900)
src/cmd-pet.c
src/cmd1.c
src/xtra1.c

index 7dfd6ff..4643b7f 100644 (file)
@@ -1149,11 +1149,8 @@ bool rakuba(HIT_POINT dam, bool force)
        calc_bonuses();
 
        p_ptr->update |= (PU_BONUS);
-
        p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
-
        p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
        p_ptr->redraw |= (PR_EXTRA);
 
        /* Update health track of mount */
index 5efc9be..c78e626 100644 (file)
@@ -826,16 +826,17 @@ bool player_can_enter(s16b feature, u16b mode)
  */
 bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
 {
+       POSITION oy = p_ptr->y;
+       POSITION ox = p_ptr->x;
        cave_type *c_ptr = &cave[ny][nx];
+       cave_type *oc_ptr = &cave[oy][ox];
        feature_type *f_ptr = &f_info[c_ptr->feat];
+       feature_type *of_ptr = &f_info[oc_ptr->feat];
 
        if (!(mpe_mode & MPE_STAYING))
        {
-               POSITION oy = p_ptr->y;
-               POSITION ox = p_ptr->x;
-               cave_type *oc_ptr = &cave[oy][ox];
-               IDX om_idx = oc_ptr->m_idx;
-               IDX nm_idx = c_ptr->m_idx;
+               MONSTER_IDX om_idx = oc_ptr->m_idx;
+               MONSTER_IDX nm_idx = c_ptr->m_idx;
 
                /* Move the player */
                p_ptr->y = ny;
@@ -885,7 +886,6 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
                }
 
                p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_DISTANCE);
-
                p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
                /* Remove "unsafe" flag */
@@ -908,6 +908,15 @@ bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode)
                        msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
                        set_action(ACTION_NONE);
                }
+
+               if (p_ptr->prace == RACE_MERFOLK)
+               {
+                       if(have_flag(f_ptr->flags, FF_WATER) ^ have_flag(of_ptr->flags, FF_WATER))
+                       {
+                               p_ptr->update |= PU_BONUS;
+                               update_stuff();
+                       }
+               }
        }
 
        if (mpe_mode & MPE_ENERGY_USE)
index 3e60f3b..2065f39 100644 (file)
@@ -3153,22 +3153,22 @@ s16b calc_num_fire(object_type *o_ptr)
  */
 void calc_bonuses(void)
 {
-       int             i, j, hold, neutral[2];
-       int             new_speed;
-       int             default_hand = 0;
-       int             empty_hands_status = empty_hands(TRUE);
-       int             extra_blows[2];
-       object_type     *o_ptr;
+       int i, j, hold, neutral[2];
+       int new_speed;
+       int default_hand = 0;
+       int empty_hands_status = empty_hands(TRUE);
+       int extra_blows[2];
+       object_type *o_ptr;
        BIT_FLAGS flgs[TR_FLAG_SIZE];
-       bool            omoi = FALSE;
-       bool            yoiyami = FALSE;
-       bool            down_saving = FALSE;
+       bool omoi = FALSE;
+       bool yoiyami = FALSE;
+       bool down_saving = FALSE;
 #if 0
-       bool            have_dd_s = FALSE, have_dd_t = FALSE;
+       bool have_dd_s = FALSE, have_dd_t = FALSE;
 #endif
-       bool            have_sw = FALSE, have_kabe = FALSE;
-       bool            easy_2weapon = FALSE;
-       bool            riding_levitation = FALSE;
+       bool have_sw = FALSE, have_kabe = FALSE;
+       bool easy_2weapon = FALSE;
+       bool riding_levitation = FALSE;
        OBJECT_IDX this_o_idx, next_o_idx = 0;
        const player_race *tmp_rp_ptr;
 
@@ -3189,9 +3189,12 @@ void calc_bonuses(void)
        bool old_see_inv = p_ptr->see_inv;
        bool old_mighty_throw = p_ptr->mighty_throw;
 
+       /* Current feature under player. */
+       feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];
+
        /* Save the old armor class */
-       s16b old_dis_ac = p_ptr->dis_ac;
-       s16b old_dis_to_a = p_ptr->dis_to_a;
+       ARMOUR_CLASS old_dis_ac = p_ptr->dis_ac;
+       ARMOUR_CLASS old_dis_to_a = p_ptr->dis_to_a;
 
 
        /* Clear extra blows/shots */
@@ -3773,6 +3776,15 @@ void calc_bonuses(void)
                        break;
                case RACE_MERFOLK:
                        p_ptr->resist_water = TRUE;
+                       if(have_flag(f_ptr->flags, FF_WATER))
+                       {
+                               new_speed += (2 + p_ptr->lev / 10);
+                       }
+                       else if(!p_ptr->levitation)
+                       {
+                               new_speed -= 2;
+                       }
+                       break;
                default:
                        /* Do nothing */
                        ;