Bash.tv → GitHub → itch.io

Randomized rewards that feel exciting and fair. Weighted loot tables with nested tables, guaranteed drops plus random rolls, quantity ranges, rarity tiers with colors, level and condition filters, luck modifiers, pity timers (bad-luck protection), drop-rate math (chance in N tries, tries for 90% of players), showing honest odds, and loot feedback (beams, sounds, colors). Includes a tested loot....

Download skill (.zip) Files on GitHub

Loot system

Drop-in: assets/loot.js (tests over 20,000 rolls: nested rare table hits its 10% weight, coin quantities average right, pity never allows more than 4 misses, luck raises legendary rates, drop math matches the formulas).

import { createLoot, RARITY, chanceInN, triesFor } from "./core/loot.js";
const loot = createLoot({ rng: rng.next, tables: {
  goblin: { always: [{ item: "coin", min: 1, max: 3 }], rolls: 1, entries: [
    { item: "potion", weight: 30 }, { table: "gems", weight: 10 }, { nothing: true, weight: 60 } ] },
  gems: { entries: [{ item: "ruby", weight: 3, rarity: "rare" }, { item: "diamond", weight: 1, rarity: "epic", minLevel: 5 }] },
  boss: { rolls: 2, pity: { after: 4, match: (e) => e.item === "crown" }, entries: [{ item: "crown", weight: 5 }, { item: "gold", weight: 95, min: 20, max: 40 }] },
}});
const drops = loot.roll("goblin", { level: player.level, luck: player.luck });   // [{ item, count, rarity? }]
save.set("pity", loot.misses());                                                  // keep bad-luck protection across sessions

Design rules

Feedback

Rare drops: a beam or glow by rarity, a distinct sound, a short slow-mo or freeze for legendaries, and a toast. Auto-collect common drops (magnet) and make rare ones a deliberate pickup.

Balance

Simulate a session (game-balance-testing): items per hour by rarity, gold income vs prices (game-economy), and time until the first rare.