farming-weight
Version:
Tools for calculating farming weight and fortune in Hypixel Skyblock
109 lines (108 loc) • 3.81 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const VITEST_1 = require('vitest');
const WEIGHTCALC_1 = require('./weightcalc');
const CROPS_1 = require('../constants/crops');
const WEIGHT_1 = require('../constants/weight');
const PESTS_1 = require('../util/pests');
const CROPS = {
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Cactus] * 50,
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Carrot] * 10,
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.CocoaBeans] * 10,
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Melon] * 10,
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.NetherWart] * 10,
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Potato] * 10,
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Pumpkin] * 10,
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.SugarCane] * 50,
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Wheat] * 10,
};
const PESTS = {
pest_fly_1: 150,
pest_beetle_1: 86,
};
(0, VITEST_1.test)('Basic weight calculation', () => {
const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
collection: CROPS,
});
(0, VITEST_1.expect)(WEIGHT.getWeightInfo().totalWeight).toBeCloseTo(170);
});
(0, VITEST_1.test)('Mushroom weight calculation', () => {
const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
collection: {
...CROPS,
[]: WEIGHT_1.CROP_WEIGHT[CROPS_1.Crop.Mushroom] * 13.74,
},
});
(0, VITEST_1.expect)(WEIGHT.getWeightInfo().totalWeight).toBeCloseTo(180);
});
(0, VITEST_1.test)('Pest debuff weight calculation', () => {
const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
collection: CROPS,
pests: PESTS,
});
const UNCOUNTED = (0, PESTS_1.uncountedCropsFromPests)(PESTS);
const UNCOUNTED_WHEAT = UNCOUNTED[CROPS_1.Crop.Wheat] ?? 0;
const UNCOUNTED_WART = UNCOUNTED[CROPS_1.Crop.NetherWart] ?? 0;
(0, VITEST_1.expect)(WEIGHT.getWeightInfo().uncountedCrops[CROPS_1.Crop.Wheat]).toBeCloseTo(UNCOUNTED_WHEAT);
(0, VITEST_1.expect)(WEIGHT.getWeightInfo().uncountedCrops[CROPS_1.Crop.NetherWart]).toBeCloseTo(UNCOUNTED_WART);
const WEIGHT_EXPECTED = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
collection: {
...CROPS,
[]: CROPS[CROPS_1.Crop.Wheat] - UNCOUNTED_WHEAT,
[]: CROPS[CROPS_1.Crop.NetherWart] - UNCOUNTED_WART,
},
});
(0, VITEST_1.expect)(WEIGHT.getWeightInfo().cropWeight).toBeCloseTo(WEIGHT_EXPECTED.getWeightInfo().cropWeight);
});
(0, VITEST_1.test)('Full weight calculation', () => {
const crops = {
[]: 1219395,
[]: 14238991,
[]: 901826,
[]: 5041491,
[]: 9063168,
[]: 897212645,
[]: 171017100,
[]: 1496477,
[]: 15509429,
[]: 21996256,
};
const pests = {
pest_fly_1: 222,
pest_rat_1: 40,
pest_mite_1: 43,
pest_moth_1: 40,
pest_slug_1: 34,
pest_worm_1: 32,
pest_beetle_1: 265,
pest_locust_1: 41,
pest_cricket_1: 36,
pest_mosquito_1: 41,
};
const MINIONS = [
'WHEAT_11',
'CARROT_11',
'POTATO_12',
'PUMPKIN_12',
'MELON_12',
'MUSHROOM_12',
'COCOA_11',
'CACTUS_11',
'SUGAR_CANE_12',
'NETHER_WARTS_12',
];
const WEIGHT = (0, WEIGHTCALC_1.createFarmingWeightCalculator)({
collection: crops,
pests: pests,
farmingXp: 286958923.31966937,
levelCapUpgrade: 10,
anitaBonusFarmingFortuneLevel: 15,
minions: MINIONS,
}).setEarnedMedals({
diamond: 246,
platinum: 75,
gold: 99,
});
(0, VITEST_1.expect)(WEIGHT.getWeightInfo().totalWeight).toBeCloseTo(5176.617);
});
//# sourceMappingURL=weightcalc.test.js.map