OSDN Git Service

Merge pull request #2469 from habu1010/feature/fix-refill-by-oil-flask
authorHabu <habu1010+github@gmail.com>
Fri, 1 Apr 2022 14:59:15 +0000 (23:59 +0900)
committerGitHub <noreply@github.com>
Fri, 1 Apr 2022 14:59:15 +0000 (23:59 +0900)
[Fix] 油つぼからランタンの燃料補給ができなくなる

src/monster-attack/monster-eating.cpp
src/spell-class/spells-mirror-master.cpp

index c116f69..67e8a3d 100644 (file)
@@ -230,8 +230,8 @@ bool process_un_power(PlayerType *player_ptr, MonsterAttackPlayer *monap_ptr)
     object_kind *kind_ptr = &k_info[monap_ptr->o_ptr->k_idx];
     PARAMETER_VALUE pval = kind_ptr->pval;
     DEPTH level = monap_ptr->rlev;
-    int drain = is_magic_mastery ? std::min<short>(pval, pval * level / 400 + pval * randint1(level) / 400) : pval;
-    drain = std::min<short>(drain, monap_ptr->o_ptr->pval);
+    auto drain = is_magic_mastery ? std::min<short>(pval, pval * level / 400 + pval * randint1(level) / 400) : pval;
+    drain = std::min(drain, monap_ptr->o_ptr->pval);
     if (drain <= 0) {
         return false;
     }
index 2a6affc..4a03b6a 100644 (file)
@@ -255,8 +255,10 @@ void SpellsMirrorMaster::next_mirror(int *next_y, int *next_x, int cury, int cur
         return;
     }
 
-    *next_y = cury + randint0(5) - 2;
-    *next_x = curx + randint0(5) - 2;
+    do {
+        *next_y = cury + randint0(5) - 2;
+        *next_x = curx + randint0(5) - 2;
+    } while ((*next_y == cury) && (*next_x == curx));
 }
 
 void SpellsMirrorMaster::project_seeker_ray(int target_x, int target_y, int dam)