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

Snowflake singleplayer implementation #57

Open
wants to merge 48 commits into
base: singleplayer
Choose a base branch
from

Conversation

Walinski
Copy link

@Walinski Walinski commented Oct 1, 2024

No description provided.

dependabot bot and others added 19 commits July 30, 2024 19:13
Bumps [redis](https://github.com/redis/redis-py) from 5.0.7 to 5.0.8.
- [Release notes](https://github.com/redis/redis-py/releases)
- [Changelog](https://github.com/redis/redis-py/blob/master/CHANGES)
- [Commits](redis/redis-py@v5.0.7...v5.0.8)

---
updated-dependencies:
- dependency-name: redis
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.31 to 2.0.32.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)

---
updated-dependencies:
- dependency-name: sqlalchemy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…2.0.32

Bump sqlalchemy from 2.0.31 to 2.0.32
Bumps [twisted](https://github.com/twisted/twisted) from 24.3.0 to 24.7.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](twisted/twisted@twisted-24.3.0...twisted-24.7.0)

---
updated-dependencies:
- dependency-name: twisted
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.32 to 2.0.33.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)

---
updated-dependencies:
- dependency-name: sqlalchemy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…2.0.33

Bump sqlalchemy from 2.0.32 to 2.0.33
Bumps [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy) from 2.0.33 to 2.0.35.
- [Release notes](https://github.com/sqlalchemy/sqlalchemy/releases)
- [Changelog](https://github.com/sqlalchemy/sqlalchemy/blob/main/CHANGES.rst)
- [Commits](https://github.com/sqlalchemy/sqlalchemy/commits)

---
updated-dependencies:
- dependency-name: sqlalchemy
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
…2.0.35

Bump sqlalchemy from 2.0.33 to 2.0.35
@Lekuruu Lekuruu changed the base branch from main to singleplayer October 1, 2024 10:23
@Lekuruu Lekuruu added the feature New feature or request label Oct 1, 2024
@Lekuruu
Copy link
Owner

Lekuruu commented Oct 1, 2024

Time to take a look at this...

Copy link
Owner

@Lekuruu Lekuruu left a comment

Choose a reason for hiding this comment

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

This looks pretty good so far. I did some cleanup, and the only issue I encountered was, that after some time, the ninjas would just not attack anymore. However, this could have been an issue on my end, as I have no idea how to reproduce this issue yet.
Please take a look at the reviews, when you get time!

self.power_card_slots: List[CardObject] = []
self.power_cards: List[CardObject] = []
self.owned_cards: List[CardObject] = []
self.cards_ready: int = 0
Copy link
Owner

Choose a reason for hiding this comment

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

Please explain the differences between the previous card system and the new one. What does it help with?

app/engine/tusk.py Outdated Show resolved Hide resolved
Comment on lines +197 to +199
if self.cards_ready >= 4:
self.logger.info(f'{self.name} needs to place a card before queuing a new one!')
return
Copy link
Owner

Choose a reason for hiding this comment

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

Why is this there? This should get handled below, with the cycle update attribute:

if len(self.owned_cards) > 3:
    update['cycle'] = True

Copy link
Owner

@Lekuruu Lekuruu Oct 1, 2024

Choose a reason for hiding this comment

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

Could this check be added to the next_power_card function, like this?

def next_power_card(self) -> CardObject | None:
    if not self.has_power_cards:
        # Client has no more power cards
        self.logger.info(f'{self.name} has no more power cards')
        return

    if self.cards_ready >= 4:
        self.logger.info(f'{self.name} needs to place a card before queuing a new one!')
        return

    next_card = random.choice(self.owned_cards)
    self.owned_cards.append(next_card)
    self.owned_cards.remove(next_card)

    return next_card

because this would mean that the stamina bar still goes up, like it used to.

Copy link
Author

@Walinski Walinski Oct 10, 2024

Choose a reason for hiding this comment

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

Yes. But why should the stamina bar go up if the card queue is full? Wouldn't this mean you 'waste' stamina which could be used on a card because your queue is full?

I also don't see why we're appending to the end of self.owned_cards and removing the same entry?
Wouldn't this leave the list as it is?

Copy link
Owner

Choose a reason for hiding this comment

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

The .append & .remove was there in your original code, so I am not sure if this is intended.

The stamina bar is supposed to go up, even if you have all slots filled up already. But don't worry, this doesn't mean they "waste" anything. This is where the cycle attribute comes in. This one just resets the stamina back to 0, without giving you any card, so that it can go back up again. If you want I could try to find a video for this, but its very rare to see someone having 4 powercards at once.

image

Comment on lines +77 to +78
def is_ninja_selected(self, ninja: Ninja) -> bool:
return any(ninja.selected_object == ninja for ninja in self.game.ninjas)
Copy link
Owner

Choose a reason for hiding this comment

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

Please check if this section works correctly. The ninja parameter might get overridden inside the for-loop.

@Lekuruu
Copy link
Owner

Lekuruu commented Oct 1, 2024

Okay, I have debugged this a bit and it seems like the snow ninja's selection doesn't work anymore after a while. If you have time, maybe investigate this a bit.

@Lekuruu
Copy link
Owner

Lekuruu commented Oct 9, 2024

@Walinski Please address the requested changes if you get time. Thanks!

@Lekuruu
Copy link
Owner

Lekuruu commented Oct 11, 2024

Sorry that the review took so long, we are almost done!

@Lekuruu Lekuruu changed the title Snowflake Singleplayer Edition Snowflake singleplayer implementation Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants