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

Stat override message #564

Merged
merged 19 commits into from
May 15, 2024
Merged

Stat override message #564

merged 19 commits into from
May 15, 2024

Conversation

ncontinanza
Copy link
Contributor

@ncontinanza ncontinanza commented May 3, 2024

Part of https://github.com/lambdaclass/champions_of_mirra/issues/280

Motivation

We should have a specific message for the case in which we want to override a stat's value, despite its current value.
In the immediate future this will be used to set the energy to 0 after casting the ultimate skill, in the near future it will be used to set other stats such as the health.

Summary of changes

  • Create a new StatOverride message.
  • Send this message when casting a unit's ultimate skill, setting its energy to 0.

How to test it?

You can use the SocketTester (remember to move it to the gateway directory) to simulate a battle and check that this new message is sent. You can follow these steps to do so:

IEx.configure(inspect: [limit: :infinity])
{:ok, user} = Champions.Users.register("Lotu")
campaign_progress = user.super_campaign_progresses |> hd()
{:ok, pid} = Gateway.SocketTester.start_link
Gateway.SocketTester.fight_level(pid, user.id, campaign_progress.level_id)

If you feel more comfortable using the client, start the client using this branch, go to BattleManager.cs and add a Debug.Log() in the PlayOutSteps() method, in the StatOverride case of the switch statement. Run a battle and there you should see how the frontend receives this new message when a unit is about to use the ulti.

Checklist

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

@ncontinanza ncontinanza marked this pull request as ready for review May 3, 2024 17:58
@ncontinanza ncontinanza changed the base branch from main to stat-affected-energy May 3, 2024 17:59
@ncontinanza ncontinanza added the waiting on PR Waiting on another PR in this repo or in the client repo label May 3, 2024
Base automatically changed from stat-affected-energy to main May 7, 2024 18:27
@ncontinanza ncontinanza marked this pull request as ready for review May 7, 2024 18:43
@lotuuu lotuuu assigned lotuuu and unassigned lotuuu May 7, 2024
@lotuuu
Copy link
Contributor

lotuuu commented May 7, 2024

Let's implement statoverrides for heal caps

target_id: unit.id,
stat_affected: %{
stat: :ENERGY,
amount: -@ultimate_energy_cost
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be 0, otehrwise the whole concept of stat_override doesn't make sense

Copy link
Contributor

@lotuuu lotuuu left a comment

Choose a reason for hiding this comment

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

To test with SocketTester:

IEx.configure(inspect: [limit: :infinity])
{:ok, user} = Champions.Users.register("Lotu")
campaign_progress = user.super_campaign_progresses |> hd()
{:ok, pid} = Gateway.SocketTester.start_link
Gateway.SocketTester.fight_level(pid, user.id, campaign_progress.level_id)

@ncontinanza
Copy link
Contributor Author

To test with SocketTester:

IEx.configure(inspect: [limit: :infinity])
{:ok, user} = Champions.Users.register("Lotu")
campaign_progress = user.super_campaign_progresses |> hd()
{:ok, pid} = Gateway.SocketTester.start_link
Gateway.SocketTester.fight_level(pid, user.id, campaign_progress.level_id)

Nice! I'll add it to the description

@lotuuu lotuuu added the autobattler AFK Gacha Autobattler game label May 13, 2024
Copy link
Contributor

@tkz00 tkz00 left a comment

Choose a reason for hiding this comment

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

Passed functional review!

@lotuuu lotuuu merged commit 1cd4d8a into main May 15, 2024
1 check passed
@lotuuu lotuuu deleted the stat-override-message branch May 15, 2024 20:22
@lotuuu lotuuu removed the waiting on PR Waiting on another PR in this repo or in the client repo label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autobattler AFK Gacha Autobattler game
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants