diff --git a/package-lock.json b/package-lock.json index 7f8c54dbe..49fd3e481 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,8 +27,8 @@ "eslint-config-standard-with-typescript": "^43.0.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^27.9.0", - "eslint-plugin-jsdoc": "^48.2.1", - "eslint-plugin-react": "^7.34.0", + "eslint-plugin-jsdoc": "^48.2.3", + "eslint-plugin-react": "^7.34.1", "eslint-plugin-sort-keys-fix": "^1.1.2", "eslint-plugin-unused-imports": "^3.1.0", "fast-xml-parser": "^4.3.5", @@ -45,8 +45,8 @@ "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", - "typescript": "^5.3.3", - "typescript-to-lua": "^1.24.1" + "typescript": "^5.4.2", + "typescript-to-lua": "^1.25.1" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -3484,9 +3484,9 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "48.2.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.2.1.tgz", - "integrity": "sha512-iUvbcyDZSO/9xSuRv2HQBw++8VkV/pt3UWtX9cpPH0l7GKPq78QC/6+PmyQHHvNZaTjAce6QVciEbnc6J/zH5g==", + "version": "48.2.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.2.3.tgz", + "integrity": "sha512-r9DMAmFs66VNvNqRLLjHejdnJtILrt3xGi+Qx0op0oRfFGVpOR1Hb3BC++MacseHx93d8SKYPhyrC9BS7Os2QA==", "dev": true, "dependencies": { "@es-joy/jsdoccomment": "~0.42.0", @@ -3547,9 +3547,9 @@ } }, "node_modules/eslint-plugin-react": { - "version": "7.34.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.34.0.tgz", - "integrity": "sha512-MeVXdReleBTdkz/bvcQMSnCXGi+c9kvy51IpinjnJgutl3YTHWsDdke7Z1ufZpGfDG8xduBDKyjtB9JH1eBKIQ==", + "version": "7.34.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.34.1.tgz", + "integrity": "sha512-N97CxlouPT1AHt8Jn0mhhN2RrADlUAsk1/atcT2KyA/l9Q/E6ll7OIGwNumFmWfZ9skV3XXccYS19h80rHtgkw==", "dev": true, "dependencies": { "array-includes": "^3.1.7", @@ -7988,9 +7988,9 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", + "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -8000,9 +8000,9 @@ } }, "node_modules/typescript-to-lua": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.24.1.tgz", - "integrity": "sha512-IqHKVMkgRk9cd8S8nhu5wKP+AiK9QeCJ9OUphKcNzQMNpEirrQKHvbQwoeVNWNsIaiCUvrdM1SuyxDX1B3TRZw==", + "version": "1.25.1", + "resolved": "https://registry.npmjs.org/typescript-to-lua/-/typescript-to-lua-1.25.1.tgz", + "integrity": "sha512-4wV1VCaxTWtrhsNmSkAt0FWTDccoK9U4qcpVrzMdQvhQYyx629J4ivl3vXEh/Z600DfgnF/GGPTa7i96KVpYIA==", "dependencies": { "@typescript-to-lua/language-extensions": "1.19.0", "enhanced-resolve": "^5.8.2", @@ -8017,7 +8017,7 @@ "node": ">=16.10.0" }, "peerDependencies": { - "typescript": "5.3.3" + "typescript": "5.4.2" } }, "node_modules/typescript-to-lua/node_modules/source-map": { diff --git a/package.json b/package.json index e779e3c53..89af75e1a 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,8 @@ "eslint-config-standard-with-typescript": "^43.0.1", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^27.9.0", - "eslint-plugin-jsdoc": "^48.2.1", - "eslint-plugin-react": "^7.34.0", + "eslint-plugin-jsdoc": "^48.2.3", + "eslint-plugin-react": "^7.34.1", "eslint-plugin-sort-keys-fix": "^1.1.2", "eslint-plugin-unused-imports": "^3.1.0", "fast-xml-parser": "^4.3.5", @@ -55,8 +55,8 @@ "ts-jest": "^29.1.2", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", - "typescript": "^5.3.3", - "typescript-to-lua": "^1.24.1" + "typescript": "^5.4.2", + "typescript-to-lua": "^1.25.1" }, "bin": { "xrf": "./cli/run.ts" diff --git a/src/engine/scripts/declarations/effects/object.test.ts b/src/engine/scripts/declarations/effects/object.test.ts index c0649ff2d..4ad551ee4 100644 --- a/src/engine/scripts/declarations/effects/object.test.ts +++ b/src/engine/scripts/declarations/effects/object.test.ts @@ -1,4 +1,4 @@ -import { beforeAll, beforeEach, describe, expect, it } from "@jest/globals"; +import { beforeAll, beforeEach, describe, expect, it, jest } from "@jest/globals"; import { registerStoryLink } from "@/engine/core/database"; import { misc } from "@/engine/lib/constants/items/misc"; @@ -126,9 +126,27 @@ describe("object effects implementation", () => { it.todo("force_obj should set const force for objects"); - it.todo("burer_force_gravi_attack should force burrer attack"); + it("burer_force_gravi_attack should force burrer attack", () => { + const object: GameObject = MockGameObject.mock(); + + jest.spyOn(object, "burer_set_force_gravi_attack").mockImplementation(jest.fn()); + + callXrEffect("burer_force_gravi_attack", MockGameObject.mockActor(), object); + + expect(object.burer_set_force_gravi_attack).toHaveBeenCalledTimes(1); + expect(object.burer_set_force_gravi_attack).toHaveBeenCalledWith(true); + }); - it.todo("burer_force_anti_aim should force attack reset"); + it("burer_force_anti_aim should force attack reset", () => { + const object: GameObject = MockGameObject.mock(); + + jest.spyOn(object, "set_force_anti_aim").mockImplementation(jest.fn()); + + callXrEffect("burer_force_anti_aim", MockGameObject.mockActor(), object); + + expect(object.set_force_anti_aim).toHaveBeenCalledTimes(1); + expect(object.set_force_anti_aim).toHaveBeenCalledWith(true); + }); it.todo("give_items should give items for object"); @@ -138,13 +156,29 @@ describe("object effects implementation", () => { it.todo("set_force_sleep_animation should force sleep animation"); - it.todo("release_force_sleep_animation should stop forced sleep animation"); + it("release_force_sleep_animation should stop forced sleep animation", () => { + const object: GameObject = MockGameObject.mock(); + + jest.spyOn(object, "release_stand_sleep_animation").mockImplementation(jest.fn()); + + callXrEffect("release_force_sleep_animation", MockGameObject.mockActor(), object); + + expect(object.release_stand_sleep_animation).toHaveBeenCalledTimes(1); + }); it.todo("set_visual_memory_enabled should enable visual memory"); it.todo("set_monster_animation should set animations for monsters"); - it.todo("clear_monster_animation should clear animations for monsters"); + it("clear_monster_animation should clear animations for monsters", () => { + const object: GameObject = MockGameObject.mock(); + + jest.spyOn(object, "clear_override_animation").mockImplementation(jest.fn()); + + callXrEffect("clear_monster_animation", MockGameObject.mockActor(), object); + + expect(object.clear_override_animation).toHaveBeenCalledTimes(1); + }); it.todo("switch_to_desired_job should switch objects to desired jobs"); diff --git a/src/engine/scripts/declarations/effects/object.ts b/src/engine/scripts/declarations/effects/object.ts index fc3447303..cfc080b7c 100644 --- a/src/engine/scripts/declarations/effects/object.ts +++ b/src/engine/scripts/declarations/effects/object.ts @@ -638,14 +638,14 @@ extern( ); /** - * todo; + * Force burer gravity attack as enabled. */ extern("xr_effects.burer_force_gravi_attack", (_: GameObject, object: GameObject): void => { object.burer_set_force_gravi_attack(true); }); /** - * todo; + * Force burer anti aim force. */ extern("xr_effects.burer_force_anti_aim", (_: GameObject, object: GameObject): void => { object.set_force_anti_aim(true); @@ -699,7 +699,7 @@ extern("xr_effects.set_force_sleep_animation", (_: GameObject, object: GameObjec }); /** - * todo; + * Release sleep animation of the object. */ extern("xr_effects.release_force_sleep_animation", (_: GameObject, object: GameObject): void => { object.release_stand_sleep_animation(); @@ -729,7 +729,7 @@ extern( ); /** - * todo; + * Clear animation of monster object. */ extern("xr_effects.clear_monster_animation", (_: GameObject, object: GameObject): void => { object.clear_override_animation(); diff --git a/src/fixtures/xray/mocks/objects/game/game_object.mock.ts b/src/fixtures/xray/mocks/objects/game/game_object.mock.ts index d2fbffc25..47a95c423 100644 --- a/src/fixtures/xray/mocks/objects/game/game_object.mock.ts +++ b/src/fixtures/xray/mocks/objects/game/game_object.mock.ts @@ -227,6 +227,10 @@ export class MockGameObject { public bind_object = jest.fn(); + public burer_set_force_gravi_attack = jest.fn(); + + public set_force_anti_aim = jest.fn(); + public buy_condition = jest.fn(); public buy_supplies = jest.fn(); @@ -239,6 +243,8 @@ export class MockGameObject { public center = jest.fn(() => this.objectCenter); + public clear_override_animation = jest.fn(); + public change_team = jest.fn(); public change_character_reputation = jest.fn(); @@ -487,6 +493,8 @@ export class MockGameObject { public play_cycle = jest.fn(); + public release_stand_sleep_animation = jest.fn(); + public rank = jest.fn(() => this.objectRank); public relation = jest.fn(() => {