Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ability] Implement ability illusion #2217

Closed
wants to merge 202 commits into from

Conversation

PyGaVS
Copy link
Contributor

@PyGaVS PyGaVS commented Jun 14, 2024

What are the changes?

Adding illusion

Why am I doing these changes?

Make ability illusion works so we can play Zoroark and make fusion with illusion

What did change?

Added PreSummonAbAttr class as ability attribute.
A pokemon with illusion create an illusion from the last pokemon of the trainer's party.
If we encounter a wild Zoroark he will use the illusion of Entei, Suicune or Raiku like in the original game. We can change that in the method generateIllusion() in src/field/pokemon.ts.
The class pokemon has a new attribute illusion.
A shiny Zoroark will create a shiny illusion.
A non shiny Zoroark will create a non-shiny illusion.
This doesn't affect the luck of course, it's just visual.
A pokemon with illusion can use illusion one time per battle like in the original game.
After a battle, the pokemon can use illusion again.
The AI move choice will be affected by the illusion.

Screenshots/Videos

https://discord.com/channels/1125469663833370665/1176874654015684739/1251234015760089159
https://discord.com/channels/1125469663833370665/1176874654015684739/1251234045204103238
https://discord.com/channels/1125469663833370665/1176874654015684739/1251234047104127039

How to test the changes?

I played Zoroark and override the enemy pokemon with Zoroark so we can see him using illusion of Raikou Suicune Entei
I used illusion on a fusion and with a fusion
I tried to switch with the illusion

Checklist

  • There is no overlap with another PR?
  • The PR is self-contained and cannot be split into smaller PRs?
  • Have I provided a clear explanation of the changes?
  • Have I tested the changes (manually)?
    • Are all unit tests still passing? (npm run test)
  • Are the changes visual?
    • Have I provided screenshots/videos of the changes?

@PyGaVS PyGaVS changed the title Implement ability illusion [Ability] Implement ability illusion Jun 14, 2024
@Tempo-anon Tempo-anon added the Ability Affects an ability label Jun 14, 2024
src/data/ability.ts Outdated Show resolved Hide resolved
src/data/ability.ts Outdated Show resolved Hide resolved
src/data/ability.ts Show resolved Hide resolved
src/data/ability.ts Outdated Show resolved Hide resolved
src/data/ability.ts Show resolved Hide resolved
src/field/pokemon.ts Outdated Show resolved Hide resolved
src/field/pokemon.ts Outdated Show resolved Hide resolved
src/field/pokemon.ts Outdated Show resolved Hide resolved
src/field/pokemon.ts Outdated Show resolved Hide resolved
src/field/pokemon.ts Outdated Show resolved Hide resolved
@DayKev
Copy link
Collaborator

DayKev commented Jun 15, 2024

