forked from mico/idle_moloch
Fixes wrong boss rewards calculation
This commit is contained in:
parent
9e15e0eb2a
commit
8d845e9890
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user