Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MISC: Crimes can now be unfocused. #2844

Closed
wants to merge 14 commits into from

Conversation

phyzical
Copy link
Contributor

@phyzical phyzical commented Jan 27, 2022

Feature

Add optional focus to commitCrime via api
Added ability to "do something else" via the ui
converted Work over to a switch from a series of if statements and added support for crime

Testing

manually tested committing a crime, canceling and new do something else + re focus
also tested commitCrime from api with and without focus
also tested calling commitCrime via the api while a crime was initiated via the ui

  • add a 25% penalty when committing a crime unfocused
  • refactored implementation of success rate to take "focus" external of player object to allow api usage/ static ui usage and make sleeves compatible
  • changes the output of getCrimeChance to return a percentage rather than a flat 0 - 1 number
  • moved focus + router logic into the Crime helper for simplier implementation
  • hard coded sleeves to a "focus" true when calculating the success chance as not applicable

Apr-16-2022 15-18-31
Apr-16-2022 15-37-31

* also added ability to "do something else" bia the ui
@phyzical
Copy link
Contributor Author

Also thought i should note, i attempted to handle the focus deeper down but i noticed there are disconnects between the data i.e in CharacterOverview.tsx you never seem to get the final focus = false for some reason, and based on other functions from the api context i.e createProgram they seemed to kind of just overwrite the focusness at the end

@alainbryden
Copy link
Contributor

alainbryden commented Feb 1, 2022

I think this might not be merged on principle, because crimes are supposed to require focus. You aren't supposed to be able to personally do crimes in the background.

Sleeves are an existing mechanic which can be earned / unlocked and which enable the player to gain kills / negative karma without focusing, so it's not like it fills a need that's missing from the game either.

@phyzical
Copy link
Contributor Author

phyzical commented Feb 2, 2022

@alainbryden the same could be said about working for a company or going a gymWorkout or going to a university or creating a program though?

the reason i made the pr is when i am grinding to create a gang the game is a PIA to say "killall" and reboot if your other auto scripts if things go wrong

@phyzical
Copy link
Contributor Author

phyzical commented Feb 2, 2022

Granted i am only at BN4: and have not reeched sleeves so i understand the point of view, but it just feels silly as you still can only be doing one thing.

@alainbryden
Copy link
Contributor

@alainbryden the same could be said about working for a company or going a gymWorkout or going to a university or creating a program though?

the reason i made the pr is when i am grinding to create a gang the game is a PIA to say "killall" and reboot if your other auto scripts if things go wrong

Maybe not the best place for me to be saying this, but note that a good solution to the problem you are having is to call ns.tail() before or after any calls to ns.commitCrime or other focus-stealing functions. This will ensure the tail window for your script is always visible (even if you accidentally closed it) and therefore can be easily killed you're struggling to exit your crime loop.

@phyzical
Copy link
Contributor Author

phyzical commented Feb 3, 2022

@alainbryden perfectly valid workaround, sadly doesn't change the fact this singularity logic is missing this optional focus that the rest seem to have

@alainbryden
Copy link
Contributor

If we are to go ahead with merging this PR, then I propose we first introduce a penalty to un-focused crime when the user does not yet have the augmentation "Neuroreceptor Management Implant" - similar to the penalty when working for factions or companies.

This penalty should have been put in place when the "do something else" option was added to gym/study (which previously required focus), but we missed the boat on that one for now.

@phyzical
Copy link
Contributor Author

we can always do that as part of this tbh, this one hasnt been approved yet so theres every chance it just closed.

But if we do want it im happy to add some penalties to those also

cc @hydroflame

@hydroflame hydroflame changed the title commitCrime focus argument MISC: Crimes can now be unfocused. Apr 14, 2022
@DavidGrinberg
Copy link
Contributor

Suggestion for the penalty: significantly reduced crime success change.

@phyzical
Copy link
Contributor Author

sure! what do we reckon it should be 70% as effective when unfocused?

@alainbryden
Copy link
Contributor

