aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Battlegrounds/ArenaTeam.cpp44
-rw-r--r--src/server/game/Battlegrounds/ArenaTeam.h2
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp2
3 files changed, 33 insertions, 15 deletions
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 0a4a5b7c11c..e8b79b3088a 100644
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -654,8 +654,10 @@ int32 ArenaTeam::WonAgainst(uint32 againstRating)
// calculate the rating modification
// simulation on how it works. Not much info on how it really works
int32 mod;
- if (m_stats.rating < 1500)
- mod = (int32)ceil(48.0f * (1.0f - chance) * (1.0f - chance));
+ if (m_stats.rating < 1000)
+ mod = (int32)ceil(48.0f * (1.0f - chance));
+ else if (m_stats.rating < 1300)
+ mod = (int32)ceil((24.0f + (24.0f * (1300 - m_stats.rating) / 300)) * (1.0f - chance));
else
mod = (int32)ceil(24.0f * (1.0f - chance));
@@ -668,21 +670,19 @@ int32 ArenaTeam::WonAgainst(uint32 againstRating)
return mod;
}
-int32 ArenaTeam::LostAgainst(uint32 againstRating, bool winnerlowrating)
+int32 ArenaTeam::LostAgainst(uint32 againstRating)
{
// called when the team has lost
//'chance' calculation - to loose to the opponent
float chance = GetChanceAgainst(m_stats.rating, againstRating);
- if (m_stats.rating < 1000)
- {
- FinishGame(0);
- return 0;
- }
+
// calculate the rating lost
// there is not much info on the formula, but this is a very good simulation
int32 mod;
- if (winnerlowrating)
- mod = (int32)floor(48.0f * chance * chance) * -1;
+ if (m_stats.rating < 1000)
+ mod = (int32)floor(48.0f * (0.0f - chance));
+ else if (m_stats.rating < 1300)
+ mod = (int32)floor((24.0f + (24.0f * (1300 - m_stats.rating) / 300)) * (0.0f - chance));
else
mod = (int32)floor(24.0f * (0.0f - chance));
@@ -703,7 +703,13 @@ void ArenaTeam::MemberLost(Player * plr, uint32 againstMatchmakerRating)
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, m_stats.rating);
// calculate the rating modification
- int32 mod = (int32)floor(24.0f * (0.0f - chance));
+ int32 mod;
+ if (itr->personal_rating < 1000)
+ mod = (int32)floor(48.0f * (0.0f - chance));
+ else if (itr->personal_rating < 1300)
+ mod = (int32)floor((24.0f + (24.0f * (1300 - m_stats.rating) / 300)) * (0.0f - chance));
+ else
+ mod = (int32)floor(24.0f * (0.0f - chance));
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update matchmaker rating
chance = GetChanceAgainst(itr->matchmaker_rating, againstMatchmakerRating);
@@ -731,7 +737,13 @@ void ArenaTeam::OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating)
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, m_stats.rating);
// calculate the rating modification
- int32 mod = (int32)ceil(24.0f * (0.0f - chance));
+ int32 mod;
+ if (itr->personal_rating < 1000)
+ mod = (int32)floor(48.0f * (0.0f - chance));
+ else if (itr->personal_rating < 1300)
+ mod = (int32)floor((24.0f + (24.0f * (1300 - m_stats.rating) / 300)) * (0.0f - chance));
+ else
+ mod = (int32)floor(24.0f * (0.0f - chance));
itr->ModifyPersonalRating(NULL, mod, GetSlot());
// update matchmaker rating
chance = GetChanceAgainst(itr->matchmaker_rating, againstMatchmakerRating);
@@ -757,7 +769,13 @@ void ArenaTeam::MemberWon(Player * plr, uint32 againstMatchmakerRating)
// update personal rating
float chance = GetChanceAgainst(itr->personal_rating, m_stats.rating);
// calculate the rating modification
- int32 mod = (int32)ceil(24.0f * (1.0f - chance));
+ int32 mod;
+ if (itr->personal_rating < 1000)
+ mod = (int32)ceil(48.0f * (1.0f - chance) * (1.0f - chance));
+ else if (itr->personal_rating < 1300)
+ mod = (int32)ceil((24.0f + (24.0f * (1300 - m_stats.rating) / 300)) * (1.0f - chance));
+ else
+ mod = (int32)ceil(24.0f * (1.0f - chance));
itr->ModifyPersonalRating(plr, mod, GetSlot());
// update matchmaker rating
chance = GetChanceAgainst(matchmakerrating, againstMatchmakerRating);
diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h
index 7e747ae3e0a..d27a5992d3f 100644
--- a/src/server/game/Battlegrounds/ArenaTeam.h
+++ b/src/server/game/Battlegrounds/ArenaTeam.h
@@ -200,7 +200,7 @@ class ArenaTeam
float GetChanceAgainst(uint32 own_rating, uint32 enemy_rating);
int32 WonAgainst(uint32 againstRating);
void MemberWon(Player * plr, uint32 againstMatchmakerRating);
- int32 LostAgainst(uint32 againstRating, bool winnerlowrating);
+ int32 LostAgainst(uint32 againstRating);
void MemberLost(Player * plr, uint32 againstMatchmakerRating);
void OfflineMemberLost(uint64 guid, uint32 againstMatchmakerRating);
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 7cdc8ddedf1..81d93357ec9 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -731,7 +731,7 @@ void Battleground::EndBattleground(uint32 winner)
winner_team_rating = winner_arena_team->GetRating();
winner_matchmaker_rating = winner_arena_team->GetAverageMMR(GetBgRaid(winner));
int32 winner_change = winner_arena_team->WonAgainst(loser_matchmaker_rating);
- int32 loser_change = loser_arena_team->LostAgainst(winner_matchmaker_rating, winner_team_rating < 1500);
+ int32 loser_change = loser_arena_team->LostAgainst(winner_matchmaker_rating);
sLog.outDebug("--- Winner rating: %u, Loser rating: %u, Winner MMR: %u, Loser MMR: %u, Winner change: %u, Losser change: %u ---", winner_team_rating, loser_team_rating,
winner_matchmaker_rating, loser_matchmaker_rating, winner_change, loser_change);
SetArenaTeamRatingChangeForTeam(winner, winner_change);