mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-04-26 18:17:16 -05:00
Added check for 1v5 and 1v6 exact conditions
This commit is contained in:
parent
d27ffc3271
commit
56f4c39ce2
|
|
@ -38,10 +38,28 @@ class MatchConfiguration extends Model
|
||||||
*/
|
*/
|
||||||
public static function getAvailableMatchConfigs(int $runnerCount, int $hunterCount): Collection
|
public static function getAvailableMatchConfigs(int $runnerCount, int $hunterCount): Collection
|
||||||
{
|
{
|
||||||
return MatchConfiguration::where('runners', '<=', $runnerCount)
|
$availableMatchConfigs = null
|
||||||
->where('hunters', '<=', $hunterCount)
|
|
||||||
->where('enabled', '=', true)
|
if($hunterCount == 1 and $runnerCount >= 6) {
|
||||||
->get();
|
$availableMatchConfigs = MatchConfiguration::where('runners', '>=', 6)
|
||||||
|
->where('hunters', '=', $hunterCount)
|
||||||
|
->where('enabled', '=', true)
|
||||||
|
->get();
|
||||||
|
} elseif ($hunterCount == 1 and $runnerCount >= 4) {
|
||||||
|
$availableMatchConfigs = MatchConfiguration::where('runners', '=', $runnerCount)
|
||||||
|
->where('hunters', '=', $hunterCount)
|
||||||
|
->where('enabled', '=', true)
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($availableMatchConfigs === null or $availableMatchConfigs->isEmpty())
|
||||||
|
return MatchConfiguration::where('runners', '<=', $runnerCount)
|
||||||
|
->where('hunters', '<=', $hunterCount)
|
||||||
|
->where('enabled', '=', true)
|
||||||
|
->get();
|
||||||
|
} else {
|
||||||
|
return $availableMatchConfigs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function selectRandomConfigByWeight(Collection &$collection): MatchConfiguration|null
|
public static function selectRandomConfigByWeight(Collection &$collection): MatchConfiguration|null
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user