From cacb9ad18a0bd63f2704a06ba39f80c5bbd09caa Mon Sep 17 00:00:00 2001 From: Fate-JH Date: Tue, 14 May 2024 22:03:55 -0400 Subject: [PATCH] Scoring (#1202) * cep from towers set to 10; reorganized an if...else * replacing maxBy with maxByOption and then resolving maxBy the long way with appropriate fallback value --- .../participation/TowerHackParticipation.scala | 4 ++-- .../net/psforever/objects/zones/exp/KillAssists.scala | 10 ++++++---- .../net/psforever/objects/zones/exp/Support.scala | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/scala/net/psforever/objects/serverobject/structures/participation/TowerHackParticipation.scala b/src/main/scala/net/psforever/objects/serverobject/structures/participation/TowerHackParticipation.scala index b780c749..824f6089 100644 --- a/src/main/scala/net/psforever/objects/serverobject/structures/participation/TowerHackParticipation.scala +++ b/src/main/scala/net/psforever/objects/serverobject/structures/participation/TowerHackParticipation.scala @@ -132,12 +132,12 @@ final case class TowerHackParticipation(building: Building) extends FacilityHack overwhelmingOddsBonus = 30L ) //6. calculate overall command experience points - val finalCep: Long = math.ceil( + val finalCep: Long = 10L /*math.ceil( baseExperienceFromFacilityCapture * populationModifier * competitionMultiplier * Config.app.game.experience.cep.rate + competitionBonus - ).toLong + ).toLong*/ //7. reward participants //Classically, only players in the SOI are rewarded //terminal hacker (always cep) diff --git a/src/main/scala/net/psforever/objects/zones/exp/KillAssists.scala b/src/main/scala/net/psforever/objects/zones/exp/KillAssists.scala index 4695817b..91a4d3a6 100644 --- a/src/main/scala/net/psforever/objects/zones/exp/KillAssists.scala +++ b/src/main/scala/net/psforever/objects/zones/exp/KillAssists.scala @@ -190,10 +190,12 @@ object KillAssists { val victimUnique = victim.unique val lastDeath = killer.progress.prior.flatMap(_.death) val sameLastKiller = lastDeath.map(_.assailant.map(_.unique)).flatMap(_.headOption).contains(victimUnique) - if (revenge.defaultExperience != 0 && sameLastKiller) { - revenge.defaultExperience - } else if (sameLastKiller) { - math.min(revenge.maxExperience, (lastDeath.map(_.experienceEarned.toFloat).getOrElse(0f) * revenge.rate).toLong) + if (sameLastKiller) { + if (revenge.defaultExperience != 0) { + revenge.defaultExperience + } else { + math.min(revenge.maxExperience, (lastDeath.map(_.experienceEarned.toFloat).getOrElse(0f) * revenge.rate).toLong) + } } else { 0L } diff --git a/src/main/scala/net/psforever/objects/zones/exp/Support.scala b/src/main/scala/net/psforever/objects/zones/exp/Support.scala index 75bd8577..1b0551b5 100644 --- a/src/main/scala/net/psforever/objects/zones/exp/Support.scala +++ b/src/main/scala/net/psforever/objects/zones/exp/Support.scala @@ -242,7 +242,7 @@ object Support { individualThreatEstimates.filter(_._1 < 10) } else { individualThreatEstimates.filter(_._1 > 10) - }).maxBy(_._2)._1, + }).maxByOption(_._2).map(_._1).getOrElse(0), defaultValue ) }