Compare commits

...

10 Commits

Author SHA1 Message Date
podar 3f5f48df12
Merge 1f77955fb0 into 206419c9f1 2024-12-31 03:12:24 -08:00
NightKev 206419c9f1
Merge pull request #5061 from pagefaultgames/main
Merge main (1.4.2) into beta
2024-12-31 02:38:07 -08:00
NightKev 14902cdb60
[Hotfix] Prevent Keldeo from changing forms in Daily Run (#5060)
* [Hotfix] Prevent Keldeo from changing forms in Daily Run

* Update patch version
2024-12-30 20:20:23 -08:00
NightKev 1f77955fb0
Merge branch 'beta' into keyboard-key-repeat-fix 2024-11-29 14:44:14 -08:00
flx-sta dfe28b2752
Merge branch 'beta' into keyboard-key-repeat-fix 2024-10-22 09:50:55 -07:00
NightKev 8ca9c6a3f8
Merge branch 'beta' into keyboard-key-repeat-fix 2024-10-13 21:57:46 -07:00
podar 1eb062c802
Merge branch 'beta' into keyboard-key-repeat-fix 2024-09-26 13:36:17 -05:00
podar c060ba6e1e
Merge branch 'beta' into keyboard-key-repeat-fix 2024-09-23 03:26:58 -05:00
flx-sta 98e95caebc
Merge branch 'beta' into keyboard-key-repeat-fix 2024-09-16 11:07:44 -07:00
podar 2114c9737f [Bug] Fixing keyboard input repeating indefinitely when meta key is held. 2024-09-16 00:18:27 -05:00
6 changed files with 17 additions and 8 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "pokemon-rogue-battle",
"version": "1.4.1",
"version": "1.4.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pokemon-rogue-battle",
"version": "1.4.1",
"version": "1.4.2",
"hasInstallScript": true,
"dependencies": {
"@material/material-color-utilities": "^0.2.7",

View File

@ -1,7 +1,7 @@
{
"name": "pokemon-rogue-battle",
"private": true,
"version": "1.4.1",
"version": "1.4.2",
"type": "module",
"scripts": {
"start": "vite",

View File

@ -770,8 +770,8 @@ export const pokemonFormChanges: PokemonFormChanges = {
new SpeciesFormChange(Species.KYUREM, "", "white", new SpeciesFormChangeItemTrigger(FormChangeItem.LIGHT_STONE), false, getSpeciesDependentFormChangeCondition(Species.RESHIRAM))
],
[Species.KELDEO]: [
new SpeciesFormChange(Species.KELDEO, "ordinary", "resolute", new SpeciesFormChangeMoveLearnedTrigger(Moves.SECRET_SWORD)),
new SpeciesFormChange(Species.KELDEO, "resolute", "ordinary", new SpeciesFormChangeMoveLearnedTrigger(Moves.SECRET_SWORD, false))
new SpeciesFormChange(Species.KELDEO, "ordinary", "resolute", new SpeciesFormChangeMoveLearnedTrigger(Moves.SECRET_SWORD), false, new SpeciesFormChangeCondition((p) => p.scene.gameMode.isDaily !== true)),
new SpeciesFormChange(Species.KELDEO, "resolute", "ordinary", new SpeciesFormChangeMoveLearnedTrigger(Moves.SECRET_SWORD, false), false, new SpeciesFormChangeCondition((p) => p.scene.gameMode.isDaily !== true))
],
[Species.MELOETTA]: [
new SpeciesFormChange(Species.MELOETTA, "aria", "pirouette", new MeloettaFormChangePostMoveTrigger(Moves.RELIC_SONG), true),

View File

@ -349,12 +349,16 @@ export class InputsController {
* Handles the keydown event for the keyboard.
*
* @param event The keyboard event.
*
* @remarks On Mac the keyup event for a pressed key is not fired if the meta key is held down. To
* insure that that key is not repeatedly input until the user presses it again only emit events
* when the meta key is not held.
*/
keyboardKeyDown(event): void {
this.lastSource = "keyboard";
this.ensureKeyboardIsInit();
const buttonDown = getButtonWithKeycode(this.getActiveConfig(Device.KEYBOARD), event.keyCode);
if (buttonDown !== undefined) {
if (buttonDown !== undefined && !event.metaKey) {
if (this.buttonLock.includes(buttonDown)) {
return;
}

View File

@ -52,6 +52,11 @@ describe("Inputs", () => {
expect(game.inputsHandler.log.length).toBe(5);
});
it("keyboard - test input holding meta key - 0 input", async() => {
await game.inputsHandler.pressKeyboardKey(cfg_keyboard_qwerty.deviceMapping.KEY_ARROW_UP, 1, true);
expect(game.inputsHandler.log.length).toBe(0);
});
it("keyboard - test input holding for 200ms - 1 input", async() => {
await game.inputsHandler.pressKeyboardKey(cfg_keyboard_qwerty.deviceMapping.KEY_ARROW_UP, 200);
expect(game.inputsHandler.log.length).toBe(1);

View File

@ -48,9 +48,9 @@ export default class InputsHandler {
});
}
pressKeyboardKey(key: integer, duration: integer): Promise<void> {
pressKeyboardKey(key: integer, duration: integer, isMetaPressed: boolean = false): Promise<void> {
return new Promise(async (resolve) => {
this.scene.input.keyboard?.emit("keydown", { keyCode: key });
this.scene.input.keyboard?.emit("keydown", { keyCode: key, metaKey: isMetaPressed });
await holdOn(duration);
this.scene.input.keyboard?.emit("keyup", { keyCode: key });
resolve();