Skip to content
This repository was archived by the owner on Aug 6, 2024. It is now read-only.

Moves - #83

Merged
riverpaper merged 13 commits into
Pokemon-PythonRed:masterfrom
nasserkessas:moves
Nov 18, 2022
Merged

riverpaper merged 13 commits into
Pokemon-PythonRed:masterfrom
nasserkessas:moves

Conversation

@nasserkessas

@nasserkessas nasserkessas commented Nov 17, 2022 •

Copy link
Copy Markdown
Contributor

I have implemented basic Pokémon Move functionality into the game including:

  • All level-up moves data from Generation 1 (source: Pokeapi)
  • Move choices in the battle
  • Move learning and forgetting by levelling up
  • PP functionality
  • Missing based on move accuracy
  • Move type colouring
  • Struggle move when Pokémon runs out of PP
  • Updating the damage calculation

I have not added:

  • Tm's and Hm's
  • Effects of Abilities and Natures
  • Pokémon Accuracy stat (accuracy is solely based on move's accuracy)
  • Ability to check moves in the menu
  • Ability to check move data before forgetting
  • Trainer move selection, that is, trainers will select moves randomly without strategy. We will have to fix this in the future.

Note:

  • Some game text I have written is not from the original Pokémon Red as I could not find screenshots for all circumstances
  • Move data is from the latest Generation, that is, if the move has changed (for example the base power) the game will use the newer values. This means MEWTWO for example will learn the move PSYSTRIKE at level 100 which wouldn't have happened in the original Pokémon Red.
  • I have removed Pokémon not in Generation 1 as the method I used to retrieve the move data affected this. I also figured this is a waste of space unless you are planning on introducing trading or something.
  • This also meant I removed the MISSINGNO. Pokémon. I'm not sure why this was there unless you wanted to reproduce the MISSINGNO. OLD MAN glitch 😆

Feel free to ask me to fix anything with this PR (bugs, method etc.) or put any of the old data back as I'll be happy to do so.

Thanks

@sourcery-ai

sourcery-ai Bot commented Nov 17, 2022 •

Copy link
Copy Markdown
Contributor

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 1.79%.

Quality metrics Before After Change
Complexity 159.88 ⛔ 148.54 ⛔ -11.34 👍
Method Length 145.69 😞 158.39 😞 12.70 👎
Working memory 20.76 ⛔ 20.68 ⛔ -0.08 👍
Quality 29.13% 😞 27.34% 😞 -1.79% 👎
Other metrics Before After Change
Lines 701 769 68
Changed files Quality Before Quality After Quality Change
app/main.py 29.13% 😞 27.34% 😞 -1.79% 👎

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
app/main.py Pokemon.level_up 59 ⛔ 403 ⛔ 18 ⛔ 8.71% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
app/main.py Pokemon.deal_damage 33 ⛔ 273 ⛔ 27 ⛔ 13.97% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
app/main.py Pokemon.__init__ 14 🙂 294 ⛔ 15 😞 32.31% 😞 Try splitting into smaller methods. Extract out complex expressions
app/main.py Pokemon.reset_stats 6 ⭐ 338 ⛔ 14 😞 39.60% 😞 Try splitting into smaller methods. Extract out complex expressions
app/main.py catch 13 🙂 211 ⛔ 10 😞 45.23% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@sourcery-ai sourcery-ai Bot mentioned this pull request Nov 17, 2022
@riverpaper

Copy link
Copy Markdown
Member

I did have plans to host giveaways rewarding out-of-region Pokémon, but with you having set up the API connections, I'd rather re-work my plans to fit the new system. Thank you for this!

@nasserkessas

nasserkessas commented Nov 17, 2022 •

Copy link
Copy Markdown
Contributor Author

No, its ok, I can easily add the Pokémon back as I still have the file I used to update dex.json, it's no problem

@riverpaper

Copy link
Copy Markdown
Member

Will the later-gen Pokémon fit the API standard that's already been implemented?

@nasserkessas

nasserkessas commented Nov 17, 2022 •

Copy link
Copy Markdown
Contributor Author

The API has all the Pokémon and moves to date so I just have to update the array I used to iterate and generate the files. The later-gen Pokémon should work just fine with this system. I used the API to generate the files but no connection of any sort is needed to play the game.

@riverpaper

Copy link
Copy Markdown
Member

I understand now. In that case, could you please add them back to the file?

@nasserkessas

Copy link
Copy Markdown
Contributor Author

Yes sure, I'll add the moves for those Pokémon as well then. Would you like me to add MISSINGNO. back as well?

@riverpaper

Copy link
Copy Markdown
Member

Good question... If you can find some in-game stats for it, I'd be happy to include it.

@nasserkessas

Copy link
Copy Markdown
Contributor Author

Ok, I'll have a look and push another commit soon.

@riverpaper

Copy link
Copy Markdown
Member

Much appreciated!

@nasserkessas

Copy link
Copy Markdown
Contributor Author

Just a note: The original MISSINGNO. has the move WATER GUN twice but I'm not too sure if the game will accept this so I made it only have WATER GUN once.

@nasserkessas

nasserkessas commented Nov 17, 2022 •

Copy link
Copy Markdown
Contributor Author

All done. Let me know if you have any other fixes. Hope you accept the PR.

@nasserkessas

Copy link
Copy Markdown
Contributor Author

Another note: The last 7 Pokémon have no moves (Pokedex entries 899-905) and I thought I did something wrong but I checked the API and it actually returned an empty moves array. I'm not sure why this is but I think they might be updating the API at the moment.

@riverpaper

Copy link
Copy Markdown
Member

I've removed a few bugs in the database loading process, next I'll be testing the battle system.

@riverpaper

Copy link
Copy Markdown
Member

It seems to be working well. Thanks again for your contributions.

@riverpaper
riverpaper merged commit 77aed52 into Pokemon-PythonRed:master Nov 18, 2022
@nasserkessas

nasserkessas commented Nov 18, 2022 •

Copy link
Copy Markdown
Contributor Author

Ah, good catch with those bugs, I hadn't noticed them when I tested it, Thanks

@nasserkessas
nasserkessas deleted the moves branch November 18, 2022 09:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants