Skip to content

Bug in alien alloy calculation in borehole #735

@arnablegend

Description

@arnablegend

I noticed in the fandom page that Borehole will give 1-3 alien alloys for the first visit with some probability. Are the chances of getting either 1, 2 or 3 alien alloys intended to be equal? If yes, the code does not seem to confirm to that.

To elaborate, loot calculation is handled by the following code in events.js:927
var num = Math.floor(Math.random() * (loot.max - loot.min)) + loot.min;
Math.random() returns x, a float, where 0 <= x < 1
Since loot.max = 3 and loot.min = 1 for boreholes, we get Math.floor(y) where 0 <= y < 2.
So, num will always be either 1 or 2.

This applies to loot calculation in the entire game.

IMHO, the correct implementation should have been

var num = Math.floor(Math.random() * (loot.max + 1 - loot.min)) + loot.min;

And I could be completely wrong and the game is designed to give only 1-2 alien alloy on the undiscovered visits. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions