Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \::
- SetKeyDelay, 0
- ; base scale so that you use it for variants
- baseScale := 48000 ; divisible by 3, 6, 12, 24, 48 of course
- ; arras polygons with weights so that they all have different rarities
- shapes := []
- shapes.Push({ name: "Egg", weight: 16000, type: "regular" }) ; 1/3 chance
- shapes.Push({ name: "Square", weight: 8000, type: "regular" }) ; 1/6 chance
- shapes.Push({ name: "Triangle", weight: 4000, type: "regular" }) ; etc
- shapes.Push({ name: "Pentagon", weight: 2000, type: "regular" })
- shapes.Push({ name: "Hexagon", weight: 1000, type: "regular" })
- ; polyhedra (without mutations ofc, you ever seen a shiny dodecahedron?)
- shapes.Push({ name: "The Cube", weight: 0.00001403508, type: "polyhedron" })
- shapes.Push({ name: "The Dodecahedron", weight: 0.00000701754, type: "polyhedron" })
- shapes.Push({ name: "The Icosahedron", weight: 0.00000350877, type: "polyhedron" })
- ; variants (crasher, alpha, beta) (omega only for the labyrinth version of this script)
- variants := []
- variants.Push({ name: "Crasher Egg", weight: Round(baseScale / 60), type: "variant" })
- variants.Push({ name: "Alpha Egg", weight: Round(baseScale / 33), type: "variant" })
- variants.Push({ name: "Beta Egg", weight: Round(baseScale / 10), type: "variant" })
- variants.Push({ name: "Crasher Square", weight: Round(baseScale / 120), type: "variant" })
- variants.Push({ name: "Alpha Square", weight: Round(baseScale / 67), type: "variant" })
- variants.Push({ name: "Beta Square", weight: Round(baseScale / 20), type: "variant" })
- variants.Push({ name: "Crasher Triangle", weight: Round(baseScale / 240), type: "variant" })
- variants.Push({ name: "Alpha Triangle", weight: Round(baseScale / 133), type: "variant" })
- variants.Push({ name: "Beta Triangle", weight: Round(baseScale / 40), type: "variant" })
- variants.Push({ name: "Crasher Pentagon", weight: Round(baseScale / 480), type: "variant" })
- variants.Push({ name: "Alpha Pentagon", weight: Round(baseScale / 267), type: "variant" })
- variants.Push({ name: "Beta Pentagon", weight: Round(baseScale / 80), type: "variant" })
- variants.Push({ name: "Crasher Hexagon", weight: Round(baseScale / 960), type: "variant" })
- variants.Push({ name: "Alpha Hexagon", weight: Round(baseScale / 533), type: "variant" })
- variants.Push({ name: "Beta Hexagon", weight: Round(baseScale / 160), type: "variant" })
- for _, v in variants
- shapes.Push(v)
- ; mutation types and its multipliers - crasher removed cause it caused issues (we don't like bugs)
- mutations := []
- mutations.Push({ name: "", multiplier: 1 })
- mutations.Push({ name: "Shiny", multiplier: 50000 })
- mutations.Push({ name: "Legendary", multiplier: 1000000 })
- mutations.Push({ name: "Shadow", multiplier: 3000000 })
- mutations.Push({ name: "Rainbow", multiplier: 76000000 })
- mutations.Push({ name: "Transgender", multiplier: 152000000 })
- ; if you want you can add albino and epilepsy (even though they got removed)
- ; it generates a combo (mutation, shape/variant)/(polyhedra) based on the rules added
- comboList := GetCombos(shapes, mutations)
- ; pick a weighted random combo (basically a biased rng)
- chosenCombo := WeightedRandomPick(comboList)
- ; calculate the rarity
- rarity := Round(baseScale / chosenCombo.weight)
- formattedRarity := FormatRarity(rarity)
- ; basically composes the full name (e.g: shiny beta pentagon)
- fullName := ComposeMutationName(chosenCombo.mutations) . chosenCombo.shapeName
- ; shows what you rolled
- output := "You rolled: " fullName " | 1 in " formattedRarity
- Send, {Enter} %output% {Enter}
- ; if you want you can remove the enters if you feel like they're useless
- return
- GetCombos(shapes, mutations) {
- combos := []
- for _, shape in shapes {
- ; makes it so that polyhedra don't get mutation
- if (shape.type = "polyhedron") {
- combos.Push({ shapeName: shape.name, mutations: [], baseWeight: shape.weight, weight: shape.weight })
- continue
- }
- ; this part makes it so that only 0 or 1 mutation can be added
- ; starting off with no mutation
- combos.Push({ shapeName: shape.name, mutations: [], baseWeight: shape.weight, weight: shape.weight })
- for _, mut in mutations {
- if (mut.name = "")
- continue
- ; otherwise add 1 mutation only
- comboWeight := shape.weight / mut.multiplier
- if (comboWeight < 0.000001)
- comboWeight := 0.000001
- combos.Push({ shapeName: shape.name, mutations: [mut], baseWeight: shape.weight, weight: comboWeight })
- }
- }
- return combos
- }
- WeightedRandomPick(comboList) {
- totalWeight := 0.0
- for _, c in comboList
- totalWeight += c.weight
- Random, randWeight, 0.0, %totalWeight%
- cumulative := 0.0
- for _, c in comboList {
- cumulative += c.weight
- if (randWeight <= cumulative)
- return c
- }
- ; fallback in case something weird happens (hopefully not lmao)
- return comboList[1]
- }
- FormatRarity(r) { ; this basically shortens the number rarity thing (e.g: You rolled: The Dodecahedron | 1 in 13.68B)
- if (r >= 1000000000)
- return Round(r / 1000000000, 2) . "B"
- else if (r >= 1000000)
- return Round(r / 1000000, 2) . "M"
- else if (r >= 1000)
- return Round(r / 1000, 2) . "K"
- else
- return r
- }
- ComposeMutationName(mutList) {
- if (mutList.Length() = 0)
- return ""
- SortByMultiplier(mutList)
- nameStr := ""
- for _, m in mutList
- nameStr .= m.name " "
- return nameStr
- }
- ; man this was hard to make. thank god it's over
- SortByMultiplier(mutList) {
- mutList.Sort((a,b) => b.multiplier - a.multiplier)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement