Merge branch 'super-fang-multi-lens' of https://github.com/Bertie690/pokerogue into super-fang-multi-lens

This commit is contained in:
Bertie690 2024-11-18 21:36:04 -05:00
commit 6605ffc2aa
7 changed files with 105 additions and 52 deletions

View File

@ -1,37 +1,76 @@
<!-- Make sure the title includes categorization (i.e. [Bug], [QoL], [Localization]) --> <!-- (Once you have read these comments, you are free to remove them) -->
<!-- Make sure that this PR is not overlapping with someone else's work --> <!-- Feel free to look at other PRs for examples -->
<!-- Please try to keep the PR self-contained (and small) --> <!--
Make sure the title includes categorization (choose the one that best fits):
- [Bug]: If the PR is primarily a bug fix
- [Move]: If a move has new or changed functionality
- [Ability]: If an ability has new or changed functionality
- [Item]: For new or modified items
- [Mystery]: For new or modified Mystery Encounters
- [Test]: If the PR is primarily adding or modifying tests
- [UI/UX]: If the PR is changing UI/UX elements
- [Audio]: If the PR is adding or changing music/sfx
- [Sprite]: If the PR is adding or changing sprites
- [Balance]: If the PR is related to game balance
- [Challenge]: If the PR is adding or modifying challenges
- [Refactor]: If the PR is primarily rewriting existing code
- [Docs]: If the PR is just adding or modifying documentation (such as tsdocs/code comments)
- [GitHub]: For changes to GitHub workflows/templates/etc
- [Misc]: If no other category fits the PR
-->
<!--
Make sure that this PR is not overlapping with someone else's work
Please try to keep the PR self-contained (and small)
-->
## What are the changes the user will see? ## What are the changes the user will see?
<!-- Summarize what are the changes from a user perspective on the application --> <!-- Summarize what are the changes from a user perspective on the application -->
## Why am I making these changes? ## Why am I making these changes?
<!-- Explain why you decided to introduce these changes --> <!--
<!-- Does it come from an issue or another PR? Please link it --> Explain why you decided to introduce these changes
<!-- Explain why you believe this can enhance user experience --> Does it come from an issue or another PR? Please link it
Explain why you believe this can enhance user experience
-->
<!--
If there are existing GitHub issues related to the PR that would be fixed,
you can add "Fixes #[issue number]" (ie: "Fixes #1234") to link an issue to your PR
so that it will automatically be closed when the PR is merged.
-->
## What are the changes from a developer perspective? ## What are the changes from a developer perspective?
<!-- Explicitly state what are the changes introduced by the PR --> <!--
<!-- You can make use of a comparison between what was the state before and after your PR changes --> Explicitly state what are the changes introduced by the PR
You can make use of a comparison between what was the state before and after your PR changes
Ex: What files have been changed? What classes/functions/variables/etc have been added or changed?
-->
### Screenshots/Videos ## Screenshots/Videos
<!-- If your change is changing anything on the user experience, please provide visual proofs of it --> <!--
<!-- Please take screenshots/videos before and after your changes, to show what is brought by this PR --> If your changes are changing anything on the user experience, please provide visual proofs of it
Please take screenshots/videos before and after your changes, to show what is brought by this PR
-->
## How to test the changes? ## How to test the changes?
<!-- How can a reviewer test your changes once they check out on your branch? --> <!--
<!-- Did you just make use of the `src/overrides.ts` file? --> How can a reviewer test your changes once they check out on your branch?
<!-- Did you introduce any automated tests? --> Did you make use of the `src/overrides.ts` file?
<!-- Do the reviewer need to do something special in order to test your change? --> Did you introduce any automated tests?
Do the reviewers need to do something special in order to test your changes?
-->
## Checklist ## Checklist
- [ ] **I'm using `beta` as my base branch** - [ ] **I'm using `beta` as my base branch**
- [ ] There is no overlap with another PR? - [ ] There is no overlap with another PR?
- [ ] The PR is self-contained and cannot be split into smaller PRs? - [ ] The PR is self-contained and cannot be split into smaller PRs?
- [ ] Have I provided a clear explanation of the changes? - [ ] Have I provided a clear explanation of the changes?
- [ ] Have I considered writing automated tests for the issue? - [ ] Have I tested the changes manually?
- [ ] If I have text, did I make it translatable and add a key in the English locale file(s)?
- [ ] Have I tested the changes (manually)?
- [ ] Are all unit tests still passing? (`npm run test`) - [ ] Are all unit tests still passing? (`npm run test`)
- [ ] Are the changes visual? - [ ] Have I created new automated tests (`npm run create-test`) or updated existing tests related to the PR's changes?
- [ ] Have I provided screenshots/videos of the changes? - [ ] Have I provided screenshots/videos of the changes (if applicable)?
- [ ] Have I made sure that any UI change works for both UI themes (default and legacy)?
Are there any localization additions or changes? If so:
- [ ] Has a locales PR been created on the [locales](https://github.com/pagefaultgames/pokerogue-locales) repo?
- [ ] If so, please leave a link to it here:
- [ ] Has the translation team been contacted for proofreading/translation?

4
package-lock.json generated
View File

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

View File

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

View File

@ -6091,11 +6091,9 @@ export function initAbilities() {
new Ability(Abilities.NEUROFORCE, 7) new Ability(Abilities.NEUROFORCE, 7)
.attr(MovePowerBoostAbAttr, (user, target, move) => (target?.getMoveEffectiveness(user!, move) ?? 1) >= 2, 1.25), .attr(MovePowerBoostAbAttr, (user, target, move) => (target?.getMoveEffectiveness(user!, move) ?? 1) >= 2, 1.25),
new Ability(Abilities.INTREPID_SWORD, 8) new Ability(Abilities.INTREPID_SWORD, 8)
.attr(PostSummonStatStageChangeAbAttr, [ Stat.ATK ], 1, true) .attr(PostSummonStatStageChangeAbAttr, [ Stat.ATK ], 1, true),
.condition(getOncePerBattleCondition(Abilities.INTREPID_SWORD)),
new Ability(Abilities.DAUNTLESS_SHIELD, 8) new Ability(Abilities.DAUNTLESS_SHIELD, 8)
.attr(PostSummonStatStageChangeAbAttr, [ Stat.DEF ], 1, true) .attr(PostSummonStatStageChangeAbAttr, [ Stat.DEF ], 1, true),
.condition(getOncePerBattleCondition(Abilities.DAUNTLESS_SHIELD)),
new Ability(Abilities.LIBERO, 8) new Ability(Abilities.LIBERO, 8)
.attr(PokemonTypeChangeAbAttr), .attr(PokemonTypeChangeAbAttr),
//.condition((p) => !p.summonData?.abilitiesApplied.includes(Abilities.LIBERO)), //Gen 9 Implementation //.condition((p) => !p.summonData?.abilitiesApplied.includes(Abilities.LIBERO)), //Gen 9 Implementation

View File

@ -17,38 +17,43 @@ export const EGG_SEED = 1073741824;
/** Egg options to override egg properties */ /** Egg options to override egg properties */
export interface IEggOptions { export interface IEggOptions {
/** Id. Used to check if egg type will be manaphy (id % 204 === 0) */ /** ID. Used to check if egg type will be manaphy (`id % 204 === 0`) */
id?: number; id?: number;
/** Timestamp when this egg got created */ /** Timestamp when this egg got created */
timestamp?: number; timestamp?: number;
/** Defines if the egg got pulled from a gacha or not. If true, egg pity and pull statistics will be applyed. /**
* Defines if the egg got pulled from a gacha or not. If true, egg pity and pull statistics will be applyed.
* Egg will be automaticly added to the game data. * Egg will be automaticly added to the game data.
* NEEDS scene eggOption to work. * NEEDS `scene` `eggOption` to work.
*/ */
pulled?: boolean; pulled?: boolean;
/** Defines where the egg comes from. Applies specific modifiers. /**
* Defines where the egg comes from. Applies specific modifiers.
* Will also define the text displayed in the egg list. * Will also define the text displayed in the egg list.
*/ */
sourceType?: EggSourceType; sourceType?: EggSourceType;
/** Needs to be defined if eggOption pulled is defined or if no species or isShiny is degined since this will be needed to generate them. */ /** Needs to be defined if `eggOption` pulled is defined or if no species or `isShiny` is defined since this will be needed to generate them. */
scene?: BattleScene; scene?: BattleScene;
/** Sets the tier of the egg. Only species of this tier can be hatched from this egg. /**
* Tier will be overriden if species eggOption is set. * Sets the tier of the egg. Only species of this tier can be hatched from this egg.
* Tier will be overriden if species `eggOption` is set.
*/ */
tier?: EggTier; tier?: EggTier;
/** Sets how many waves it will take till this egg hatches. */ /** Sets how many waves it will take till this egg hatches. */
hatchWaves?: number; hatchWaves?: number;
/** Sets the exact species that will hatch from this egg. /**
* Needs scene eggOption if not provided. * Sets the exact species that will hatch from this egg.
* Needs `scene` `eggOption` if not provided.
*/ */
species?: Species; species?: Species;
/** Defines if the hatched pokemon will be a shiny. */ /** Defines if the hatched pokemon will be a shiny. */
isShiny?: boolean; isShiny?: boolean;
/** Defines the variant of the pokemon that will hatch from this egg. If no variantTier is given the normal variant rates will apply. */ /** Defines the variant of the pokemon that will hatch from this egg. If no `variantTier` is given the normal variant rates will apply. */
variantTier?: VariantTier; variantTier?: VariantTier;
/** Defines which egg move will be unlocked. 3 = rare egg move. */ /** Defines which egg move will be unlocked. `3` = rare egg move. */
eggMoveIndex?: number; eggMoveIndex?: number;
/** Defines if the egg will hatch with the hidden ability of this species. /**
* Defines if the egg will hatch with the hidden ability of this species.
* If no hidden ability exist, a random one will get choosen. * If no hidden ability exist, a random one will get choosen.
*/ */
overrideHiddenAbility?: boolean, overrideHiddenAbility?: boolean,
@ -418,7 +423,7 @@ export class Egg {
} }
/** /**
* Pokemon that are cheaper in their tier get a weight boost. Regionals get a weight penalty * Pokemon that are cheaper in their tier get a weight boost.
* 1 cost mons get 2x * 1 cost mons get 2x
* 2 cost mons get 1.5x * 2 cost mons get 1.5x
* 4, 6, 8 cost mons get 1.75x * 4, 6, 8 cost mons get 1.75x
@ -433,11 +438,7 @@ export class Egg {
for (const speciesId of speciesPool) { for (const speciesId of speciesPool) {
// Accounts for species that have starter costs outside of the normal range for their EggTier // Accounts for species that have starter costs outside of the normal range for their EggTier
const speciesCostClamped = Phaser.Math.Clamp(speciesStarterCosts[speciesId], minStarterValue, maxStarterValue); const speciesCostClamped = Phaser.Math.Clamp(speciesStarterCosts[speciesId], minStarterValue, maxStarterValue);
let weight = Math.floor((((maxStarterValue - speciesCostClamped) / ((maxStarterValue - minStarterValue) + 1)) * 1.5 + 1) * 100); const weight = Math.floor((((maxStarterValue - speciesCostClamped) / ((maxStarterValue - minStarterValue) + 1)) * 1.5 + 1) * 100);
const species = getPokemonSpecies(speciesId);
if (species.isRegional()) {
weight = Math.floor(weight / 2);
}
speciesWeights.push(totalWeight + weight); speciesWeights.push(totalWeight + weight);
totalWeight += weight; totalWeight += weight;
} }

View File

@ -3267,11 +3267,14 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
return null; return null;
} }
getMoveHistory(): TurnMove[] { public getMoveHistory(): TurnMove[] {
return this.battleSummonData.moveHistory; return this.battleSummonData.moveHistory;
} }
pushMoveHistory(turnMove: TurnMove) { public pushMoveHistory(turnMove: TurnMove): void {
if (!this.isOnField()) {
return;
}
turnMove.turn = this.scene.currentBattle?.turn; turnMove.turn = this.scene.currentBattle?.turn;
this.getMoveHistory().push(turnMove); this.getMoveHistory().push(turnMove);
} }

View File

@ -92,8 +92,20 @@ export class MoveEffectPhase extends PokemonPhase {
const isDelayedAttack = this.move.getMove().hasAttr(DelayedAttackAttr); const isDelayedAttack = this.move.getMove().hasAttr(DelayedAttackAttr);
/** If the user was somehow removed from the field and it's not a delayed attack, end this phase */ /** If the user was somehow removed from the field and it's not a delayed attack, end this phase */
if (!user.isOnField() && !isDelayedAttack) { if (!user.isOnField()) {
if (!isDelayedAttack) {
return super.end(); return super.end();
} else {
if (!user.scene) {
/**
* This happens if the Pokemon that used the delayed attack gets caught and released
* on the turn the attack would have triggered. Having access to the global scene
* in the future may solve this entirely, so for now we just cancel the hit
*/
return super.end();
}
user.resetTurnData();
}
} }
/** /**
@ -174,7 +186,7 @@ export class MoveEffectPhase extends PokemonPhase {
const playOnEmptyField = this.scene.currentBattle?.mysteryEncounter?.hasBattleAnimationsWithoutTargets ?? false; const playOnEmptyField = this.scene.currentBattle?.mysteryEncounter?.hasBattleAnimationsWithoutTargets ?? false;
// Move animation only needs one target // Move animation only needs one target
new MoveAnim(move.id as Moves, user, this.getFirstTarget()!.getBattlerIndex()!, playOnEmptyField).play(this.scene, move.hitsSubstitute(user, this.getFirstTarget()!), () => { new MoveAnim(move.id as Moves, user, this.getFirstTarget()!.getBattlerIndex(), playOnEmptyField).play(this.scene, move.hitsSubstitute(user, this.getFirstTarget()!), () => {
/** Has the move successfully hit a target (for damage) yet? */ /** Has the move successfully hit a target (for damage) yet? */
let hasHit: boolean = false; let hasHit: boolean = false;
for (const target of targets) { for (const target of targets) {