物件重生

From ZeldaMods (Breath of the Wild)
Jump to navigation Jump to search
This page is a translated version of the page Object respawning and the translation is 79% complete.
Other languages:


曠野之息裡的材料、武器、跟敵人會在一段時間後重生。這個機制是為了防止遊戲世界變得「太空曠」。確切的重生規則取決於每種東西的特性。

GameData 裡用來追蹤每個東西應該如何重生的 flag 叫做 "revival flags"(復活標籤)。這些 revival flags 無時無刻都存在遊戲的記憶體裡,即使是相應的物件可能並不存在。

商品

商店裡賣的東西會在子夜時更新(商店會補貨),但是必須滿足下面這些條件:

  • 每件商品都會對應到一塊區域,玩家在補貨的當下不能處在個範圍內。
  • 箭類的物品只有在玩家持有少於 50 [1] 個時才會補貨。

[1.3.1+] 檢查玩家持有多少箭的函數會檢查玩家「真正的」口袋。所謂「假的」口袋則是指玩家在劍之考驗之類的特殊任務裡,物品欄會被暫時清空。換句話說,故意進入這些特殊任務不再會讓 GameDataMgr 誤以為玩家箭很少,進而補貨。

商品的 Revival flags 裡,GameDataMgr 這一項被設成 3。(意思是凡是設成 3 的物品都會遵守上面講的商店補貨的邏輯。)

重生用地圖網格

上面提到的商品和另一類隨機重生的物件(下面會詳述)使用的地圖網格和正常的地圖網格有一點點不同。這裡用到的地圖網格有 10 columns (從 0 到 9)和 8 rows(從 0 到 7)。

假設一件商品(或一個隨機重生的物件)位在第 itemCol 個 column 跟第 itemRow 個 row 裡,那麼玩家「不在指定區域內」的意思是

  • itemCol < playerCol1
  • 或 itemCol > playerCol2
  • 或 itemRow < playerRow1
  • 或 itemRow > playerRow2

玩家的位置(playerCol1、playerCol2、playerRow1、playerRow2)是這樣計算的:

int col = std::clamp(((signed int)x + 5000) / 1000, 0, 9);
int row = std::clamp(((signed int)z + 4000) / 1000, 0, 7);
if ( (col + 0.5) * 1000.0 + -5000.0 >= x ) {
  *col1 = col - 1;
  *col2 = col;
} else {
  *col1 = col;
  *col2 = col + 1;
}
if ( (row + 0.5) * 1000.0 + -4000.0 >= z ) {
  *row1 = row - 1;
  *row2 = row;
} else {
  *row1 = row;
  *row2 = row + 1;
}

This grid is shown on the object map. It is also possible to show the no-revival area for an object by right clicking on it.

血月後重生的物件 (RevivalBloodyMoon)

血月 blood moon 是大部分武器跟敵人重生的關鍵。每次血月出現後,所有跟血月有關的 revival flags 都會被重設為預設值。

對於這一類的物品,GameDataMgr 這一項的值是 1。(換句話說,所有 ResetType 是 1 的物品都會在血月後復活。)

Actors under the RevivalBloodyMoon policy

不自動重生的物件 (RevivalNone)

遵守 RevivalNone policy 的物件不會自動重生。這些物件的列表如下。

Actors under the RevivalNone policy

不重複掉落的物件 (RevivalNoneForDrop)

遵守 RevivalNoneForDrop policy 的物件也不會再次出現。這個類別主要包含了壞掉的守護者(眼睛不會亮的)底下的材料。

Actors under the RevivalNoneForDrop policy

不重複使用的物件 (RevivalNoneForUsed)

這一類的物件主要包含勇導石(林克拿希卡石去碰的東西),這些物件只能使用一次。

Actors under the RevivalNoneForUsed policy

隨機重生的物件 (RevivalRandom)

RevivalRandom policy 底下包含的物件會在隨機時間點重生。此時間長短與紅月無關。這一類的物件主要是素材(植物、水果、石頭等)。

這些物件的 GameDataMgr 是 0,and the position of the object on the main map is stored in the upper 7 bits of the initial flag value。

Actors under the RevivalRandom policy

隨機重生跟隨機掉落的邏輯

每隔六十秒[2]RadarMgr 會計算玩家在重生用網格上的位置。

如果玩家在 AocField(劍之考驗)裡:

  • 某些特殊的 flags (with the reset data set to 127) 會被忽略而不重生.
  • 其他物件有 1% 機率重生。

如果玩家不在劍之考驗裡,那麼檢查:

  • 如果玩家在主世界裡,上面講到的特殊的 flags 有 1% 機率重生。
  • 如果玩家不在主世界裡不特殊的 flags 也有 1% 機率重生。
  • 若以上皆非,那麼每個 flag 還是有 1% 機率重生,前提是玩家跟該物件不處在同一個網格裡。

隨機掉落的物件 (RevivalRandomForDrop)

RevivalRandomForDrop policy 底下包含的物件會在隨機時間點重生。此時間長短與紅月無關。這一類主要是打壞木箱後掉出來的東西(水果等)。

這些物件的 GameDataMgr 是 0,and the position of the object on the main map is stored in the upper 7 bits of the initial flag value。

Actors under the RevivalRandomForDrop policy

和山林霸主一起出現的物件 (RevivalUnderGodTim)

RevivalUnderGodTime policy 底下的物件會和山林霸主一起出現,也就是當 AnimalMaster_Appearance flag 被 WorldMgr 設成 true 的時候。

對這類物件而言,GameDataMgr 的值是 4。

Actors under the RevivalUnderGodTime policy
  1. This is configured by ActorInfo.product.sbyml (itemSaleRevivalCount property) .
  2. Time spent in menus and cutscenes does not count