* 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
This commit is contained in:
Fate-JH 2024-05-14 22:03:55 -04:00 committed by GitHub
parent 2dd44142d2
commit cacb9ad18a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 7 deletions

View file

@ -132,12 +132,12 @@ final case class TowerHackParticipation(building: Building) extends FacilityHack
overwhelmingOddsBonus = 30L overwhelmingOddsBonus = 30L
) )
//6. calculate overall command experience points //6. calculate overall command experience points
val finalCep: Long = math.ceil( val finalCep: Long = 10L /*math.ceil(
baseExperienceFromFacilityCapture * baseExperienceFromFacilityCapture *
populationModifier * populationModifier *
competitionMultiplier * competitionMultiplier *
Config.app.game.experience.cep.rate + competitionBonus Config.app.game.experience.cep.rate + competitionBonus
).toLong ).toLong*/
//7. reward participants //7. reward participants
//Classically, only players in the SOI are rewarded //Classically, only players in the SOI are rewarded
//terminal hacker (always cep) //terminal hacker (always cep)

View file

@ -190,10 +190,12 @@ object KillAssists {
val victimUnique = victim.unique val victimUnique = victim.unique
val lastDeath = killer.progress.prior.flatMap(_.death) val lastDeath = killer.progress.prior.flatMap(_.death)
val sameLastKiller = lastDeath.map(_.assailant.map(_.unique)).flatMap(_.headOption).contains(victimUnique) val sameLastKiller = lastDeath.map(_.assailant.map(_.unique)).flatMap(_.headOption).contains(victimUnique)
if (revenge.defaultExperience != 0 && sameLastKiller) { if (sameLastKiller) {
revenge.defaultExperience if (revenge.defaultExperience != 0) {
} else if (sameLastKiller) { revenge.defaultExperience
math.min(revenge.maxExperience, (lastDeath.map(_.experienceEarned.toFloat).getOrElse(0f) * revenge.rate).toLong) } else {
math.min(revenge.maxExperience, (lastDeath.map(_.experienceEarned.toFloat).getOrElse(0f) * revenge.rate).toLong)
}
} else { } else {
0L 0L
} }

View file

@ -242,7 +242,7 @@ object Support {
individualThreatEstimates.filter(_._1 < 10) individualThreatEstimates.filter(_._1 < 10)
} else { } else {
individualThreatEstimates.filter(_._1 > 10) individualThreatEstimates.filter(_._1 > 10)
}).maxBy(_._2)._1, }).maxByOption(_._2).map(_._1).getOrElse(0),
defaultValue defaultValue
) )
} }