Move player skills and exp to their struct

This commit is contained in:
Olivier Gagnon
2022-07-26 23:54:17 -04:00
parent 3e4f26ac0a
commit 326d9fd7ef
45 changed files with 546 additions and 487 deletions
+27 -27
View File
@@ -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;
+12 -12
View File
@@ -20,33 +20,33 @@ export function MoreStatsModal(props: IProps): React.ReactElement {
rows={[
[
<>Hacking:&nbsp;</>,
props.sleeve.hacking,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.hacking_exp)} exp)</>,
props.sleeve.skills.hacking,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.exp.hacking)} exp)</>,
],
[
<>Strength:&nbsp;</>,
props.sleeve.strength,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.strength_exp)} exp)</>,
props.sleeve.skills.strength,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.exp.strength)} exp)</>,
],
[
<>Defense:&nbsp;</>,
props.sleeve.defense,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.defense_exp)} exp)</>,
props.sleeve.skills.defense,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.exp.defense)} exp)</>,
],
[
<>Dexterity:&nbsp;</>,
props.sleeve.dexterity,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.dexterity_exp)} exp)</>,
props.sleeve.skills.dexterity,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.exp.dexterity)} exp)</>,
],
[
<>Agility:&nbsp;</>,
props.sleeve.agility,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.agility_exp)} exp)</>,
props.sleeve.skills.agility,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.exp.agility)} exp)</>,
],
[
<>Charisma:&nbsp;</>,
props.sleeve.charisma,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.charisma_exp)} exp)</>,
props.sleeve.skills.charisma,
<>&nbsp;({numeralWrapper.formatExp(props.sleeve.exp.charisma)} exp)</>,
],
]}
title="Stats:"
+9 -7
View File
@@ -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 }}>