Skip to content

Commit

Permalink
chore: update deps + refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Zamiell committed Dec 3, 2023
1 parent b039c48 commit 829adb0
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 54 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"cloc": "^1.98.0-cloc",
"isaacscript": "^3.29.0",
"isaacscript-common-node": "^1.4.0",
"isaacscript-lint": "^6.9.1",
"isaacscript-lint": "^6.10.1",
"isaacscript-spell": "^1.11.0",
"isaacscript-tsconfig": "^5.0.0",
"tsx": "^4.6.2",
Expand Down
84 changes: 46 additions & 38 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,29 +146,29 @@ export function getRandomOffsetPosition(
let offsetX: int;
let offsetY: int;
switch (offsetDirection) {
// Bottom right
case 1: {
// Bottom right
offsetX = offsetSize;
offsetY = offsetSize;
break;
}

// Top right
case 2: {
// Top right
offsetX = offsetSize;
offsetY = offsetSize * -1;
break;
}

// Bottom left
case 3: {
// Bottom left
offsetX = offsetSize * -1;
offsetY = offsetSize;
break;
}

// Top left
case 4: {
// Top left
offsetX = offsetSize * -1;
offsetY = offsetSize * -1;
break;
Expand Down Expand Up @@ -394,77 +394,85 @@ export function spawnRandomPickup(
position: Vector,
velocity: Vector = VectorZero,
noItems = false,
): undefined {
): EntityPickup {
// Spawn a random pickup.
const pickupVariantChoice = noItems
? getRandomInt(1, 9, rng) // Exclude trinkets and collectibles.
: getRandomInt(1, 11, rng);

switch (pickupVariantChoice) {
// Random heart.
case 1: {
// Random heart.
spawnHeart(HeartSubType.NULL, position, velocity, undefined, rng);
return undefined;
return spawnHeart(HeartSubType.NULL, position, velocity, undefined, rng);
}

// Random coin.
case 2: {
// Random coin.
spawnCoin(CoinSubType.NULL, position, velocity, undefined, rng);
return undefined;
return spawnCoin(CoinSubType.NULL, position, velocity, undefined, rng);
}

// Random key.
case 3: {
// Random key.
spawnKey(KeySubType.NULL, position, velocity, undefined, rng);
return undefined;
return spawnKey(KeySubType.NULL, position, velocity, undefined, rng);
}

// Random bomb.
case 4: {
// Random bomb.
spawnBombPickup(BombSubType.NULL, position, velocity, undefined, rng);
return undefined;
return spawnBombPickup(
BombSubType.NULL,
position,
velocity,
undefined,
rng,
);
}

// Random chest.
case 5: {
// Random chest.
spawnPickup(PickupVariant.CHEST, 0, position, velocity, undefined, rng);
return undefined;
return spawnPickup(
PickupVariant.CHEST,
0,
position,
velocity,
undefined,
rng,
);
}

// Random sack.
case 6: {
// Random sack.
spawnSack(SackSubType.NULL, position, velocity, undefined, rng);
return undefined;
return spawnSack(SackSubType.NULL, position, velocity, undefined, rng);
}

// Random battery.
case 7: {
// Random battery.
spawnBattery(BatterySubType.NULL, position, velocity, undefined, rng);
return undefined;
return spawnBattery(
BatterySubType.NULL,
position,
velocity,
undefined,
rng,
);
}

// Random pill.
case 8: {
// Random pill.
spawnPill(PillColor.NULL, position, velocity, undefined, rng);
return undefined;
return spawnPill(PillColor.NULL, position, velocity, undefined, rng);
}

// Random card / rune.
case 9: {
// Random card / rune.
spawnCard(CardType.NULL, position, velocity, undefined, rng);
return undefined;
return spawnCard(CardType.NULL, position, velocity, undefined, rng);
}

// Random trinket.
case 10: {
// Random trinket.
spawnTrinket(TrinketType.NULL, position, velocity, undefined, rng);
return undefined;
return spawnTrinket(TrinketType.NULL, position, velocity, undefined, rng);
}

// Random collectible.
case 11: {
// Random collectible.
spawnCollectible(CollectibleType.NULL, position, rng);
return undefined;
return spawnCollectible(CollectibleType.NULL, position, rng);
}

default: {
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ __metadata:
isaacscript: "npm:^3.29.0"
isaacscript-common: "npm:^81.0.5"
isaacscript-common-node: "npm:^1.4.0"
isaacscript-lint: "npm:^6.9.1"
isaacscript-lint: "npm:^6.10.1"
isaacscript-spell: "npm:^1.11.0"
isaacscript-tsconfig: "npm:^5.0.0"
tsx: "npm:^4.6.2"
Expand Down Expand Up @@ -2807,12 +2807,12 @@ __metadata:
languageName: node
linkType: hard

"eslint-config-isaacscript@npm:^4.13.0":
version: 4.13.0
resolution: "eslint-config-isaacscript@npm:4.13.0"
"eslint-config-isaacscript@npm:^4.14.0":
version: 4.14.0
resolution: "eslint-config-isaacscript@npm:4.14.0"
dependencies:
confusing-browser-globals: "npm:^1.0.11"
checksum: d3ea782650d4df3f18d1e973f6109e79c3579e97d2d14660b17e2b14bc072930dae4ba09a679dbf8c31bde61c90c55decd7f94237adec437a6aa2df3b2f13746
checksum: 1bb196414d36ad542a685546044ac9f1c76edd586b97a4eef824040af2e63f17899802d56e1bdc05652c3020c60917a380c1d6e7a47434bda38a915643adf74e
languageName: node
linkType: hard

Expand Down Expand Up @@ -2907,9 +2907,9 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-isaacscript@npm:^3.9.1":
version: 3.9.1
resolution: "eslint-plugin-isaacscript@npm:3.9.1"
"eslint-plugin-isaacscript@npm:^3.10.1":
version: 3.10.1
resolution: "eslint-plugin-isaacscript@npm:3.10.1"
dependencies:
"@typescript-eslint/type-utils": "npm:^6.13.1"
"@typescript-eslint/types": "npm:^6.13.1"
Expand All @@ -2918,7 +2918,7 @@ __metadata:
"@typescript-eslint/parser": ">= 6.0.0"
eslint: ">= 8.0.0"
typescript: ">= 5.0.0"
checksum: ef7e6901a620061c096e6a5c3d12e4eb3a58f34c620eef8edd7adaa993bf9b641670d52d9683c6ef1016c97801ece7033e675c11508b35caadb5c134c0847574
checksum: 14a20fbfc58afc21876bcc49a1305adadae115fb8d382b16c7d4761e83d5cd5324c673c64a4eeb1e2fbcb7e89a3937cbcc4dbb84c141ad94230d7f7ac0c13454
languageName: node
linkType: hard

Expand Down Expand Up @@ -4320,22 +4320,22 @@ __metadata:
languageName: node
linkType: hard

"isaacscript-lint@npm:^6.9.1":
version: 6.9.1
resolution: "isaacscript-lint@npm:6.9.1"
"isaacscript-lint@npm:^6.10.1":
version: 6.10.1
resolution: "isaacscript-lint@npm:6.10.1"
dependencies:
"@prettier/plugin-xml": "npm:^3.2.2"
"@typescript-eslint/eslint-plugin": "npm:^6.13.1"
"@typescript-eslint/parser": "npm:^6.13.1"
cspell: "npm:^8.1.0"
cspell-check-unused-words: "npm:^1.0.11"
eslint: "npm:^8.55.0"
eslint-config-isaacscript: "npm:^4.13.0"
eslint-config-isaacscript: "npm:^4.14.0"
eslint-config-prettier: "npm:^9.1.0"
eslint-plugin-deprecation: "npm:^2.0.0"
eslint-plugin-eslint-comments: "npm:^3.2.0"
eslint-plugin-import: "npm:eslint-plugin-i@latest"
eslint-plugin-isaacscript: "npm:^3.9.1"
eslint-plugin-isaacscript: "npm:^3.10.1"
eslint-plugin-jsdoc: "npm:^46.9.0"
eslint-plugin-n: "npm:^16.3.1"
eslint-plugin-no-autofix: "npm:^1.2.3"
Expand All @@ -4348,7 +4348,7 @@ __metadata:
ts-prune-2: "npm:^0.10.7"
peerDependencies:
typescript: ">= 5.0.0"
checksum: 2c1325f778504e0fd677df512f3d418f995250179b33dbcb51559a3b3c8dd3da78d9a66becac5b576c36b840e73b732e910bd77515a2e9140bf846df21456101
checksum: d1a069e41595c52c9bf9d051de31f37661f887cc2f837a4fc4eeb62f75ca2bee12a9d304b6705ffacfb8a8639c3046ed24cff7ec4b4dd46d8c20a3fe5d8a9004
languageName: node
linkType: hard

Expand Down

0 comments on commit 829adb0

Please sign in to comment.