When you kill a player in swordbattle, you get coins. Everybody knows this. But sometimes, it just doesn’t seem like you got enough coins. I know that if there were no limit, the game would lag when a player with lots of coins died, and it would be really OP, so I came up with a new xp equation. The current one works like this, you get 80% of the player’s coins, clamped between 10 and 20,000, so you never get more than 20k.
var dropAmount = clamp(Math.round(thePlayer.coins*0.8), 10, 20000);
Now my solution was to use a logarithmic function so that it still increases, but not too fast. The highest anyone could realistically get using this equation is 85k, which is still a considerable amount more. It uses the same equation that is in the game except it doesn’t cap at 20k. After 20k it switches to the logarithmic function, and the slope begins to flatten out faster.
var dropAmount = thePlayer.coins < 13 ? 10 : Math.round(thePlayer.coins < 25000 ? thePlayer.coins * 0.8 : Math.log10(thePlayer.coins) * 30000 - 111938.2002602);
I’ve tested it and it seems to work fine. You should just be able to replace the old line of code with this new one to implement it. Maybe try it for a day or so and if it needs tweaking I can change it for you. Lastly, I have included a nice graph and a link to it to show what it will look like. The green line shows the old equation and the blue line shows the new one. The purple line is just y=x for a reference. The function should NEVER go above y=x. To hide a line just click on the colored circle next to its equation.
Here is the link: