mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
GANG: Clarify install behavior & add getInstallResult() (#1119)
New function returns post-install ascension ratios. * Add ascension penalty to Gang constants * Improve wording of Gang install message * Add GangMember#getInstallResults() * Update prestiging to use getInstallResults() * Add ns.gang.getInstallResults(memberName) * Update definitions * Add ram cost for ns.gang.getInstallResult() * Fix typo * More specific wording in documentation * Fix another typo * Run prettier * Rename getInstallResults to getPostInstallPoints * Update Prestige.ts * Update Gang.ts
This commit is contained in:
parent
d00fad472e
commit
f6871f0911
@ -5,6 +5,7 @@ import { GangMemberUpgrades } from "./GangMemberUpgrades";
|
||||
import { IAscensionResult } from "./IAscensionResult";
|
||||
import { Player } from "@player";
|
||||
import { Gang } from "./Gang";
|
||||
import { GangConstants } from "./data/Constants";
|
||||
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../utils/JSONReviver";
|
||||
import {
|
||||
calculateRespectGain,
|
||||
@ -250,6 +251,17 @@ export class GangMember {
|
||||
};
|
||||
}
|
||||
|
||||
getPostInstallPoints(): IMults {
|
||||
return {
|
||||
hack: this.hack_asc_points * GangConstants.InstallAscensionPenalty,
|
||||
str: this.str_asc_points * GangConstants.InstallAscensionPenalty,
|
||||
def: this.def_asc_points * GangConstants.InstallAscensionPenalty,
|
||||
dex: this.dex_asc_points * GangConstants.InstallAscensionPenalty,
|
||||
agi: this.agi_asc_points * GangConstants.InstallAscensionPenalty,
|
||||
cha: this.cha_asc_points * GangConstants.InstallAscensionPenalty,
|
||||
};
|
||||
}
|
||||
|
||||
ascend(): IAscensionResult {
|
||||
const res = this.getAscensionResults();
|
||||
const points = this.getGainedAscensionPoints();
|
||||
|
@ -12,6 +12,8 @@ export const GangConstants = {
|
||||
CyclesPerTerritoryAndPowerUpdate: 100,
|
||||
// Portion of upgrade multiplier that is kept after ascending
|
||||
AscensionMultiplierRatio: 0.15,
|
||||
// Penalty to ascension points on install
|
||||
InstallAscensionPenalty: 0.95,
|
||||
// Names of possible Gangs
|
||||
Names: [
|
||||
FactionName.SlumSnakes,
|
||||
|
@ -21,8 +21,9 @@ export function ManagementSubpage(): React.ReactElement {
|
||||
Vigilante Justice to lower your wanted level.
|
||||
<br />
|
||||
<br />
|
||||
Installing Augmentations does NOT reset progress with your Gang. Furthermore, after installing Augmentations,
|
||||
you will automatically join whatever Faction you created your gang with.
|
||||
Installing Augmentations does NOT reset progress with your Gang, however ascension multipliers will decrease
|
||||
slightly. Furthermore, after installing Augmentations, you will automatically join whatever Faction you created
|
||||
your gang with.
|
||||
<br />
|
||||
<br />
|
||||
You can also manage your gang programmatically through Netscript using the Gang API.
|
||||
|
@ -237,6 +237,7 @@ const gang = {
|
||||
purchaseEquipment: RamCostConstants.GangApiBase,
|
||||
ascendMember: RamCostConstants.GangApiBase,
|
||||
getAscensionResult: RamCostConstants.GangApiBase / 2,
|
||||
getInstallResult: RamCostConstants.GangApiBase / 2,
|
||||
setTerritoryWarfare: RamCostConstants.GangApiBase / 2,
|
||||
getChanceToWinClash: RamCostConstants.GangApiBase,
|
||||
getBonusTime: 0,
|
||||
|
@ -297,6 +297,22 @@ export function NetscriptGang(): InternalAPI<IGang> {
|
||||
...member.getAscensionResults(),
|
||||
};
|
||||
},
|
||||
getInstallResult: (ctx) => (_memberName) => {
|
||||
const memberName = helpers.string(ctx, "memberName", _memberName);
|
||||
getGang(ctx);
|
||||
const member = getGangMember(ctx, memberName);
|
||||
if (!member.canAscend()) return;
|
||||
const preInstall = member.getCurrentAscensionMults();
|
||||
const postInstall = member.getPostInstallPoints();
|
||||
return {
|
||||
hack: member.calculateAscensionMult(postInstall.hack) / preInstall.hack,
|
||||
str: member.calculateAscensionMult(postInstall.str) / preInstall.str,
|
||||
def: member.calculateAscensionMult(postInstall.def) / preInstall.def,
|
||||
dex: member.calculateAscensionMult(postInstall.dex) / preInstall.dex,
|
||||
agi: member.calculateAscensionMult(postInstall.agi) / preInstall.agi,
|
||||
cha: member.calculateAscensionMult(postInstall.cha) / preInstall.cha,
|
||||
};
|
||||
},
|
||||
setTerritoryWarfare: (ctx) => (_engage) => {
|
||||
const engage = !!_engage;
|
||||
const gang = getGang(ctx);
|
||||
|
@ -110,14 +110,14 @@ export function prestigeAugmentation(): void {
|
||||
if (gang) {
|
||||
const faction = Factions[gang.facName];
|
||||
if (faction) joinFaction(faction);
|
||||
const penalty = 0.95;
|
||||
for (const m of gang.members) {
|
||||
m.hack_asc_points *= penalty;
|
||||
m.str_asc_points *= penalty;
|
||||
m.def_asc_points *= penalty;
|
||||
m.dex_asc_points *= penalty;
|
||||
m.agi_asc_points *= penalty;
|
||||
m.cha_asc_points *= penalty;
|
||||
const results = m.getPostInstallPoints();
|
||||
m.hack_asc_points = results.hack;
|
||||
m.str_asc_points = results.str;
|
||||
m.def_asc_points = results.def;
|
||||
m.dex_asc_points = results.dex;
|
||||
m.agi_asc_points = results.agi;
|
||||
m.cha_asc_points = results.cha;
|
||||
}
|
||||
}
|
||||
|
||||
|
28
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
28
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -961,6 +961,22 @@ interface GangMemberInfo {
|
||||
moneyGain: number;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
interface GangMemberInstall {
|
||||
/** Factor by which the hacking ascension multiplier was decreased (newMult / oldMult) */
|
||||
hack: number;
|
||||
/** Factor by which the strength ascension multiplier was decreased (newMult / oldMult) */
|
||||
str: number;
|
||||
/** Factor by which the defense ascension multiplier was decreased (newMult / oldMult) */
|
||||
def: number;
|
||||
/** Factor by which the dexterity ascension multiplier was decreased (newMult / oldMult) */
|
||||
dex: number;
|
||||
/** Factor by which the agility ascension multiplier was decreased (newMult / oldMult) */
|
||||
agi: number;
|
||||
/** Factor by which the charisma ascension multiplier was decreased (newMult / oldMult) */
|
||||
cha: number;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
interface GangMemberAscension {
|
||||
/** Amount of respect lost from ascending */
|
||||
@ -3832,6 +3848,18 @@ export interface Gang {
|
||||
*/
|
||||
getAscensionResult(memberName: string): GangMemberAscension | undefined;
|
||||
|
||||
/**
|
||||
* Get the effect of an install on ascension multipliers without installing.
|
||||
* @remarks
|
||||
* RAM cost: 2 GB
|
||||
*
|
||||
* Get {@link GangMemberInstall} effects on ascension multipliers for a gang member after installing without performing the install.
|
||||
*
|
||||
* @param memberName - Name of member.
|
||||
* @returns Object with info about the install results on ascension multipliers, or undefined if ascension is not possible.
|
||||
*/
|
||||
getInstallResult(memberName: string): GangMemberInstall | undefined;
|
||||
|
||||
/**
|
||||
* Enable/Disable territory clashes.
|
||||
* @remarks
|
||||
|
Loading…
Reference in New Issue
Block a user