loot

package
v0.0.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package loot is the drop table: what a slain ship leaves behind, and how often. Combat feeds the fleet rather than only authored pickups, and a tougher hull is worth killing.

The roll is pure — a table plus a number in [0,1) — so the rates are testable without an RNG and identical wherever they are rolled. Which stream that number comes from is the caller's business: Linefire wants a fixed loot stream so a run is reproducible, and a seeded simulation wants its own.

Index

Constants

This section is empty.

Variables

View Source
var Table = map[string][]Band{
	"enemy":  {{0.12, "powerup"}},
	"turret": {{0.15, "powerup"}, {0.25, "ratepower"}},
	"rusher": {{0.15, "powerup"}, {0.23, "firepower"}},
	"sniper": {{0.18, "powerup"}, {0.32, "damagepower"}},
	"tank":   {{0.25, "shield"}, {0.45, "firepower"}, {0.65, "damagepower"}, {0.78, "wpn_missile"}},
}

Table maps a ship kind — its asset Kind, the same key the profiles use — to its cumulative bands. Tougher ships drop more, and better. An unknown kind drops nothing, so a hull nobody wrote a line for is simply not worth looting.

Functions

func Refs

func Refs() []string

Refs lists every distinct thing the table can drop. A consumer uses it to load exactly the art it needs, instead of guessing or loading everything.

func Roll

func Roll(kind string, roll float64) (string, bool)

Roll returns what a slain ship of the given kind drops for a roll in [0,1), and whether anything dropped at all.

Types

type Band

type Band struct {
	Upto float64
	Ref  string // the dropped asset's name: a power-up like "firepower", or a weapon "wpn_*"
}

Band is one slice of a drop roll: a roll below Upto drops Ref. Bands are cumulative upper bounds in [0,1), and the gap left up to 1.0 is "nothing".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL