farming-weight 0.14.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -18
- package/dist/constants/attributes.d.ts +12 -7
- package/dist/constants/attributes.js +17 -39
- package/dist/constants/attributes.js.map +1 -1
- package/dist/constants/chips.d.ts +1 -6
- package/dist/constants/chips.js +11 -15
- package/dist/constants/chips.js.map +1 -1
- package/dist/constants/crops.d.ts +28 -4
- package/dist/constants/crops.js +65 -2
- package/dist/constants/crops.js.map +1 -1
- package/dist/constants/enchants.d.ts +1 -1
- package/dist/constants/enchants.js +117 -68
- package/dist/constants/enchants.js.map +1 -1
- package/dist/constants/garden.js +152 -137
- package/dist/constants/garden.js.map +1 -1
- package/dist/constants/pests.d.ts +3 -2
- package/dist/constants/pests.js +5 -0
- package/dist/constants/pests.js.map +1 -1
- package/dist/constants/reforge-types.d.ts +57 -0
- package/dist/constants/reforge-types.js +40 -0
- package/dist/constants/reforge-types.js.map +1 -0
- package/dist/constants/reforges.d.ts +8 -55
- package/dist/constants/reforges.js +10 -635
- package/dist/constants/reforges.js.map +1 -1
- package/dist/constants/specific.js +11 -11
- package/dist/constants/specific.js.map +1 -1
- package/dist/constants/stats.d.ts +1 -0
- package/dist/constants/stats.js +2 -0
- package/dist/constants/stats.js.map +1 -1
- package/dist/constants/tempfortune.d.ts +5 -0
- package/dist/constants/tempfortune.js +36 -7
- package/dist/constants/tempfortune.js.map +1 -1
- package/dist/constants/upgrades.d.ts +36 -3
- package/dist/constants/upgrades.js +12 -0
- package/dist/constants/upgrades.js.map +1 -1
- package/dist/crops/special.d.ts +1 -1
- package/dist/crops/special.js.map +1 -1
- package/dist/effects/environment.d.ts +12 -0
- package/dist/effects/environment.js +33 -0
- package/dist/effects/environment.js.map +1 -0
- package/dist/effects/index.d.ts +4 -0
- package/dist/effects/index.js +5 -0
- package/dist/effects/index.js.map +1 -0
- package/dist/effects/matcher.d.ts +23 -0
- package/dist/effects/matcher.js +108 -0
- package/dist/effects/matcher.js.map +1 -0
- package/dist/effects/resolver.d.ts +63 -0
- package/dist/effects/resolver.js +239 -0
- package/dist/effects/resolver.js.map +1 -0
- package/dist/effects/summary.d.ts +5 -0
- package/dist/effects/summary.js +21 -0
- package/dist/effects/summary.js.map +1 -0
- package/dist/effects/types.d.ts +147 -0
- package/dist/effects/types.js +9 -0
- package/dist/effects/types.js.map +1 -0
- package/dist/features/composter/upgrades.js +5 -5
- package/dist/features/composter/upgrades.js.map +1 -1
- package/dist/fortune/farmingaccessory.d.ts +9 -1
- package/dist/fortune/farmingaccessory.js +24 -13
- package/dist/fortune/farmingaccessory.js.map +1 -1
- package/dist/fortune/farmingarmor.d.ts +21 -10
- package/dist/fortune/farmingarmor.js +89 -29
- package/dist/fortune/farmingarmor.js.map +1 -1
- package/dist/fortune/farmingequipment.d.ts +10 -1
- package/dist/fortune/farmingequipment.js +44 -11
- package/dist/fortune/farmingequipment.js.map +1 -1
- package/dist/fortune/farmingpet.d.ts +16 -0
- package/dist/fortune/farmingpet.js +207 -0
- package/dist/fortune/farmingpet.js.map +1 -1
- package/dist/fortune/farmingtool.d.ts +13 -6
- package/dist/fortune/farmingtool.js +60 -44
- package/dist/fortune/farmingtool.js.map +1 -1
- package/dist/fortune/lotuspiecebonus.d.ts +6 -0
- package/dist/fortune/lotuspiecebonus.js +20 -0
- package/dist/fortune/lotuspiecebonus.js.map +1 -0
- package/dist/fortune/upgradeable.d.ts +2 -4
- package/dist/fortune/upgradeablebase.d.ts +2 -4
- package/dist/fortune/upgradeablebase.js +4 -10
- package/dist/fortune/upgradeablebase.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/items/accessories/base.d.ts +3 -0
- package/dist/items/accessories/base.js +4 -0
- package/dist/items/accessories/base.js.map +1 -0
- package/dist/items/accessories/fermento-family.d.ts +91 -0
- package/dist/items/accessories/fermento-family.js +125 -0
- package/dist/items/accessories/fermento-family.js.map +1 -0
- package/dist/items/accessories/freshly-baked.d.ts +80 -0
- package/dist/items/accessories/freshly-baked.js +119 -0
- package/dist/items/accessories/freshly-baked.js.map +1 -0
- package/dist/items/accessories/index.d.ts +25 -0
- package/dist/items/accessories/index.js +25 -0
- package/dist/items/accessories/index.js.map +1 -0
- package/dist/items/accessories/power-relic.d.ts +18 -0
- package/dist/items/accessories/power-relic.js +37 -0
- package/dist/items/accessories/power-relic.js.map +1 -0
- package/dist/items/accessories/special.d.ts +24 -0
- package/dist/items/accessories/special.js +41 -0
- package/dist/items/accessories/special.js.map +1 -0
- package/dist/items/accessories.d.ts +2 -3
- package/dist/items/accessories.js +1 -137
- package/dist/items/accessories.js.map +1 -1
- package/dist/items/armor/biohazard.js +4 -4
- package/dist/items/armor/biohazard.js.map +1 -1
- package/dist/items/armor/cropie.d.ts +4 -0
- package/dist/items/armor/cropie.js +10 -4
- package/dist/items/armor/cropie.js.map +1 -1
- package/dist/items/armor/farm.js +4 -4
- package/dist/items/armor/farm.js.map +1 -1
- package/dist/items/armor/fermento.d.ts +4 -0
- package/dist/items/armor/fermento.js +10 -4
- package/dist/items/armor/fermento.js.map +1 -1
- package/dist/items/armor/groups.d.ts +2 -0
- package/dist/items/armor/groups.js +17 -0
- package/dist/items/armor/groups.js.map +1 -0
- package/dist/items/armor/helianthus.js +4 -4
- package/dist/items/armor/helianthus.js.map +1 -1
- package/dist/items/armor/melon.d.ts +4 -0
- package/dist/items/armor/melon.js +10 -4
- package/dist/items/armor/melon.js.map +1 -1
- package/dist/items/armor/mushroom.js +4 -4
- package/dist/items/armor/mushroom.js.map +1 -1
- package/dist/items/armor/rabbit.js +4 -4
- package/dist/items/armor/rabbit.js.map +1 -1
- package/dist/items/armor/special.js +4 -4
- package/dist/items/armor/special.js.map +1 -1
- package/dist/items/armor/squash.d.ts +4 -0
- package/dist/items/armor/squash.js +10 -4
- package/dist/items/armor/squash.js.map +1 -1
- package/dist/items/equipment/blossom.js +4 -4
- package/dist/items/equipment/blossom.js.map +1 -1
- package/dist/items/equipment/lotus.js +4 -4
- package/dist/items/equipment/lotus.js.map +1 -1
- package/dist/items/equipment/pesthunter.js +4 -4
- package/dist/items/equipment/pesthunter.js.map +1 -1
- package/dist/items/equipment/special.js +2 -2
- package/dist/items/equipment/special.js.map +1 -1
- package/dist/items/gems/base.d.ts +19 -0
- package/dist/items/gems/base.js +60 -0
- package/dist/items/gems/base.js.map +1 -0
- package/dist/items/gems/index.d.ts +1 -0
- package/dist/items/gems/index.js +2 -0
- package/dist/items/gems/index.js.map +1 -0
- package/dist/items/pets/bee.d.ts +9 -0
- package/dist/items/pets/bee.js +33 -1
- package/dist/items/pets/bee.js.map +1 -1
- package/dist/items/pets/chicken.js +1 -1
- package/dist/items/pets/chicken.js.map +1 -1
- package/dist/items/pets/elephant.js +1 -1
- package/dist/items/pets/elephant.js.map +1 -1
- package/dist/items/pets/hedgehog.d.ts +5 -0
- package/dist/items/pets/hedgehog.js +6 -1
- package/dist/items/pets/hedgehog.js.map +1 -1
- package/dist/items/pets/mooshroom-cow.js +1 -1
- package/dist/items/pets/mooshroom-cow.js.map +1 -1
- package/dist/items/pets/mosquito.js +1 -1
- package/dist/items/pets/mosquito.js.map +1 -1
- package/dist/items/pets/pig.d.ts +5 -0
- package/dist/items/pets/pig.js +19 -14
- package/dist/items/pets/pig.js.map +1 -1
- package/dist/items/pets/rabbit.js +1 -1
- package/dist/items/pets/rabbit.js.map +1 -1
- package/dist/items/pets/rose-dragon.js +12 -14
- package/dist/items/pets/rose-dragon.js.map +1 -1
- package/dist/items/pets/slug.js +1 -1
- package/dist/items/pets/slug.js.map +1 -1
- package/dist/items/pets.d.ts +1 -1
- package/dist/items/pets.js +18 -4
- package/dist/items/pets.js.map +1 -1
- package/dist/items/reforges/base.d.ts +18 -0
- package/dist/items/reforges/base.js +54 -0
- package/dist/items/reforges/base.js.map +1 -0
- package/dist/items/reforges/blessed.d.ts +7 -0
- package/dist/items/reforges/blessed.js +90 -0
- package/dist/items/reforges/blessed.js.map +1 -0
- package/dist/items/reforges/blooming.d.ts +4 -0
- package/dist/items/reforges/blooming.js +43 -0
- package/dist/items/reforges/blooming.js.map +1 -0
- package/dist/items/reforges/bountiful.d.ts +4 -0
- package/dist/items/reforges/bountiful.js +63 -0
- package/dist/items/reforges/bountiful.js.map +1 -0
- package/dist/items/reforges/bustling.d.ts +4 -0
- package/dist/items/reforges/bustling.js +26 -0
- package/dist/items/reforges/bustling.js.map +1 -0
- package/dist/items/reforges/deep-fried.d.ts +7 -0
- package/dist/items/reforges/deep-fried.js +38 -0
- package/dist/items/reforges/deep-fried.js.map +1 -0
- package/dist/items/reforges/earthy.d.ts +4 -0
- package/dist/items/reforges/earthy.js +26 -0
- package/dist/items/reforges/earthy.js.map +1 -0
- package/dist/items/reforges/green-thumb.d.ts +4 -0
- package/dist/items/reforges/green-thumb.js +43 -0
- package/dist/items/reforges/green-thumb.js.map +1 -0
- package/dist/items/reforges/index.d.ts +16 -0
- package/dist/items/reforges/index.js +43 -0
- package/dist/items/reforges/index.js.map +1 -0
- package/dist/items/reforges/mantid.d.ts +4 -0
- package/dist/items/reforges/mantid.js +43 -0
- package/dist/items/reforges/mantid.js.map +1 -0
- package/dist/items/reforges/mossy.d.ts +4 -0
- package/dist/items/reforges/mossy.js +44 -0
- package/dist/items/reforges/mossy.js.map +1 -0
- package/dist/items/reforges/overpriced.d.ts +4 -0
- package/dist/items/reforges/overpriced.js +43 -0
- package/dist/items/reforges/overpriced.js.map +1 -0
- package/dist/items/reforges/robust.d.ts +4 -0
- package/dist/items/reforges/robust.js +22 -0
- package/dist/items/reforges/robust.js.map +1 -0
- package/dist/items/reforges/rooted.d.ts +4 -0
- package/dist/items/reforges/rooted.js +43 -0
- package/dist/items/reforges/rooted.js.map +1 -0
- package/dist/items/reforges/squeaky.d.ts +4 -0
- package/dist/items/reforges/squeaky.js +47 -0
- package/dist/items/reforges/squeaky.js.map +1 -0
- package/dist/items/sources/attributes.d.ts +119 -0
- package/dist/items/sources/attributes.js +285 -0
- package/dist/items/sources/attributes.js.map +1 -0
- package/dist/items/sources/base.d.ts +33 -0
- package/dist/items/sources/base.js +13 -0
- package/dist/items/sources/base.js.map +1 -0
- package/dist/items/sources/chips.d.ts +54 -0
- package/dist/items/sources/chips.js +100 -0
- package/dist/items/sources/chips.js.map +1 -0
- package/dist/items/sources/effects-util.d.ts +10 -0
- package/dist/items/sources/effects-util.js +35 -0
- package/dist/items/sources/effects-util.js.map +1 -0
- package/dist/items/sources/enchants.d.ts +28 -0
- package/dist/items/sources/enchants.js +87 -0
- package/dist/items/sources/enchants.js.map +1 -0
- package/dist/items/sources/gems.d.ts +9 -0
- package/dist/items/sources/gems.js +35 -0
- package/dist/items/sources/gems.js.map +1 -0
- package/dist/items/sources/index.d.ts +6 -0
- package/dist/items/sources/index.js +7 -0
- package/dist/items/sources/index.js.map +1 -0
- package/dist/items/sources/reforges.d.ts +8 -0
- package/dist/items/sources/reforges.js +10 -0
- package/dist/items/sources/reforges.js.map +1 -0
- package/dist/items/tools/cactus-knife.js +6 -6
- package/dist/items/tools/cactus-knife.js.map +1 -1
- package/dist/items/tools/cocoa-chopper.js +6 -6
- package/dist/items/tools/cocoa-chopper.js.map +1 -1
- package/dist/items/tools/dicers.js +6 -6
- package/dist/items/tools/dicers.js.map +1 -1
- package/dist/items/tools/fungi-cutter.js +6 -6
- package/dist/items/tools/fungi-cutter.js.map +1 -1
- package/dist/items/tools/mathematical-hoes.d.ts +5 -5
- package/dist/items/tools/mathematical-hoes.js +26 -26
- package/dist/items/tools/mathematical-hoes.js.map +1 -1
- package/dist/items/tools/special.js +2 -2
- package/dist/items/tools/special.js.map +1 -1
- package/dist/items/types/pets.d.ts +0 -2
- package/dist/player/player.d.ts +60 -7
- package/dist/player/player.js +318 -128
- package/dist/player/player.js.map +1 -1
- package/dist/player/playeroptions.d.ts +25 -1
- package/dist/player/playeroptions.js.map +1 -1
- package/dist/upgrades/enchantupgrades.js +22 -8
- package/dist/upgrades/enchantupgrades.js.map +1 -1
- package/dist/upgrades/getsourceprogress.js +7 -0
- package/dist/upgrades/getsourceprogress.js.map +1 -1
- package/dist/upgrades/groups.d.ts +3 -0
- package/dist/upgrades/groups.js +86 -0
- package/dist/upgrades/groups.js.map +1 -0
- package/dist/upgrades/itemcatalog.d.ts +3 -0
- package/dist/upgrades/itemcatalog.js +21 -0
- package/dist/upgrades/itemcatalog.js.map +1 -0
- package/dist/upgrades/itemregistry.d.ts +1 -2
- package/dist/upgrades/itemregistry.js +23 -3
- package/dist/upgrades/itemregistry.js.map +1 -1
- package/dist/upgrades/sources/accessorysources.js +1 -1
- package/dist/upgrades/sources/accessorysources.js.map +1 -1
- package/dist/upgrades/sources/armorsetsources.js +16 -16
- package/dist/upgrades/sources/armorsetsources.js.map +1 -1
- package/dist/upgrades/sources/cropsources.js +10 -5
- package/dist/upgrades/sources/cropsources.js.map +1 -1
- package/dist/upgrades/sources/dynamicfortunesources.d.ts +5 -2
- package/dist/upgrades/sources/effectsources.d.ts +4 -0
- package/dist/upgrades/sources/effectsources.js +60 -0
- package/dist/upgrades/sources/effectsources.js.map +1 -0
- package/dist/upgrades/sources/gearsources.js +33 -8
- package/dist/upgrades/sources/gearsources.js.map +1 -1
- package/dist/upgrades/sources/generalsources.d.ts +3 -2
- package/dist/upgrades/sources/generalsources.js +313 -22
- package/dist/upgrades/sources/generalsources.js.map +1 -1
- package/dist/upgrades/sources/toolsources.js +64 -84
- package/dist/upgrades/sources/toolsources.js.map +1 -1
- package/dist/upgrades/upgradekeys.d.ts +2 -0
- package/dist/upgrades/upgradekeys.js +5 -0
- package/dist/upgrades/upgradekeys.js.map +1 -0
- package/dist/upgrades/upgrades.d.ts +5 -7
- package/dist/upgrades/upgrades.js +142 -43
- package/dist/upgrades/upgrades.js.map +1 -1
- package/dist/upgrades/upgradeutils.d.ts +2 -4
- package/dist/upgrades/upgradeutils.js +26 -6
- package/dist/upgrades/upgradeutils.js.map +1 -1
- package/dist/util/bestiary.d.ts +10 -0
- package/dist/util/bestiary.js +41 -0
- package/dist/util/bestiary.js.map +1 -0
- package/dist/util/enchants.d.ts +6 -0
- package/dist/util/enchants.js +20 -5
- package/dist/util/enchants.js.map +1 -1
- package/dist/util/gems.js +4 -30
- package/dist/util/gems.js.map +1 -1
- package/dist/util/itemstats.d.ts +3 -0
- package/dist/util/itemstats.js +20 -2
- package/dist/util/itemstats.js.map +1 -1
- package/dist/util/ratecalc-effects.d.ts +64 -0
- package/dist/util/ratecalc-effects.js +252 -0
- package/dist/util/ratecalc-effects.js.map +1 -0
- package/dist/util/ratecalc.d.ts +0 -33
- package/dist/util/ratecalc.js +0 -187
- package/dist/util/ratecalc.js.map +1 -1
- package/dist/util/skyblocktime.d.ts +1 -0
- package/dist/util/skyblocktime.js +4 -0
- package/dist/util/skyblocktime.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if `scope` matches the given `DropContext`.
|
|
3
|
+
*
|
|
4
|
+
* Empty scope = global match. All declared fields are AND-ed. The optional
|
|
5
|
+
* `match` predicate runs last.
|
|
6
|
+
*/
|
|
7
|
+
export function matchesScopeForDrop(scope, ctx) {
|
|
8
|
+
if (!scope)
|
|
9
|
+
return true;
|
|
10
|
+
if (scope.crops && !scope.crops.includes(ctx.crop))
|
|
11
|
+
return false;
|
|
12
|
+
if (scope.dropKinds && !scope.dropKinds.includes(ctx.dropKind))
|
|
13
|
+
return false;
|
|
14
|
+
if (scope.items && !scope.items.includes(ctx.itemId))
|
|
15
|
+
return false;
|
|
16
|
+
if (scope.specialCropTypes) {
|
|
17
|
+
if (!ctx.specialCropType)
|
|
18
|
+
return false;
|
|
19
|
+
if (!scope.specialCropTypes.includes(ctx.specialCropType))
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (scope.tags) {
|
|
23
|
+
for (const tag of scope.tags) {
|
|
24
|
+
if (!ctx.tags.has(tag))
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (scope.requiresHarvestFeast && !ctx.env.harvestFeast)
|
|
29
|
+
return false;
|
|
30
|
+
if (scope.requiresInSeason && !ctx.env.inSeason)
|
|
31
|
+
return false;
|
|
32
|
+
if (scope.appliesToAddedDrops === false && ctx.fromAddDrop)
|
|
33
|
+
return false;
|
|
34
|
+
if (scope.match && !scope.match(ctx))
|
|
35
|
+
return false;
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns true if `scope` is valid for stat resolution.
|
|
40
|
+
*
|
|
41
|
+
* Drop-only scoped effects never match stat resolution. Any of `items`,
|
|
42
|
+
* `dropKinds`, `specialCropTypes`, `tags`, or `match` causes outright rejection.
|
|
43
|
+
*/
|
|
44
|
+
export function matchesScopeForStat(scope, ctx) {
|
|
45
|
+
if (!scope)
|
|
46
|
+
return true;
|
|
47
|
+
// Drop-only fields disqualify the effect from stat resolution.
|
|
48
|
+
if (scope.items)
|
|
49
|
+
return false;
|
|
50
|
+
if (scope.dropKinds)
|
|
51
|
+
return false;
|
|
52
|
+
if (scope.specialCropTypes)
|
|
53
|
+
return false;
|
|
54
|
+
if (scope.tags)
|
|
55
|
+
return false;
|
|
56
|
+
if (scope.match)
|
|
57
|
+
return false;
|
|
58
|
+
if (scope.crops) {
|
|
59
|
+
// A crop-scoped effect contributes to a stat query only when the query
|
|
60
|
+
// names a crop AND that crop is in the scope.
|
|
61
|
+
if (!ctx.crop)
|
|
62
|
+
return false;
|
|
63
|
+
if (!scope.crops.includes(ctx.crop))
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
if (scope.requiresHarvestFeast && !ctx.env.harvestFeast)
|
|
67
|
+
return false;
|
|
68
|
+
if (scope.requiresInSeason) {
|
|
69
|
+
// In-season requires a crop and an active feast.
|
|
70
|
+
if (!ctx.crop || !ctx.env.inSeason)
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns true if `scope` is structurally "global Overbloom-shaped":
|
|
77
|
+
* no crop/feast/season narrowing, optionally `tags: ['overbloom']` only.
|
|
78
|
+
*
|
|
79
|
+
* Used by `getStat(Stat.Overbloom)` to decide which Overbloom-related
|
|
80
|
+
* `add-rare-pct` effects count toward the scalar total.
|
|
81
|
+
*/
|
|
82
|
+
export function isGlobalOverbloomScope(scope) {
|
|
83
|
+
if (!scope)
|
|
84
|
+
return true;
|
|
85
|
+
if (scope.crops)
|
|
86
|
+
return false;
|
|
87
|
+
if (scope.dropKinds)
|
|
88
|
+
return false;
|
|
89
|
+
if (scope.items)
|
|
90
|
+
return false;
|
|
91
|
+
if (scope.specialCropTypes)
|
|
92
|
+
return false;
|
|
93
|
+
if (scope.match)
|
|
94
|
+
return false;
|
|
95
|
+
if (scope.requiresHarvestFeast)
|
|
96
|
+
return false;
|
|
97
|
+
if (scope.requiresInSeason)
|
|
98
|
+
return false;
|
|
99
|
+
if (scope.appliesToAddedDrops === false)
|
|
100
|
+
return false;
|
|
101
|
+
if (scope.tags) {
|
|
102
|
+
// Allow only `['overbloom']` (in any order/length 1).
|
|
103
|
+
if (scope.tags.length !== 1 || scope.tags[0] !== 'overbloom')
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=matcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matcher.js","sourceRoot":"","sources":["../../src/effects/matcher.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAwB,EAAE,GAAgB;IAC7E,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC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,CAAC;IAC9B,IAAI,KAAK,CAAC,oBAAoB;QAAE,OAAO,KAAK,CAAC;IAC7C,IAAI,KAAK,CAAC,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACzC,IAAI,KAAK,CAAC,mBAAmB,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAChB,sDAAsD;QACtD,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW;YAAE,OAAO,KAAK,CAAC;IAC5E,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Stat } from '../constants/stats.js';
|
|
2
|
+
import { type AppliedEffect, type DropContext, type Effect, type EffectAddDropPayload, type EffectEnvironment, type EffectPhase, type StatContext } from './types.js';
|
|
3
|
+
/** Resolve an effect's phase, defaulting from its op when omitted. */
|
|
4
|
+
export declare function effectPhase(effect: Effect): EffectPhase;
|
|
5
|
+
/**
|
|
6
|
+
* Throw if a multiplicative effect carries an invalid value. Catches the
|
|
7
|
+
* Cropeetle/Deep-Fried delta-vs-factor mismatch class of bugs at the source.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assertValidEffect(effect: Effect): void;
|
|
10
|
+
/**
|
|
11
|
+
* Sum `add-stat` effects matching a stat query and a `StatContext`.
|
|
12
|
+
*
|
|
13
|
+
* Drop-only scoped effects are rejected by the matcher.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveStatTotal(effects: readonly Effect[], stat: Stat, ctx: StatContext): number;
|
|
16
|
+
/**
|
|
17
|
+
* Per-stat breakdown of `add-stat` contributions matching a `StatContext`.
|
|
18
|
+
* Returns `{ source: amount }` aggregated by source name.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveStatBreakdown(effects: readonly Effect[], stat: Stat, ctx: StatContext): Record<string, number>;
|
|
21
|
+
/**
|
|
22
|
+
* Compute the virtual scalar for `Stat.Overbloom`.
|
|
23
|
+
*
|
|
24
|
+
* Sums `value` from `add-rare-pct` effects whose `relatedStats` includes
|
|
25
|
+
* `Stat.Overbloom` and whose scope is global Overbloom-shaped. Scoped Overbloom-
|
|
26
|
+
* flavored effects are excluded by design - see the architecture plan.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveOverbloomScalar(effects: readonly Effect[], ctx: StatContext, overbloomStat: Stat): number;
|
|
29
|
+
/**
|
|
30
|
+
* Per-source breakdown of the global Overbloom scalar.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveOverbloomBreakdown(effects: readonly Effect[], ctx: StatContext, overbloomStat: Stat): Record<string, number>;
|
|
33
|
+
export interface ProducedDrop {
|
|
34
|
+
source: string;
|
|
35
|
+
payload: EffectAddDropPayload;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Collect drops emitted by `add-drop` effects whose env-level scope matches.
|
|
39
|
+
*
|
|
40
|
+
* Real per-drop scope filtering (tags, items, etc.) happens later when the
|
|
41
|
+
* calculator builds a `DropContext` for each candidate.
|
|
42
|
+
*/
|
|
43
|
+
export declare function produceAddedDrops(effects: readonly Effect[], env: EffectEnvironment): ProducedDrop[];
|
|
44
|
+
export interface DropResolutionResult {
|
|
45
|
+
/** Additive percentage points (e.g. 50 = +50%) summed from `add-rare-pct` effects. */
|
|
46
|
+
addRarePct: number;
|
|
47
|
+
/** Combined `mul-rare` factor (product of all matching factors). 1.0 = identity. */
|
|
48
|
+
mulRare: number;
|
|
49
|
+
/** Combined `mul-drop` factor (product of all matching factors). 1.0 = identity. */
|
|
50
|
+
mulDrop: number;
|
|
51
|
+
/** Per-effect record of contributions to this drop, in pipeline order. */
|
|
52
|
+
applied: AppliedEffect[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolve `add-rare-pct`, `mul-rare`, and `mul-drop` effects for a single drop.
|
|
56
|
+
*
|
|
57
|
+
* The calculator is expected to combine the parts as:
|
|
58
|
+
* `final = base * (1 + addRarePct/100) * mulRare * mulDrop`
|
|
59
|
+
*
|
|
60
|
+
* `applied` records every effect that touched this drop, with phase and
|
|
61
|
+
* resolved amount, for breakdown UIs.
|
|
62
|
+
*/
|
|
63
|
+
export declare function resolveDropEffects(effects: readonly Effect[], ctx: DropContext): DropResolutionResult;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { isGlobalOverbloomScope, matchesScopeForDrop, matchesScopeForStat } from './matcher.js';
|
|
2
|
+
import { DEFAULT_PHASE_FOR_OP, } from './types.js';
|
|
3
|
+
/** Resolve an effect's phase, defaulting from its op when omitted. */
|
|
4
|
+
export function effectPhase(effect) {
|
|
5
|
+
return effect.phase ?? DEFAULT_PHASE_FOR_OP[effect.op];
|
|
6
|
+
}
|
|
7
|
+
/** Resolve the numeric `value` of an effect at a given context. */
|
|
8
|
+
function resolveValue(effect, ctx) {
|
|
9
|
+
const { value } = effect;
|
|
10
|
+
if (typeof value === 'function')
|
|
11
|
+
return value(ctx);
|
|
12
|
+
return typeof value === 'number' ? value : 0;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Throw if a multiplicative effect carries an invalid value. Catches the
|
|
16
|
+
* Cropeetle/Deep-Fried delta-vs-factor mismatch class of bugs at the source.
|
|
17
|
+
*/
|
|
18
|
+
export function assertValidEffect(effect) {
|
|
19
|
+
if (effect.op === 'mul-rare' || effect.op === 'mul-drop') {
|
|
20
|
+
const v = effect.value;
|
|
21
|
+
const numeric = typeof v === 'number' ? v : null;
|
|
22
|
+
if (numeric !== null && numeric < 0) {
|
|
23
|
+
throw new Error(`Invalid ${effect.op} effect from "${effect.source}": value must be >= 0 (got ${numeric}). ` +
|
|
24
|
+
'Multiplicative ops carry a factor (1.2 = x1.2), not a delta.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (effect.op === 'add-stat' && !effect.stat) {
|
|
28
|
+
throw new Error(`Invalid add-stat effect from "${effect.source}": missing 'stat' field.`);
|
|
29
|
+
}
|
|
30
|
+
if (effect.op === 'add-drop' && !effect.drop) {
|
|
31
|
+
throw new Error(`Invalid add-drop effect from "${effect.source}": missing 'drop' field.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sum `add-stat` effects matching a stat query and a `StatContext`.
|
|
36
|
+
*
|
|
37
|
+
* Drop-only scoped effects are rejected by the matcher.
|
|
38
|
+
*/
|
|
39
|
+
export function resolveStatTotal(effects, stat, ctx) {
|
|
40
|
+
let total = 0;
|
|
41
|
+
for (const effect of effects) {
|
|
42
|
+
if (effect.op !== 'add-stat')
|
|
43
|
+
continue;
|
|
44
|
+
if (effect.stat !== stat)
|
|
45
|
+
continue;
|
|
46
|
+
if (!matchesScopeForStat(effect.scope, ctx))
|
|
47
|
+
continue;
|
|
48
|
+
total += resolveValue(effect, ctx);
|
|
49
|
+
}
|
|
50
|
+
return total;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Per-stat breakdown of `add-stat` contributions matching a `StatContext`.
|
|
54
|
+
* Returns `{ source: amount }` aggregated by source name.
|
|
55
|
+
*/
|
|
56
|
+
export function resolveStatBreakdown(effects, stat, ctx) {
|
|
57
|
+
const out = {};
|
|
58
|
+
for (const effect of effects) {
|
|
59
|
+
if (effect.op !== 'add-stat')
|
|
60
|
+
continue;
|
|
61
|
+
if (effect.stat !== stat)
|
|
62
|
+
continue;
|
|
63
|
+
if (!matchesScopeForStat(effect.scope, ctx))
|
|
64
|
+
continue;
|
|
65
|
+
const v = resolveValue(effect, ctx);
|
|
66
|
+
if (!v)
|
|
67
|
+
continue;
|
|
68
|
+
out[effect.source] = (out[effect.source] ?? 0) + v;
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Compute the virtual scalar for `Stat.Overbloom`.
|
|
74
|
+
*
|
|
75
|
+
* Sums `value` from `add-rare-pct` effects whose `relatedStats` includes
|
|
76
|
+
* `Stat.Overbloom` and whose scope is global Overbloom-shaped. Scoped Overbloom-
|
|
77
|
+
* flavored effects are excluded by design - see the architecture plan.
|
|
78
|
+
*/
|
|
79
|
+
export function resolveOverbloomScalar(effects, ctx, overbloomStat) {
|
|
80
|
+
let total = 0;
|
|
81
|
+
for (const effect of effects) {
|
|
82
|
+
if (effect.op !== 'add-rare-pct')
|
|
83
|
+
continue;
|
|
84
|
+
if (!effect.relatedStats?.includes(overbloomStat))
|
|
85
|
+
continue;
|
|
86
|
+
if (!isGlobalOverbloomScope(effect.scope))
|
|
87
|
+
continue;
|
|
88
|
+
// Env-level requirements still apply to the scalar (e.g. Harvest Feast-only flat Overbloom would only
|
|
89
|
+
// contribute when the feast is active). `requiresInSeason` requires a crop in the StatContext.
|
|
90
|
+
if (effect.scope?.requiresHarvestFeast && !ctx.env.harvestFeast)
|
|
91
|
+
continue;
|
|
92
|
+
if (effect.scope?.requiresInSeason && (!ctx.crop || !ctx.env.inSeason))
|
|
93
|
+
continue;
|
|
94
|
+
total += resolveValue(effect, ctx);
|
|
95
|
+
}
|
|
96
|
+
return total;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Per-source breakdown of the global Overbloom scalar.
|
|
100
|
+
*/
|
|
101
|
+
export function resolveOverbloomBreakdown(effects, ctx, overbloomStat) {
|
|
102
|
+
const out = {};
|
|
103
|
+
for (const effect of effects) {
|
|
104
|
+
if (effect.op !== 'add-rare-pct')
|
|
105
|
+
continue;
|
|
106
|
+
if (!effect.relatedStats?.includes(overbloomStat))
|
|
107
|
+
continue;
|
|
108
|
+
if (!isGlobalOverbloomScope(effect.scope))
|
|
109
|
+
continue;
|
|
110
|
+
if (effect.scope?.requiresHarvestFeast && !ctx.env.harvestFeast)
|
|
111
|
+
continue;
|
|
112
|
+
if (effect.scope?.requiresInSeason && (!ctx.crop || !ctx.env.inSeason))
|
|
113
|
+
continue;
|
|
114
|
+
const v = resolveValue(effect, ctx);
|
|
115
|
+
if (!v)
|
|
116
|
+
continue;
|
|
117
|
+
out[effect.source] = (out[effect.source] ?? 0) + v;
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Collect drops emitted by `add-drop` effects whose env-level scope matches.
|
|
123
|
+
*
|
|
124
|
+
* Real per-drop scope filtering (tags, items, etc.) happens later when the
|
|
125
|
+
* calculator builds a `DropContext` for each candidate.
|
|
126
|
+
*/
|
|
127
|
+
export function produceAddedDrops(effects, env) {
|
|
128
|
+
const out = [];
|
|
129
|
+
for (const effect of effects) {
|
|
130
|
+
if (effect.op !== 'add-drop')
|
|
131
|
+
continue;
|
|
132
|
+
if (!effect.drop)
|
|
133
|
+
continue;
|
|
134
|
+
const scope = effect.scope;
|
|
135
|
+
if (scope) {
|
|
136
|
+
if (scope.crops) {
|
|
137
|
+
if (!env.crop)
|
|
138
|
+
continue;
|
|
139
|
+
if (!scope.crops.includes(env.crop))
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (scope.requiresHarvestFeast && !env.harvestFeast)
|
|
143
|
+
continue;
|
|
144
|
+
if (scope.requiresInSeason && !env.inSeason)
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
out.push({ source: effect.source, payload: effect.drop });
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Resolve `add-rare-pct`, `mul-rare`, and `mul-drop` effects for a single drop.
|
|
153
|
+
*
|
|
154
|
+
* The calculator is expected to combine the parts as:
|
|
155
|
+
* `final = base * (1 + addRarePct/100) * mulRare * mulDrop`
|
|
156
|
+
*
|
|
157
|
+
* `applied` records every effect that touched this drop, with phase and
|
|
158
|
+
* resolved amount, for breakdown UIs.
|
|
159
|
+
*/
|
|
160
|
+
export function resolveDropEffects(effects, ctx) {
|
|
161
|
+
let addRarePct = 0;
|
|
162
|
+
let mulRare = 1;
|
|
163
|
+
let mulDrop = 1;
|
|
164
|
+
const applied = [];
|
|
165
|
+
// Phase: add-rare
|
|
166
|
+
for (const effect of effects) {
|
|
167
|
+
if (effect.op !== 'add-rare-pct')
|
|
168
|
+
continue;
|
|
169
|
+
if (!matchesScopeForDrop(effect.scope, ctx))
|
|
170
|
+
continue;
|
|
171
|
+
const v = resolveValue(effect, ctx);
|
|
172
|
+
if (!v)
|
|
173
|
+
continue;
|
|
174
|
+
addRarePct += v;
|
|
175
|
+
applied.push({
|
|
176
|
+
source: effect.source,
|
|
177
|
+
op: effect.op,
|
|
178
|
+
phase: 'add-rare',
|
|
179
|
+
amount: v,
|
|
180
|
+
relatedStats: effect.relatedStats,
|
|
181
|
+
scope: effect.scope,
|
|
182
|
+
description: effect.meta?.description,
|
|
183
|
+
valueDisplay: effect.meta?.valueDisplay,
|
|
184
|
+
valueStat: effect.meta?.valueStat,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
// Phase: mul-rare
|
|
188
|
+
for (const effect of effects) {
|
|
189
|
+
if (effect.op !== 'mul-rare')
|
|
190
|
+
continue;
|
|
191
|
+
if (!matchesScopeForDrop(effect.scope, ctx))
|
|
192
|
+
continue;
|
|
193
|
+
const v = resolveValue(effect, ctx);
|
|
194
|
+
if (v < 0) {
|
|
195
|
+
throw new Error(`Invalid mul-rare value ${v} from "${effect.source}" (must be >= 0; factor semantics).`);
|
|
196
|
+
}
|
|
197
|
+
if (v === 1)
|
|
198
|
+
continue;
|
|
199
|
+
mulRare *= v;
|
|
200
|
+
applied.push({
|
|
201
|
+
source: effect.source,
|
|
202
|
+
op: effect.op,
|
|
203
|
+
phase: 'mul-rare',
|
|
204
|
+
amount: v,
|
|
205
|
+
relatedStats: effect.relatedStats,
|
|
206
|
+
scope: effect.scope,
|
|
207
|
+
description: effect.meta?.description,
|
|
208
|
+
valueDisplay: effect.meta?.valueDisplay,
|
|
209
|
+
valueStat: effect.meta?.valueStat,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
// Phase: mul-drop
|
|
213
|
+
for (const effect of effects) {
|
|
214
|
+
if (effect.op !== 'mul-drop')
|
|
215
|
+
continue;
|
|
216
|
+
if (!matchesScopeForDrop(effect.scope, ctx))
|
|
217
|
+
continue;
|
|
218
|
+
const v = resolveValue(effect, ctx);
|
|
219
|
+
if (v < 0) {
|
|
220
|
+
throw new Error(`Invalid mul-drop value ${v} from "${effect.source}" (must be >= 0; factor semantics).`);
|
|
221
|
+
}
|
|
222
|
+
if (v === 1)
|
|
223
|
+
continue;
|
|
224
|
+
mulDrop *= v;
|
|
225
|
+
applied.push({
|
|
226
|
+
source: effect.source,
|
|
227
|
+
op: effect.op,
|
|
228
|
+
phase: 'mul-drop',
|
|
229
|
+
amount: v,
|
|
230
|
+
relatedStats: effect.relatedStats,
|
|
231
|
+
scope: effect.scope,
|
|
232
|
+
description: effect.meta?.description,
|
|
233
|
+
valueDisplay: effect.meta?.valueDisplay,
|
|
234
|
+
valueStat: effect.meta?.valueStat,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return { addRarePct, mulRare, mulDrop, applied };
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/effects/resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EAEN,oBAAoB,GAOpB,MAAM,YAAY,CAAC;AAEpB,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,MAAc;IACzC,OAAO,MAAM,CAAC,KAAK,IAAI,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,mEAAmE;AACnE,SAAS,YAAY,CAAC,MAAc,EAAE,GAA8B;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACzB,IAAI,OAAO,KAAK,K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C"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Stat } from '../constants/stats.js';
|
|
2
|
+
import type { EffectSummary } from '../constants/upgrades.js';
|
|
3
|
+
import type { Effect } from './types.js';
|
|
4
|
+
export declare function effectToSummary(effect: Effect): EffectSummary | undefined;
|
|
5
|
+
export declare function effectsToSummaries(effects: readonly Effect[], stats?: readonly Stat[]): EffectSummary[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function effectToSummary(effect) {
|
|
2
|
+
if (!effect.relatedStats || effect.relatedStats.length === 0)
|
|
3
|
+
return undefined;
|
|
4
|
+
return {
|
|
5
|
+
source: effect.source,
|
|
6
|
+
op: effect.op,
|
|
7
|
+
description: effect.meta?.description,
|
|
8
|
+
relatedStats: effect.relatedStats,
|
|
9
|
+
scope: effect.scope,
|
|
10
|
+
value: typeof effect.value === 'number' ? effect.value : undefined,
|
|
11
|
+
valueDisplay: effect.meta?.valueDisplay,
|
|
12
|
+
valueStat: effect.meta?.valueStat,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function effectsToSummaries(effects, stats) {
|
|
16
|
+
const summaries = effects.map(effectToSummary).filter((summary) => summary !== undefined);
|
|
17
|
+
if (!stats || stats.length === 0)
|
|
18
|
+
return summaries;
|
|
19
|
+
return summaries.filter((summary) => summary.relatedStats?.some((stat) => stats.includes(stat)));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/effects/summary.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,eAAe,CAAC,MAAc;IAC7C,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC/E,OAAO;QACN,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW;QACrC,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,KAAK,EAAE,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QAClE,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,YAAY;QACvC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS;KACjC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAA0B,EAAE,KAAuB;IACrF,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC;IAC1F,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACnD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { Crop } from '../constants/crops.js';
|
|
2
|
+
import type { SpecialCrop } from '../constants/specialcrops.js';
|
|
3
|
+
import type { Stat } from '../constants/stats.js';
|
|
4
|
+
/**
|
|
5
|
+
* Built-in well-known drop tags. Sources can use any string, but built-ins are
|
|
6
|
+
* the auditable set used by the package's own drop entries and effects.
|
|
7
|
+
*
|
|
8
|
+
* - `overbloom`: drop is buffed by Overbloom-class effects (`add-rare-pct` + `mul-rare`).
|
|
9
|
+
* - `rare-crop`: drop is part of the SkyBlock "Rare Crop" pool conceptually.
|
|
10
|
+
* - `special-crop`: drop is a Special Crop (Cropie/Squash/Fermento/Helianthus).
|
|
11
|
+
* - `seasoning`: Harvest Feast Seasoning category.
|
|
12
|
+
* - `feast`: any Harvest Feast drop (seasoning + per-crop materials).
|
|
13
|
+
* - `pest`: drop comes from a pest, not a regular crop break.
|
|
14
|
+
*/
|
|
15
|
+
export type DropTagBuiltin = 'overbloom' | 'rare-crop' | 'special-crop' | 'seasoning' | 'feast' | 'pest';
|
|
16
|
+
export type DropTag = DropTagBuiltin | (string & {});
|
|
17
|
+
/**
|
|
18
|
+
* Minimal player/world environment data needed to collect effects. Constructed
|
|
19
|
+
* exclusively by `buildEffectEnvironment(player, crop?)`.
|
|
20
|
+
*/
|
|
21
|
+
export interface EffectEnvironment {
|
|
22
|
+
/** Active crop for the rate calc, if any. `undefined` for crop-agnostic stat queries. */
|
|
23
|
+
crop?: Crop;
|
|
24
|
+
/** Harvest Feast active in the world. */
|
|
25
|
+
harvestFeast: boolean;
|
|
26
|
+
/** True only when `crop` is provided AND it is in-season under an active Harvest Feast. */
|
|
27
|
+
inSeason: boolean;
|
|
28
|
+
/** Player is currently on an infested plot (probability > 0). */
|
|
29
|
+
infestedPlot: boolean;
|
|
30
|
+
/** Selected crop from the player's options (used by some shards' force-active rules). */
|
|
31
|
+
selectedCrop?: Crop;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Drop kinds carried on every candidate drop. Used by `Scope.dropKinds` and
|
|
35
|
+
* for resolver phase routing.
|
|
36
|
+
*/
|
|
37
|
+
export type DropKind = 'rare' | 'rng' | 'special-crop' | 'pest' | 'crop';
|
|
38
|
+
/**
|
|
39
|
+
* Per-drop context built by the resolver during `produce-drops`/`add-rare`/etc.
|
|
40
|
+
* Sources never construct one of these directly.
|
|
41
|
+
*/
|
|
42
|
+
export interface DropContext {
|
|
43
|
+
env: EffectEnvironment;
|
|
44
|
+
crop: Crop;
|
|
45
|
+
dropKind: DropKind;
|
|
46
|
+
/** Item id of the drop being evaluated, e.g. `'CROPIE'`, `'SEASONING'`, `'WARTY'`. */
|
|
47
|
+
itemId: string;
|
|
48
|
+
specialCropType?: SpecialCrop;
|
|
49
|
+
tags: ReadonlySet<DropTag>;
|
|
50
|
+
/** True iff this drop was produced by an `add-drop` effect this run. */
|
|
51
|
+
fromAddDrop?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Context for stat-shaped queries (`getStat`). Carries no drop fields by design.
|
|
55
|
+
* The stat matcher rejects any scope that uses drop-only fields.
|
|
56
|
+
*/
|
|
57
|
+
export interface StatContext {
|
|
58
|
+
env: EffectEnvironment;
|
|
59
|
+
/** Optional crop scoping for crop-specific fortunes. */
|
|
60
|
+
crop?: Crop;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Declarative scope for an effect. Empty scope = global match.
|
|
64
|
+
*
|
|
65
|
+
* Drop-only fields (`items`, `dropKinds`, `specialCropTypes`, `tags`, `match`)
|
|
66
|
+
* cause the stat matcher to reject the effect outright.
|
|
67
|
+
*/
|
|
68
|
+
export interface Scope {
|
|
69
|
+
crops?: readonly Crop[];
|
|
70
|
+
dropKinds?: readonly DropKind[];
|
|
71
|
+
items?: readonly string[];
|
|
72
|
+
specialCropTypes?: readonly SpecialCrop[];
|
|
73
|
+
/** Match if every listed tag is present on the drop. */
|
|
74
|
+
tags?: readonly DropTag[];
|
|
75
|
+
/** Effect only applies when a Harvest Feast is active in the env. */
|
|
76
|
+
requiresHarvestFeast?: boolean;
|
|
77
|
+
/** Effect only applies when the drop's crop is in-season. */
|
|
78
|
+
requiresInSeason?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* If `false`, the effect won't match drops produced by an `add-drop` effect.
|
|
81
|
+
* Default `true`.
|
|
82
|
+
*/
|
|
83
|
+
appliesToAddedDrops?: boolean;
|
|
84
|
+
/** Predicate escape hatch. Drop-only; never invoked during stat resolution. */
|
|
85
|
+
match?: (ctx: DropContext) => boolean;
|
|
86
|
+
}
|
|
87
|
+
export type EffectOp = 'add-stat' | 'add-rare-pct' | 'mul-rare' | 'add-drop' | 'mul-drop';
|
|
88
|
+
export type EffectPhase = 'scalar' | 'produce-drops' | 'add-rare' | 'mul-rare' | 'mul-drop';
|
|
89
|
+
/** Default phase for each op. Effects rarely override. */
|
|
90
|
+
export declare const DEFAULT_PHASE_FOR_OP: Record<EffectOp, EffectPhase>;
|
|
91
|
+
export interface EffectAddDropPayload {
|
|
92
|
+
itemId: string;
|
|
93
|
+
/** Output bucket for the produced drop. Defaults to `rng`. */
|
|
94
|
+
output?: 'rng' | 'collection' | 'currency';
|
|
95
|
+
/** Optional flat amount per block broken (alternative to `chance`). */
|
|
96
|
+
baseAmount?: number;
|
|
97
|
+
/** Optional 0..1 chance per block broken. */
|
|
98
|
+
chance?: number;
|
|
99
|
+
specialCropType?: SpecialCrop;
|
|
100
|
+
/** Tags assigned to the produced drop. Defaults to `['rare-crop','overbloom']`. */
|
|
101
|
+
tags?: readonly DropTag[];
|
|
102
|
+
/** Drop kind for the produced drop. Defaults to `'rare'`. */
|
|
103
|
+
dropKind?: DropKind;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Numeric semantics by op (no mixing of factor vs delta within an op):
|
|
107
|
+
* - `add-stat`: additive scalar contribution to `stat` (e.g. 5 = +5 Fortune).
|
|
108
|
+
* - `add-rare-pct`: additive percentage points (e.g. 50 = +50% on rare drops).
|
|
109
|
+
* - `mul-rare`: multiplicative factor (e.g. 1.2 = x1.2). Must be >= 0.
|
|
110
|
+
* - `mul-drop`: multiplicative factor (e.g. 1.25 = x1.25). Must be >= 0.
|
|
111
|
+
* - `add-drop`: `value` is unused; `drop` carries the payload.
|
|
112
|
+
*/
|
|
113
|
+
export interface Effect {
|
|
114
|
+
source: string;
|
|
115
|
+
op: EffectOp;
|
|
116
|
+
phase?: EffectPhase;
|
|
117
|
+
scope?: Scope;
|
|
118
|
+
stat?: Stat;
|
|
119
|
+
value?: number | ((ctx: DropContext | StatContext) => number);
|
|
120
|
+
drop?: EffectAddDropPayload;
|
|
121
|
+
relatedStats?: readonly Stat[];
|
|
122
|
+
meta?: {
|
|
123
|
+
description?: string;
|
|
124
|
+
valueDisplay?: 'stat' | 'percent' | 'factor';
|
|
125
|
+
valueStat?: Stat;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Per-drop record of an applied effect, surfaced via `DetailedDropsResult`.
|
|
130
|
+
*/
|
|
131
|
+
export interface AppliedEffect {
|
|
132
|
+
source: string;
|
|
133
|
+
op: EffectOp;
|
|
134
|
+
phase: EffectPhase;
|
|
135
|
+
/** Resolved numeric contribution at this drop. */
|
|
136
|
+
amount: number;
|
|
137
|
+
relatedStats?: readonly Stat[];
|
|
138
|
+
scope?: Scope;
|
|
139
|
+
description?: string;
|
|
140
|
+
valueDisplay?: 'stat' | 'percent' | 'factor';
|
|
141
|
+
valueStat?: Stat;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Aggregate per-source totals across the whole rate calc.
|
|
145
|
+
* Replaces today's `rareItemBonusBreakdown`.
|
|
146
|
+
*/
|
|
147
|
+
export type EffectsBreakdown = Record<string, number>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Default phase for each op. Effects rarely override. */
|
|
2
|
+
export const DEFAULT_PHASE_FOR_OP = {
|
|
3
|
+
'add-stat': 'scalar',
|
|
4
|
+
'add-rare-pct': 'add-rare',
|
|
5
|
+
'mul-rare': 'mul-rare',
|
|
6
|
+
'add-drop': 'produce-drops',
|
|
7
|
+
'mul-drop': 'mul-drop',
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/effects/types.ts"],"names":[],"mappings":"AAkGA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAkC;IAClE,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,UAAU;IAC1B,UAAU,EAAE,UAAU;IACtB,UAAU,EAAE,eAAe;IAC3B,UAAU,EAAE,UAAU;CACtB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { ComposterUpgrade } from './composter.js';
|
|
|
4
4
|
export const COMPOSTER_UPGRADES = {
|
|
5
5
|
[ComposterUpgrade.Speed]: {
|
|
6
6
|
name: 'Composter Speed',
|
|
7
|
-
wiki: 'https://
|
|
7
|
+
wiki: 'https://w.elitesb.gg/Composter#Upgrades',
|
|
8
8
|
current: (level) => (20 * level) / 100,
|
|
9
9
|
levels: [
|
|
10
10
|
{
|
|
@@ -205,7 +205,7 @@ export const COMPOSTER_UPGRADES = {
|
|
|
205
205
|
},
|
|
206
206
|
[ComposterUpgrade.MultiDrop]: {
|
|
207
207
|
name: 'Multi Drop',
|
|
208
|
-
wiki: 'https://
|
|
208
|
+
wiki: 'https://w.elitesb.gg/Composter#Upgrades',
|
|
209
209
|
current: (level) => (3 * level) / 100,
|
|
210
210
|
levels: [
|
|
211
211
|
{
|
|
@@ -406,7 +406,7 @@ export const COMPOSTER_UPGRADES = {
|
|
|
406
406
|
},
|
|
407
407
|
[ComposterUpgrade.FuelCap]: {
|
|
408
408
|
name: 'Fuel Cap',
|
|
409
|
-
wiki: 'https://
|
|
409
|
+
wiki: 'https://w.elitesb.gg/Composter#Upgrades',
|
|
410
410
|
current: (level) => 30_000 * level + 100_000,
|
|
411
411
|
levels: [
|
|
412
412
|
{
|
|
@@ -607,7 +607,7 @@ export const COMPOSTER_UPGRADES = {
|
|
|
607
607
|
},
|
|
608
608
|
[ComposterUpgrade.OrganicMatterCap]: {
|
|
609
609
|
name: 'Organic Matter Cap',
|
|
610
|
-
wiki: 'https://
|
|
610
|
+
wiki: 'https://w.elitesb.gg/Composter#Upgrades',
|
|
611
611
|
current: (level) => 30_000 * level + 40_000,
|
|
612
612
|
levels: [
|
|
613
613
|
{
|
|
@@ -808,7 +808,7 @@ export const COMPOSTER_UPGRADES = {
|
|
|
808
808
|
},
|
|
809
809
|
[ComposterUpgrade.CostReduction]: {
|
|
810
810
|
name: 'Cost Reduction',
|
|
811
|
-
wiki: 'https://
|
|
811
|
+
wiki: 'https://w.elitesb.gg/Composter#Upgrades',
|
|
812
812
|
current: (level) => level / 100,
|
|
813
813
|
levels: [
|
|
814
814
|
{
|