Fixes wrong boss rewards calculation
Some checks failed
CI / Foundry project (push) Waiting to run
CI / Foundry project (pull_request) Has been cancelled

This commit is contained in:
mic0 2024-10-31 13:26:02 +01:00
parent 9e15e0eb2a
commit 8d845e9890
Signed by: mico
GPG Key ID: A3F8023524CF1C8D
2 changed files with 3 additions and 3 deletions

View File

@ -98,8 +98,8 @@ library RaidGeldUtils {
function calculateBossReward(uint8 bossLevel, uint256 baseReward) internal pure returns (uint256) {
// TODO: This could as well just be pre-calculated
uint256 cumulativeChance = getBossCumulativeChance(bossLevel); // 0 - 1e18 range
uint256 rewardMultiplier = ((2 * (1e18 - cumulativeChance)) ** 2) / 1e18;
return (baseReward * rewardMultiplier);
uint256 rewardMultiplier = ((2 * (1e18 - cumulativeChance)) ** 2);
return (baseReward * rewardMultiplier) / 1e18 ** 2;
}
// Calculates whether user survives the fight

View File

@ -142,7 +142,7 @@ contract raid_geldTest is Test {
function test_4_print_boss_rewards() public {
uint256 total = 0;
for (uint8 i = 0; i < 7; i++) {
uint256 reward = RaidGeldUtils.calculateBossReward(i, 500);
uint256 reward = RaidGeldUtils.calculateBossReward(i, 500e18);
console.log("Reward", i,reward);
total += reward;
}