bitburner-official / bitburner-src

Bitburner source code.
Other
837 stars 273 forks source link

CORPORATION: Fix wrong initial productionMult of new division #1794

Open catloversg opened 1 day ago

catloversg commented 1 day ago

productionMult of a division is updated in all states except START, and it cannot be smaller than 1: https://github.com/bitburner-official/bitburner-src/blob/596a621c6279c725d6952b31999a6a7bd0b6d8d1/src/Corporation/Division.ts#L135

However, when a new division is created, we initialize productionMult with 0 instead of 1. It does not make sense because:

Test code:

/** @param {NS} ns */
export async function main(ns) {
  ns.tail();
  ns.corporation.createCorporation("Corp", false);
  ns.corporation.expandIndustry("Agriculture", "A");
  ns.print(
    `State: ${ns.corporation.getCorporation().prevState}, productionMult: ${ns.corporation.getDivision("A").productionMult}`
  );
  await ns.corporation.nextUpdate();
  ns.print(
    `State: ${ns.corporation.getCorporation().prevState}, productionMult: ${ns.corporation.getDivision("A").productionMult}`
  );
  await ns.corporation.nextUpdate();
  ns.print(
    `State: ${ns.corporation.getCorporation().prevState}, productionMult: ${ns.corporation.getDivision("A").productionMult}`
  );
}

Before:

State: SALE, productionMult: 0
State: START, productionMult: 0
State: PURCHASE, productionMult: 1

After:

State: SALE, productionMult: 1
State: START, productionMult: 1
State: PURCHASE, productionMult: 1