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
+4
View File
@@ -0,0 +1,4 @@
export interface HP {
current: number;
max: number;
}
+5 -19
View File
@@ -2,29 +2,15 @@
// a Sleeve. Used for functions that need to take in both.
import { IPlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
import { HP } from "./HP";
import { ITaskTracker } from "./ITaskTracker";
import { Multipliers } from "./Multipliers";
import { Skills } from "./Skills";
export interface IPerson {
// Stats
hacking: number;
strength: number;
defense: number;
dexterity: number;
agility: number;
charisma: number;
intelligence: number;
hp: number;
max_hp: number;
// Experience
hacking_exp: number;
strength_exp: number;
defense_exp: number;
dexterity_exp: number;
agility_exp: number;
charisma_exp: number;
intelligence_exp: number;
hp: HP;
skills: Skills;
exp: Skills;
mults: Multipliers;
+5 -19
View File
@@ -31,6 +31,8 @@ import { PlayerAchievement } from "../Achievements/Achievements";
import { IPerson } from "./IPerson";
import { Work } from "../Work/Work";
import { Multipliers } from "./Multipliers";
import { Skills } from "./Skills";
import { HP } from "./HP";
export interface IPlayer extends IPerson {
bitNodeN: number;
@@ -47,12 +49,10 @@ export interface IPlayer extends IPerson {
hashManager: HashManager;
hasTixApiAccess: boolean;
hasWseAccount: boolean;
hp: number;
jobs: IMap<string>;
karma: number;
numPeopleKilled: number;
location: LocationName;
max_hp: number;
readonly money: number;
moneySourceA: MoneySourceTracker;
moneySourceB: MoneySourceTracker;
@@ -70,23 +70,9 @@ export interface IPlayer extends IPerson {
lastUpdate: number;
totalPlaytime: number;
// Stats
hacking: number;
strength: number;
defense: number;
dexterity: number;
agility: number;
charisma: number;
intelligence: number;
// Experience
hacking_exp: number;
strength_exp: number;
defense_exp: number;
dexterity_exp: number;
agility_exp: number;
charisma_exp: number;
intelligence_exp: number;
hp: HP;
skills: Skills;
exp: Skills;
mults: Multipliers;
+49 -51
View File
@@ -8,32 +8,30 @@ import { calculateSkill } from "./formulas/skill";
import { calculateIntelligenceBonus } from "./formulas/intelligence";
import { IPerson } from "./IPerson";
import { defaultMultipliers, mergeMultipliers } from "./Multipliers";
import { Skills } from "./Skills";
import { HP } from "./HP";
// Base class representing a person-like object
export abstract class Person implements IPerson {
/**
* Stats
*/
hacking = 1;
strength = 1;
defense = 1;
dexterity = 1;
agility = 1;
charisma = 1;
intelligence = 0;
hp = 10;
max_hp = 10;
/**
* Experience
*/
hacking_exp = 0;
strength_exp = 0;
defense_exp = 0;
dexterity_exp = 0;
agility_exp = 0;
charisma_exp = 0;
intelligence_exp = 0;
hp: HP = { current: 10, max: 10 };
skills: Skills = {
hacking: 1,
strength: 1,
defense: 1,
dexterity: 1,
agility: 1,
charisma: 1,
intelligence: 1,
};
exp: Skills = {
hacking: 0,
strength: 0,
defense: 0,
dexterity: 0,
agility: 0,
charisma: 0,
intelligence: 0,
};
mults = defaultMultipliers();
@@ -81,12 +79,12 @@ export abstract class Person implements IPerson {
getFactionFieldWorkRepGain(): number {
const t =
(0.9 *
(this.hacking / CONSTANTS.MaxSkillLevel +
this.strength / CONSTANTS.MaxSkillLevel +
this.defense / CONSTANTS.MaxSkillLevel +
this.dexterity / CONSTANTS.MaxSkillLevel +
this.agility / CONSTANTS.MaxSkillLevel +
this.charisma / CONSTANTS.MaxSkillLevel)) /
(this.skills.hacking / CONSTANTS.MaxSkillLevel +
this.skills.strength / CONSTANTS.MaxSkillLevel +
this.skills.defense / CONSTANTS.MaxSkillLevel +
this.skills.dexterity / CONSTANTS.MaxSkillLevel +
this.skills.agility / CONSTANTS.MaxSkillLevel +
this.skills.charisma / CONSTANTS.MaxSkillLevel)) /
5.5;
return t * this.mults.faction_rep;
}
@@ -96,7 +94,7 @@ export abstract class Person implements IPerson {
* when doing Hacking Work for a faction
*/
getFactionHackingWorkRepGain(): number {
return (this.hacking / CONSTANTS.MaxSkillLevel) * this.mults.faction_rep;
return (this.skills.hacking / CONSTANTS.MaxSkillLevel) * this.mults.faction_rep;
}
/**
@@ -106,11 +104,11 @@ export abstract class Person implements IPerson {
getFactionSecurityWorkRepGain(): number {
const t =
(0.9 *
(this.hacking / CONSTANTS.MaxSkillLevel +
this.strength / CONSTANTS.MaxSkillLevel +
this.defense / CONSTANTS.MaxSkillLevel +
this.dexterity / CONSTANTS.MaxSkillLevel +
this.agility / CONSTANTS.MaxSkillLevel)) /
(this.skills.hacking / CONSTANTS.MaxSkillLevel +
this.skills.strength / CONSTANTS.MaxSkillLevel +
this.skills.defense / CONSTANTS.MaxSkillLevel +
this.skills.dexterity / CONSTANTS.MaxSkillLevel +
this.skills.agility / CONSTANTS.MaxSkillLevel)) /
4.5;
return t * this.mults.faction_rep;
}
@@ -126,44 +124,44 @@ export abstract class Person implements IPerson {
* Update all stat levels
*/
updateStatLevels(): void {
this.hacking = Math.max(
this.skills.hacking = Math.max(
1,
Math.floor(this.calculateStat(this.hacking_exp, this.mults.hacking * BitNodeMultipliers.HackingLevelMultiplier)),
Math.floor(this.calculateStat(this.exp.hacking, this.mults.hacking * BitNodeMultipliers.HackingLevelMultiplier)),
);
this.strength = Math.max(
this.skills.strength = Math.max(
1,
Math.floor(
this.calculateStat(this.strength_exp, this.mults.strength * BitNodeMultipliers.StrengthLevelMultiplier),
this.calculateStat(this.exp.strength, this.mults.strength * BitNodeMultipliers.StrengthLevelMultiplier),
),
);
this.defense = Math.max(
this.skills.defense = Math.max(
1,
Math.floor(this.calculateStat(this.defense_exp, this.mults.defense * BitNodeMultipliers.DefenseLevelMultiplier)),
Math.floor(this.calculateStat(this.exp.defense, this.mults.defense * BitNodeMultipliers.DefenseLevelMultiplier)),
);
this.dexterity = Math.max(
this.skills.dexterity = Math.max(
1,
Math.floor(
this.calculateStat(this.dexterity_exp, this.mults.dexterity * BitNodeMultipliers.DexterityLevelMultiplier),
this.calculateStat(this.exp.dexterity, this.mults.dexterity * BitNodeMultipliers.DexterityLevelMultiplier),
),
);
this.agility = Math.max(
this.skills.agility = Math.max(
1,
Math.floor(this.calculateStat(this.agility_exp, this.mults.agility * BitNodeMultipliers.AgilityLevelMultiplier)),
Math.floor(this.calculateStat(this.exp.agility, this.mults.agility * BitNodeMultipliers.AgilityLevelMultiplier)),
);
this.charisma = Math.max(
this.skills.charisma = Math.max(
1,
Math.floor(
this.calculateStat(this.charisma_exp, this.mults.charisma * BitNodeMultipliers.CharismaLevelMultiplier),
this.calculateStat(this.exp.charisma, this.mults.charisma * BitNodeMultipliers.CharismaLevelMultiplier),
),
);
const ratio: number = this.hp / this.max_hp;
this.max_hp = Math.floor(10 + this.defense / 10);
this.hp = Math.round(this.max_hp * ratio);
const ratio: number = this.hp.current / this.hp.max;
this.hp.max = Math.floor(10 + this.skills.defense / 10);
this.hp.current = Math.round(this.hp.max * ratio);
}
getIntelligenceBonus(weight: number): number {
return calculateIntelligenceBonus(this.intelligence, weight);
return calculateIntelligenceBonus(this.skills.intelligence, weight);
}
abstract takeDamage(amt: number): boolean;
+24 -44
View File
@@ -40,6 +40,8 @@ import { ITaskTracker } from "../ITaskTracker";
import { CONSTANTS } from "../../Constants";
import { Work } from "src/Work/Work";
import { defaultMultipliers, Multipliers } from "../Multipliers";
import { HP } from "../HP";
import { Skills } from "../Skills";
export class PlayerObject implements IPlayer {
// Class members
@@ -58,13 +60,11 @@ export class PlayerObject implements IPlayer {
hashManager: HashManager;
hasTixApiAccess: boolean;
hasWseAccount: boolean;
hp: number;
jobs: IMap<string>;
init: () => void;
karma: number;
numPeopleKilled: number;
location: LocationName;
max_hp: number;
money: number;
moneySourceA: MoneySourceTracker;
moneySourceB: MoneySourceTracker;
@@ -84,23 +84,9 @@ export class PlayerObject implements IPlayer {
lastSave: number;
totalPlaytime: number;
// Stats
hacking: number;
strength: number;
defense: number;
dexterity: number;
agility: number;
charisma: number;
intelligence: number;
// Experience
hacking_exp: number;
strength_exp: number;
defense_exp: number;
dexterity_exp: number;
agility_exp: number;
charisma_exp: number;
intelligence_exp: number;
hp: HP;
skills: Skills;
exp: Skills;
mults: Multipliers;
@@ -197,31 +183,25 @@ export class PlayerObject implements IPlayer {
focusPenalty: () => number;
constructor() {
//Skills and stats
this.hacking = 1;
//Combat stats
this.hp = 10;
this.max_hp = 10;
this.strength = 1;
this.defense = 1;
this.dexterity = 1;
this.agility = 1;
//Labor stats
this.charisma = 1;
//Special stats
this.intelligence = 0;
//Experience and multipliers
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.intelligence_exp = 0;
this.hp = { current: 10, max: 10 };
this.skills = {
hacking: 1,
strength: 1,
defense: 1,
dexterity: 1,
agility: 1,
charisma: 1,
intelligence: 1,
};
this.exp = {
hacking: 0,
strength: 0,
defense: 0,
dexterity: 0,
agility: 0,
charisma: 0,
intelligence: 0,
};
this.mults = defaultMultipliers();
@@ -78,21 +78,21 @@ export function prestigeAugmentation(this: PlayerObject): void {
this.numPeopleKilled = 0;
//Reset stats
this.hacking = 1;
this.skills.hacking = 1;
this.strength = 1;
this.defense = 1;
this.dexterity = 1;
this.agility = 1;
this.skills.strength = 1;
this.skills.defense = 1;
this.skills.dexterity = 1;
this.skills.agility = 1;
this.charisma = 1;
this.skills.charisma = 1;
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.money = 1000 + CONSTANTS.Donations;
@@ -136,7 +136,7 @@ export function prestigeAugmentation(this: PlayerObject): void {
// Reapply augs, re-calculate skills and reset HP
this.reapplyAllAugmentations(true);
this.hp = this.max_hp;
this.hp.current = this.hp.max;
this.finishWork(true);
}
@@ -197,46 +197,46 @@ export function calculateSkillProgress(this: IPlayer, exp: number, mult = 1): IS
}
export function updateSkillLevels(this: IPlayer): void {
this.hacking = Math.max(
this.skills.hacking = Math.max(
1,
Math.floor(this.calculateSkill(this.hacking_exp, this.mults.hacking * BitNodeMultipliers.HackingLevelMultiplier)),
Math.floor(this.calculateSkill(this.exp.hacking, this.mults.hacking * BitNodeMultipliers.HackingLevelMultiplier)),
);
this.strength = Math.max(
this.skills.strength = Math.max(
1,
Math.floor(
this.calculateSkill(this.strength_exp, this.mults.strength * BitNodeMultipliers.StrengthLevelMultiplier),
this.calculateSkill(this.exp.strength, this.mults.strength * BitNodeMultipliers.StrengthLevelMultiplier),
),
);
this.defense = Math.max(
this.skills.defense = Math.max(
1,
Math.floor(this.calculateSkill(this.defense_exp, this.mults.defense * BitNodeMultipliers.DefenseLevelMultiplier)),
Math.floor(this.calculateSkill(this.exp.defense, this.mults.defense * BitNodeMultipliers.DefenseLevelMultiplier)),
);
this.dexterity = Math.max(
this.skills.dexterity = Math.max(
1,
Math.floor(
this.calculateSkill(this.dexterity_exp, this.mults.dexterity * BitNodeMultipliers.DexterityLevelMultiplier),
this.calculateSkill(this.exp.dexterity, this.mults.dexterity * BitNodeMultipliers.DexterityLevelMultiplier),
),
);
this.agility = Math.max(
this.skills.agility = Math.max(
1,
Math.floor(this.calculateSkill(this.agility_exp, this.mults.agility * BitNodeMultipliers.AgilityLevelMultiplier)),
Math.floor(this.calculateSkill(this.exp.agility, this.mults.agility * BitNodeMultipliers.AgilityLevelMultiplier)),
);
this.charisma = Math.max(
this.skills.charisma = Math.max(
1,
Math.floor(
this.calculateSkill(this.charisma_exp, this.mults.charisma * BitNodeMultipliers.CharismaLevelMultiplier),
this.calculateSkill(this.exp.charisma, this.mults.charisma * BitNodeMultipliers.CharismaLevelMultiplier),
),
);
if (this.intelligence > 0) {
this.intelligence = Math.floor(this.calculateSkill(this.intelligence_exp));
if (this.skills.intelligence > 0) {
this.skills.intelligence = Math.floor(this.calculateSkill(this.exp.intelligence));
} else {
this.intelligence = 0;
this.skills.intelligence = 0;
}
const ratio = this.hp / this.max_hp;
this.max_hp = Math.floor(10 + this.defense / 10);
this.hp = Math.round(this.max_hp * ratio);
const ratio = this.hp.current / this.hp.max;
this.hp.max = Math.floor(10 + this.skills.defense / 10);
this.hp.current = Math.round(this.hp.max * ratio);
}
export function resetMultipliers(this: IPlayer): void {
@@ -311,12 +311,15 @@ export function gainHackingExp(this: IPerson, exp: number): void {
console.error("ERR: NaN passed into Player.gainHackingExp()");
return;
}
this.hacking_exp += exp;
if (this.hacking_exp < 0) {
this.hacking_exp = 0;
this.exp.hacking += exp;
if (this.exp.hacking < 0) {
this.exp.hacking = 0;
}
this.hacking = calculateSkillF(this.hacking_exp, this.mults.hacking * BitNodeMultipliers.HackingLevelMultiplier);
this.skills.hacking = calculateSkillF(
this.exp.hacking,
this.mults.hacking * BitNodeMultipliers.HackingLevelMultiplier,
);
}
export function gainStrengthExp(this: IPerson, exp: number): void {
@@ -324,12 +327,15 @@ export function gainStrengthExp(this: IPerson, exp: number): void {
console.error("ERR: NaN passed into Player.gainStrengthExp()");
return;
}
this.strength_exp += exp;
if (this.strength_exp < 0) {
this.strength_exp = 0;
this.exp.strength += exp;
if (this.exp.strength < 0) {
this.exp.strength = 0;
}
this.strength = calculateSkillF(this.strength_exp, this.mults.strength * BitNodeMultipliers.StrengthLevelMultiplier);
this.skills.strength = calculateSkillF(
this.exp.strength,
this.mults.strength * BitNodeMultipliers.StrengthLevelMultiplier,
);
}
export function gainDefenseExp(this: IPerson, exp: number): void {
@@ -337,15 +343,18 @@ export function gainDefenseExp(this: IPerson, exp: number): void {
console.error("ERR: NaN passed into player.gainDefenseExp()");
return;
}
this.defense_exp += exp;
if (this.defense_exp < 0) {
this.defense_exp = 0;
this.exp.defense += exp;
if (this.exp.defense < 0) {
this.exp.defense = 0;
}
this.defense = calculateSkillF(this.defense_exp, this.mults.defense * BitNodeMultipliers.DefenseLevelMultiplier);
const ratio = this.hp / this.max_hp;
this.max_hp = Math.floor(10 + this.defense / 10);
this.hp = Math.round(this.max_hp * ratio);
this.skills.defense = calculateSkillF(
this.exp.defense,
this.mults.defense * BitNodeMultipliers.DefenseLevelMultiplier,
);
const ratio = this.hp.current / this.hp.max;
this.hp.max = Math.floor(10 + this.skills.defense / 10);
this.hp.current = Math.round(this.hp.max * ratio);
}
export function gainDexterityExp(this: IPerson, exp: number): void {
@@ -353,13 +362,13 @@ export function gainDexterityExp(this: IPerson, exp: number): void {
console.error("ERR: NaN passed into Player.gainDexterityExp()");
return;
}
this.dexterity_exp += exp;
if (this.dexterity_exp < 0) {
this.dexterity_exp = 0;
this.exp.dexterity += exp;
if (this.exp.dexterity < 0) {
this.exp.dexterity = 0;
}
this.dexterity = calculateSkillF(
this.dexterity_exp,
this.skills.dexterity = calculateSkillF(
this.exp.dexterity,
this.mults.dexterity * BitNodeMultipliers.DexterityLevelMultiplier,
);
}
@@ -369,12 +378,15 @@ export function gainAgilityExp(this: IPerson, exp: number): void {
console.error("ERR: NaN passed into Player.gainAgilityExp()");
return;
}
this.agility_exp += exp;
if (this.agility_exp < 0) {
this.agility_exp = 0;
this.exp.agility += exp;
if (this.exp.agility < 0) {
this.exp.agility = 0;
}
this.agility = calculateSkillF(this.agility_exp, this.mults.agility * BitNodeMultipliers.AgilityLevelMultiplier);
this.skills.agility = calculateSkillF(
this.exp.agility,
this.mults.agility * BitNodeMultipliers.AgilityLevelMultiplier,
);
}
export function gainCharismaExp(this: IPerson, exp: number): void {
@@ -382,12 +394,15 @@ export function gainCharismaExp(this: IPerson, exp: number): void {
console.error("ERR: NaN passed into Player.gainCharismaExp()");
return;
}
this.charisma_exp += exp;
if (this.charisma_exp < 0) {
this.charisma_exp = 0;
this.exp.charisma += exp;
if (this.exp.charisma < 0) {
this.exp.charisma = 0;
}
this.charisma = calculateSkillF(this.charisma_exp, this.mults.charisma * BitNodeMultipliers.CharismaLevelMultiplier);
this.skills.charisma = calculateSkillF(
this.exp.charisma,
this.mults.charisma * BitNodeMultipliers.CharismaLevelMultiplier,
);
}
export function gainIntelligenceExp(this: IPerson, exp: number): void {
@@ -395,9 +410,9 @@ export function gainIntelligenceExp(this: IPerson, exp: number): void {
console.error("ERROR: NaN passed into Player.gainIntelligenceExp()");
return;
}
if (Player.sourceFileLvl(5) > 0 || this.intelligence > 0) {
this.intelligence_exp += exp;
this.intelligence = Math.floor(this.calculateSkill(this.intelligence_exp, 1));
if (Player.sourceFileLvl(5) > 0 || this.skills.intelligence > 0) {
this.exp.intelligence += exp;
this.skills.intelligence = Math.floor(this.calculateSkill(this.exp.intelligence, 1));
}
}
@@ -415,25 +430,25 @@ export function gainStats(this: IPerson, retValue: ITaskTracker): void {
export function queryStatFromString(this: IPlayer, str: string): number {
const tempStr = str.toLowerCase();
if (tempStr.includes("hack")) {
return this.hacking;
return this.skills.hacking;
}
if (tempStr.includes("str")) {
return this.strength;
return this.skills.strength;
}
if (tempStr.includes("def")) {
return this.defense;
return this.skills.defense;
}
if (tempStr.includes("dex")) {
return this.dexterity;
return this.skills.dexterity;
}
if (tempStr.includes("agi")) {
return this.agility;
return this.skills.agility;
}
if (tempStr.includes("cha")) {
return this.charisma;
return this.skills.charisma;
}
if (tempStr.includes("int")) {
return this.intelligence;
return this.skills.intelligence;
}
return 0;
}
@@ -453,8 +468,8 @@ export function takeDamage(this: IPlayer, amt: number): boolean {
return false;
}
this.hp -= amt;
if (this.hp <= 0) {
this.hp.current -= amt;
if (this.hp.current <= 0) {
this.hospitalize();
return true;
} else {
@@ -467,9 +482,9 @@ export function regenerateHp(this: IPerson, amt: number): void {
console.warn(`Player.regenerateHp() called without a numeric argument: ${amt}`);
return;
}
this.hp += amt;
if (this.hp > this.max_hp) {
this.hp = this.max_hp;
this.hp.current += amt;
if (this.hp.current > this.hp.max) {
this.hp.current = this.hp.max;
}
}
@@ -478,7 +493,7 @@ export function hospitalize(this: IPlayer): number {
SnackbarEvents.emit(`You've been Hospitalized for ${numeralWrapper.formatMoney(cost)}`, ToastVariant.WARNING, 2000);
this.loseMoney(cost, "hospitalization");
this.hp = this.max_hp;
this.hp.current = this.hp.max;
return cost;
}
@@ -754,12 +769,12 @@ export function isQualified(this: IPlayer, company: Company, position: CompanyPo
const reqCharisma = position.requiredCharisma > 0 ? position.requiredCharisma + offset : 0;
return (
this.hacking >= reqHacking &&
this.strength >= reqStrength &&
this.defense >= reqDefense &&
this.dexterity >= reqDexterity &&
this.agility >= reqAgility &&
this.charisma >= reqCharisma &&
this.skills.hacking >= reqHacking &&
this.skills.strength >= reqStrength &&
this.skills.defense >= reqDefense &&
this.skills.dexterity >= reqDexterity &&
this.skills.agility >= reqAgility &&
this.skills.charisma >= reqCharisma &&
company.playerReputation >= position.requiredReputation
);
}
@@ -851,11 +866,11 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!illuminatiFac.alreadyInvited &&
numAugmentations >= 30 &&
this.money >= 150000000000 &&
this.hacking >= 1500 &&
this.strength >= 1200 &&
this.defense >= 1200 &&
this.dexterity >= 1200 &&
this.agility >= 1200
this.skills.hacking >= 1500 &&
this.skills.strength >= 1200 &&
this.skills.defense >= 1200 &&
this.skills.dexterity >= 1200 &&
this.skills.agility >= 1200
) {
invitedFactions.push(illuminatiFac);
}
@@ -868,8 +883,11 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!daedalusFac.alreadyInvited &&
numAugmentations >= BitNodeMultipliers.DaedalusAugsRequirement &&
this.money >= 100000000000 &&
(this.hacking >= 2500 ||
(this.strength >= 1500 && this.defense >= 1500 && this.dexterity >= 1500 && this.agility >= 1500))
(this.skills.hacking >= 2500 ||
(this.skills.strength >= 1500 &&
this.skills.defense >= 1500 &&
this.skills.dexterity >= 1500 &&
this.skills.agility >= 1500))
) {
invitedFactions.push(daedalusFac);
}
@@ -882,11 +900,11 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!covenantFac.alreadyInvited &&
numAugmentations >= 20 &&
this.money >= 75000000000 &&
this.hacking >= 850 &&
this.strength >= 850 &&
this.defense >= 850 &&
this.dexterity >= 850 &&
this.agility >= 850
this.skills.hacking >= 850 &&
this.skills.strength >= 850 &&
this.skills.defense >= 850 &&
this.skills.dexterity >= 850 &&
this.skills.agility >= 850
) {
invitedFactions.push(covenantFac);
}
@@ -1131,11 +1149,11 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!speakersforthedeadFac.isBanned &&
!speakersforthedeadFac.isMember &&
!speakersforthedeadFac.alreadyInvited &&
this.hacking >= 100 &&
this.strength >= 300 &&
this.defense >= 300 &&
this.dexterity >= 300 &&
this.agility >= 300 &&
this.skills.hacking >= 100 &&
this.skills.strength >= 300 &&
this.skills.defense >= 300 &&
this.skills.dexterity >= 300 &&
this.skills.agility >= 300 &&
this.numPeopleKilled >= 30 &&
this.karma <= -45 &&
!allCompanies.includes(LocationName.Sector12CIA) &&
@@ -1150,11 +1168,11 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!thedarkarmyFac.isBanned &&
!thedarkarmyFac.isMember &&
!thedarkarmyFac.alreadyInvited &&
this.hacking >= 300 &&
this.strength >= 300 &&
this.defense >= 300 &&
this.dexterity >= 300 &&
this.agility >= 300 &&
this.skills.hacking >= 300 &&
this.skills.strength >= 300 &&
this.skills.defense >= 300 &&
this.skills.dexterity >= 300 &&
this.skills.agility >= 300 &&
this.city == CityName.Chongqing &&
this.numPeopleKilled >= 5 &&
this.karma <= -45 &&
@@ -1170,11 +1188,11 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!thesyndicateFac.isBanned &&
!thesyndicateFac.isMember &&
!thesyndicateFac.alreadyInvited &&
this.hacking >= 200 &&
this.strength >= 200 &&
this.defense >= 200 &&
this.dexterity >= 200 &&
this.agility >= 200 &&
this.skills.hacking >= 200 &&
this.skills.strength >= 200 &&
this.skills.defense >= 200 &&
this.skills.dexterity >= 200 &&
this.skills.agility >= 200 &&
(this.city == CityName.Aevum || this.city == CityName.Sector12) &&
this.money >= 10000000 &&
this.karma <= -90 &&
@@ -1206,10 +1224,10 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!tetradsFac.isMember &&
!tetradsFac.alreadyInvited &&
(this.city == CityName.Chongqing || this.city == CityName.NewTokyo || this.city == CityName.Ishima) &&
this.strength >= 75 &&
this.defense >= 75 &&
this.dexterity >= 75 &&
this.agility >= 75 &&
this.skills.strength >= 75 &&
this.skills.defense >= 75 &&
this.skills.dexterity >= 75 &&
this.skills.agility >= 75 &&
this.karma <= -18
) {
invitedFactions.push(tetradsFac);
@@ -1221,10 +1239,10 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!slumsnakesFac.isBanned &&
!slumsnakesFac.isMember &&
!slumsnakesFac.alreadyInvited &&
this.strength >= 30 &&
this.defense >= 30 &&
this.dexterity >= 30 &&
this.agility >= 30 &&
this.skills.strength >= 30 &&
this.skills.defense >= 30 &&
this.skills.dexterity >= 30 &&
this.skills.agility >= 30 &&
this.karma <= -9 &&
this.money >= 1000000
) {
@@ -1255,7 +1273,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!netburnersFac.isBanned &&
!netburnersFac.isMember &&
!netburnersFac.alreadyInvited &&
this.hacking >= 80 &&
this.skills.hacking >= 80 &&
totalHacknetRam >= 8 &&
totalHacknetCores >= 4 &&
totalHacknetLevels >= 100
@@ -1270,7 +1288,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
!tiandihuiFac.isMember &&
!tiandihuiFac.alreadyInvited &&
this.money >= 1000000 &&
this.hacking >= 50 &&
this.skills.hacking >= 50 &&
(this.city == CityName.Chongqing || this.city == CityName.NewTokyo || this.city == CityName.Ishima)
) {
invitedFactions.push(tiandihuiFac);
@@ -1418,7 +1436,7 @@ export function giveAchievement(this: IPlayer, achievementId: string): void {
}
export function getIntelligenceBonus(this: IPlayer, weight: number): number {
return calculateIntelligenceBonus(this.intelligence, weight);
return calculateIntelligenceBonus(this.skills.intelligence, weight);
}
export function getCasinoWinnings(this: IPlayer): number {
+9
View File
@@ -0,0 +1,9 @@
export interface Skills {
hacking: number;
strength: number;
defense: number;
dexterity: number;
agility: number;
charisma: number;
intelligence: number;
}
+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 }}>
+13 -8
View File
@@ -14,7 +14,7 @@ function mult(f: Faction): number {
export function getHackingWorkRepGain(p: IPlayer, f: Faction): number {
return (
((p.hacking + p.intelligence / 3) / CONSTANTS.MaxSkillLevel) *
((p.skills.hacking + p.skills.intelligence / 3) / CONSTANTS.MaxSkillLevel) *
p.mults.faction_rep *
p.getIntelligenceBonus(1) *
mult(f) *
@@ -24,7 +24,12 @@ export function getHackingWorkRepGain(p: IPlayer, f: Faction): number {
export function getFactionSecurityWorkRepGain(p: IPlayer, f: Faction): number {
const t =
(0.9 * (p.strength + p.defense + p.dexterity + p.agility + (p.hacking + p.intelligence) * CalculateShareMult())) /
(0.9 *
(p.skills.strength +
p.skills.defense +
p.skills.dexterity +
p.skills.agility +
(p.skills.hacking + p.skills.intelligence) * CalculateShareMult())) /
CONSTANTS.MaxSkillLevel /
4.5;
return t * p.mults.faction_rep * mult(f) * p.getIntelligenceBonus(1);
@@ -33,12 +38,12 @@ export function getFactionSecurityWorkRepGain(p: IPlayer, f: Faction): number {
export function getFactionFieldWorkRepGain(p: IPlayer, f: Faction): number {
const t =
(0.9 *
(p.strength +
p.defense +
p.dexterity +
p.agility +
p.charisma +
(p.hacking + p.intelligence) * CalculateShareMult())) /
(p.skills.strength +
p.skills.defense +
p.skills.dexterity +
p.skills.agility +
p.skills.charisma +
(p.skills.hacking + p.skills.intelligence) * CalculateShareMult())) /
CONSTANTS.MaxSkillLevel /
5.5;
return t * p.mults.faction_rep * mult(f) * p.getIntelligenceBonus(1);