Release v0.15.12.0

This commit is contained in:
Joonas Rikkonen
2021-10-27 18:50:57 +03:00
parent bf95e82d80
commit 234fb6bc06
450 changed files with 26042 additions and 10457 deletions
@@ -60,7 +60,7 @@ namespace Barotrauma
private LocationType addInitialMissionsForType;
public bool Discovered;
public bool Discovered { get; private set; }
public readonly Dictionary<LocationTypeChange.Requirement, int> ProximityTimer = new Dictionary<LocationTypeChange.Requirement, int>();
public (LocationTypeChange typeChange, int delay, MissionPrefab parentMission)? PendingLocationTypeChange;
@@ -90,7 +90,7 @@ namespace Barotrauma
private const float StoreMaxReputationModifier = 0.1f;
private const float StoreSellPriceModifier = 0.8f;
private const float DailySpecialPriceModifier = 0.9f;
private const float DailySpecialPriceModifier = 0.5f;
private const float RequestGoodPriceModifier = 1.5f;
public const int StoreInitialBalance = 5000;
/// <summary>
@@ -868,6 +868,8 @@ namespace Barotrauma
// Adjust by random price modifier
price = ((100 + StorePriceModifier) / 100.0f) * price;
price *= priceInfo.BuyingPriceMultiplier;
// Adjust by daily special status
if (considerDailySpecials && DailySpecials.Contains(item))
{
@@ -1004,12 +1006,22 @@ namespace Barotrauma
stockToRemove.ForEach(i => stock.Remove(i));
StoreStock = stock;
if (++StepsSinceSpecialsUpdated >= SpecialsUpdateInterval)
int extraSpecialSalesCount = GetExtraSpecialSalesCount();
if (++StepsSinceSpecialsUpdated >= SpecialsUpdateInterval ||
DailySpecials.Count() != DailySpecialsCount + extraSpecialSalesCount)
{
CreateStoreSpecials();
}
}
private int GetExtraSpecialSalesCount()
{
var characters = GameSession.GetSessionCrewCharacters();
if (!characters.Any()) { return 0; }
return characters.Max(c => (int)c.GetStatValue(StatTypes.ExtraSpecialSalesCount));
}
private void GenerateRandomPriceModifier()
{
StorePriceModifier = Rand.Range(-StorePriceModifierRange, StorePriceModifierRange);
@@ -1033,7 +1045,9 @@ namespace Barotrauma
}
availableStock.Add(stockItem.ItemPrefab, weight);
}
for (int i = 0; i < DailySpecialsCount; i++)
int extraSpecialSalesCount = GetExtraSpecialSalesCount();
for (int i = 0; i < DailySpecialsCount + extraSpecialSalesCount; i++)
{
if (availableStock.None()) { break; }
var item = ToolBox.SelectWeightedRandom(availableStock.Keys.ToList(), availableStock.Values.ToList(), Rand.RandSync.Unsynced);
@@ -1111,6 +1125,30 @@ namespace Barotrauma
return nextStatus;
}
public void Discover(bool checkTalents = true)
{
if (Discovered) { return; }
Discovered = true;
if (checkTalents)
{
GameSession.GetSessionCrewCharacters().ForEach(c => c.CheckTalents(AbilityEffectType.OnLocationDiscovered, new Abilities.AbilityLocation(this)));
}
}
public void Reset()
{
if (Type != OriginalType)
{
ChangeType(OriginalType);
PendingLocationTypeChange = null;
}
CreateStore(force: true);
ClearMissions();
LevelData?.EventHistory?.Clear();
UnlockInitialMissions();
Discovered = false;
}
public XElement Save(Map map, XElement parentElement)
{
var locationElement = new XElement("location",
@@ -231,7 +231,7 @@ namespace Barotrauma
}
System.Diagnostics.Debug.Assert(StartLocation != null, "Start location not assigned after level generation.");
CurrentLocation.Discovered = true;
CurrentLocation.Discover(true);
CurrentLocation.CreateStore();
InitProjectSpecific();
@@ -472,17 +472,18 @@ namespace Barotrauma
foreach (LocationConnection connection in Connections)
{
connection.Difficulty = MathHelper.Clamp((connection.CenterPos.X / Width * 100) + Rand.Range(-10.0f, 0.0f, Rand.RandSync.Server), 1.2f, 100.0f);
float difficulty = GetLevelDifficulty(connection.CenterPos.X / Width);
connection.Difficulty = MathHelper.Clamp(difficulty + Rand.Range(-10.0f, 0.0f, Rand.RandSync.Server), 1.2f, 100.0f);
}
AssignBiomes();
CreateEndLocation();
foreach (Location location in Locations)
{
location.LevelData = new LevelData(location)
{
Difficulty = MathHelper.Clamp(location.MapPosition.X / Width * 100, 0.0f, 100.0f)
Difficulty = MathHelper.Clamp(GetLevelDifficulty(location.MapPosition.X / Width), 0.0f, 100.0f)
};
location.UnlockInitialMissions();
}
@@ -490,6 +491,14 @@ namespace Barotrauma
{
connection.LevelData = new LevelData(connection);
}
float GetLevelDifficulty(float areaDifficulty)
{
const float CurveModifier = 1.5f;
const float DifficultyMultiplier = 1.14f;
const float BaseDifficulty = -3f;
return (float)(1 - Math.Pow(1 - areaDifficulty, CurveModifier)) * DifficultyMultiplier * 100f + BaseDifficulty;
}
}
partial void GenerateLocationConnectionVisuals();
@@ -671,7 +680,7 @@ namespace Barotrauma
SelectedConnection.Passed = true;
CurrentLocation = SelectedLocation;
CurrentLocation.Discovered = true;
CurrentLocation.Discover();
SelectedLocation = null;
CurrentLocation.CreateStore();
@@ -702,7 +711,7 @@ namespace Barotrauma
Location prevLocation = CurrentLocation;
CurrentLocation = Locations[index];
CurrentLocation.Discovered = true;
CurrentLocation.Discover();
if (prevLocation != CurrentLocation)
{
@@ -1055,7 +1064,10 @@ namespace Barotrauma
}
}
location.LoadLocationTypeChange(subElement);
location.Discovered = subElement.GetAttributeBool("discovered", false);
if (subElement.GetAttributeBool("discovered", false))
{
location.Discover(checkTalents: false);
}
if (location.Discovered)
{
#if CLIENT
@@ -149,7 +149,7 @@ namespace Barotrauma
public XElement Save()
{
XElement element = new XElement(nameof(Radiation));
SerializableProperty.SerializeProperties(this, element);
SerializableProperty.SerializeProperties(this, element, saveIfDefault: true);
return element;
}
}