lines = (outcomes, defense) =>
Plot.plot({
marks: [
Plot.line(
outcomes
.flatMap(([label, weapon]) =>
atLeast(simulate(weapon, defense), label)
)
.filter((d) => d.accuracy < 8),
{
x: "damage",
y: "count",
stroke: "label",
fx: "accuracy",
sort: "damage",
marker: true
}
)
],
x: { ticks: 4 },
y: { zero: true, tickFormat: "%" },
color: { legend: true },
grid: true,
height: 200,
width: 900
})