Unstable 1.2.4.0

This commit is contained in:
Markus Isberg
2023-11-30 13:53:00 +02:00
parent 8a2e2ea0ae
commit fb5ea537bf
210 changed files with 4201 additions and 1283 deletions
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Barotrauma
@@ -20,6 +21,23 @@ namespace Barotrauma
AvailableCharacters.Remove(character);
}
public static int GetSalaryFor(IReadOnlyCollection<CharacterInfo> hires)
{
return hires.Sum(hire => GetSalaryFor(hire));
}
public static int GetSalaryFor(CharacterInfo hire)
{
IEnumerable<Character> crew = GameSession.GetSessionCrewCharacters(CharacterType.Both);
float multiplier = 0;
foreach (var character in crew)
{
multiplier += character?.Info?.GetSavedStatValueWithAll(StatTypes.HireCostMultiplier, hire.Job.Prefab.Identifier) ?? 0;
}
float finalMultiplier = 1f + MathF.Max(multiplier, -1f);
return (int)(hire.Salary * finalMultiplier);
}
public void GenerateCharacters(Location location, int amount)
{
AvailableCharacters.ForEach(c => c.Remove());