游民星空 > 攻略秘籍 > 攻略 > 正文

《饥荒》食谱代码深入详细解析

2016-01-29 17:21:50 来源:饥荒游戏吧 作者:a4440 我要投稿

第2页:

展开

  现在回到preparedfoods.lua,接下来选取部分菜谱,继续解释公式计算方法和一些稀有的菜品属性。

蛙腿三明治:

frogglebunwich =
{
test = function(cooker, names, tags) return (names.froglegs or names.froglegs_cooked) and tags.veggie end,
priority = 1,
foodtype = "MEAT",
health = TUNING.HEALING_MED,
hunger = TUNING.CALORIES_LARGE,
perishtime = TUNING.PERISH_SLOW,
sanity = TUNING.SANITY_TINY,
cooktime = 2,
},

  这个的公式里面出现了"or",意味着至少要取生蛙腿(froglegs)或熟蛙腿(froglegs_cooked)中的一个。整个公式是说:有蛙腿(生或熟)且有蔬菜(tags.veggie)。运算优先级:not > and > or,这里为了先算or,就把or两边的东西用括号括起来了。

太妃糖:

taffy =
{
test = function(cooker, names, tags) return tags.sweetener and tags.sweetener >= 3 and not tags.meat end,
priority = 10,
foodtype = "VEGGIE",
health = -TUNING.HEALING_SMALL,
hunger = TUNING.CALORIES_SMALL*2,
perishtime = TUNING.PERISH_SLOW,
sanity = TUNING.SANITY_MED,
cooktime = 2,
tags = {"honeyed"}
},

  这个公式里面有tags.sweetener >= 3,意味着甜度大于等于3。整个公式是说:甜度大于等于3,且不能有肉(not tags.meat)。那么这里就要用到之前cooking.lua里面的数据了。在cooking.lua里面搜索sweetener,找到唯一一行:

AddIngredientValues({"honey", "honeycomb"}, {sweetener=1}, true)

  意味着蜂蜜和蜂房都可以提供1甜度。那么我们就知道,至少需要三个蜂蜜或蜂房。当然,拿蜂房做菜非常的奢侈。

  另外要注意太妃糖里面health = -TUNING.HEALING_SMALL,这一行。注意等号后面的那个负号,意味着吃太妃糖要损血,减少的血量是HEALING_SMALL,具体值可以在tuning.lua里面查询。

茄子饭/茄子煲/茄子杂烩之类的名字:

stuffedeggplant =
{
test = function(cooker, names, tags) return (names.eggplant or names.eggplant_cooked) and tags.veggie and tags.veggie > 1 end,
priority = 1,
foodtype = "VEGGIE",
health = TUNING.HEALING_SMALL,
hunger = TUNING.CALORIES_LARGE,
perishtime = TUNING.PERISH_SLOW,
sanity = TUNING.SANITY_TINY,
temperature = TUNING.HOT_FOOD_BONUS_TEMP,
temperatureduration = TUNING.FOOD_TEMP_BRIEF,
cooktime = 2,
},

这里面出现了稀有的温度属性:

temperature = TUNING.HOT_FOOD_BONUS_TEMP,
temperatureduration = TUNING.FOOD_TEMP_BRIEF,

  temperature是温度影响,HOT_FOOD_BONUS_TEMP,可以在tuning.lua里面搜到是40,显然吃这个会让角色体温升高。相对的还有COLD_FOOD_BONUS_TEMP=-40,意思也不用我说了吧。

  temperatureduration是温度持续时间,可以在tuning.lua里面搜到FOOD_TEMP_BRIEF = 5。当然数值越长,持续越久。由于没有装显示体温的mod,也无力测试具体数值,有兴趣的话大家可以自己试试。

鱼排:

fishsticks =
{
test = function(cooker, names, tags) return tags.fish and names.twigs and (tags.inedible and tags.inedible <= 1) end,
priority = 10,
foodtype = "MEAT",
health = TUNING.HEALING_LARGE,
hunger = TUNING.CALORIES_LARGE,
perishtime = TUNING.PERISH_MED,
sanity = TUNING.SANITY_TINY,
cooktime = 2,
tags = {"catfood"}
},

  公式里面出现了tags.inedible,inedible在这里可以解释为“不可食度”,唯一具有该度的就是树枝(twigs)。tags.inedible and tags.inedible <= 1就是说有不可食度大于0,不大于1。整个公式是说:有鱼(tags.fish),有树枝(names.twigs),且不可食度大于0,不大于1。再简单点讲就是有鱼,有且仅有一个树枝。

  下面一条tags = {"catfood"},应该与RoG DLC中的猫相关。

SW里面的咖啡:

coffee =
{
test = function(cooker, names, tags) return names.coffeebeans_cooked and (names.coffeebeans_cooked == 4 or (names.coffeebeans_cooked == 3 and (tags.dairy or tags.sweetener))) end,
priority = 30,
foodtype = "VEGGIE",
health = TUNING.HEALING_SMALL,
hunger = TUNING.CALORIES_TINY,
perishtime = TUNING.PERISH_MED,
sanity = -TUNING.SANITY_TINY,
caffeinedelta = TUNING.CAFFEINE_FOOD_BONUS_SPEED,
caffeineduration = TUNING.FOOD_SPEED_LONG,
cooktime = 0.5,
},

  相信看到这里的人应该能看懂公式了:4个烤咖啡豆或者3烤咖啡豆加一奶制品或蜂蜜。

下面比较特殊的两行:

caffeinedelta = TUNING.CAFFEINE_FOOD_BONUS_SPEED,
caffeineduration = TUNING.FOOD_SPEED_LONG,

  咖啡的效果在于加速,caffeinedelta为增加的速度量

tuning.lua中有:

CAFFEINE_FOOD_BONUS_SPEED = 5, -- player base speed plus this, 6 is normal walk speed

  好心的程序员用注释告诉我们,普通行走速度为6,喝了咖啡再加5,将近翻倍。

  然后持续时间caffeineduration = FOOD_SPEED_LONG = total_day_time / 2,喝咖啡加速效果持续半天。

更多相关内容请关注:饥荒专区

责任编辑:Shy夏夏

上一页 1 2
友情提示:支持键盘左右键“← →”翻页

本文是否解决了您的问题

游民星空APP
随手浏览游戏攻略
code
攻略合集
单机游戏下载
休闲娱乐
综合热点资讯
游民星空联运游戏