物件重生

From ZeldaMods (Breath of the Wild)
Revision as of 23:40, 28 May 2020 by Simple (talk | contribs) (Created page with "上面提到的商品和另一類隨機生成的物件(下面會詳述)使用的地圖網格和正常的地圖網格有一點點不同。這裡用到的地圖網格有 10...")
Jump to navigation Jump to search
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)。

Given an item located in column itemCol and row itemRow, the player is considered to not be in its map area if and only if:

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

where the player column and row values are calculated as follows:

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.

Revival during blood moons (RevivalBloodyMoon)

This policy is used for most weapons and enemies. Every time a blood moon occurs, all associated revival flags are reset to their initial value.

Revival flags for objects under this policy have their GameDataMgr set to 1.

Actors under the RevivalBloodyMoon policy

No automatic revival (RevivalNone)

Objects under the RevivalNone policy will not be automatically revived.

Actors under the RevivalNone policy

No drop revival (RevivalNoneForDrop)

Drops for objects under the RevivalNoneForDrop policy will not be revived. This is used for broken Guardians.

Actors under the RevivalNoneForDrop policy

No revival for use flag (RevivalNoneForUsed)

The use status for objects under the RevivalNoneForUsed policy will not be reset. This is notably used for terminals.

Actors under the RevivalNoneForUsed policy

Random revival (RevivalRandom)

Objects under the RevivalRandom policy will be revived at random times independently of blood moons. This is used for most materials (fruits, rocks, etc.)

Revival flags for objects under this policy have their GameDataMgr set to 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

RevivalRandom and RevivalRandomForDrop logic

Every 60 seconds[2], RadarMgr determines where the player is on the revival grid.

If the player is on AocField (Trial of the Sword):

  • Special flags (with the reset data set to 127) are skipped.
  • Any other revival flag has a 1% chance of being reset.

Otherwise:

  • If the player is on MainField, special flags have a 1% chance of being reset.
  • If the player is not on MainField, non-special flags also have a 1% chance of being reset.
  • In any other case, flags have a 1% chance of being reset, but only if the player is not in the same map area as the object that is to be revived.

Random drop revival (RevivalRandomForDrop)

Drops of objects under the RevivalRandom policy will be revived at random times independently of blood moons. This is used for wooden boxes and other things that contain materials (fruits, etc.)

Revival flags for objects under this policy have their GameDataMgr set to 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

Revival whenever the Lord of the Mountain appears (RevivalUnderGodTime)

Objects under the RevivalUnderGodTime policy will be revived whenever the Lord of the Mountain appears (more precisely, when the AnimalMaster_Appearance flag is set by WorldMgr).

Revival flags for objects under this policy have their GameDataMgr set to 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