Skip to content

Instantly share code, notes, and snippets.

@fleon
Created November 19, 2018 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fleon/7ae701b36fb0bcdf71a1fd3aecf2a119 to your computer and use it in GitHub Desktop.
Save fleon/7ae701b36fb0bcdf71a1fd3aecf2a119 to your computer and use it in GitHub Desktop.
computeCoinGainForWinning(against: User, cleanWin = false) {
const L = against.experience.level
const l = this.experience.level
const c = cleanWin ? 1.5 : 1
const m = this.gameUnlocked ? 2 : 1
return Math.floor(
c * m * Math.log10(2 * L) / Math.log10(1.01) * (
1 - (L - l < 0 ? Math.min(1.9, (l - L + 1) ** 0.18) - 1 : 0) +
(L - l > 0 ? L - l : 0) ** 2 / L ** 1.25
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment