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

[BUGFIX] Fixed Super Fang interaction with Multi Lens #4914

Merged
merged 10 commits into from
Nov 30, 2024

Conversation

Bertie690
Copy link
Contributor

@Bertie690 Bertie690 commented Nov 19, 2024

RIP funny math formula, you will be missed.

What are the changes the user will see?

Super Fang and company now deal correct damage with multi lens (ie 50%), split between the appropriate amount of hits linearly.
For an example of how it works: The 1st hit of super fang with 2 lenses does (target.hp/2)*0.5=0.25*hp damage, leaving the enemy down to 75% hp after the first hit. The remaining 2 multi lens hits each get half the difference between the leftover (75%) and the target (50%) amounts, for 12.5% damage each.

Parental Bond works similarly, but it changes the target damage amount to 0.25 instead (the hp% the target would have left after 2 halvings).

Why am I making these changes?

BECAUSE I COULD.

What are the changes from a developer perspective?

Adds a check in TargetHalfHpDamageAttr.apply() for subsequent repeated hits that splits the damage of hits after the first one linearly to make them add up to the desired amount. The first hit is unaffected as the following strikes are intended to adjust for it appropriately.
Also adds a check in pokemon.ts to skip multiplying the move damage for the subsequent hits of such moves because they're already pre computed and I really don't want to deal with reciprocals...

Screenshots/Videos

oh god please no I'm not spending another hour filming these just for someone to tell me to refactor them 12 hours later

How to test the changes?

npm run test multi_lens
Check the last few tests at the end.
Alternately use the following overrides:

const overrides = {
  MOVESET_OVERRIDE: Moves.SUPER_FANG,
  STARTING_LEVEL_OVERRIDE: 1000,
  STARTING_HELD_ITEMS_OVERRIDE: [{ name: "MULTI_LENS", count: 2 }],
  OPP_LEVEL_OVERRIDE: 100,
  OPP_SPECIES_OVERRIDE: Species.BLISSEY,
  OPP_MOVESET_OVERRIDE: Moves.SPLASH,
} satisfies Partial<InstanceType<typeof DefaultOverrides>>;

and start a new game with a Koffing and literally any other starter without PB.

Checklist

  • 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?
  • Have I considered writing automated tests for the issue?
  • 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 the changes visual?
  • Have I provided screenshots/videos of the changes?

@Bertie690 Bertie690 requested a review from a team as a code owner November 19, 2024 01:56
src/field/pokemon.ts Outdated Show resolved Hide resolved
src/test/items/multi_lens.test.ts Outdated Show resolved Hide resolved
src/test/items/multi_lens.test.ts Outdated Show resolved Hide resolved
src/test/items/multi_lens.test.ts Outdated Show resolved Hide resolved
src/test/items/multi_lens.test.ts Outdated Show resolved Hide resolved
src/test/items/multi_lens.test.ts Outdated Show resolved Hide resolved
src/test/items/multi_lens.test.ts Outdated Show resolved Hide resolved
src/test/items/multi_lens.test.ts Outdated Show resolved Hide resolved
@DayKev
Copy link
Collaborator

DayKev commented Nov 19, 2024

Seems fine to me (code-wise), just some style comments.

src/field/pokemon.ts Outdated Show resolved Hide resolved
@innerthunder
Copy link
Contributor

I'm not a fan of hard-coding the fixed damage values like this. We just updated Multi-Lens to reduce its tech debt, and this change feels like we're going backwards on that. Also, the balance team has made comments implying that Multi-Lens' maximum stack count is subject to change, and this change could potentially get in the way of that.

Some options that wouldn't increase tech debt:

  1. We leave the interaction as is. This ultimately makes Multi-Lens a nerf to Super Fang's damage output, but obviously it would be the easiest option for devs.
  2. We revert the changes from [Balance] Multi Lens damage reduction on fixed-damage moves #4896. This would probably make fixed-damage moves too overpowered, but would definitely make the Super Fang interaction more stable.
  3. We restrict Multi-Lens' effect on all fixed-damage moves. I don't think players would enjoy this change, at least in the short term, but this restriction has been in place before, and it wouldn't be difficult to add.
  4. We restrict Multi-Lens' effect on Super Fang, Ruination, and Nature's Madness. This would "fix" the interaction while preserving the interactions of other fixed-damage moves, but it wouldn't be very intuitive to the player (I could see some "bug" reports come from this one)

@DayKev
Copy link
Collaborator

DayKev commented Nov 19, 2024

We restrict Multi-Lens' effect on Super Fang, Ruination, and Nature's Madness. This would "fix" the interaction while preserving the interactions of other fixed-damage moves, but it wouldn't be very intuitive to the player (I could see some "bug" reports come from this one)

This is what I prefer tbh.

We leave the interaction as is. This ultimately makes Multi-Lens a nerf to Super Fang's damage output, but obviously it would be the easiest option for devs.

This would be fine too.

@Tempo-anon Tempo-anon added Item Affects an item P2 Bug Minor. Non crashing Incorrect move/ability/interaction labels Nov 19, 2024
@Tempo-anon
Copy link
Contributor

Appreciate the math and work done on this but will also echo the sentiment that hardcoding it is not the way to go

@Bertie690
Copy link
Contributor Author

Bertie690 commented Nov 19, 2024

Thanks for the feedback everyone.
I do get the message (hardcoding = not future proofed = bad), but at the same time, I do think these hard coded values serve a purpose - as a "stopgap" fix that fixes stuff now and can be cleaned up later.
I can work on a cleaner implementation of this stuff later (likely using some sort of "target" damage tracker like pigeon-bar suggested), but frankly that can be a task for next week's me, not today's me.
(I'm just sharing my opinion FYI - feel free to pick it apart.)

@innerthunder
Copy link
Contributor

Thanks for the feedback everyone. I do get the message (hardcoding = not future proofed = bad), but at the same time, I do think these hard coded values serve a purpose - as a "stopgap" fix that fixes stuff now and can be cleaned up later. I can work on a cleaner implementation of this stuff later (likely using some sort of "target" damage tracker like pigeon-bar suggested), but frankly that can be a task for next week's me, not today's me. (I'm just sharing my opinion FYI - feel free to pick it apart.)

I think when it comes to an open-source project where development is largely based on "best effort," it's generally best to avoid stopgap fixes when possible. The cleanup for "temporary" fixes tends to fall into low priority, so it's likely that a stopgap sticks around until it ends up causing problems itself.

@Bertie690
Copy link
Contributor Author

I'll get started on reworking it then.

pls tell me this isn't too much tech debt now
(also RIP unnecessarily convoluted cube roots, you will be missed)
src/field/pokemon.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@frutescens frutescens left a comment

Choose a reason for hiding this comment

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

Screenshots/Videos

oh god please no I'm not spending another hour filming these just for someone to tell me to refactor them 12 hours later

Approving - however, I do want to emphasize that even though providing screenshots/video proof is annoying and time-consuming, it is important and good practice to do so. The burden of proof is on the PR's creator... so please remember this in the future.

@DayKev DayKev merged commit 5fed690 into pagefaultgames:beta Nov 30, 2024
13 checks passed
@DayKev DayKev added the Move Affects a move label Nov 30, 2024
@Bertie690 Bertie690 deleted the super-fang-multi-lens branch December 21, 2024 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Item Affects an item Move Affects a move P2 Bug Minor. Non crashing Incorrect move/ability/interaction
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants