mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-08 22:37:37 +01:00
the gang UI has a force update on ascension.
This commit is contained in:
parent
05b1b55e9a
commit
42aa6525a6
@ -195,65 +195,24 @@ export class GangMember {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAscensionResults(): IMults {
|
getAscensionResults(): IMults {
|
||||||
//Calculate ascension bonus to stat multipliers.
|
|
||||||
//This is based on the current number of multipliers from Non-Augmentation upgrades
|
|
||||||
//+ Ascension Bonus = N% of current bonus from Augmentations
|
|
||||||
let hack = 1;
|
|
||||||
let str = 1;
|
|
||||||
let def = 1;
|
|
||||||
let dex = 1;
|
|
||||||
let agi = 1;
|
|
||||||
let cha = 1;
|
|
||||||
for (let i = 0; i < this.upgrades.length; ++i) {
|
|
||||||
const upg = GangMemberUpgrades[this.upgrades[i]];
|
|
||||||
if (upg.mults.hack != null) hack *= upg.mults.hack;
|
|
||||||
if (upg.mults.str != null) str *= upg.mults.str;
|
|
||||||
if (upg.mults.def != null) def *= upg.mults.def;
|
|
||||||
if (upg.mults.dex != null) dex *= upg.mults.dex;
|
|
||||||
if (upg.mults.agi != null) agi *= upg.mults.agi;
|
|
||||||
if (upg.mults.cha != null) cha *= upg.mults.cha;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Subtract 1 because we're only interested in the actual "bonus" part
|
|
||||||
const eff = this.getAscensionEfficiency();
|
|
||||||
return {
|
return {
|
||||||
hack: (Math.max(0, hack - 1) * GangConstants.AscensionMultiplierRatio * eff.hack),
|
hack: this.hack_exp,
|
||||||
str: (Math.max(0, str - 1) * GangConstants.AscensionMultiplierRatio * eff.str),
|
str: this.str_exp,
|
||||||
def: (Math.max(0, def - 1) * GangConstants.AscensionMultiplierRatio * eff.def),
|
def: this.def_exp,
|
||||||
dex: (Math.max(0, dex - 1) * GangConstants.AscensionMultiplierRatio * eff.dex),
|
dex: this.dex_exp,
|
||||||
agi: (Math.max(0, agi - 1) * GangConstants.AscensionMultiplierRatio * eff.agi),
|
agi: this.agi_exp,
|
||||||
cha: (Math.max(0, cha - 1) * GangConstants.AscensionMultiplierRatio * eff.cha),
|
cha: this.cha_exp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getAscensionEfficiency(): IMults {
|
|
||||||
function formula(mult: number): number {
|
|
||||||
return 1/(1+Math.log(mult)/Math.log(20));
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
hack: formula(this.hack_asc_mult),
|
|
||||||
str: formula(this.str_asc_mult),
|
|
||||||
def: formula(this.def_asc_mult),
|
|
||||||
dex: formula(this.dex_asc_mult),
|
|
||||||
agi: formula(this.agi_asc_mult),
|
|
||||||
cha: formula(this.cha_asc_mult),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
ascend(): IAscensionResult {
|
ascend(): IAscensionResult {
|
||||||
const res = this.getAscensionResults();
|
const res = this.getAscensionResults();
|
||||||
const hackAscMult = res.hack;
|
this.hack_asc_mult += res.hack;
|
||||||
const strAscMult = res.str;
|
this.str_asc_mult += res.str;
|
||||||
const defAscMult = res.def;
|
this.def_asc_mult += res.def;
|
||||||
const dexAscMult = res.dex;
|
this.dex_asc_mult += res.dex;
|
||||||
const agiAscMult = res.agi;
|
this.agi_asc_mult += res.agi;
|
||||||
const chaAscMult = res.cha;
|
this.cha_asc_mult += res.cha;
|
||||||
this.hack_asc_mult += hackAscMult;
|
|
||||||
this.str_asc_mult += strAscMult;
|
|
||||||
this.def_asc_mult += defAscMult;
|
|
||||||
this.dex_asc_mult += dexAscMult;
|
|
||||||
this.agi_asc_mult += agiAscMult;
|
|
||||||
this.cha_asc_mult += chaAscMult;
|
|
||||||
|
|
||||||
// Remove upgrades. Then re-calculate multipliers and stats
|
// Remove upgrades. Then re-calculate multipliers and stats
|
||||||
this.upgrades.length = 0;
|
this.upgrades.length = 0;
|
||||||
@ -281,12 +240,12 @@ export class GangMember {
|
|||||||
this.earnedRespect = 0;
|
this.earnedRespect = 0;
|
||||||
return {
|
return {
|
||||||
respect: respectToDeduct,
|
respect: respectToDeduct,
|
||||||
hack: hackAscMult,
|
hack: res.hack,
|
||||||
str: strAscMult,
|
str: res.str,
|
||||||
def: defAscMult,
|
def: res.def,
|
||||||
dex: dexAscMult,
|
dex: res.dex,
|
||||||
agi: agiAscMult,
|
agi: res.agi,
|
||||||
cha: chaAscMult,
|
cha: res.cha,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,11 +12,13 @@ interface IProps {
|
|||||||
member: GangMember;
|
member: GangMember;
|
||||||
gang: Gang;
|
gang: Gang;
|
||||||
popupId: string;
|
popupId: string;
|
||||||
|
onAscend: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AscensionPopup(props: IProps): React.ReactElement {
|
export function AscensionPopup(props: IProps): React.ReactElement {
|
||||||
function confirm(): void {
|
function confirm(): void {
|
||||||
props.gang.ascendMember(props.member);
|
props.gang.ascendMember(props.member);
|
||||||
|
props.onAscend();
|
||||||
removePopup(props.popupId);
|
removePopup(props.popupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,10 @@ export function GangMemberAccordionContent(props: IProps): React.ReactElement {
|
|||||||
const setRerender = useState(false)[1];
|
const setRerender = useState(false)[1];
|
||||||
return (<>
|
return (<>
|
||||||
<div className={"gang-member-info-div tooltip"}>
|
<div className={"gang-member-info-div tooltip"}>
|
||||||
<GangMemberStats gang={props.gang} member={props.member} />
|
<GangMemberStats
|
||||||
|
onAscend={()=>setRerender(old => !old)}
|
||||||
|
gang={props.gang}
|
||||||
|
member={props.member} />
|
||||||
</div>
|
</div>
|
||||||
<div className={"gang-member-info-div"}>
|
<div className={"gang-member-info-div"}>
|
||||||
<TaskSelector
|
<TaskSelector
|
||||||
|
@ -14,6 +14,7 @@ import { AscensionPopup } from "./AscensionPopup";
|
|||||||
interface IProps {
|
interface IProps {
|
||||||
member: GangMember;
|
member: GangMember;
|
||||||
gang: Gang;
|
gang: Gang;
|
||||||
|
onAscend: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GangMemberStats(props: IProps): React.ReactElement {
|
export function GangMemberStats(props: IProps): React.ReactElement {
|
||||||
@ -23,6 +24,7 @@ export function GangMemberStats(props: IProps): React.ReactElement {
|
|||||||
member: props.member,
|
member: props.member,
|
||||||
gang: props.gang,
|
gang: props.gang,
|
||||||
popupId: popupId,
|
popupId: popupId,
|
||||||
|
onAscend: props.onAscend,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user