ragesit immediate playban - closes #5602

If a player ragesits (ragequit or sit or sit-move)
Then if their ragesit score is < -200 they get a playban
Else if their ragesit score is < -100
and they have another recent ragesit (last 30 games)
then they get a playban
Else if their ragesit score is < -50
and they have two other recent ragesits (last 30 games)
then they get a playban
study-remote-socket
Thibault Duplessis 2019-10-23 15:00:34 +02:00
parent ec4cbd3f6c
commit 7e6fd1b87d
1 changed files with 19 additions and 6 deletions

View File

@ -42,15 +42,26 @@ case class UserRecord(
}
def bannable(accountCreationDate: DateTime): Option[TempBan] = {
outcomes.lastOption.exists(_ != Outcome.Good) && {
// too many bad overall
badOutcomeScore >= (badOutcomeRatio * nbOutcomes atLeast minBadOutcomes) || {
// bad result streak
outcomes.size >= badOutcomesStreakSize &&
outcomes.takeRight(badOutcomesStreakSize).forall(Outcome.Good !=)
rageSitRecidive || {
outcomes.lastOption.exists(_ != Outcome.Good) && {
// too many bad overall
badOutcomeScore >= (badOutcomeRatio * nbOutcomes atLeast minBadOutcomes) || {
// bad result streak
outcomes.size >= badOutcomesStreakSize &&
outcomes.takeRight(badOutcomesStreakSize).forall(Outcome.Good !=)
}
}
}
} option TempBan.make(bans, accountCreationDate)
def rageSitRecidive =
outcomes.lastOption.exists(Outcome.rageSitLike.contains) && {
rageSit.isTerrible || {
rageSit.isVeryBad && outcomes.count(Outcome.rageSitLike.contains) > 1
} || {
rageSit.isBad && outcomes.count(Outcome.rageSitLike.contains) > 2
}
}
}
case class TempBan(
@ -114,6 +125,8 @@ object Outcome {
case object SitMoving extends Outcome(5, "Waits then moves at last moment")
case object Sandbag extends Outcome(6, "Deliberately lost the game")
val rageSitLike: Set[Outcome] = Set(RageQuit, Sitting, SitMoving)
val all = List(Good, Abort, NoPlay, RageQuit, Sitting, SitMoving, Sandbag)
val byId = all map { v => (v.id, v) } toMap