I believe the rep focus penalty is 75% (25% as effective) so we should be consistent with that maybe.

* refactored implementation of success rate to take "focus" external of player object to allow api usage/ static ui usage and make sleeves compatible
* changes the output of getCrimeChance to return a percentage rather than a flat 0 - 1 number
* moved focus + router logic into the Crime helper for simplier implementation
* hard coded sleeves to a "focus" true when calculating the success chance as not applicable
@phyzical
Copy link
Contributor Author

@alainbryden mind giving the changes another looksie, should be ready for review

@@ -1496,13 +1496,14 @@ export function startCrime(
chaExp: number,
money: number,
time: number,
focus: true,
Copy link
Contributor

@Snarling Snarling Apr 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

focus:true in the type definitions of the params for startCrime... focus should be type defined as a boolean.

@Snarling
Copy link
Contributor

Snarling commented Apr 18, 2022

  • 25% reduction in success chance is only a penalty until you can achieve a 125% success chance. To match up with other work tasks, any penalty should be applied to the actual rewards (money, karma, xp). It should also take into account Neuroreceptor Management Implant.
  • Focus doesn't work well with crime because unlike other work tasks, crime is a discrete task. The player can just re-focus moments before the end of the crime and they avoid any penalty, since that's the only time any rewards are given out. Other tasks are continuous and the penalty applies for the entire duration the player is unfocused and nothing more.
  • I'm also not sure why this needs to also include API breaking changes to getCrimeChance (changing it from a fractional chance to a percentage)
  • I personally don't think focus/unfocus should be added to crime.

@phyzical
Copy link
Contributor Author

25% reduction in success chance is only a penalty until you can achieve a 125% success chance. To match up with other work tasks, any penalty should be applied to the actual rewards (money, karma, xp). It should also take into account Neuroreceptor Management Implant.

happy to change

Focus doesn't work well with crime because unlike other work tasks, crime is a discrete task. The player can just re-focus moments before the end of the crime and they avoid any penalty, since that's the only time any rewards are given out. Other tasks are continuous and the penalty applies for the entire duration the player is unfocused and nothing more.

yeah this is correct but i suppose i decided if the player wants to be smart about it so be it reward users for better time management, metawise i look at it this way rob a store and "unfocus" pull out your phone to run more scripts and if you dont focus at the last second the store owner might knock the gun out of your hand reducing the chance of success

I'm also not sure why this needs to also include API breaking changes to getCrimeChance (changing it from a fractional chance to a percentage)

i guess i dont see the point in returning a non % value when the ui displays it as such, users would just be using this value as a > value anyway

I personally don't think focus/unfocus should be added to crime.

fair enough i just added this as spending 16 hours murdering to start a gang was boring AF

feature/optional-crime-focus

File List:
.github/PULL_REQUEST_TEMPLATE
.github/workflows/validate-pr.yml
dist/bitburner.d.ts
dist/main.bundle.js
dist/main.bundle.js.map
dist/vendor.bundle.js
dist/vendor.bundle.js.map
doc/NEW_BN_GUIDELINE.md
doc/POTENTIAL_BN_0.md
doc/POTENTIAL_BN_1.md
doc/POTENTIAL_BN_2.md
doc/source/basicgameplay/codingcontracts.rst
doc/source/guidesandtips/recommendedbitnodeorder.rst
jest.config.js
jest.setup.js
letter_to_fandom.com
markdown/bitburner.bitnodemultipliers.corporationsoftcap.md
markdown/bitburner.bitnodemultipliers.md
markdown/bitburner.codingcontract.attempt.md
markdown/bitburner.codingcontract.getcontracttype.md
markdown/bitburner.codingcontract.getdescription.md
markdown/bitburner.codingcontract.getnumtriesremaining.md
markdown/bitburner.division.makesproducts.md
markdown/bitburner.division.md
markdown/bitburner.employee.cha.md
markdown/bitburner.employee.cre.md
markdown/bitburner.employee.eff.md
markdown/bitburner.employee.ene.md
markdown/bitburner.employee.exp.md
markdown/bitburner.employee.hap.md
markdown/bitburner.employee.int.md
markdown/bitburner.employee.loc.md
markdown/bitburner.employee.md
markdown/bitburner.employee.mor.md
markdown/bitburner.employee.pos.md
markdown/bitburner.employee.sal.md
markdown/bitburner.infiltration.getinfiltration.md
markdown/bitburner.infiltration.getpossiblelocations.md
markdown/bitburner.infiltration.md
markdown/bitburner.infiltrationlocation.difficulty.md
markdown/bitburner.infiltrationlocation.location.md
markdown/bitburner.infiltrationlocation.md
markdown/bitburner.infiltrationlocation.reward.md
markdown/bitburner.infiltrationreward.md
markdown/bitburner.infiltrationreward.sellcash.md
markdown/bitburner.infiltrationreward.soarep.md
markdown/bitburner.infiltrationreward.traderep.md
markdown/bitburner.material.cost.md
markdown/bitburner.material.md
markdown/bitburner.material.scost.md
markdown/bitburner.md
markdown/bitburner.ns.asleep.md
markdown/bitburner.ns.closetail.md
markdown/bitburner.ns.exec.md
markdown/bitburner.ns.getscriptram.md
markdown/bitburner.ns.infiltration.md
markdown/bitburner.ns.killall.md
markdown/bitburner.ns.md
markdown/bitburner.reputationformulas.md
markdown/bitburner.reputationformulas.repfromdonation.md
markdown/bitburner.singularity.b1tflum3.md
markdown/bitburner.singularity.destroyw0r1dd43m0n.md
markdown/bitburner.singularity.getdarkwebprograms.md
markdown/bitburner.singularity.installaugmentations.md
markdown/bitburner.singularity.md
markdown/bitburner.singularity.quitjob.md
markdown/bitburner.sleeve.md
markdown/bitburner.sleeve.settobladeburneraction.md
markdown/bitburner.stanek.acceptgift.md
markdown/bitburner.stanek.md
markdown/bitburner.userinterface.clearterminal.md
markdown/bitburner.userinterface.md
markdown/bitburner.warehouseapi.getupgradewarehousecost.md
markdown/bitburner.warehouseapi.limitmaterialproduction.md
markdown/bitburner.warehouseapi.limitproductproduction.md
markdown/bitburner.warehouseapi.md
markdown/bitburner.warehouseapi.upgradewarehouse.md
package-lock.json
package.json
src/@types/global.d.ts
src/Achievements/AchievementData.json
src/Achievements/Achievements.ts
src/Augmentation/Augmentation.tsx
src/Augmentation/AugmentationHelpers.tsx
src/Augmentation/StaticAugmentations.ts
src/Augmentation/data/AugmentationCreator.tsx
src/Augmentation/data/AugmentationNames.ts
src/Augmentation/ui/AugmentationsRoot.tsx
src/Augmentation/ui/InstalledAugmentations.tsx
src/Augmentation/ui/PlayerMultipliers.tsx
src/Augmentation/ui/PurchasableAugmentations.tsx
src/Augmentation/ui/PurchaseAugmentationModal.tsx
src/Augmentation/ui/PurchasedAugmentations.tsx
src/BitNode/BitNode.tsx
src/BitNode/BitNodeMultipliers.ts
src/BitNode/ui/BitnodeMultipliersDescription.tsx
src/BitNode/ui/BitverseRoot.tsx
src/BitNode/ui/PortalModal.tsx
src/Bladeburner/Action.tsx
src/Bladeburner/Bladeburner.tsx
src/Bladeburner/IAction.tsx
src/Bladeburner/IBladeburner.ts
src/Bladeburner/ui/BlackOpElem.tsx
src/Bladeburner/ui/ContractElem.tsx
src/Bladeburner/ui/OperationElem.tsx
src/Bladeburner/ui/SuccessChance.tsx
src/Casino/Roulette.tsx
src/CodingContractGenerator.ts
src/Constants.ts
src/Corporation/Corporation.tsx
src/Corporation/ui/MaterialElem.tsx
src/Corporation/ui/Overview.tsx
src/Corporation/ui/modals/PurchaseMaterialModal.tsx
src/CotMG/ActiveFragment.ts
src/CotMG/Fragment.ts
src/CotMG/StaneksGift.ts
src/CotMG/formulas/charge.ts
src/CotMG/formulas/effect.ts
src/CotMG/ui/ActiveFragmentSummary.tsx
src/CotMG/ui/FragmentInspector.tsx
src/CotMG/ui/MainBoard.tsx
src/CotMG/ui/StaneksGiftRoot.tsx
src/Crime/Crime.ts
src/Crime/Crimes.ts
src/DevMenu.tsx
src/DevMenu/ui/SaveFile.tsx
src/Electron.tsx
src/Faction/FactionHelpers.tsx
src/Faction/FactionInfo.tsx
src/Faction/data/FactionNames.ts
src/Faction/ui/AugmentationsPage.tsx
src/Faction/ui/FactionRoot.tsx
src/Faction/ui/FactionsRoot.tsx
src/Faction/ui/GangButton.tsx
src/Faction/ui/Info.tsx
src/Faction/ui/PurchaseableAugmentation.tsx
src/GameOptions/GameOptionsTab.ts
src/GameOptions/ui/CurrentOptionsPage.tsx
src/GameOptions/ui/GameOptionsPage.tsx
src/GameOptions/ui/GameOptionsRoot.tsx
src/GameOptions/ui/GameOptionsSidebar.tsx
src/GameOptions/ui/OptionsSlider.tsx
src/Gang/data/Constants.ts
src/Gang/ui/TerritorySubpage.tsx
src/Hacknet/data/HashUpgradesMetadata.tsx
src/Hacknet/ui/HacknetServerElem.tsx
src/Hospital/Hospital.ts
src/Infiltration/formulas/game.ts
src/Infiltration/formulas/victory.ts
src/Infiltration/ui/BackwardGame.tsx
src/Infiltration/ui/BlinkingCursor.tsx
src/Infiltration/ui/BracketGame.tsx
src/Infiltration/ui/BribeGame.tsx
src/Infiltration/ui/CheatCodeGame.tsx
src/Infiltration/ui/Countdown.tsx
src/Infiltration/ui/Cyberpunk2077Game.tsx
src/Infiltration/ui/Game.tsx
src/Infiltration/ui/GameTimer.tsx
src/Infiltration/ui/InfiltrationRoot.tsx
src/Infiltration/ui/Intro.tsx
src/Infiltration/ui/MinesweeperGame.tsx
src/Infiltration/ui/SlashGame.tsx
src/Infiltration/ui/Victory.tsx
src/Infiltration/ui/WireCuttingGame.tsx
src/InteractiveTutorial.ts
src/Locations/LocationsHelpers.tsx
src/Locations/ui/GymLocation.tsx
src/Locations/ui/RamButton.tsx
src/Locations/ui/SpecialLocation.tsx
src/Locations/ui/UniversityLocation.tsx
src/Netscript/APIWrapper.ts
src/Netscript/RamCostGenerator.ts
src/Netscript/WorkerScript.ts
src/NetscriptEvaluator.ts
src/NetscriptFunctions.ts
src/NetscriptFunctions/Bladeburner.ts
src/NetscriptFunctions/CodingContract.ts
src/NetscriptFunctions/Corporation.ts
src/NetscriptFunctions/Extra.ts
src/NetscriptFunctions/Formulas.ts
src/NetscriptFunctions/Gang.ts
src/NetscriptFunctions/Grafting.ts
src/NetscriptFunctions/Hacknet.ts
src/NetscriptFunctions/INetscriptHelper.ts
src/NetscriptFunctions/Infiltration.ts
src/NetscriptFunctions/Singularity.ts
src/NetscriptFunctions/Sleeve.ts
src/NetscriptFunctions/Stanek.ts
src/NetscriptFunctions/StockMarket.ts
src/NetscriptFunctions/UserInterface.ts
src/NetscriptJSEvaluator.ts
src/NetscriptWorker.ts
src/PersonObjects/Grafting/GraftableAugmentation.ts
src/PersonObjects/Grafting/GraftingHelpers.ts
src/PersonObjects/Grafting/ui/GraftingRoot.tsx
src/PersonObjects/IPerson.ts
src/PersonObjects/IPlayer.ts
src/PersonObjects/IPlayerOrSleeve.ts
src/PersonObjects/ITaskTracker.ts
src/PersonObjects/Person.ts
src/PersonObjects/Player/PlayerObject.ts
src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts
src/PersonObjects/Player/PlayerObjectGangMethods.ts
src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx
src/PersonObjects/Player/PlayerObjectServerMethods.ts
src/PersonObjects/Sleeve/Sleeve.ts
src/PersonObjects/Sleeve/SleeveHelpers.ts
src/PersonObjects/Sleeve/SleeveTaskTypesEnum.ts
src/PersonObjects/Sleeve/ui/SleeveAugmentationsModal.tsx
src/PersonObjects/Sleeve/ui/SleeveElem.tsx
src/PersonObjects/Sleeve/ui/TaskSelector.tsx
src/PersonObjects/Sleeve/ui/TravelModal.tsx
src/PersonObjects/formulas/work.ts
src/Prestige.ts
src/Programs/data/ProgramsMetadata.ts
src/SaveObject.tsx
src/Script/RamCalculations.ts
src/ScriptEditor/NetscriptDefinitions.d.ts
src/ScriptEditor/ui/ScriptEditorRoot.tsx
src/Server/data/servers.ts
src/Settings/Settings.ts
src/Sidebar/ui/SidebarRoot.tsx
src/SourceFile/SourceFiles.tsx
src/Terminal/DirectoryHelpers.ts
src/Terminal/Terminal.ts
src/Terminal/commands/cd.ts
src/Terminal/commands/mv.ts
src/Terminal/commands/runScript.ts
src/Terminal/commands/wget.ts
src/Terminal/ui/TerminalInput.tsx
src/Terminal/ui/TerminalRoot.tsx
src/data/codingcontracttypes.ts
src/engine.tsx
src/index.tsx
src/ui/CharacterStats.tsx
src/ui/GameRoot.tsx
src/ui/InteractiveTutorial/InteractiveTutorialRoot.tsx
src/ui/InteractiveTutorial/NSSelection.tsx
src/ui/React/CharacterOverview.tsx
src/ui/React/GameOptionsRoot.tsx
src/ui/React/LogBoxManager.tsx
src/ui/React/Modal.tsx
src/ui/React/Overview.tsx
src/ui/React/Progress.tsx
src/ui/React/StatsRow.tsx
src/ui/WorkInProgressRoot.tsx
src/ui/numeralFormat.ts
src/utils/CompressionContracts.ts
src/utils/StringHelperFunctions.ts
src/utils/WorkType.ts
src/utils/helpers/exceptionAlert.ts
src/utils/helpers/keyCodes.ts
test/cypress/tsconfig.json
test/jest/Netscript/DynamicRamCalculation.test.js
test/jest/Netscript/StaticRamCalculation.test.js
test/jest/Netscript/StaticRamParsingCalculation.test.js
test/jest/Script/Script.test.ts
test/jest/StockMarket.test.ts
test/jest/StringHelperFunctions.test.ts
test/jest/Terminal/Directory.test.js
test/jest/Terminal/determineAllPossibilitiesForTabCompletion.test.ts
test/jest/ui/nFormat.test.js
test/tsconfig.json
tsconfig.json
webpack.config.js
@hydroflame
Copy link
Collaborator

Closed because wont work with new work system (plus implemented there)

@hydroflame hydroflame closed this Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants