Skip to content

Instantly share code, notes, and snippets.

@akarnokd
Created June 11, 2020 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akarnokd/4464bef07680d29d3900d41c9c5e3479 to your computer and use it in GitHub Desktop.
Save akarnokd/4464bef07680d29d3900d41c9c5e3479 to your computer and use it in GitHub Desktop.
LPI_Clothes_LocTheme matches LL_Clothes_LocTheme_Asylum entry (Q:1)
LL_Clothes_LocTheme_Asylum would pick Q:1 of 3 at random
LL_Clothes_Asylum_Rare would pick the first entry that the RNG matched
LLD_Creature_Glowing wants to return 1, goes into LLE_NukeResources_Glowing
LLE_NukeResources_Glowing filters out the entries closest to the target level, then the RNG is matching the filtered entries. Finally, the list picks one of the surviving entries at uniform random.
Essentially the closest to target level will only allow one entry as the entries have distinct level requirements
so pick-one-randomly is a no-op because there would be at most one item to pick.
Let's assume it picked LLS_NukeResources_Glowing
LLS_NukeResources_Glowing has no level requirement and has pick-one-randomly
Let's assume LLS_NukeResources_Glowing_Mass is picked
LLS_NukeResources_Glowing_Mass is also pick-one-randomly with repeated entries to form a 6-3-1 distribution for quantities 1-2-3
E01F_Fasnacht_LL_Quest_Rewards_High will return everything (flags=all, max=0)
:: E01F_Fasnacht_LL_Quest_Rewards_Default will return everything that hasn't been learned (flags=all, max=0)
:: E01F_Fasnacht_LLS_Misc_Rewards_Recipes is set to (flags=all_levels, parent-quantity-random) and the parent has Q:1
:: E01F_Fasnacht_LL_Headwear_Rewards_Rare is set to (flags=all, max=1)
:: E01F_Fasnacht_LL_Headwear_Rewards_Rare will pick the first entry that matches the RNG
:::: E01F_Fasnacht_LLS_Headwear_Rewards_Rare is set to (flags=all-levels, parent-quantity-random)
:::: E01F_Fasnacht_LLS_Headwear_Rewards_Rare will pick 1 of 5 at random.
LL_TreasureHunt_Chest_Loot_Low (flags=all, max=0) will return everything what its items produce
:: LLS_Systemic_Rewards_Goodies_Common (flags=closest+one-random, max=0) will pick something 1/14
:: LLS_TreasureHunt_Rewards_Treasure_Common (flags:all-levels+parent-quantity-random, max=0), parent has Quantity=3
:: will pick 3 random entries (i.e., shuffle the list randomly and take items 0 .. Quantity-1)
:: LLS_TreasureHunt_Rewards_Crafted_Single (flags:all-levels+parent-quantity-random, max=0), parent has Quantity=1, but 50% chance to be evaluated
:: LLS_TreasureHunt_Rewards_Crafted_Single has strange entries with LVIV = 0 or LVIV = 1
:::: LLS_Systemic_Rewards_Armor (flags=closest+one-random, max=0) picks an entry 1/4,
:::: LLS_Systemic_Rewards_Taxidermy_Common (flags=closest+one-random, max=0) picks an entry 1/17
:::: LLS_Systemic_Rewards_Weapons (flags=closest+one-random, max=0)
It has two entries with LLS_Systemic_Rewards_Weapons_PrimeMods having a GetLevel >= 50 condition.
So if the level is >= 50, it picks 1/2
:::::: LLS_Systemic_Rewards_Weapons_PrimeMods (flags=closest+one-random, max=0) picks an entry 1/38
:::::: LLS_Systemic_Rewards_Weapons_Plans (flags=closest+one-random, max=0) has a bunch of level conditions, won't list them. 1/N
var resultList = [];
for (var entry of lvli.Entries) {
if (entry.chanceNone / 100.0 <= Math.random()) {
resultList.addAll(evaluateList(entry.subList, entry.Quantity))
}
if (lvli.max > 0 && resultList.length >= lvli.max) {
break;
}
}
if (lvli.max > 0) {
return resultList.split(0, lvli.max);
}
return resultList;
--------
flags=all, max=0
each entry Pi = 1 - ChanceNone[i]
list-empty E = ChanceNone[1] * ChanceNone[2] * ... * ChanceNone[n]
flags=all, max=1
each entry Pi = ChanceNone[1] * ChanceNone[2] * ... * ChanceNone[i - 1] * (1 - ChanceNone[i])
list-empty E = ChanceNone[1] * ChanceNone[2] * ... * ChanceNone[n]
flags=one-random, max=0
each entry Pi =
ChanceNone[1] * ChanceNone[2] * ... * ChanceNone[i - 1] * (1- ChanceNone[i]) * ChanceNone[i + 1] * ... * ChanceNone[n] +
(1- ChanceNone[1]) * ChanceNone[2] * ... * ChanceNone[i -1] * (1- ChanceNone[i]) * ChanceNone[i + 1] * ... * ChanceNone[n] / 2 +
...
(1- ChanceNone[1]) * (1- ChanceNone[2]) * ... * (1- ChanceNone[i]) * ... * (1- ChanceNone[n]) / n
list empty E = ChanceNone[1] * ChanceNone[2] * ... * ChanceNone[i] ... * ChanceNone[n]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment