INNER CODE UNIT · TypeScript
stepIndex
Thorium-Sim/thorium · server/classes/generic/index.ts:398
const stepIndex = Math.floor(Math.random() * optionalSteps.length);
if (optionalSteps.length > 0) {
if (
optionalSteps[stepIndex].name === "generic" ||
!damageSteps.find(d => d.name === optionalSteps[stepIndex].name)
) {
damageSteps.push(optionalSteps[stepIndex]);
if (optionalSteps[stepIndex].name !== "damageTeam") {
// We need to remove this optional step from the list so it is not repeated;
// Keep damage teams so we can get a cleanup team.
optionalSteps = optionalSteps.filter(
(_: never, i: number) => i !== stepIndex,
);
}
} else if (
optionalSteps[stepIndex].name === "damageTeam" &&
damageSteps.filter(d => d.name === "damageTeam").length === 1
) {