}
/*!
- * @brief プレイヤーのフロア離脱に伴う全モンスター配列の消去 / Delete/Remove all the monsters when the player leaves the level
+ * @brief プレイヤーのフロア離脱に伴う全モンスター配列の消去
* @param player_ptr プレイヤーへの参照ポインタ
- * @details
- * This is an efficient method of simulating multiple calls to the
- * "delete_monster()" function, with no visual effects.
+ * @details 視覚効果なしでdelete_monster() をフロア全体に対して呼び出す.
*/
void wipe_monsters_list(PlayerType *player_ptr)
{
- if (!monraces_info[MonsterRaceId::BANORLUPART].max_num) {
- if (monraces_info[MonsterRaceId::BANOR].max_num) {
- monraces_info[MonsterRaceId::BANOR].max_num = 0;
- monraces_info[MonsterRaceId::BANOR].r_pkills++;
- monraces_info[MonsterRaceId::BANOR].r_akills++;
- if (monraces_info[MonsterRaceId::BANOR].r_tkills < MAX_SHORT) {
- monraces_info[MonsterRaceId::BANOR].r_tkills++;
- }
- }
-
- if (monraces_info[MonsterRaceId::LUPART].max_num) {
- monraces_info[MonsterRaceId::LUPART].max_num = 0;
- monraces_info[MonsterRaceId::LUPART].r_pkills++;
- monraces_info[MonsterRaceId::LUPART].r_akills++;
- if (monraces_info[MonsterRaceId::LUPART].r_tkills < MAX_SHORT) {
- monraces_info[MonsterRaceId::LUPART].r_tkills++;
- }
- }
- }
-
+ MonraceList::get_instance().defeat_separated_uniques();
auto *floor_ptr = player_ptr->current_floor_ptr;
for (int i = floor_ptr->m_max - 1; i >= 1; i--) {
auto *m_ptr = &floor_ptr->m_list[i];
return std::all_of(it->second.begin(), it->second.end(), [](const auto x) { return monraces_info[x].cur_num == 0; });
}
+
+/*!
+ * @brief 合体ユニークが撃破済の状態でフロアから離脱した時に、各分離ユニークも撃破済状態へと変更する
+ */
+void MonraceList::defeat_separated_uniques()
+{
+ for (const auto &[unified_unique, separates] : unified_uniques) {
+ if (monraces_info[unified_unique].max_num > 0) {
+ continue;
+ }
+
+ for (const auto separate : separates) {
+ auto &monrace = monraces_info[separate];
+ if (monrace.max_num == 0) {
+ continue;
+ }
+
+ monrace.max_num = 0;
+ monrace.r_pkills++;
+ monrace.r_akills++;
+ if (monrace.r_tkills < MAX_SHORT) {
+ monrace.r_tkills++;
+ }
+ }
+ }
+}