feat: infusing abilities #676

Merged
Sainan merged 2 commits from ability-overrides into main 2025-01-01 23:54:27 -08:00
Showing only changes of commit cb5fc1a338 - Show all commits

View File

@ -43,7 +43,8 @@ export const upgradesController: RequestHandler = async (req, res) => {
const recipe = getRecipeByResult(operation.UpgradeRequirement)!; const recipe = getRecipeByResult(operation.UpgradeRequirement)!;
for (const ingredient of recipe.ingredients) { for (const ingredient of recipe.ingredients) {
inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == ingredient.ItemType)!.Count -= ingredient.ItemCount; inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == ingredient.ItemType)!.Count -=
ingredient.ItemCount;
} }
} }
@ -51,7 +52,8 @@ export const upgradesController: RequestHandler = async (req, res) => {
suit.Configs[entry.Slot] ??= {}; suit.Configs[entry.Slot] ??= {};
suit.Configs[entry.Slot].AbilityOverride = newAbilityOverride; suit.Configs[entry.Slot].AbilityOverride = newAbilityOverride;
} }
} else switch (operation.UpgradeRequirement) { } else
switch (operation.UpgradeRequirement) {
case "/Lotus/Types/Items/MiscItems/OrokinReactor": case "/Lotus/Types/Items/MiscItems/OrokinReactor":
case "/Lotus/Types/Items/MiscItems/OrokinCatalyst": case "/Lotus/Types/Items/MiscItems/OrokinCatalyst":
for (const item of inventory[payload.ItemCategory]) { for (const item of inventory[payload.ItemCategory]) {
coderabbitai[bot] commented 2024-12-30 18:21:40 -08:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion

Check for potential absent suit or mismatched category.

console.assert() will not throw errors in production mode by default. If suit is not found or payload.ItemCategory !== "Suits", the code might continue in an unexpected state without raising an error. Consider throwing an exception or returning early when these conditions fail.

_:hammer_and_wrench: Refactor suggestion_ **Check for potential absent `suit` or mismatched category.** `console.assert()` will not throw errors in production mode by default. If `suit` is not found or `payload.ItemCategory !== "Suits"`, the code might continue in an unexpected state without raising an error. Consider throwing an exception or returning early when these conditions fail. <!-- This is an auto-generated comment by CodeRabbit -->