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-1010] - Fix deathmatch endgame results #1008

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/arena/lib/arena/game_tracker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ defmodule Arena.GameTracker do
| {:heal, player_id(), non_neg_integer()}
| {:kill_by_zone, player_id()}
| {:select_bounty, player_id(), bounty_quest_id()}
| {:deathmatch_position, player_id(), pos_integer()}

@spec push_event(pid(), event()) :: :ok
def push_event(match_pid, event) do
Expand Down Expand Up @@ -136,6 +137,11 @@ defmodule Arena.GameTracker do
|> put_in([:position_on_death], data.position_on_death - 1)
end

defp update_data(data, {:deathmatch_position, player_id, position}) do
data
|> put_in([:players, player_id, :position], position)
end

defp update_data(data, {:damage_taken, player_id, amount}) do
update_in(data, [:players, player_id, :damage_taken], fn damage_taken -> damage_taken + amount end)
end
Expand Down
1 change: 1 addition & 0 deletions apps/arena/lib/arena/game_updater.ex
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ defmodule Arena.GameUpdater do
teams_with_kills
|> Enum.reduce(game_state, fn {team, position}, game_state_acc ->
Enum.reduce(team.players, game_state_acc, fn player, game_state_acc ->
GameTracker.push_event(self(), {:deathmatch_position, player.id, position})
put_player_position(game_state_acc, player.id, position)
end)
end)
Expand Down
130 changes: 130 additions & 0 deletions apps/game_backend/priv/arena_prestige_ranks.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,136 @@
"reward": -12
}
]
},
{
"position": 11,
"distributions": [
{
"min": 0,
"max": 49,
"reward": 0
},
{
"min": 50,
"max": 99,
"reward": -1
},
{
"min": 100,
"max": 199,
"reward": -2
},
{
"min": 200,
"max": 299,
"reward": -3
},
{
"min": 300,
"max": 399,
"reward": -4
},
{
"min": 400,
"max": 499,
"reward": -5
},
{
"min": 500,
"max": 599,
"reward": -6
},
{
"min": 600,
"max": 699,
"reward": -7
},
{
"min": 700,
"max": 799,
"reward": -8
},
{
"min": 800,
"max": 899,
"reward": -9
},
{
"min": 900,
"max": 999,
"reward": -10
},
{
"min": 1000,
"max": 2147483647,
"reward": -12
}
]
},
{
"position": 12,
"distributions": [
{
"min": 0,
"max": 49,
"reward": 0
},
{
"min": 50,
"max": 99,
"reward": -1
},
{
"min": 100,
"max": 199,
"reward": -2
},
{
"min": 200,
"max": 299,
"reward": -3
},
{
"min": 300,
"max": 399,
"reward": -4
},
{
"min": 400,
"max": 499,
"reward": -5
},
{
"min": 500,
"max": 599,
"reward": -6
},
{
"min": 600,
"max": 699,
"reward": -7
},
{
"min": 700,
"max": 799,
"reward": -8
},
{
"min": 800,
"max": 899,
"reward": -9
},
{
"min": 900,
"max": 999,
"reward": -10
},
{
"min": 1000,
"max": 2147483647,
"reward": -12
}
]
}
],
"ranks": [
Expand Down
Loading