shadorki / genshin-impact-wish-simulator

A React web application to simulate Genshin Impact gacha in the browser
713 stars 162 forks source link

Probability balancing between characters and weapons #42

Closed lauslim12 closed 3 years ago

lauslim12 commented 3 years ago

Problem

What's up dude? Sorry I have not been active lately, kind of busy with final exams! Anyways, from issue #28, we know that our current setup has not yet been implemented with probability balancing between characters and weapons.

Fix

To fix this issue, I added two new methods, which are getRandom4StarCharacters and getRandom4StarWeapons. Both function will be called from getRandomItem function if we get a 4 star (rating is equal to 4). I also split the probability via the given flipACoin function. I have implemented them in the Gentry of Hermitage, the Epitome Invocation, and the Wanderlust Invocation banner.

Extra

I noticed that you have not updated the isFeatured property for Sacrificial Greatsword in the Wanderlust Invocation and the Gentry of Hermitage banner. I fixed it in this PR.

Closing

Hope this PR will be useful, and thank you dude!

Resolves #28

shadorki commented 3 years ago

@lauslim12 Hey dude! Good to see ya, ahev you ran this with the new test suite? It does a stress test to make sure it doesn't crash, you can check to see if everything looks fine after wards, and also run the new build command when the tests pass.

lauslim12 commented 3 years ago

Sure! Do I have to run the Cypress test too? I have run it with Mocha and it looks fine!

lauslim12 commented 3 years ago

Hey man, I have run the tests on Cypress and Mocha, my fork passed all tests successfully! However, it seems that I got the algorithm wrong. Every ten pulls now gives two four-stars 😂, I have not yet run the build script for this reason. I'll fix it ASAP.

EDIT: Must be my imagination. Could you verify this behavior by pulling from my fork? Thank you!

shadorki commented 3 years ago

Finishing some things for a class I'm teaching tomorrow, if I have time I'll give it a check!

shadorki commented 3 years ago

I was having an issue with the algorithm as well, there seems to be some randomized behavior thats causing it, we will have to rerun it after the next update, we can hop on a call later on!

lauslim12 commented 3 years ago

Sure thing dude! I'll close this PR for now. I'll be waiting for your fix to the algorithm, then I will add this probability balancing feature, no worries!