维护提醒

BWIKI 全站将于 9 月 3 日(全天)进行维护,期间无法编辑任何页面或发布新的评论。

全站通知:

模组:礼物喜好数据

来自星露谷物语维基
跳到导航 跳到搜索

目录

此页面解释游戏如何计算村民礼物喜好。这是面向模组开发者的高级指南。

数据

原始数据

NPC礼物喜好存储在Content\Data\NPCGiftTastes.xnb。可以解包此文件以便编辑。此处是1.5.1的原始数据以供参考:

格式

文件包含两种类型的数据

  • 普遍喜好对所有村民有效。其键名为Universal_喜好程度,其值为使用空格分隔的ID数组(该值≥0代表物品ID,<0 代表类别ID)。例如,考虑如下条目:
      "Universal_Like": "-2 -7 -26 -75 -80 72 395 613 634 635 636 637 638 724 459"
    

    此数据意味着村民应当普遍喜欢类别-2以及物品72,等等。

  • 个人喜好对特定村民有效。其键名为村民的内部名称(例如 Abigail),其值为按照如下喜好程度顺序列出的对话文本:最爱、喜欢、不喜欢、讨厌、一般。例如,考虑阿比盖尔的礼物喜好:
      "Abigail": " I seriously love this! You're the best, @!/66 128 220 226 276 611/Hey, how'd you know I was hungry? This looks delicious!//What am I supposed to do with this?/-5 -75 -79 16 245 246/What were you thinking? This is awful!/330/You brought me a present? Thanks.// "
    

    通过使用/作为分隔符来切分该字符串,可以提取如下数据:

    索引 喜好 反应对话 标识ID
    0, 1 love I seriously love this! You're the best, @! 66 128 220 226 276 611
    2, 3 like Hey, how'd you know I was hungry? This looks delicious! none
    4, 5 dislike What am I supposed to do with this? -5 -75 -79 16 245 246
    6, 7 hate What were you thinking? This is awful! 330
    8, 9 neutral You brought me a present? Thanks. none

    此数据意味着,阿比盖尔有如下个人喜好:喜欢物品66(紫水晶),讨厌类别-5(蛋),诸如此类。

如何确定礼物喜好

该数据格式可能导致喜好发生如下冲突:

  • 物品ID和类别ID冲突
  • 普遍喜好和个人喜好冲突
  • 冲突值(例如乔迪在个人喜好中同时最爱和讨厌黄水仙(物品ID18))。
  • 上述冲突的混合(例如普遍喜好中的物品ID和个人喜好中的类别ID)。

游戏使用相当复杂的算法以计算村民在多大程度上喜爱某个例如(参见 NPC::getGiftTasteForThisItem)。此处是用伪代码呈现的、整理过的算法:

var TASTE = neutral
bool HAS_UNIVERSAL_ID = false
bool HAS_UNIVERSAL_NEUTRAL_ID = false

// part I: universal taste by category
if category is universally loved:
   TASTE = love
else if category is universally hated:
   TASTE = hate
else if category is universally liked:
   TASTE = like
else if category is universally disliked:
   TASTE = dislike

// part II: universal taste by item ID
if itemID is universally loved:
   TASTE = love
   HAS_UNIVERSAL_ID = true
else if itemID is universally hated:
   TASTE = hate
   HAS_UNIVERSAL_ID = true
else if itemID is universally liked:
   TASTE = like
   HAS_UNIVERSAL_ID = true
else if itemID is universally disliked:
   TASTE = dislike
   HAS_UNIVERSAL_ID = true
else if itemID is universally neutral:
   TASTE = neutral
   HAS_UNIVERSAL_ID = true
   HAS_UNIVERSAL_NEUTRAL_ID = true

// part III: override neutral if it's from universal category
if TASTE is neutral and not HAS_UNIVERSAL_NEUTRAL_ID:
   if item is edible but tastes bad (-300 > edibility < 0):
      TASTE = hate
   else if item has a price < 20g:
      TASTE = dislike

// part IV: sometimes override with personal tastes
if ((npc loves itemID OR (item has a category AND npc loves category)) AND (item has no category OR npc doesn't personally love category OR no universal taste for itemID)
   return love
if ((npc hates itemID OR (item has a category AND npc hates category)) AND (item has no category OR npc doesn't personally hate category OR no universal taste for itemID)
   return hate
if ((npc like itemID OR (item has a category AND npc likes category)) AND (item has no category OR npc doesn't personally like category OR no universal taste for itemID)
   return like
if ((npc dislikes itemID OR (item has a category AND npc dislikes category)) AND (item has no category OR npc doesn't personally dislike category OR no universal taste for itemID)
   return dislike
if ((npc neutrals itemID OR (item has a category AND npc neutrals category)) AND (item has no category OR npc doesn't personally neutral category OR no universal taste for itemID)
   return neutral

// part V: return taste if not overridden
return TASTE