package main

// Every piece carries two numbers: hit points and fuel. A square is twice as
// tough as anything else and a star carries five times the fuel; each tier adds
// half again on top, so a fully upgraded piece is worth two base pieces of it.
func stats(kind string, tier int) (hp, fuel float64) {
	hp, fuel = 10, 1
	switch kind {
	case "square":
		hp = 20
	case "star":
		fuel = 5
	}
	m := 1 + 0.5*float64(tier)
	return hp * m, fuel * m
}

// A new piece arrives intact: full hit points for its kind and tier.
func (h *hub) fitted(kind string, tier int) piece {
	hp, _ := stats(kind, tier)
	return piece{ID: h.pieceID(), Kind: kind, HP: hp, MaxHP: hp, Tier: tier}
}
