IPVGO: Add getCheatCount(). (#1734)

This commit is contained in:
ballardrog 2024-10-27 18:52:23 -07:00 committed by GitHub
parent b01527a9dc
commit 0bf378a1b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 55 additions and 7 deletions

@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [GoCheat](./bitburner.gocheat.md) &gt; [getCheatCount](./bitburner.gocheat.getcheatcount.md)
## GoCheat.getCheatCount() method
Returns the number of times you've attempted to cheat in the current game.
**Signature:**
```typescript
getCheatCount(): number;
```
**Returns:**
number
## Remarks
RAM cost: 1 GB Requires BitNode 14.2 to use

@ -4,15 +4,22 @@
## GoCheat.getCheatSuccessChance() method ## GoCheat.getCheatSuccessChance() method
Returns your chance of successfully playing one of the special moves in the ns.go.cheat API. Scales with your crime success rate stat. Returns your chance of successfully playing one of the special moves in the ns.go.cheat API. Scales up with your crime success rate stat. Scales down with the number of times you've attempted to cheat in the current game.
Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet. Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.
**Signature:** **Signature:**
```typescript ```typescript
getCheatSuccessChance(): number; getCheatSuccessChance(cheatCount?: number): number;
``` ```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| cheatCount | number | _(Optional)_ Optional override for the number of cheats already attempted. Defaults to the number of cheats attempted in the current game. |
**Returns:** **Returns:**
number number

@ -17,7 +17,8 @@ export interface GoCheat
| Method | Description | | Method | Description |
| --- | --- | | --- | --- |
| [destroyNode(x, y)](./bitburner.gocheat.destroynode.md) | <p>Attempts to destroy an empty node, leaving an offline dead space that does not count as territory or provide open node access to adjacent routers.</p><p>Success chance can be seen via ns.go.getCheatSuccessChance()</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> | | [destroyNode(x, y)](./bitburner.gocheat.destroynode.md) | <p>Attempts to destroy an empty node, leaving an offline dead space that does not count as territory or provide open node access to adjacent routers.</p><p>Success chance can be seen via ns.go.getCheatSuccessChance()</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> |
| [getCheatSuccessChance()](./bitburner.gocheat.getcheatsuccesschance.md) | <p>Returns your chance of successfully playing one of the special moves in the ns.go.cheat API. Scales with your crime success rate stat.</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> | | [getCheatCount()](./bitburner.gocheat.getcheatcount.md) | Returns the number of times you've attempted to cheat in the current game. |
| [getCheatSuccessChance(cheatCount)](./bitburner.gocheat.getcheatsuccesschance.md) | <p>Returns your chance of successfully playing one of the special moves in the ns.go.cheat API. Scales up with your crime success rate stat. Scales down with the number of times you've attempted to cheat in the current game.</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> |
| [playTwoMoves(x1, y1, x2, y2)](./bitburner.gocheat.playtwomoves.md) | <p>Attempts to place two routers at once on empty nodes. Note that this ignores other move restrictions, so you can suicide your own routers if they have no access to empty ports and do not capture any enemy routers.</p><p>Success chance can be seen via ns.go.getCheatSuccessChance()</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> | | [playTwoMoves(x1, y1, x2, y2)](./bitburner.gocheat.playtwomoves.md) | <p>Attempts to place two routers at once on empty nodes. Note that this ignores other move restrictions, so you can suicide your own routers if they have no access to empty ports and do not capture any enemy routers.</p><p>Success chance can be seen via ns.go.getCheatSuccessChance()</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> |
| [removeRouter(x, y)](./bitburner.gocheat.removerouter.md) | <p>Attempts to remove an existing router, leaving an empty node behind.</p><p>Success chance can be seen via ns.go.getCheatSuccessChance()</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> | | [removeRouter(x, y)](./bitburner.gocheat.removerouter.md) | <p>Attempts to remove an existing router, leaving an empty node behind.</p><p>Success chance can be seen via ns.go.getCheatSuccessChance()</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> |
| [repairOfflineNode(x, y)](./bitburner.gocheat.repairofflinenode.md) | <p>Attempts to repair an offline node, leaving an empty playable node behind.</p><p>Success chance can be seen via ns.go.getCheatSuccessChance()</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> | | [repairOfflineNode(x, y)](./bitburner.gocheat.repairofflinenode.md) | <p>Attempts to repair an offline node, leaving an empty playable node behind.</p><p>Success chance can be seen via ns.go.getCheatSuccessChance()</p><p>Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a small (\~10%) chance you will instantly be ejected from the subnet.</p> |

@ -272,6 +272,7 @@ const go = {
}, },
cheat: { cheat: {
getCheatSuccessChance: 1, getCheatSuccessChance: 1,
getCheatCount: 1,
removeRouter: 8, removeRouter: 8,
playTwoMoves: 8, playTwoMoves: 8,
repairOfflineNode: 8, repairOfflineNode: 8,

@ -100,9 +100,16 @@ export function NetscriptGo(): InternalAPI<NSGo> {
}, },
}, },
cheat: { cheat: {
getCheatSuccessChance: (ctx: NetscriptContext) => () => { getCheatSuccessChance:
(ctx: NetscriptContext) =>
(_cheatCount = Go.currentGame.cheatCount) => {
checkCheatApiAccess(error(ctx));
const cheatCount = helpers.number(ctx, "cheatCount", _cheatCount);
return cheatSuccessChance(cheatCount);
},
getCheatCount: (ctx: NetscriptContext) => () => {
checkCheatApiAccess(error(ctx)); checkCheatApiAccess(error(ctx));
return cheatSuccessChance(Go.currentGame.cheatCount); return Go.currentGame.cheatCount;
}, },
removeRouter: removeRouter:
(ctx: NetscriptContext) => (ctx: NetscriptContext) =>

@ -4399,16 +4399,27 @@ export interface GoAnalysis {
export interface GoCheat { export interface GoCheat {
/** /**
* Returns your chance of successfully playing one of the special moves in the ns.go.cheat API. * Returns your chance of successfully playing one of the special moves in the ns.go.cheat API.
* Scales with your crime success rate stat. * Scales up with your crime success rate stat.
* Scales down with the number of times you've attempted to cheat in the current game.
* *
* Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a * Warning: if you fail to play a cheat move, your turn will be skipped. After your first cheat attempt, if you fail, there is a
* small (~10%) chance you will instantly be ejected from the subnet. * small (~10%) chance you will instantly be ejected from the subnet.
* *
* @param cheatCount - Optional override for the number of cheats already attempted. Defaults to the number of cheats attempted in the current game.
*
* @remarks * @remarks
* RAM cost: 1 GB * RAM cost: 1 GB
* Requires BitNode 14.2 to use * Requires BitNode 14.2 to use
*/ */
getCheatSuccessChance(): number; getCheatSuccessChance(cheatCount?: number): number;
/**
* Returns the number of times you've attempted to cheat in the current game.
*
* @remarks
* RAM cost: 1 GB
* Requires BitNode 14.2 to use
*/
getCheatCount(): number;
/** /**
* Attempts to remove an existing router, leaving an empty node behind. * Attempts to remove an existing router, leaving an empty node behind.
* *