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

[Move] Make invalid move lists ReadonlySets and update their contents #874

Merged
merged 3 commits into from
Mar 27, 2025

Conversation

DayKev
Copy link
Contributor

@DayKev DayKev commented Mar 25, 2025

What are the changes the user will see?

More potential moves used by Metronome

  • Apple acid
  • Armor cannon
  • Astral barrage
  • Aura wheel
  • Behemoth bash
  • Behemoth blade
  • Blazing Torque
  • Body press
  • Branch poke
  • Breaking swipe
  • Chatter
  • Chilling water
  • Chilly reception
  • Clangorous soul
  • Collision Course
  • Combat torque
  • Covet
  • Diamond storm
  • Doodle
  • Double iron bash
  • Double shock
  • Dragon ascent
  • Dragon energy
  • Drum beating
  • Dynamax cannon
  • Electro drift
  • Eternabeam
  • False surrender
  • Fiery wrath
  • Fillet away
  • Fleur cannon
  • Freeze shock
  • Freezing glare
  • Glacial lance
  • Grav apple
  • Hyper drill
  • Hyperspace fury
  • Hyperspace hole
  • Ice burn
  • Jet punch
  • Jungle healing
  • Life dew
  • Light of ruin
  • Make it rain
  • Magical torque
  • Meteor assault
  • Mind blown
  • Moongeist beam
  • Nature power
  • Natures madness
  • Noxious torque
  • Origin pulse
  • Overdrive
  • Photon geyser
  • Plasma fists
  • Population bomb
  • Pounce
  • Power shift
  • Precipice blades
  • Pyro ball
  • Rage fist
  • Raging bull
  • Raging fury
  • Relic song
  • Ruination
  • Salt cure
  • Secret sword
  • Shed tail
  • Snap trap
  • Snarl
  • Snowscape
  • Spectral thief
  • Spicy extract
  • Spirit break
  • Steam eruption
  • Steel beam
  • Strange steam
  • Sunsteel strike
  • Surging strikes
  • Techno blast
  • Tera starstorm
  • Theif
  • Thousand arrows
  • Thousand waves
  • Thunder cage
  • Thunderous kick
  • Tidy up
  • Trailblaze
  • Twin beam
  • V create
  • Wicked blow
  • Wicked torque

More potential moves used by mirror move

  • Aromatherapy
  • Aurora veil
  • Blazing torque
  • Combat torque
  • Dynamax cannon
  • Happy hour
  • Heal bell
  • Howl
  • Jungle healing
  • Life dew
  • Light screen
  • Lucky chant
  • Lunar blessing
  • Magical torque
  • Nature power
  • Noxious torque
  • Reflect
  • Safeguard
  • Spikes
  • Stealth rock
  • Sticky web
  • Tailwind
  • Toxic spikes

Why am I making these changes?

Change to ReadonlySets from arrays: These lists should not be modified at runtime.
Change to list contents: More fun.

What are the changes from a developer perspective?

  • CallMoveAttr.invalidMoves is now ReadonlySet<MoveId> instead of MoveId[].
  • Same for invalidCopyCatMoves, invalidMetronomeMoves, invalidMirrorMoves, invalidAssistMoves and invalidSleepTalkMoves.
  • Many moves were removed from invalidMetronomeMoves and some from invalidMirrorMoves because we're not Gamefreak.

Checklist

  • Otherwise: I'm using beta as my base branch
  • 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?

Sorry, something went wrong.

@DayKev DayKev added Move For move implementations/interactions Balance Tweaking specific gameplay elements Refactor For refactoring code labels Mar 25, 2025
@DayKev
Copy link
Contributor Author

DayKev commented Mar 25, 2025

Btw it's best to view the changes with "Hide Whitespace" https://github.com/Despair-Games/poketernity/pull/874/files?diff=unified&w=1

torranx
torranx previously approved these changes Mar 25, 2025
@Tempo-anon
Copy link
Contributor

Is there a list of which moves are now allowed in the PR desc? Also there should probably be a comment above the invalid move lists that explain there's a custom implementation to allow certain moves.;

@Tempo-anon Tempo-anon closed this Mar 25, 2025
@Tempo-anon Tempo-anon reopened this Mar 25, 2025
@DayKev DayKev force-pushed the misc/metronome-callables branch from c0e1587 to 3c4cedb Compare March 25, 2025 23:56
PigeonBar
PigeonBar previously approved these changes Mar 26, 2025
Copy link
Contributor

@PigeonBar PigeonBar left a comment

Choose a reason for hiding this comment

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

I just tested it, and unfortunately, freezing a set doesn't seem to work (e.g., calling this.invalidMoves.delete(moveId) still deletes the move). This PR will still be useful for providing type checks, though.

@DayKev DayKev force-pushed the misc/metronome-callables branch from 3c4cedb to 4e44930 Compare March 26, 2025 04:20
@DayKev
Copy link
Contributor Author

DayKev commented Mar 26, 2025

I just tested it, and unfortunately, freezing a set doesn't seem to work (e.g., calling this.invalidMoves.delete(moveId) still deletes the move). This PR will still be useful for providing type checks, though.

Hm, maybe I have to call Object.freeze on the variable after it's been assigned to. Lemme see.

@DayKev
Copy link
Contributor Author

DayKev commented Mar 26, 2025

No that didn't work either, wtf?

The Object.freeze() static method freezes an object. Freezing an object prevents extensions and makes existing properties non-writable and non-configurable. A frozen object can no longer be changed: new properties cannot be added, existing properties cannot be removed, their enumerability, configurability, writability, or value cannot be changed, and the object's prototype cannot be re-assigned. freeze() returns the same object that was passed in.

Freezing an object is the highest integrity level that JavaScript provides.

@DayKev
Copy link
Contributor Author

DayKev commented Mar 26, 2025

Well I tried a bunch of stuff and wasn't able to make it work like I wanted, oh well... there should still technically be a performance benefit (even if it's very negligible lol) and leaving it doesn't break anything.

@DayKev
Copy link
Contributor Author

DayKev commented Mar 26, 2025

Is there a list of which moves are now allowed in the PR desc? Also there should probably be a comment above the invalid move lists that explain there's a custom implementation to allow certain moves.;

@Tempo-anon Well you can just look in the files changed tab and see the list right there so I didn't put one in the PR description (you may need to disable "whitespace changes" via the link I provided above or by checking this checkbox):
image

@Tempo-anon
Copy link
Contributor

I updated the PR desc to include the full changes. There should still be a comment near the sets (maybe linking to this PR) to indicate that they are custom sets with extra moves allowed

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@DayKev DayKev dismissed stale reviews from PigeonBar and torranx via 7fdfcf1 March 27, 2025 04:03
@DayKev DayKev merged commit 8ba589f into beta Mar 27, 2025
8 checks passed
@DayKev DayKev deleted the misc/metronome-callables branch March 27, 2025 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Balance Tweaking specific gameplay elements Move For move implementations/interactions Refactor For refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants