mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
Changed the ascension mechanic
This commit is contained in:
parent
42aa6525a6
commit
af46324c6d
@ -350,19 +350,7 @@ export class Gang {
|
|||||||
try {
|
try {
|
||||||
const res = member.ascend();
|
const res = member.ascend();
|
||||||
this.respect = Math.max(1, this.respect - res.respect);
|
this.respect = Math.max(1, this.respect - res.respect);
|
||||||
if (workerScript == null) {
|
if (workerScript) {
|
||||||
dialogBoxCreate([`You ascended ${member.name}!`,
|
|
||||||
"",
|
|
||||||
`Your gang lost ${numeralWrapper.formatRespect(res.respect)} respect`,
|
|
||||||
"",
|
|
||||||
`${member.name} gained the following stat multipliers for ascending:`,
|
|
||||||
`Hacking: ${numeralWrapper.formatPercentage(res.hack, 3)}`,
|
|
||||||
`Strength: ${numeralWrapper.formatPercentage(res.str, 3)}`,
|
|
||||||
`Defense: ${numeralWrapper.formatPercentage(res.def, 3)}`,
|
|
||||||
`Dexterity: ${numeralWrapper.formatPercentage(res.dex, 3)}`,
|
|
||||||
`Agility: ${numeralWrapper.formatPercentage(res.agi, 3)}`,
|
|
||||||
`Charisma: ${numeralWrapper.formatPercentage(res.cha, 3)}`].join("<br>"));
|
|
||||||
} else {
|
|
||||||
workerScript.log('ascend', `Ascended Gang member ${member.name}`);
|
workerScript.log('ascend', `Ascended Gang member ${member.name}`);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -45,12 +45,12 @@ export class GangMember {
|
|||||||
agi_mult = 1;
|
agi_mult = 1;
|
||||||
cha_mult = 1;
|
cha_mult = 1;
|
||||||
|
|
||||||
hack_asc_mult = 1;
|
hack_asc_points = 0;
|
||||||
str_asc_mult = 1;
|
str_asc_points = 0;
|
||||||
def_asc_mult = 1;
|
def_asc_points = 0;
|
||||||
dex_asc_mult = 1;
|
dex_asc_points = 0;
|
||||||
agi_asc_mult = 1;
|
agi_asc_points = 0;
|
||||||
cha_asc_mult = 1;
|
cha_asc_points = 0;
|
||||||
|
|
||||||
upgrades: string[] = []; // Names of upgrades
|
upgrades: string[] = []; // Names of upgrades
|
||||||
augmentations: string[] = []; // Names of augmentations only
|
augmentations: string[] = []; // Names of augmentations only
|
||||||
@ -63,13 +63,17 @@ export class GangMember {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
calculateAscensionMult(points: number): number {
|
||||||
|
return Math.max(Math.pow(points/2000, 0.9), 1);
|
||||||
|
}
|
||||||
|
|
||||||
updateSkillLevels(): void {
|
updateSkillLevels(): void {
|
||||||
this.hack = this.calculateSkill(this.hack_exp, this.hack_mult * this.hack_asc_mult);
|
this.hack = this.calculateSkill(this.hack_exp, this.hack_mult * this.calculateAscensionMult(this.hack_asc_points));
|
||||||
this.str = this.calculateSkill(this.str_exp, this.str_mult * this.str_asc_mult);
|
this.str = this.calculateSkill(this.str_exp, this.str_mult * this.calculateAscensionMult(this.str_asc_points));
|
||||||
this.def = this.calculateSkill(this.def_exp, this.def_mult * this.def_asc_mult);
|
this.def = this.calculateSkill(this.def_exp, this.def_mult * this.calculateAscensionMult(this.def_asc_points));
|
||||||
this.dex = this.calculateSkill(this.dex_exp, this.dex_mult * this.dex_asc_mult);
|
this.dex = this.calculateSkill(this.dex_exp, this.dex_mult * this.calculateAscensionMult(this.dex_asc_points));
|
||||||
this.agi = this.calculateSkill(this.agi_exp, this.agi_mult * this.agi_asc_mult);
|
this.agi = this.calculateSkill(this.agi_exp, this.agi_mult * this.calculateAscensionMult(this.agi_asc_points));
|
||||||
this.cha = this.calculateSkill(this.cha_exp, this.cha_mult * this.cha_asc_mult);
|
this.cha = this.calculateSkill(this.cha_exp, this.cha_mult * this.calculateAscensionMult(this.cha_asc_points));
|
||||||
}
|
}
|
||||||
|
|
||||||
calculatePower(): number {
|
calculatePower(): number {
|
||||||
@ -194,25 +198,47 @@ export class GangMember {
|
|||||||
this.earnedRespect += (this.calculateRespectGain(gang) * numCycles);
|
this.earnedRespect += (this.calculateRespectGain(gang) * numCycles);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAscensionResults(): IMults {
|
getGainedAscensionPoints(): IMults {
|
||||||
return {
|
return {
|
||||||
hack: this.hack_exp,
|
hack: Math.max(this.hack_exp - 1000, 0),
|
||||||
str: this.str_exp,
|
str: Math.max(this.str_exp - 1000, 0),
|
||||||
def: this.def_exp,
|
def: Math.max(this.def_exp - 1000, 0),
|
||||||
dex: this.dex_exp,
|
dex: Math.max(this.dex_exp - 1000, 0),
|
||||||
agi: this.agi_exp,
|
agi: Math.max(this.agi_exp - 1000, 0),
|
||||||
cha: this.cha_exp,
|
cha: Math.max(this.cha_exp - 1000, 0),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
canAscend(): boolean {
|
||||||
|
const points = this.getGainedAscensionPoints();
|
||||||
|
return points.hack > 0 ||
|
||||||
|
points.str > 0 ||
|
||||||
|
points.def > 0 ||
|
||||||
|
points.dex > 0 ||
|
||||||
|
points.agi > 0 ||
|
||||||
|
points.cha > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAscensionResults(): IMults {
|
||||||
|
const points = this.getGainedAscensionPoints();
|
||||||
|
return {
|
||||||
|
hack: this.calculateAscensionMult(this.hack_asc_points+points.hack)/this.calculateAscensionMult(this.hack_asc_points),
|
||||||
|
str: this.calculateAscensionMult(this.str_asc_points+points.str)/this.calculateAscensionMult(this.str_asc_points),
|
||||||
|
def: this.calculateAscensionMult(this.def_asc_points+points.def)/this.calculateAscensionMult(this.def_asc_points),
|
||||||
|
dex: this.calculateAscensionMult(this.dex_asc_points+points.dex)/this.calculateAscensionMult(this.dex_asc_points),
|
||||||
|
agi: this.calculateAscensionMult(this.agi_asc_points+points.agi)/this.calculateAscensionMult(this.agi_asc_points),
|
||||||
|
cha: this.calculateAscensionMult(this.cha_asc_points+points.cha)/this.calculateAscensionMult(this.cha_asc_points),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ascend(): IAscensionResult {
|
ascend(): IAscensionResult {
|
||||||
const res = this.getAscensionResults();
|
const res = this.getAscensionResults();
|
||||||
this.hack_asc_mult += res.hack;
|
this.hack_asc_points += this.hack_exp;
|
||||||
this.str_asc_mult += res.str;
|
this.str_asc_points += this.str_exp;
|
||||||
this.def_asc_mult += res.def;
|
this.def_asc_points += this.def_exp;
|
||||||
this.dex_asc_mult += res.dex;
|
this.dex_asc_points += this.dex_exp;
|
||||||
this.agi_asc_mult += res.agi;
|
this.agi_asc_points += this.agi_exp;
|
||||||
this.cha_asc_mult += res.cha;
|
this.cha_asc_points += this.cha_exp;
|
||||||
|
|
||||||
// Remove upgrades. Then re-calculate multipliers and stats
|
// Remove upgrades. Then re-calculate multipliers and stats
|
||||||
this.upgrades.length = 0;
|
this.upgrades.length = 0;
|
||||||
|
@ -255,7 +255,7 @@ export const gangMemberTasksMetadata: IGangMemberTaskMetadata[] = [
|
|||||||
name: "Train Combat",
|
name: "Train Combat",
|
||||||
params: {
|
params: {
|
||||||
strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 25,
|
strWeight: 25, defWeight: 25, dexWeight: 25, agiWeight: 25,
|
||||||
difficulty: 200,
|
difficulty: 100,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
* React Component for the content of the popup before the player confirms the
|
* React Component for the content of the popup before the player confirms the
|
||||||
* ascension of a gang member.
|
* ascension of a gang member.
|
||||||
*/
|
*/
|
||||||
import React from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Gang } from "../Gang";
|
import { Gang } from "../Gang";
|
||||||
import { GangMember } from "../GangMember";
|
import { GangMember } from "../GangMember";
|
||||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
import { removePopup } from "../../ui/React/createPopup";
|
import { removePopup } from "../../ui/React/createPopup";
|
||||||
|
import { dialogBoxCreate } from "../../../utils/DialogBox";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
member: GangMember;
|
member: GangMember;
|
||||||
@ -16,9 +17,29 @@ interface IProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function AscensionPopup(props: IProps): React.ReactElement {
|
export function AscensionPopup(props: IProps): React.ReactElement {
|
||||||
|
const setRerender = useState(false)[1];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const id = setInterval(() => setRerender(old => !old), 1000);
|
||||||
|
return () => clearInterval(id);
|
||||||
|
}, []);
|
||||||
|
|
||||||
function confirm(): void {
|
function confirm(): void {
|
||||||
props.gang.ascendMember(props.member);
|
|
||||||
props.onAscend();
|
props.onAscend();
|
||||||
|
const res = props.gang.ascendMember(props.member);
|
||||||
|
dialogBoxCreate(<p>
|
||||||
|
You ascended {props.member.name}!<br />
|
||||||
|
<br />
|
||||||
|
Your gang lost {numeralWrapper.formatRespect(res.respect)} respect.<br />
|
||||||
|
<br />
|
||||||
|
{props.member.name} gained the following stat multipliers for ascending:<br />
|
||||||
|
Hacking: x{numeralWrapper.format(res.hack, '0.000')}<br />
|
||||||
|
Strength: x{numeralWrapper.format(res.str, '0.000')}<br />
|
||||||
|
Defense: x{numeralWrapper.format(res.def, '0.000')}<br />
|
||||||
|
Dexterity: x{numeralWrapper.format(res.dex, '0.000')}<br />
|
||||||
|
Agility: x{numeralWrapper.format(res.agi, '0.000')}<br />
|
||||||
|
Charisma: x{numeralWrapper.format(res.cha, '0.000')}<br />
|
||||||
|
</p>);
|
||||||
removePopup(props.popupId);
|
removePopup(props.popupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,12 +57,12 @@ their non-Augmentation upgrades and their stats will reset back to 1.<br />
|
|||||||
Furthermore, your gang will lose {numeralWrapper.formatRespect(props.member.earnedRespect)} respect<br />
|
Furthermore, your gang will lose {numeralWrapper.formatRespect(props.member.earnedRespect)} respect<br />
|
||||||
<br />
|
<br />
|
||||||
In return, they will gain the following permanent boost to stat multipliers:<br />
|
In return, they will gain the following permanent boost to stat multipliers:<br />
|
||||||
Hacking: +{numeralWrapper.formatPercentage(ascendBenefits.hack/100)}<br />
|
Hacking: x{numeralWrapper.format(ascendBenefits.hack, '0.000')}<br />
|
||||||
Strength: +{numeralWrapper.formatPercentage(ascendBenefits.str/100)}<br />
|
Strength: x{numeralWrapper.format(ascendBenefits.str, '0.000')}<br />
|
||||||
Defense: +{numeralWrapper.formatPercentage(ascendBenefits.def/100)}<br />
|
Defense: x{numeralWrapper.format(ascendBenefits.def, '0.000')}<br />
|
||||||
Dexterity: +{numeralWrapper.formatPercentage(ascendBenefits.dex/100)}<br />
|
Dexterity: x{numeralWrapper.format(ascendBenefits.dex, '0.000')}<br />
|
||||||
Agility: +{numeralWrapper.formatPercentage(ascendBenefits.agi/100)}<br />
|
Agility: x{numeralWrapper.format(ascendBenefits.agi, '0.000')}<br />
|
||||||
Charisma: +{numeralWrapper.formatPercentage(ascendBenefits.cha/100)}<br />
|
Charisma: x{numeralWrapper.format(ascendBenefits.cha, '0.000')}<br />
|
||||||
</pre>
|
</pre>
|
||||||
<button className="std-button" onClick={confirm}>Ascend</button>
|
<button className="std-button" onClick={confirm}>Ascend</button>
|
||||||
<button className="std-button" onClick={cancel}>Cancel</button>
|
<button className="std-button" onClick={cancel}>Cancel</button>
|
||||||
|
@ -34,8 +34,7 @@ export function GangMemberStats(props: IProps): React.ReactElement {
|
|||||||
exchange for a permanent boost to their stat multipliers.
|
exchange for a permanent boost to their stat multipliers.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
The additional stat multiplier that the Gang Member gains upon
|
The additional stat multiplier that the Gang Member gains upon
|
||||||
ascension is based on the amount of multipliers the member has from
|
ascension is based on the amount of exp they have.
|
||||||
non-Augmentation Equipment.
|
|
||||||
<br /><br />
|
<br /><br />
|
||||||
Upon ascension, the member will lose all of its non-Augmentation
|
Upon ascension, the member will lose all of its non-Augmentation
|
||||||
Equipment and your gang will lose respect equal to the total respect
|
Equipment and your gang will lose respect equal to the total respect
|
||||||
@ -43,14 +42,23 @@ export function GangMemberStats(props: IProps): React.ReactElement {
|
|||||||
</>);
|
</>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const asc = {
|
||||||
|
hack: props.member.calculateAscensionMult(props.member.hack_asc_points),
|
||||||
|
str: props.member.calculateAscensionMult(props.member.str_asc_points),
|
||||||
|
def: props.member.calculateAscensionMult(props.member.def_asc_points),
|
||||||
|
dex: props.member.calculateAscensionMult(props.member.dex_asc_points),
|
||||||
|
agi: props.member.calculateAscensionMult(props.member.agi_asc_points),
|
||||||
|
cha: props.member.calculateAscensionMult(props.member.cha_asc_points),
|
||||||
|
};
|
||||||
|
|
||||||
return (<>
|
return (<>
|
||||||
<span className="tooltiptext smallfont">
|
<span className="tooltiptext smallfont">
|
||||||
Hk: x{numeralWrapper.formatMultiplier(props.member.hack_mult * props.member.hack_asc_mult)}(x{numeralWrapper.formatMultiplier(props.member.hack_mult)} Eq, x{numeralWrapper.formatMultiplier(props.member.hack_asc_mult)} Asc)<br />
|
Hk: x{numeralWrapper.formatMultiplier(props.member.hack_mult * asc.hack)}(x{numeralWrapper.formatMultiplier(props.member.hack_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.hack)} Asc)<br />
|
||||||
St: x{numeralWrapper.formatMultiplier(props.member.str_mult * props.member.str_asc_mult)}(x{numeralWrapper.formatMultiplier(props.member.str_mult)} Eq, x{numeralWrapper.formatMultiplier(props.member.str_asc_mult)} Asc)<br />
|
St: x{numeralWrapper.formatMultiplier(props.member.str_mult * asc.str)}(x{numeralWrapper.formatMultiplier(props.member.str_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.str)} Asc)<br />
|
||||||
Df: x{numeralWrapper.formatMultiplier(props.member.def_mult * props.member.def_asc_mult)}(x{numeralWrapper.formatMultiplier(props.member.def_mult)} Eq, x{numeralWrapper.formatMultiplier(props.member.def_asc_mult)} Asc)<br />
|
Df: x{numeralWrapper.formatMultiplier(props.member.def_mult * asc.def)}(x{numeralWrapper.formatMultiplier(props.member.def_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.def)} Asc)<br />
|
||||||
Dx: x{numeralWrapper.formatMultiplier(props.member.dex_mult * props.member.dex_asc_mult)}(x{numeralWrapper.formatMultiplier(props.member.dex_mult)} Eq, x{numeralWrapper.formatMultiplier(props.member.dex_asc_mult)} Asc)<br />
|
Dx: x{numeralWrapper.formatMultiplier(props.member.dex_mult * asc.dex)}(x{numeralWrapper.formatMultiplier(props.member.dex_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.dex)} Asc)<br />
|
||||||
Ag: x{numeralWrapper.formatMultiplier(props.member.agi_mult * props.member.agi_asc_mult)}(x{numeralWrapper.formatMultiplier(props.member.agi_mult)} Eq, x{numeralWrapper.formatMultiplier(props.member.agi_asc_mult)} Asc)<br />
|
Ag: x{numeralWrapper.formatMultiplier(props.member.agi_mult * asc.agi)}(x{numeralWrapper.formatMultiplier(props.member.agi_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.agi)} Asc)<br />
|
||||||
Ch: x{numeralWrapper.formatMultiplier(props.member.cha_mult * props.member.cha_asc_mult)}(x{numeralWrapper.formatMultiplier(props.member.cha_mult)} Eq, x{numeralWrapper.formatMultiplier(props.member.cha_asc_mult)} Asc)
|
Ch: x{numeralWrapper.formatMultiplier(props.member.cha_mult * asc.cha)}(x{numeralWrapper.formatMultiplier(props.member.cha_mult)} Eq, x{numeralWrapper.formatMultiplier(asc.cha)} Asc)
|
||||||
</span>
|
</span>
|
||||||
<pre>
|
<pre>
|
||||||
Hacking: {formatNumber(props.member.hack, 0)} ({numeralWrapper.formatExp(props.member.hack_exp)} exp)<br />
|
Hacking: {formatNumber(props.member.hack, 0)} ({numeralWrapper.formatExp(props.member.hack_exp)} exp)<br />
|
||||||
@ -61,7 +69,9 @@ Agility: {formatNumber(props.member.agi, 0)} ({numeralWrapper.formatExp(props.me
|
|||||||
Charisma: {formatNumber(props.member.cha, 0)} ({numeralWrapper.formatExp(props.member.cha_exp)} exp)<br />
|
Charisma: {formatNumber(props.member.cha, 0)} ({numeralWrapper.formatExp(props.member.cha_exp)} exp)<br />
|
||||||
</pre>
|
</pre>
|
||||||
<br />
|
<br />
|
||||||
|
{ props.member.canAscend() && <>
|
||||||
<button className="accordion-button" onClick={ascend}>Ascend</button>
|
<button className="accordion-button" onClick={ascend}>Ascend</button>
|
||||||
<div className="help-tip" style={{marginTop: "5px"}} onClick={openAscensionHelp}>?</div>
|
<div className="help-tip" style={{marginTop: "5px"}} onClick={openAscensionHelp}>?</div>
|
||||||
|
</>}
|
||||||
</>);
|
</>);
|
||||||
}
|
}
|
||||||
|
@ -56,15 +56,23 @@ function GangMemberUpgradePanel(props: IPanelProps): React.ReactElement {
|
|||||||
</a>);
|
</a>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const asc = {
|
||||||
|
hack: props.member.calculateAscensionMult(props.member.hack_asc_points),
|
||||||
|
str: props.member.calculateAscensionMult(props.member.str_asc_points),
|
||||||
|
def: props.member.calculateAscensionMult(props.member.def_asc_points),
|
||||||
|
dex: props.member.calculateAscensionMult(props.member.dex_asc_points),
|
||||||
|
agi: props.member.calculateAscensionMult(props.member.agi_asc_points),
|
||||||
|
cha: props.member.calculateAscensionMult(props.member.cha_asc_points),
|
||||||
|
};
|
||||||
return (<div style={{border: '1px solid white'}}>
|
return (<div style={{border: '1px solid white'}}>
|
||||||
<h1>{props.member.name}({props.member.task})</h1>
|
<h1>{props.member.name}({props.member.task})</h1>
|
||||||
<pre style={{fontSize:"14px", display: "inline-block", width:"20%"}}>
|
<pre style={{fontSize:"14px", display: "inline-block", width:"20%"}}>
|
||||||
Hack: {props.member.hack} (x{formatNumber(props.member.hack_mult * props.member.hack_asc_mult, 2)})<br />
|
Hack: {props.member.hack} (x{formatNumber(props.member.hack_mult * asc.hack, 2)})<br />
|
||||||
Str: {props.member.str} (x{formatNumber(props.member.str_mult * props.member.str_asc_mult, 2)})<br />
|
Str: {props.member.str} (x{formatNumber(props.member.str_mult * asc.str, 2)})<br />
|
||||||
Def: {props.member.def} (x{formatNumber(props.member.def_mult * props.member.def_asc_mult, 2)})<br />
|
Def: {props.member.def} (x{formatNumber(props.member.def_mult * asc.def, 2)})<br />
|
||||||
Dex: {props.member.dex} (x{formatNumber(props.member.dex_mult * props.member.dex_asc_mult, 2)})<br />
|
Dex: {props.member.dex} (x{formatNumber(props.member.dex_mult * asc.dex, 2)})<br />
|
||||||
Agi: {props.member.agi} (x{formatNumber(props.member.agi_mult * props.member.agi_asc_mult, 2)})<br />
|
Agi: {props.member.agi} (x{formatNumber(props.member.agi_mult * asc.agi, 2)})<br />
|
||||||
Cha: {props.member.cha} (x{formatNumber(props.member.cha_mult * props.member.cha_asc_mult, 2)})
|
Cha: {props.member.cha} (x{formatNumber(props.member.cha_mult * asc.cha, 2)})
|
||||||
</pre>
|
</pre>
|
||||||
<div className="gang-owned-upgrades-div">
|
<div className="gang-owned-upgrades-div">
|
||||||
Purchased Upgrades: {props.member.upgrades.map((upg: string) => purchasedUpgrade(upg))}
|
Purchased Upgrades: {props.member.upgrades.map((upg: string) => purchasedUpgrade(upg))}
|
||||||
|
Loading…
Reference in New Issue
Block a user