mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-06 15:47:52 +02:00
Move player skills and exp to their struct
This commit is contained in:
@@ -289,27 +289,27 @@ export class Sleeve extends Person {
|
||||
// Also the player does not earn anything
|
||||
if (fromOtherSleeve) {
|
||||
if (exp.hack > 0) {
|
||||
this.hacking_exp += exp.hack;
|
||||
this.exp.hacking += exp.hack;
|
||||
}
|
||||
|
||||
if (exp.str > 0) {
|
||||
this.strength_exp += exp.str;
|
||||
this.exp.strength += exp.str;
|
||||
}
|
||||
|
||||
if (exp.def > 0) {
|
||||
this.defense_exp += exp.def;
|
||||
this.exp.defense += exp.def;
|
||||
}
|
||||
|
||||
if (exp.dex > 0) {
|
||||
this.dexterity_exp += exp.dex;
|
||||
this.exp.dexterity += exp.dex;
|
||||
}
|
||||
|
||||
if (exp.agi > 0) {
|
||||
this.agility_exp += exp.agi;
|
||||
this.exp.agility += exp.agi;
|
||||
}
|
||||
|
||||
if (exp.cha > 0) {
|
||||
this.charisma_exp += exp.cha;
|
||||
this.exp.charisma += exp.cha;
|
||||
}
|
||||
|
||||
return createTaskTracker();
|
||||
@@ -469,12 +469,12 @@ export class Sleeve extends Person {
|
||||
}
|
||||
|
||||
const jobPerformance: number = companyPosition.calculateJobPerformance(
|
||||
this.hacking,
|
||||
this.strength,
|
||||
this.defense,
|
||||
this.dexterity,
|
||||
this.agility,
|
||||
this.charisma,
|
||||
this.skills.hacking,
|
||||
this.skills.strength,
|
||||
this.skills.defense,
|
||||
this.skills.dexterity,
|
||||
this.skills.agility,
|
||||
this.skills.charisma,
|
||||
);
|
||||
const favorMult = 1 + company.favor / 100;
|
||||
|
||||
@@ -485,12 +485,12 @@ export class Sleeve extends Person {
|
||||
}
|
||||
|
||||
installAugmentation(aug: Augmentation): void {
|
||||
this.hacking_exp = 0;
|
||||
this.strength_exp = 0;
|
||||
this.defense_exp = 0;
|
||||
this.dexterity_exp = 0;
|
||||
this.agility_exp = 0;
|
||||
this.charisma_exp = 0;
|
||||
this.exp.hacking = 0;
|
||||
this.exp.strength = 0;
|
||||
this.exp.defense = 0;
|
||||
this.exp.dexterity = 0;
|
||||
this.exp.agility = 0;
|
||||
this.exp.charisma = 0;
|
||||
this.applyAugmentation(aug);
|
||||
this.augmentations.push({ name: aug.name, level: 1 });
|
||||
this.updateStatLevels();
|
||||
@@ -509,12 +509,12 @@ export class Sleeve extends Person {
|
||||
*/
|
||||
prestige(p: IPlayer): void {
|
||||
// Reset exp
|
||||
this.hacking_exp = 0;
|
||||
this.strength_exp = 0;
|
||||
this.defense_exp = 0;
|
||||
this.dexterity_exp = 0;
|
||||
this.agility_exp = 0;
|
||||
this.charisma_exp = 0;
|
||||
this.exp.hacking = 0;
|
||||
this.exp.strength = 0;
|
||||
this.exp.defense = 0;
|
||||
this.exp.dexterity = 0;
|
||||
this.exp.agility = 0;
|
||||
this.exp.charisma = 0;
|
||||
|
||||
// Reset task-related stuff
|
||||
this.resetTaskStatus(p);
|
||||
@@ -1232,10 +1232,10 @@ export class Sleeve extends Person {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.hp -= amt;
|
||||
if (this.hp <= 0) {
|
||||
this.hp.current -= amt;
|
||||
if (this.hp.current <= 0) {
|
||||
this.shock = Math.min(1, this.shock - 0.5);
|
||||
this.hp = this.max_hp;
|
||||
this.hp.current = this.hp.max;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -20,33 +20,33 @@ export function MoreStatsModal(props: IProps): React.ReactElement {
|
||||
rows={[
|
||||
[
|
||||
<>Hacking: </>,
|
||||
props.sleeve.hacking,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.hacking_exp)} exp)</>,
|
||||
props.sleeve.skills.hacking,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.exp.hacking)} exp)</>,
|
||||
],
|
||||
[
|
||||
<>Strength: </>,
|
||||
props.sleeve.strength,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.strength_exp)} exp)</>,
|
||||
props.sleeve.skills.strength,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.exp.strength)} exp)</>,
|
||||
],
|
||||
[
|
||||
<>Defense: </>,
|
||||
props.sleeve.defense,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.defense_exp)} exp)</>,
|
||||
props.sleeve.skills.defense,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.exp.defense)} exp)</>,
|
||||
],
|
||||
[
|
||||
<>Dexterity: </>,
|
||||
props.sleeve.dexterity,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.dexterity_exp)} exp)</>,
|
||||
props.sleeve.skills.dexterity,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.exp.dexterity)} exp)</>,
|
||||
],
|
||||
[
|
||||
<>Agility: </>,
|
||||
props.sleeve.agility,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.agility_exp)} exp)</>,
|
||||
props.sleeve.skills.agility,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.exp.agility)} exp)</>,
|
||||
],
|
||||
[
|
||||
<>Charisma: </>,
|
||||
props.sleeve.charisma,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.charisma_exp)} exp)</>,
|
||||
props.sleeve.skills.charisma,
|
||||
<> ({numeralWrapper.formatExp(props.sleeve.exp.charisma)} exp)</>,
|
||||
],
|
||||
]}
|
||||
title="Stats:"
|
||||
|
||||
@@ -29,38 +29,40 @@ export function StatsElement(props: IProps): React.ReactElement {
|
||||
name="HP"
|
||||
color={Settings.theme.hp}
|
||||
data={{
|
||||
content: `${numeralWrapper.formatHp(props.sleeve.hp)} / ${numeralWrapper.formatHp(props.sleeve.max_hp)}`,
|
||||
content: `${numeralWrapper.formatHp(props.sleeve.hp.current)} / ${numeralWrapper.formatHp(
|
||||
props.sleeve.hp.max,
|
||||
)}`,
|
||||
}}
|
||||
/>
|
||||
<StatsRow
|
||||
name="Hacking"
|
||||
color={Settings.theme.hack}
|
||||
data={{ level: props.sleeve.hacking, exp: props.sleeve.hacking_exp }}
|
||||
data={{ level: props.sleeve.skills.hacking, exp: props.sleeve.exp.hacking }}
|
||||
/>
|
||||
<StatsRow
|
||||
name="Strength"
|
||||
color={Settings.theme.combat}
|
||||
data={{ level: props.sleeve.strength, exp: props.sleeve.strength_exp }}
|
||||
data={{ level: props.sleeve.skills.strength, exp: props.sleeve.exp.strength }}
|
||||
/>
|
||||
<StatsRow
|
||||
name="Defense"
|
||||
color={Settings.theme.combat}
|
||||
data={{ level: props.sleeve.defense, exp: props.sleeve.defense_exp }}
|
||||
data={{ level: props.sleeve.skills.defense, exp: props.sleeve.exp.defense }}
|
||||
/>
|
||||
<StatsRow
|
||||
name="Dexterity"
|
||||
color={Settings.theme.combat}
|
||||
data={{ level: props.sleeve.dexterity, exp: props.sleeve.dexterity_exp }}
|
||||
data={{ level: props.sleeve.skills.dexterity, exp: props.sleeve.exp.dexterity }}
|
||||
/>
|
||||
<StatsRow
|
||||
name="Agility"
|
||||
color={Settings.theme.combat}
|
||||
data={{ level: props.sleeve.agility, exp: props.sleeve.agility_exp }}
|
||||
data={{ level: props.sleeve.skills.agility, exp: props.sleeve.exp.agility }}
|
||||
/>
|
||||
<StatsRow
|
||||
name="Charisma"
|
||||
color={Settings.theme.cha}
|
||||
data={{ level: props.sleeve.charisma, exp: props.sleeve.charisma_exp }}
|
||||
data={{ level: props.sleeve.skills.charisma, exp: props.sleeve.exp.charisma }}
|
||||
/>
|
||||
<TableRow>
|
||||
<TableCell classes={{ root: classes.cellNone }}>
|
||||
|
||||
Reference in New Issue
Block a user