Expedition balance pass (#17969)

* Expedition balance pass

* better
This commit is contained in:
Nemanja 2023-07-11 19:56:43 -04:00 committed by GitHub
parent 5aab7703ef
commit d2e6e55ed1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 56 additions and 24 deletions

View File

@ -1,5 +1,4 @@
using Content.Server.Cargo.Components;
using Content.Server.Cargo.Systems;
using Content.Server.Salvage.Expeditions;
using Content.Server.Salvage.Expeditions.Structure;
using Content.Shared.CCVar;
@ -20,7 +19,7 @@ public sealed partial class SalvageSystem
* Handles setup / teardown of salvage expeditions.
*/
private const int MissionLimit = 5;
private const int MissionLimit = 3;
private readonly JobQueue _salvageQueue = new();
private readonly List<(SpawnSalvageMissionJob Job, CancellationTokenSource CancelToken)> _salvageJobs = new();
@ -225,20 +224,27 @@ public sealed partial class SalvageSystem
component.Missions.Clear();
var configs = Enum.GetValues<SalvageMissionType>().ToList();
if (configs.Count == 0)
return;
// Temporarily removed coz it SUCKS
configs.Remove(SalvageMissionType.Mining);
// this doesn't support having more missions than types of ratings
// but the previous system didn't do that either.
var allDifficulties = Enum.GetValues<DifficultyRating>();
_random.Shuffle(allDifficulties);
var difficulties = allDifficulties.Take(MissionLimit).ToList();
difficulties.Sort();
if (configs.Count == 0)
return;
for (var i = 0; i < MissionLimit; i++)
{
_random.Shuffle(configs);
var rating = (DifficultyRating) i;
var rating = difficulties[i];
foreach (var config in configs)
{
var mission = new SalvageMissionParams()
var mission = new SalvageMissionParams
{
Index = component.NextIndex,
MissionType = config,

View File

@ -13,11 +13,11 @@ public sealed class SalvageTimeMod : IPrototype, ISalvageMod
/// Cost for difficulty modifiers.
/// </summary>
[DataField("cost")]
public float Cost { get; } = 0f;
public float Cost { get; }
[DataField("minDuration")]
public int MinDuration = 900;
public int MinDuration = 630;
[DataField("maxDuration")]
public int MaxDuration = 900;
public int MaxDuration = 570;
}

View File

@ -72,7 +72,7 @@ public sealed class SalvageExpeditionDataComponent : Component
}
[Serializable, NetSerializable]
public sealed record SalvageMissionParams
public sealed record SalvageMissionParams : IComparable<SalvageMissionParams>
{
[ViewVariables]
public ushort Index;
@ -86,6 +86,14 @@ public sealed record SalvageMissionParams
/// Base difficulty for this mission.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)] public DifficultyRating Difficulty;
public int CompareTo(SalvageMissionParams? other)
{
if (other == null)
return -1;
return Difficulty.CompareTo(other.Difficulty);
}
}
/// <summary>

View File

@ -121,7 +121,7 @@ public abstract class SharedSalvageSystem : EntitySystem
var time = GetMod<SalvageTimeMod>(rand, ref rating);
// Round the duration to nearest 15 seconds.
var exactDuration = time.MinDuration + (time.MaxDuration - time.MinDuration) * rand.NextFloat();
var exactDuration = MathHelper.Lerp(time.MinDuration, time.MaxDuration, rand.NextFloat());
exactDuration = MathF.Round(exactDuration / 15f) * 15f;
var duration = TimeSpan.FromSeconds(exactDuration);

View File

@ -56,3 +56,11 @@
- type: TechnologyDisk
- type: StaticPrice
price: 50
- type: entity
parent: TechnologyDisk
id: TechnologyDiskRare
suffix: rare.
components:
- type: TechnologyDisk
tierWeightPrototype: RareTechDiskTierWeights

View File

@ -37,3 +37,9 @@
1: 25
2: 10
3: 1
- type: weightedRandom
id: RareTechDiskTierWeights
weights:
2: 19
3: 1

View File

@ -75,8 +75,8 @@
- type: salvageTimeMod
id: RushTime
desc: Rush
minDuration: 720
maxDuration: 780
minDuration: 420
maxDuration: 465
cost: 1
# Misc mods

View File

@ -30,19 +30,22 @@
SheetUranium: 1.0
CratePartsT3: 1.0
CratePartsT3T4: 0.5
TechnologyDiskRare: 0.5
# cloning boards
CloningPodMachineCircuitboard: 0.5
MedicalScannerMachineCircuitboard: 0.5
CloningConsoleComputerCircuitboard: 0.5
BiomassReclaimerMachineCircuitboard: 0.5
# basic weapons
CrateArmorySMG: 0.25
CrateArmoryLaser: 0.25
WeaponMakeshiftLaser: 0.25
Katana: 0.25
KukriKnife: 0.25
WeaponLaserGun: 0.25
MakeshiftShield: 0.25
# rare armor
ClothingHeadHelmetSwat: 0.1
ClothingHeadHelmetSwat: 0.25
ClothingOuterArmorBasicSlim: 0.25
# rare weapons
WeaponSubMachineGunC20r: 0.1
WeaponMakeshiftLaser: 0.1
# money
SpaceCash500: 1.0
SpaceCash1000: 0.75
@ -55,11 +58,12 @@
ResearchAndDevelopmentServerMachineCircuitboard: 1.0
CratePartsT4: 1.0
PowerCellAntiqueProto: 0.25
# rare weapons
WeaponAdvancedLaser: 1.0
WeaponLaserCannon: 1.0
WeaponXrayCannon: 1.0
WeaponSniperHristov: 1.0
# basic weapons
CrateArmorySMG: 1.0
CrateArmoryLaser: 1.0
CrateArmoryShotgun: 1.0
# rare armor
ClothingOuterArmorRiot: 1.0
# rare chemicals
CognizineChemistryBottle: 1.0
OmnizineChemistryBottle: 1.0