mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 16:32:16 +02:00
Merge branch 'beta' into biome
This commit is contained in:
commit
273f27de28
@ -1,40 +1,34 @@
|
|||||||
# ESLint
|
# Biome
|
||||||
|
|
||||||
## Key Features
|
## Key Features
|
||||||
|
|
||||||
1. **Automation**:
|
1. **Automation**:
|
||||||
- A pre-commit hook has been added to automatically run ESLint on the added or modified files, ensuring code quality before commits.
|
- A pre-commit hook has been added to automatically run Biome on the added or modified files, ensuring code quality before commits.
|
||||||
|
|
||||||
2. **Manual Usage**:
|
2. **Manual Usage**:
|
||||||
- If you prefer not to use the pre-commit hook, you can manually run ESLint to automatically fix issues using the command:
|
- If you prefer not to use the pre-commit hook, you can manually run biome to automatically fix issues using the command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npx eslint --fix . or npm run eslint
|
npx @biomejs/biome --write
|
||||||
```
|
```
|
||||||
|
|
||||||
- Running this command will lint all files in the repository.
|
- Running this command will lint all files in the repository.
|
||||||
|
|
||||||
3. **GitHub Action**:
|
3. **GitHub Action**:
|
||||||
- A GitHub Action has been added to automatically run ESLint on every push and pull request, ensuring code quality in the CI/CD pipeline.
|
- A GitHub Action has been added to automatically run Biome on every push and pull request, ensuring code quality in the CI/CD pipeline.
|
||||||
|
|
||||||
## Summary of ESLint Rules
|
If you are getting linting errors from biome and want to see which files they are coming from, you can find that out by running biome in a way that is configured to only show the errors for that specific rule: ``npx @biomejs/biome lint --only=category/ruleName``
|
||||||
|
|
||||||
1. **General Rules**:
|
## Summary of Biome Rules
|
||||||
- **Equality**: Use `===` and `!==` instead of `==` and `!=` (`eqeqeq`).
|
|
||||||
- **Indentation**: Enforce 2-space indentation (`indent`).
|
|
||||||
- **Quotes**: Use doublequotes for strings (`quotes`).
|
|
||||||
- **Variable Declarations**:
|
|
||||||
- Disallow `var`; use `let` or `const` (`no-var`).
|
|
||||||
- Prefer `const` for variables that are never reassigned (`prefer-const`).
|
|
||||||
- **Unused Variables**: Allow unused function parameters but enforce error for other unused variables (`@typescript-eslint/no-unused-vars`).
|
|
||||||
- **End of Line**: Ensure at least one newline at the end of files (`eol-last`).
|
|
||||||
- **Curly Braces**: Enforce the use of curly braces for all control statements (`curly`).
|
|
||||||
- **Brace Style**: Use one true brace style (`1tbs`) for TypeScript-specific syntax (`@typescript-eslint/brace-style`).
|
|
||||||
|
|
||||||
2. **TypeScript-Specific Rules**:
|
We use the [recommended ruleset](https://biomejs.dev/linter/rules/) for Biome, with some customizations to better suit our project's needs.
|
||||||
- **Semicolons**:
|
|
||||||
- Enforce semicolons for TypeScript-specific syntax (`@typescript-eslint/semi`).
|
|
||||||
- Disallow unnecessary semicolons (`@typescript-eslint/no-extra-semi`).
|
|
||||||
|
|
||||||
## Benefits
|
For a complete list of rules and their configurations, refer to the `biome.jsonc` file in the project root.
|
||||||
|
|
||||||
- **Consistency**: Ensures consistent coding style across the project.
|
Some things to consider:
|
||||||
- **Code Quality**: Helps catch potential errors and improve overall code quality.
|
|
||||||
- **Readability**: Makes the codebase easier to read and maintain.
|
- We have disabled rules that prioritize style over performance, such as `useTemplate`
|
||||||
|
- Some rules are currently marked as warnings (`warn`) to allow for gradual refactoring without blocking development. Do not write new code that triggers these warnings.
|
||||||
|
- The linter is configured to ignore specific files and folders, such as large or complex files that are pending refactors, to improve performance and focus on actionable areas.
|
||||||
|
|
||||||
|
Formatting is also handled by Biome. You should not have to worry about manually formatting your code.
|
||||||
|
@ -516,6 +516,34 @@
|
|||||||
"trimmed": true,
|
"trimmed": true,
|
||||||
"spriteSourceSize": { "x": 0, "y": 0, "w": 28, "h": 11 },
|
"spriteSourceSize": { "x": 0, "y": 0, "w": 28, "h": 11 },
|
||||||
"sourceSize": { "w": 28, "h": 11 }
|
"sourceSize": { "w": 28, "h": 11 }
|
||||||
|
},
|
||||||
|
"BACK_SLASH.png": {
|
||||||
|
"frame": { "x": 147, "y": 66, "w": 12, "h": 11 },
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": true,
|
||||||
|
"spriteSourceSize": { "x": 0, "y": 0, "w": 12, "h": 11 },
|
||||||
|
"sourceSize": { "w": 12, "h": 11 }
|
||||||
|
},
|
||||||
|
"FORWARD_SLASH.png": {
|
||||||
|
"frame": { "x": 144, "y": 55, "w": 12, "h": 11 },
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": true,
|
||||||
|
"spriteSourceSize": { "x": 0, "y": 0, "w": 12, "h": 11 },
|
||||||
|
"sourceSize": { "w": 12, "h": 11 }
|
||||||
|
},
|
||||||
|
"COMMA.png": {
|
||||||
|
"frame": { "x": 144, "y": 44, "w": 12, "h": 11 },
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": true,
|
||||||
|
"spriteSourceSize": { "x": 0, "y": 0, "w": 12, "h": 11 },
|
||||||
|
"sourceSize": { "w": 12, "h": 11 }
|
||||||
|
},
|
||||||
|
"PERIOD.png": {
|
||||||
|
"frame": { "x": 143, "y": 22, "w": 11, "h": 11 },
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": true,
|
||||||
|
"spriteSourceSize": { "x": 0, "y": 0, "w": 11, "h": 11 },
|
||||||
|
"sourceSize": { "w": 11, "h": 11 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.6 KiB |
@ -31,6 +31,7 @@ const cfg_keyboard_qwerty = {
|
|||||||
KEY_X: Phaser.Input.Keyboard.KeyCodes.X,
|
KEY_X: Phaser.Input.Keyboard.KeyCodes.X,
|
||||||
KEY_Y: Phaser.Input.Keyboard.KeyCodes.Y,
|
KEY_Y: Phaser.Input.Keyboard.KeyCodes.Y,
|
||||||
KEY_Z: Phaser.Input.Keyboard.KeyCodes.Z,
|
KEY_Z: Phaser.Input.Keyboard.KeyCodes.Z,
|
||||||
|
|
||||||
KEY_0: Phaser.Input.Keyboard.KeyCodes.ZERO,
|
KEY_0: Phaser.Input.Keyboard.KeyCodes.ZERO,
|
||||||
KEY_1: Phaser.Input.Keyboard.KeyCodes.ONE,
|
KEY_1: Phaser.Input.Keyboard.KeyCodes.ONE,
|
||||||
KEY_2: Phaser.Input.Keyboard.KeyCodes.TWO,
|
KEY_2: Phaser.Input.Keyboard.KeyCodes.TWO,
|
||||||
@ -41,11 +42,7 @@ const cfg_keyboard_qwerty = {
|
|||||||
KEY_7: Phaser.Input.Keyboard.KeyCodes.SEVEN,
|
KEY_7: Phaser.Input.Keyboard.KeyCodes.SEVEN,
|
||||||
KEY_8: Phaser.Input.Keyboard.KeyCodes.EIGHT,
|
KEY_8: Phaser.Input.Keyboard.KeyCodes.EIGHT,
|
||||||
KEY_9: Phaser.Input.Keyboard.KeyCodes.NINE,
|
KEY_9: Phaser.Input.Keyboard.KeyCodes.NINE,
|
||||||
KEY_CTRL: Phaser.Input.Keyboard.KeyCodes.CTRL,
|
|
||||||
KEY_DEL: Phaser.Input.Keyboard.KeyCodes.DELETE,
|
|
||||||
KEY_END: Phaser.Input.Keyboard.KeyCodes.END,
|
|
||||||
KEY_ENTER: Phaser.Input.Keyboard.KeyCodes.ENTER,
|
|
||||||
KEY_ESC: Phaser.Input.Keyboard.KeyCodes.ESC,
|
|
||||||
KEY_F1: Phaser.Input.Keyboard.KeyCodes.F1,
|
KEY_F1: Phaser.Input.Keyboard.KeyCodes.F1,
|
||||||
KEY_F2: Phaser.Input.Keyboard.KeyCodes.F2,
|
KEY_F2: Phaser.Input.Keyboard.KeyCodes.F2,
|
||||||
KEY_F3: Phaser.Input.Keyboard.KeyCodes.F3,
|
KEY_F3: Phaser.Input.Keyboard.KeyCodes.F3,
|
||||||
@ -58,24 +55,41 @@ const cfg_keyboard_qwerty = {
|
|||||||
KEY_F10: Phaser.Input.Keyboard.KeyCodes.F10,
|
KEY_F10: Phaser.Input.Keyboard.KeyCodes.F10,
|
||||||
KEY_F11: Phaser.Input.Keyboard.KeyCodes.F11,
|
KEY_F11: Phaser.Input.Keyboard.KeyCodes.F11,
|
||||||
KEY_F12: Phaser.Input.Keyboard.KeyCodes.F12,
|
KEY_F12: Phaser.Input.Keyboard.KeyCodes.F12,
|
||||||
KEY_HOME: Phaser.Input.Keyboard.KeyCodes.HOME,
|
|
||||||
KEY_INSERT: Phaser.Input.Keyboard.KeyCodes.INSERT,
|
|
||||||
KEY_PAGE_DOWN: Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN,
|
KEY_PAGE_DOWN: Phaser.Input.Keyboard.KeyCodes.PAGE_DOWN,
|
||||||
KEY_PAGE_UP: Phaser.Input.Keyboard.KeyCodes.PAGE_UP,
|
KEY_PAGE_UP: Phaser.Input.Keyboard.KeyCodes.PAGE_UP,
|
||||||
|
|
||||||
|
KEY_CTRL: Phaser.Input.Keyboard.KeyCodes.CTRL,
|
||||||
|
KEY_DEL: Phaser.Input.Keyboard.KeyCodes.DELETE,
|
||||||
|
KEY_END: Phaser.Input.Keyboard.KeyCodes.END,
|
||||||
|
KEY_ENTER: Phaser.Input.Keyboard.KeyCodes.ENTER,
|
||||||
|
KEY_ESC: Phaser.Input.Keyboard.KeyCodes.ESC,
|
||||||
|
KEY_HOME: Phaser.Input.Keyboard.KeyCodes.HOME,
|
||||||
|
KEY_INSERT: Phaser.Input.Keyboard.KeyCodes.INSERT,
|
||||||
|
|
||||||
KEY_PLUS: Phaser.Input.Keyboard.KeyCodes.NUMPAD_ADD, // Assuming numpad plus
|
KEY_PLUS: Phaser.Input.Keyboard.KeyCodes.NUMPAD_ADD, // Assuming numpad plus
|
||||||
KEY_MINUS: Phaser.Input.Keyboard.KeyCodes.NUMPAD_SUBTRACT, // Assuming numpad minus
|
KEY_MINUS: Phaser.Input.Keyboard.KeyCodes.NUMPAD_SUBTRACT, // Assuming numpad minus
|
||||||
KEY_QUOTATION: Phaser.Input.Keyboard.KeyCodes.QUOTES,
|
KEY_QUOTATION: Phaser.Input.Keyboard.KeyCodes.QUOTES,
|
||||||
KEY_SHIFT: Phaser.Input.Keyboard.KeyCodes.SHIFT,
|
KEY_SHIFT: Phaser.Input.Keyboard.KeyCodes.SHIFT,
|
||||||
|
|
||||||
KEY_SPACE: Phaser.Input.Keyboard.KeyCodes.SPACE,
|
KEY_SPACE: Phaser.Input.Keyboard.KeyCodes.SPACE,
|
||||||
KEY_TAB: Phaser.Input.Keyboard.KeyCodes.TAB,
|
KEY_TAB: Phaser.Input.Keyboard.KeyCodes.TAB,
|
||||||
KEY_TILDE: Phaser.Input.Keyboard.KeyCodes.BACKTICK,
|
KEY_TILDE: Phaser.Input.Keyboard.KeyCodes.BACKTICK,
|
||||||
|
|
||||||
KEY_ARROW_UP: Phaser.Input.Keyboard.KeyCodes.UP,
|
KEY_ARROW_UP: Phaser.Input.Keyboard.KeyCodes.UP,
|
||||||
KEY_ARROW_DOWN: Phaser.Input.Keyboard.KeyCodes.DOWN,
|
KEY_ARROW_DOWN: Phaser.Input.Keyboard.KeyCodes.DOWN,
|
||||||
KEY_ARROW_LEFT: Phaser.Input.Keyboard.KeyCodes.LEFT,
|
KEY_ARROW_LEFT: Phaser.Input.Keyboard.KeyCodes.LEFT,
|
||||||
KEY_ARROW_RIGHT: Phaser.Input.Keyboard.KeyCodes.RIGHT,
|
KEY_ARROW_RIGHT: Phaser.Input.Keyboard.KeyCodes.RIGHT,
|
||||||
|
|
||||||
KEY_LEFT_BRACKET: Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET,
|
KEY_LEFT_BRACKET: Phaser.Input.Keyboard.KeyCodes.OPEN_BRACKET,
|
||||||
KEY_RIGHT_BRACKET: Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET,
|
KEY_RIGHT_BRACKET: Phaser.Input.Keyboard.KeyCodes.CLOSED_BRACKET,
|
||||||
|
|
||||||
KEY_SEMICOLON: Phaser.Input.Keyboard.KeyCodes.SEMICOLON,
|
KEY_SEMICOLON: Phaser.Input.Keyboard.KeyCodes.SEMICOLON,
|
||||||
|
KEY_COMMA: Phaser.Input.Keyboard.KeyCodes.COMMA,
|
||||||
|
KEY_PERIOD: Phaser.Input.Keyboard.KeyCodes.PERIOD,
|
||||||
|
KEY_BACK_SLASH: Phaser.Input.Keyboard.KeyCodes.BACK_SLASH,
|
||||||
|
KEY_FORWARD_SLASH: Phaser.Input.Keyboard.KeyCodes.FORWARD_SLASH,
|
||||||
|
|
||||||
KEY_BACKSPACE: Phaser.Input.Keyboard.KeyCodes.BACKSPACE,
|
KEY_BACKSPACE: Phaser.Input.Keyboard.KeyCodes.BACKSPACE,
|
||||||
KEY_ALT: Phaser.Input.Keyboard.KeyCodes.ALT,
|
KEY_ALT: Phaser.Input.Keyboard.KeyCodes.ALT,
|
||||||
},
|
},
|
||||||
@ -160,6 +174,10 @@ const cfg_keyboard_qwerty = {
|
|||||||
KEY_RIGHT_BRACKET: "RIGHT_BRACKET.png",
|
KEY_RIGHT_BRACKET: "RIGHT_BRACKET.png",
|
||||||
|
|
||||||
KEY_SEMICOLON: "SEMICOLON.png",
|
KEY_SEMICOLON: "SEMICOLON.png",
|
||||||
|
KEY_COMMA: "COMMA.png",
|
||||||
|
KEY_PERIOD: "PERIOD.png",
|
||||||
|
KEY_BACK_SLASH: "BACK_SLASH.png",
|
||||||
|
KEY_FORWARD_SLASH: "FORWARD_SLASH.png",
|
||||||
|
|
||||||
KEY_BACKSPACE: "BACK.png",
|
KEY_BACKSPACE: "BACK.png",
|
||||||
KEY_ALT: "ALT.png",
|
KEY_ALT: "ALT.png",
|
||||||
|
@ -7665,20 +7665,6 @@ export class AverageStatsAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DiscourageFrequentUseAttr extends MoveAttr {
|
|
||||||
getUserBenefitScore(user: Pokemon, target: Pokemon, move: Move): number {
|
|
||||||
const lastMoves = user.getLastXMoves(4);
|
|
||||||
console.log(lastMoves);
|
|
||||||
for (let m = 0; m < lastMoves.length; m++) {
|
|
||||||
if (lastMoves[m].move === move.id) {
|
|
||||||
return (4 - (m + 1)) * -10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MoneyAttr extends MoveEffectAttr {
|
export class MoneyAttr extends MoveEffectAttr {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(true, {firstHitOnly: true });
|
super(true, {firstHitOnly: true });
|
||||||
@ -10517,8 +10503,7 @@ export function initMoves() {
|
|||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
.attr(DiscourageFrequentUseAttr),
|
|
||||||
|
|
||||||
new AttackMove(Moves.SNIPE_SHOT, PokemonType.WATER, MoveCategory.SPECIAL, 80, 100, 15, -1, 0, 8)
|
new AttackMove(Moves.SNIPE_SHOT, PokemonType.WATER, MoveCategory.SPECIAL, 80, 100, 15, -1, 0, 8)
|
||||||
.attr(HighCritAttr)
|
.attr(HighCritAttr)
|
||||||
|
@ -859,7 +859,7 @@ export class MoveEffectPhase extends PokemonPhase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (isCritical) {
|
if (isCritical) {
|
||||||
globalScene.queueMessage(i18next.t("battle:criticalHit"));
|
globalScene.queueMessage(i18next.t("battle:hitResultCriticalHit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damage <= 0) {
|
if (damage <= 0) {
|
||||||
|
@ -557,11 +557,11 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||||||
this.ownedIcon,
|
this.ownedIcon,
|
||||||
this.championRibbon,
|
this.championRibbon,
|
||||||
this.statusIndicator,
|
this.statusIndicator,
|
||||||
this.levelContainer,
|
|
||||||
this.statValuesContainer,
|
this.statValuesContainer,
|
||||||
].map(e => (e.x += 48 * (boss ? -1 : 1)));
|
].map(e => (e.x += 48 * (boss ? -1 : 1)));
|
||||||
this.hpBar.x += 38 * (boss ? -1 : 1);
|
this.hpBar.x += 38 * (boss ? -1 : 1);
|
||||||
this.hpBar.y += 2 * (this.boss ? -1 : 1);
|
this.hpBar.y += 2 * (this.boss ? -1 : 1);
|
||||||
|
this.levelContainer.x += 2 * (boss ? -1 : 1);
|
||||||
this.hpBar.setTexture(`overlay_hp${boss ? "_boss" : ""}`);
|
this.hpBar.setTexture(`overlay_hp${boss ? "_boss" : ""}`);
|
||||||
this.box.setTexture(this.getTextureName());
|
this.box.setTexture(this.getTextureName());
|
||||||
this.statsBox.setTexture(`${this.getTextureName()}_stats`);
|
this.statsBox.setTexture(`${this.getTextureName()}_stats`);
|
||||||
|
@ -292,6 +292,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
starterSelectBg.setOrigin(0, 0);
|
starterSelectBg.setOrigin(0, 0);
|
||||||
this.starterSelectContainer.add(starterSelectBg);
|
this.starterSelectContainer.add(starterSelectBg);
|
||||||
|
|
||||||
|
this.pokemonSprite = globalScene.add.sprite(53, 63, "pkmn__sub");
|
||||||
|
this.pokemonSprite.setPipeline(globalScene.spritePipeline, {
|
||||||
|
tone: [0.0, 0.0, 0.0, 0.0],
|
||||||
|
ignoreTimeTint: true,
|
||||||
|
});
|
||||||
|
this.starterSelectContainer.add(this.pokemonSprite);
|
||||||
|
|
||||||
this.shinyOverlay = globalScene.add.image(6, 6, "summary_overlay_shiny");
|
this.shinyOverlay = globalScene.add.image(6, 6, "summary_overlay_shiny");
|
||||||
this.shinyOverlay.setOrigin(0, 0);
|
this.shinyOverlay.setOrigin(0, 0);
|
||||||
this.shinyOverlay.setVisible(false);
|
this.shinyOverlay.setVisible(false);
|
||||||
@ -343,13 +350,6 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
|||||||
|
|
||||||
this.starterSelectContainer.add(starterBoxContainer);
|
this.starterSelectContainer.add(starterBoxContainer);
|
||||||
|
|
||||||
this.pokemonSprite = globalScene.add.sprite(53, 63, "pkmn__sub");
|
|
||||||
this.pokemonSprite.setPipeline(globalScene.spritePipeline, {
|
|
||||||
tone: [0.0, 0.0, 0.0, 0.0],
|
|
||||||
ignoreTimeTint: true,
|
|
||||||
});
|
|
||||||
this.starterSelectContainer.add(this.pokemonSprite);
|
|
||||||
|
|
||||||
this.type1Icon = globalScene.add.sprite(8, 98, getLocalizedSpriteKey("types"));
|
this.type1Icon = globalScene.add.sprite(8, 98, getLocalizedSpriteKey("types"));
|
||||||
this.type1Icon.setScale(0.5);
|
this.type1Icon.setScale(0.5);
|
||||||
this.type1Icon.setOrigin(0, 0);
|
this.type1Icon.setOrigin(0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user