tewtal / SMZ3Randomizer

Super Metroid & A Link to the Past Crossover Item Randomizer V11
https://samus.link/
MIT License
74 stars 32 forks source link

Fix GT Entry token requirement #207

Closed TarThoron closed 1 year ago

TarThoron commented 1 year ago

It's been discovered that TO(GT/7) is getting rounded to TO(0) if GT is anything other than 7. This can be fixed by multiplying before dividing, thus (TO*GT)/7.

RebelusQuo commented 1 year ago

Nice catch. But further suggestion:

        public override bool CanEnter(Progression items) {
            return items.MoonPearl && World.CanEnter("Dark World Death Mountain East", items) &&
                World.CanAcquireAtLeast(World.TowerCrystals, items, AnyCrystal) &&
                World.CanAcquireAtLeast(FractionOfBossTokens(), items, AnyBossToken);

            // Order of operations handle integer division correctly
            int FractionOfBossTokens() => World.TourianBossTokens * World.TowerCrystals / 7;
        }

For great self documentation.