Loading the starter selection screen, backing out, and then reentering it will cause a crash. I did have a save file in slot 1 with Zorua and another pokemon from earlier testing, in case that is required to recreate the crash (though I suspect it isn't relevant).

TypeError: Cannot read properties of undefined (reading 'speciesId')
    at GameData.getSpeciesDefaultDexAttr (game-data.ts:1553:43)
    at StarterSelectUiHandler.setCursor (starter-select-ui-handler.ts:1725:50)
    at StarterSelectUiHandler.setGenMode (starter-select-ui-handler.ts:1767:12)
    at StarterSelectUiHandler.show (starter-select-ui-handler.ts:790:12)
    at doSetMode (ui.ts:450:29)
    at TimerEvent2.callback (ui.ts:459:13)
    at Clock2.update (phaser.js?v=e3bbe718:131238:42)
    at EventEmitter2.emit (phaser.js?v=e3bbe718:134:43)
    at Systems2.step (phaser.js?v=e3bbe718:111665:28)
    at SceneManager2.update (phaser.js?v=e3bbe718:109823:29)

@DayKev
Copy link
Collaborator

DayKev commented Jun 15, 2024

cf https://bulbapedia.bulbagarden.net/wiki/Illusion_(Ability)

A (mostly?) exhaustive list of things that could be tested, from the Bulbapedia page.

  • Illusion uses the appearance of the last conscious Pokémon in the party (ignoring itself), including:
    • Species
    • Form
      • Zorua currently only uses the base form of the disguise target and not its actual form
    • Shininess
      • Zorua currently uses its own shininess to determine the disguise shininess when it should be looking at the disguise target's shininess
    • Nickname (N/A)
    • Pokeball
      • Currently only a normal Pokeball is used
    • Gender
      • Currently Zorua's gender is used instead of the disguise target's
  • Attract will use the Pokémon's actual gender
    • Will probably require re-testing once the gender copying is fixed
  • The type will always be displayed as the Pokémon it is disguised as, even when affected by Soak etc
    • Currently Soak (and probably other type changing moves) change the displayed Type
  • The illusion will disappear if:
    • The Pokémon has its ability changed
      • Did not test
    • The Pokémon has its ability suppressed (ie: Neutralizing Gas)
      • Currently NG does not disable the disguise
    • The Pokémon takes damage from a damaging move
  • Indirect damage will not break the illusion:
    • Life Orb (not yet implemented)
    • Weather (such as Sandstorm)
    • Status conditions
    • Recoil
  • The illusion will break after the first hit of a multi-hit move
  • Using a Z-Move will break the illusion before the move executes (Z-Moves not yet implemented)
  • Role Play will fail if the target is a Pokémon with Illusion
  • Skill Swap will fail if either Pokémon has Illusion
  • Illusion cannot be copied by:
    • Trace
    • Power of Alchemy
    • Receiver
  • If copied via Imposter or Transform, it will not activate
    • However, the opponent's type will not be updated on the UI until the next turn (but that might be an unrelated bug in Transform/Imposter)
  • Pokémon cannot transform into a Pokémon that is disguised by Illusion
    • Currently Pokémon can transform into a disguised Zorua
  • Pokémon that are disguised by Illusion cannot Transform
    • Currently Pokémon disguised with Illusion can still Transform
  • Wild Zoroark will be disguised as other wild Pokémon from the area
    • Already commented on in above PR comments
  • If the disguised Pokémon is currently disguised as Ogerpon, terastallization will break the disguise
    • Did not test
  • Illusion will not activate if the last conscious Pokémon is a Terastallized Ogerpon or Terapagos
    • Did not test

f-fsantos and others added 9 commits June 19, 2024 17:31
feat: Add link to Discord in menu UI

feat: Add Discord and Google login functionality

Add container around discord and google icons

refactor: Update environment variable names for Discord and Google client IDs

feat: Add "Or use" translation for login options in multiple languages

feat: Update menu UI translations for multiple languages

Code review fixes

refactor: Update Discord and Google client IDs in environment variables
Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com>
this also reduces output noise in tests
@PyGaVS
Copy link
Contributor Author

PyGaVS commented Jul 3, 2024

I've done a lot of updates for the illusion :

-Illusion uses the appearance of the last conscious Pokémon in the party (ignoring itself), including :
Species, Form, Shininess, Pokeball, Gender
-The type will always be displayed as the Pokémon it is disguised as, even when affected by Soak etc
-The illusion will disappear if the Pokemon has its ability changed
-Pokemon cannot transform into a Pokémon that is disguised by Illusion
-Pokémon that are disguised by Illusion cannot Transform
-Wild Zoroark will be disguised as other wild Pokémon from the area. Depending on Zorua or Zoroark level the illusion will be evolved or not.
-Illusion will not activate if the last conscious Pokémon is a Terastallized Ogerpon or Terapagos.

https://discord.com/channels/1125469663833370665/1176874654015684739/1257835032647831682
https://discord.com/channels/1125469663833370665/1176874654015684739/1257864381937619045
https://discord.com/channels/1125469663833370665/1176874654015684739/1257865512801538059

I've done a lot of test to see most of the possibility with illusion. And illusion is working well for me. If you find any bug, please tell me how we can create the bug so i can correct the bug for the futur merge.

@DayKev
Copy link
Collaborator

DayKev commented Jul 3, 2024

Testing the stuff from my previous post that wasn't in at that time:

  • Illusion uses the appearance of the last conscious Pokémon in the party (ignoring itself), including:
    • Form
    • Shininess
    • Pokeball
    • Gender
  • Attract will use the Pokémon's actual gender
  • The type will always be displayed as the Pokémon it is disguised as, even when affected by Soak etc
  • The illusion will disappear if:
    • The Pokémon has its ability changed
    • The Pokémon has its ability suppressed (ie: Neutralizing Gas)
      • NG still does not disable the disguise
  • Pokémon cannot transform into a Pokémon that is disguised by Illusion
  • Pokémon that are disguised by Illusion cannot Transform
  • Wild Zoroark will be disguised as other wild Pokémon from the area
    • Seems to be working, but one of the times it disguised as a Sableye on wave 1 in the Town biome and that Pokémon shouldn't normally spawn in that biome afaict

Seems like everything except ability suppression is working (excluding interactions with un-implemented stuff which I won't worry about now).

@PyGaVS
Copy link
Contributor Author

PyGaVS commented Jul 4, 2024

Now the pokemon can't do Illusion under neutralizing gas :
https://discord.com/channels/1125469663833370665/1176874654015684739/1258418548074745958

Madmadness65 and others added 18 commits July 22, 2024 13:55
Fixed the broken sprites in the item atlas, and fixed the Baton Pass achievement to use the Baton item now (it was broken by the Leek being renamed). Also resized the Baton item image to 32*32, like all the other items.
…s header

The removeCookie function was updated to use the Max-Age=-1 attribute instead of setting the Expires header to a past date. This change ensures that the cookie is immediately expired when removed, preventing any potential login loops. Additionally, a legacy cookie without a domain was added to handle older cookies. This commit resolves the unnecessary cookie setting in the removeCookie function.
…from party (pagefaultgames#1983)

* Initial commits with logic to remove starters if they're in your party. Still need to make it work so that the starter selection cursor disappears when a starter is unselected

* Updated code to be able to remove pokemon, including the side icons and cursor locations

* Fixed popstarter to work with any index

* Updating code to allow navigation of starter icons

* Updating code to allow navigation of party starter icons

* Updaing navigation of party icons

* Updated logic to fix incorrect icon in top left of pokemon options when navigating the starter icons

* Updated logic to include the ability to navigate and interact with the starter icons

* Forgot to push the actual starter-select-ui-handler. Might be a bit hard to test things out without that :)

* Removed some unnecessary comments

* Fixed small bug with not being able to move from the far right to the gen selection when the starter icons were empty

* Updated code to not be using a method to generate the party menu and made it more like it used to be. This should help with merge conflicts in the future

* I committed the merged version but forgot to make the starter-select-ui-handler staged after making the changes

* Accidentally broke challenges that had a specific typing requirement with last commit. This should fix it

* Changed how navigation worked based on popular demand

* Fixed code review comments

* Accidentally left in a whole block of commented code. Intentionally removing it now

* Started adding logic for mono type challenge runs to not break the game if the user tries to start a run with an invalid party

* Updated the text to say the party is invalid

* Updated logic to make invalid pokemon greyed out when no valid pokemon are in your party

* Added comments on some code

* Updated locales to include the key for trying to start with invalid parties during a challenge

* Fixed some code from a bad merge where a challenge related param that was previously a number now needed to be a boolean and wasn't

* Removed comment as per review
* Prevent Pokemon with their second ability from evolving into their HA

* Add check for fusions too
* Localization(pt): Updated move.ts and fixed King's Shield

* more fixes
* [Sprite] Mega Latis using opposite eyes

Taken from counterpart Lati

* [Sprite] Update Mega Latios eyes

* [Sprite] Update Mega Latias eyes

* [Sprite] Mega Latias duplicated palette value

Colour taken from non-exp Mega Latias
…gnet Rise (pagefaultgames#3100)

* Fix Thousand Arrows not hitting through Magnet Rise

* Add integration test for Thousand Arrows vs. Magnet Rise

* ESLint

* Remove unnecessary checks in integration tests
* Hardcoded Pokemon should have proper names

* Aeroblast is a wind move
…ngle override (pagefaultgames#3104)

`SINGLE_BATTLE_OVERRIDE` and `DOUBLE_BATTLE_OVERRIDE` are now `BATTLE_TYPE`

Also updates all uses of the old overrides with the new one
* More TM fixes

* Leaf Storm

* Removed sexy matcha
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did it touch the package-lock.json? this shouldn't happen

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no changes inside

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this noise produced?

@@ -1885,7 +1885,6 @@ export class PostSummonRemoveArenaTagAbAttr extends PostSummonAbAttr {
return true;
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: why remove this new line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not intentional

*/
applyPreSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
let suppressed = false;
pokemon.scene.getField(true).filter(p => p !== pokemon).map(p => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does p => p !== pokemon work in this case? I guess because they are references it does, right?

applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): boolean {

//[HitResult.EFFECTIVE, HitResult.SUPER_EFFECTIVE, HitResult.NOT_VERY_EFFECTIVE, HitResult.ONE_HIT_KO]
if (hitResult > 4) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You ignored @Tempo-anon s improvement request here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ability Affects an ability
Projects
None yet
Development

Successfully merging this pull request may close these issues.