Skip to content

Harvest data

Coolthulhu edited this page Nov 26, 2016 · 4 revisions

Harvest data is a simplified item group used for tree/shrub harvest and butchery. Defining it is mandatory for harvestable trees and shrubs and optional for butchery. If not defined for butchery, the old code is used instead.

Unless otherwise noted, "Skill" below means:

  • For trees/shrubs: Survival skill
  • For butchery: round(rng_float(0, survival - 3) + (rng_float(0, dexterity - 8 ) / 4) - max(0, factor / 5)) ~= round(rng_float(0, survival + dexterity / 4 - 5) - max(0, factor / 5))

factor above refers to butchery factor of the best butchery tool in inventory. Low factor will negatively affect drops, positive factor will have no effect on drop quality or quantity.

Syntax

Harvest data is in the form of an array of harvest entries.

Harvest entry

  • "id": "zombie_harvest" - should not be specified for inlined data (except for debugging purposes), has to be specified for by-id data.
  • "drop": "apple" - type of the dropped item. Must be a valid item type and not an item group. Liquid harvest is currently only supported for butchery.
  • "base_num": [ 1.5, 3 ] - base number of items that will be dropped for this entry. Note: the number isn't rolled yet. If omitted, defaults to [ 1, 1 ].
  • "scale_num": [ 0.5, 1 ] - number of extra drops from this entry per skill level.
  • "max": 10 - upper cap on the number of dropped items. Applied after all rolls.

The actual number of dropped items is calculated according to the rules below:

  • min_num = base_num[1] + (skill * scale_num[1])
  • max_num = base_num[2] + (skill * scale_num[2])
  • roll = rng_float(min_num, max_num)
  • if (roll > cap) roll = cap
  • Drop roll items (if positive) or print failure message (if roll <= 0)

Note that "base_num" and "scale_num" can be both negative. This, together with "max", can be used to define hard to harvest entries - by defining a negative "base_num", positive "scale_num" and "max": 1, an entry will not generate anything until player has enough skill to overcome the negative "base_num".

Usage in monsters

"harvest": "some_id_here" - harvest data with this id has to be defined elsewhere. Inlining isn't supported at the moment.

Usage in trees/shrubs

"harvest_by_season" : [
    { "seasons": [ "spring" ], "entries": [ { "drop": "apple", "base_num": [ 2, 5 ], "scaled_num": [ 0, 0.5 ] } ] },
    { "seasons": [ "autumn" ], "id": "twigs_and_leaves" }
  • "harvest_by_season" - an array containing objects. Each object must specify "seasons" and either "id" or "entries".
  • "seasons" - an array containing entries from array [ "spring", "summer", "autumn", "winter" ]. Note: specifying the same season twice will overwrite the previous entries for the season.
  • "id" - id of harvest data defined elsewhere.
  • "entries" - a harvest data defined in-line. That is, an array of harvest entries, as described in section above.

Examples

Harvest data itself

  {
    "id": "fish_small",
    "type": "harvest",
    "entries": [
      { "drop": "fish", "scale_num": [ 0.2, 0.4 ], "max": 2 },
      { "drop": "offal", "base_num": [ 0, 1 ], "scale_num": [ 0.2, 0.4 ], "max": 1 },
      { "drop": "stomach" },
      { "drop": "bone", "base_num": [ 1, 2 ], "scale_num": [ 0.4, 0.5 ], "max": 4 }
    ]
  }

Usage for shrub/tree (inlined)

        "type" : "terrain",
        "id" : "t_tree_apple",
        ...
        "harvest_by_season" : [
            { "seasons": [ "autumn" ], "entries": [ { "drop": "apple", "base_num": [ 2, 5 ], "scaled_num": [ 0, 0.5 ] } ] }
        ]

Usage for shrub/tree (by id)

        "id" : "t_tree_apple",
        ...
        "harvest_by_season" : [
            { "seasons": [ "autumn" ], "id": "apples" }
        ]

Usage for monster (by harvest id)

    "id": "mon_fish_blinky",
    ....
    "harvest": "fish_small"

Usage for monster (inlined)

NOT SUPPORTED

TODO

  • Support nesting (item groups?)
  • Support item groups instead of just plain items
  • (Possibly) Support inlined definitions for monsters
  • Support liquid harvest from plants
  • Verify that seasons in plant harvest do not overlap
  • Allow accessing harvest data from LUA
  • Less weird butchery skill formula (extract to json?)
  • Skills other than survival
Clone this wiki locally