mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-25 18:50:56 +02:00
prettify, sorry for the big ass commit
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
export function calculateIntelligenceBonus(intelligence: number, weight = 1): number {
|
||||
return 1+(weight*Math.pow(intelligence, 0.8)/600);
|
||||
}
|
||||
export function calculateIntelligenceBonus(
|
||||
intelligence: number,
|
||||
weight = 1,
|
||||
): number {
|
||||
return 1 + (weight * Math.pow(intelligence, 0.8)) / 600;
|
||||
}
|
||||
|
||||
@@ -1,37 +1,48 @@
|
||||
import { IPlayer } from '../IPlayer';
|
||||
import { Faction } from '../../Faction/Faction';
|
||||
import { CONSTANTS } from '../../Constants';
|
||||
import { BitNodeMultipliers } from '../../BitNode/BitNodeMultipliers';
|
||||
import { IPlayer } from "../IPlayer";
|
||||
import { Faction } from "../../Faction/Faction";
|
||||
import { CONSTANTS } from "../../Constants";
|
||||
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
|
||||
function mult(f: Faction): number {
|
||||
let favorMult = 1 + (f.favor / 100);
|
||||
if (isNaN(favorMult)) {favorMult = 1;}
|
||||
return favorMult * BitNodeMultipliers.FactionWorkRepGain;
|
||||
let favorMult = 1 + f.favor / 100;
|
||||
if (isNaN(favorMult)) {
|
||||
favorMult = 1;
|
||||
}
|
||||
return favorMult * BitNodeMultipliers.FactionWorkRepGain;
|
||||
}
|
||||
|
||||
export function getHackingWorkRepGain(p: IPlayer, f: Faction): number {
|
||||
return (p.hacking_skill + p.intelligence/3) /
|
||||
CONSTANTS.MaxSkillLevel * p.faction_rep_mult *
|
||||
p.getIntelligenceBonus(1) * mult(f);
|
||||
return (
|
||||
((p.hacking_skill + p.intelligence / 3) / CONSTANTS.MaxSkillLevel) *
|
||||
p.faction_rep_mult *
|
||||
p.getIntelligenceBonus(1) *
|
||||
mult(f)
|
||||
);
|
||||
}
|
||||
|
||||
export function getFactionSecurityWorkRepGain(p: IPlayer, f: Faction): number {
|
||||
const t = 0.9 * (p.hacking_skill / CONSTANTS.MaxSkillLevel +
|
||||
p.strength / CONSTANTS.MaxSkillLevel +
|
||||
p.defense / CONSTANTS.MaxSkillLevel +
|
||||
p.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
p.agility / CONSTANTS.MaxSkillLevel +
|
||||
p.intelligence / CONSTANTS.MaxSkillLevel) / 4.5;
|
||||
return t * p.faction_rep_mult * mult(f) * p.getIntelligenceBonus(1);
|
||||
const t =
|
||||
(0.9 *
|
||||
(p.hacking_skill / CONSTANTS.MaxSkillLevel +
|
||||
p.strength / CONSTANTS.MaxSkillLevel +
|
||||
p.defense / CONSTANTS.MaxSkillLevel +
|
||||
p.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
p.agility / CONSTANTS.MaxSkillLevel +
|
||||
p.intelligence / CONSTANTS.MaxSkillLevel)) /
|
||||
4.5;
|
||||
return t * p.faction_rep_mult * mult(f) * p.getIntelligenceBonus(1);
|
||||
}
|
||||
|
||||
export function getFactionFieldWorkRepGain(p: IPlayer, f: Faction): number {
|
||||
const t = 0.9 * (p.hacking_skill / CONSTANTS.MaxSkillLevel +
|
||||
p.strength / CONSTANTS.MaxSkillLevel +
|
||||
p.defense / CONSTANTS.MaxSkillLevel +
|
||||
p.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
p.agility / CONSTANTS.MaxSkillLevel +
|
||||
p.charisma / CONSTANTS.MaxSkillLevel +
|
||||
p.intelligence / CONSTANTS.MaxSkillLevel) / 5.5;
|
||||
return t * p.faction_rep_mult * mult(f) * p.getIntelligenceBonus(1);
|
||||
const t =
|
||||
(0.9 *
|
||||
(p.hacking_skill / CONSTANTS.MaxSkillLevel +
|
||||
p.strength / CONSTANTS.MaxSkillLevel +
|
||||
p.defense / CONSTANTS.MaxSkillLevel +
|
||||
p.dexterity / CONSTANTS.MaxSkillLevel +
|
||||
p.agility / CONSTANTS.MaxSkillLevel +
|
||||
p.charisma / CONSTANTS.MaxSkillLevel +
|
||||
p.intelligence / CONSTANTS.MaxSkillLevel)) /
|
||||
5.5;
|
||||
return t * p.faction_rep_mult * mult(f) * p.getIntelligenceBonus(1);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export function calculateSkill(exp: number, mult = 1): number {
|
||||
return Math.max(Math.floor(mult*(32 * Math.log(exp + 534.5) - 200)), 1);
|
||||
return Math.max(Math.floor(mult * (32 * Math.log(exp + 534.5) - 200)), 1);
|
||||
}
|
||||
|
||||
export function calculateExp(skill: number, mult = 1): number {
|
||||
return Math.exp((skill / mult + 200) / 32) - 534.6
|
||||
}
|
||||
return Math.exp((skill / mult + 200) / 32) - 534.6;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user