Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2025
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.37 KB | None | 0 0
  1. \::
  2. SetKeyDelay, 0
  3.  
  4. ; base scale so that you use it for variants
  5. baseScale := 48000 ; divisible by 3, 6, 12, 24, 48 of course
  6.  
  7. ; arras polygons with weights so that they all have different rarities
  8. shapes := []
  9. shapes.Push({ name: "Egg", weight: 16000, type: "regular" }) ; 1/3 chance
  10. shapes.Push({ name: "Square", weight: 8000, type: "regular" }) ; 1/6 chance
  11. shapes.Push({ name: "Triangle", weight: 4000, type: "regular" }) ; etc
  12. shapes.Push({ name: "Pentagon", weight: 2000, type: "regular" })
  13. shapes.Push({ name: "Hexagon", weight: 1000, type: "regular" })
  14.  
  15. ; polyhedra (without mutations ofc, you ever seen a shiny dodecahedron?)
  16. shapes.Push({ name: "The Cube", weight: 0.00001403508, type: "polyhedron" })
  17. shapes.Push({ name: "The Dodecahedron", weight: 0.00000701754, type: "polyhedron" })
  18. shapes.Push({ name: "The Icosahedron", weight: 0.00000350877, type: "polyhedron" })
  19.  
  20. ; variants (crasher, alpha, beta) (omega only for the labyrinth version of this script)
  21. variants := []
  22. variants.Push({ name: "Crasher Egg", weight: Round(baseScale / 60), type: "variant" })
  23. variants.Push({ name: "Alpha Egg", weight: Round(baseScale / 33), type: "variant" })
  24. variants.Push({ name: "Beta Egg", weight: Round(baseScale / 10), type: "variant" })
  25. variants.Push({ name: "Crasher Square", weight: Round(baseScale / 120), type: "variant" })
  26. variants.Push({ name: "Alpha Square", weight: Round(baseScale / 67), type: "variant" })
  27. variants.Push({ name: "Beta Square", weight: Round(baseScale / 20), type: "variant" })
  28. variants.Push({ name: "Crasher Triangle", weight: Round(baseScale / 240), type: "variant" })
  29. variants.Push({ name: "Alpha Triangle", weight: Round(baseScale / 133), type: "variant" })
  30. variants.Push({ name: "Beta Triangle", weight: Round(baseScale / 40), type: "variant" })
  31. variants.Push({ name: "Crasher Pentagon", weight: Round(baseScale / 480), type: "variant" })
  32. variants.Push({ name: "Alpha Pentagon", weight: Round(baseScale / 267), type: "variant" })
  33. variants.Push({ name: "Beta Pentagon", weight: Round(baseScale / 80), type: "variant" })
  34. variants.Push({ name: "Crasher Hexagon", weight: Round(baseScale / 960), type: "variant" })
  35. variants.Push({ name: "Alpha Hexagon", weight: Round(baseScale / 533), type: "variant" })
  36. variants.Push({ name: "Beta Hexagon", weight: Round(baseScale / 160), type: "variant" })
  37.  
  38. for _, v in variants
  39. shapes.Push(v)
  40.  
  41. ; mutation types and its multipliers - crasher removed cause it caused issues (we don't like bugs)
  42. mutations := []
  43. mutations.Push({ name: "", multiplier: 1 })
  44. mutations.Push({ name: "Shiny", multiplier: 50000 })
  45. mutations.Push({ name: "Legendary", multiplier: 1000000 })
  46. mutations.Push({ name: "Shadow", multiplier: 3000000 })
  47. mutations.Push({ name: "Rainbow", multiplier: 76000000 })
  48. mutations.Push({ name: "Transgender", multiplier: 152000000 })
  49. ; if you want you can add albino and epilepsy (even though they got removed)
  50.  
  51. ; it generates a combo (mutation, shape/variant)/(polyhedra) based on the rules added
  52. comboList := GetCombos(shapes, mutations)
  53.  
  54. ; pick a weighted random combo (basically a biased rng)
  55. chosenCombo := WeightedRandomPick(comboList)
  56.  
  57. ; calculate the rarity
  58. rarity := Round(baseScale / chosenCombo.weight)
  59.  
  60. formattedRarity := FormatRarity(rarity)
  61.  
  62. ; basically composes the full name (e.g: shiny beta pentagon)
  63. fullName := ComposeMutationName(chosenCombo.mutations) . chosenCombo.shapeName
  64.  
  65. ; shows what you rolled
  66. output := "You rolled: " fullName " | 1 in " formattedRarity
  67. Send, {Enter} %output% {Enter}
  68. ; if you want you can remove the enters if you feel like they're useless
  69. return
  70.  
  71. GetCombos(shapes, mutations) {
  72. combos := []
  73. for _, shape in shapes {
  74. ; makes it so that polyhedra don't get mutation
  75. if (shape.type = "polyhedron") {
  76. combos.Push({ shapeName: shape.name, mutations: [], baseWeight: shape.weight, weight: shape.weight })
  77. continue
  78. }
  79.  
  80. ; this part makes it so that only 0 or 1 mutation can be added
  81. ; starting off with no mutation
  82. combos.Push({ shapeName: shape.name, mutations: [], baseWeight: shape.weight, weight: shape.weight })
  83.  
  84. for _, mut in mutations {
  85. if (mut.name = "")
  86. continue
  87.  
  88. ; otherwise add 1 mutation only
  89. comboWeight := shape.weight / mut.multiplier
  90. if (comboWeight < 0.000001)
  91. comboWeight := 0.000001
  92.  
  93. combos.Push({ shapeName: shape.name, mutations: [mut], baseWeight: shape.weight, weight: comboWeight })
  94. }
  95. }
  96. return combos
  97. }
  98.  
  99. WeightedRandomPick(comboList) {
  100. totalWeight := 0.0
  101. for _, c in comboList
  102. totalWeight += c.weight
  103.  
  104. Random, randWeight, 0.0, %totalWeight%
  105. cumulative := 0.0
  106.  
  107. for _, c in comboList {
  108. cumulative += c.weight
  109. if (randWeight <= cumulative)
  110. return c
  111. }
  112. ; fallback in case something weird happens (hopefully not lmao)
  113. return comboList[1]
  114. }
  115.  
  116. FormatRarity(r) { ; this basically shortens the number rarity thing (e.g: You rolled: The Dodecahedron | 1 in 13.68B)
  117. if (r >= 1000000000)
  118. return Round(r / 1000000000, 2) . "B"
  119. else if (r >= 1000000)
  120. return Round(r / 1000000, 2) . "M"
  121. else if (r >= 1000)
  122. return Round(r / 1000, 2) . "K"
  123. else
  124. return r
  125. }
  126.  
  127. ComposeMutationName(mutList) {
  128. if (mutList.Length() = 0)
  129. return ""
  130.  
  131. SortByMultiplier(mutList)
  132.  
  133. nameStr := ""
  134. for _, m in mutList
  135. nameStr .= m.name " "
  136. return nameStr
  137. }
  138. ; man this was hard to make. thank god it's over
  139. SortByMultiplier(mutList) {
  140. mutList.Sort((a,b) => b.multiplier - a.multiplier)
  141. }
  142.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement