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

Gh 894 power ups #899

Merged
merged 17 commits into from
Sep 9, 2024
Merged

Gh 894 power ups #899

merged 17 commits into from
Sep 9, 2024

Conversation

tvillegas98
Copy link
Contributor

@tvillegas98 tvillegas98 commented Sep 4, 2024

Motivation

Redesign the way we acquire power ups through the game.

There's an existing bug where you get extra power up from crates if you hit it with two projectiles that will be fixed in #904

Closes #894

Summary of changes

How to test it?

Test the game in this branch and instead of the crates dropping the power ups to the ground you should see your power up number go up

Checklist

  • Tested the changes locally.
  • Reviewed the changes on GitHub, line by line.
  • This change requires new documentation.
    • Documentation has been added/updated.

@agustinesco agustinesco marked this pull request as ready for review September 9, 2024 15:54
manucamejo
manucamejo previously approved these changes Sep 9, 2024
@manucamejo manucamejo added the R1 First Review label Sep 9, 2024
@Nico-Sanchez Nico-Sanchez added the R2 Second Review label Sep 9, 2024
Comment on lines 1507 to 1509
unless Crate.alive?(crate) do
send(self(), {:crate_destroyed, attacking_player.id, crate.id})
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is done in multiple places. We should isolate this behavior to update every destroyed crate state in a single pass in only one place.

Copy link
Contributor

Choose a reason for hiding this comment

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

I isolated this send behavior inside of the take_damage/3

Nico-Sanchez
Nico-Sanchez previously approved these changes Sep 9, 2024
Nico-Sanchez
Nico-Sanchez previously approved these changes Sep 9, 2024
Entities.take_damage(entity, real_damage)
|> maybe_send_to_killfeed(pool_owner.id)
if Entities.alive?(entity) do
Entities.take_damage(entity, real_damage, pool_owner.id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it makes sense to move Entities.alive?/1 check to be inside of Entities.take_damage/3?

Copy link
Contributor

Choose a reason for hiding this comment

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

it totally does! i just did it

@manucamejo manucamejo merged commit dcab0f6 into main Sep 9, 2024
3 checks passed
@manucamejo manucamejo deleted the gh-894-power-ups branch September 9, 2024 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R1 First Review R2 Second Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] - Power ups should be directly granted to the player
5 participants