Unstable 0.15.15.0 (and the one before it I forgor)
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using StoreBalanceStatus = Barotrauma.LocationType.StoreBalanceStatus;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -87,16 +88,12 @@ namespace Barotrauma
|
||||
public int TurnsInRadiation { get; set; }
|
||||
|
||||
#region Store
|
||||
|
||||
private const float StoreMaxReputationModifier = 0.1f;
|
||||
private const float StoreSellPriceModifier = 0.8f;
|
||||
private const float DailySpecialPriceModifier = 0.5f;
|
||||
private const float RequestGoodPriceModifier = 1.5f;
|
||||
public const int StoreInitialBalance = 5000;
|
||||
/// <summary>
|
||||
/// In percentages
|
||||
/// </summary>
|
||||
private const int StorePriceModifierRange = 5;
|
||||
private float StoreMaxReputationModifier => Type.StoreMaxReputationModifier;
|
||||
private float StoreSellPriceModifier => Type.StoreSellPriceModifier;
|
||||
private float DailySpecialPriceModifier => Type.DailySpecialPriceModifier;
|
||||
private float RequestGoodPriceModifier => Type.RequestGoodPriceModifier;
|
||||
public int StoreInitialBalance => Type.StoreInitialBalance;
|
||||
private int StorePriceModifierRange => Type.StorePriceModifierRange;
|
||||
/// <summary>
|
||||
/// In percentages. Larger values make buying more expensive and selling less profitable, and vice versa.
|
||||
/// </summary>
|
||||
@@ -104,26 +101,7 @@ namespace Barotrauma
|
||||
|
||||
public Color BalanceColor => ActiveStoreBalanceStatus.Color;
|
||||
public StoreBalanceStatus ActiveStoreBalanceStatus { get; private set; }
|
||||
private static StoreBalanceStatus DefaultBalanceStatus { get; } = new StoreBalanceStatus(1.0f, 1.0f, Color.White);
|
||||
private static List<StoreBalanceStatus> StoreBalanceStatuses { get; } = new List<StoreBalanceStatus>
|
||||
{
|
||||
new StoreBalanceStatus(0.5f, 0.75f, Color.Orange),
|
||||
new StoreBalanceStatus(0.25f, 0.2f, Color.Red),
|
||||
};
|
||||
|
||||
public struct StoreBalanceStatus
|
||||
{
|
||||
public float PercentageOfInitialBalance { get; }
|
||||
public float SellPriceModifier { get; }
|
||||
public Color Color { get; }
|
||||
|
||||
public StoreBalanceStatus(float percentage, float sellPriceModifier, Color color)
|
||||
{
|
||||
PercentageOfInitialBalance = percentage;
|
||||
SellPriceModifier = sellPriceModifier;
|
||||
Color = color;
|
||||
}
|
||||
}
|
||||
private List<StoreBalanceStatus> StoreBalanceStatuses => Type.StoreBalanceStatuses;
|
||||
|
||||
private int storeCurrentBalance;
|
||||
public int StoreCurrentBalance
|
||||
@@ -1111,15 +1089,16 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public static StoreBalanceStatus GetStoreBalanceStatus(int balance)
|
||||
public StoreBalanceStatus GetStoreBalanceStatus(int balance)
|
||||
{
|
||||
StoreBalanceStatus nextStatus = DefaultBalanceStatus;
|
||||
foreach (var balanceStatus in StoreBalanceStatuses)
|
||||
StoreBalanceStatus nextStatus = StoreBalanceStatuses[0];
|
||||
for (int i = 1; i < StoreBalanceStatuses.Count; i++)
|
||||
{
|
||||
if (balanceStatus.PercentageOfInitialBalance < nextStatus.PercentageOfInitialBalance &&
|
||||
((float)balance / StoreInitialBalance) < balanceStatus.PercentageOfInitialBalance)
|
||||
var status = StoreBalanceStatuses[i];
|
||||
if (status.PercentageOfInitialBalance < nextStatus.PercentageOfInitialBalance &&
|
||||
((float)balance / StoreInitialBalance) < status.PercentageOfInitialBalance)
|
||||
{
|
||||
nextStatus = balanceStatus;
|
||||
nextStatus = status;
|
||||
}
|
||||
}
|
||||
return nextStatus;
|
||||
|
||||
@@ -68,6 +68,37 @@ namespace Barotrauma
|
||||
private set;
|
||||
}
|
||||
|
||||
public float StoreMaxReputationModifier { get; } = 0.1f;
|
||||
public float StoreSellPriceModifier { get; } = 0.8f;
|
||||
public float DailySpecialPriceModifier { get; } = 0.5f;
|
||||
public float RequestGoodPriceModifier { get; } = 1.5f;
|
||||
public int StoreInitialBalance { get; } = 5000;
|
||||
/// <summary>
|
||||
/// In percentages
|
||||
/// </summary>
|
||||
public int StorePriceModifierRange { get; } = 5;
|
||||
|
||||
public List<StoreBalanceStatus> StoreBalanceStatuses { get; } = new List<StoreBalanceStatus>()
|
||||
{
|
||||
new StoreBalanceStatus(1.0f, 1.0f, Color.White),
|
||||
new StoreBalanceStatus(0.5f, 0.75f, Color.Orange),
|
||||
new StoreBalanceStatus(0.25f, 0.2f, Color.Red)
|
||||
};
|
||||
|
||||
public struct StoreBalanceStatus
|
||||
{
|
||||
public float PercentageOfInitialBalance { get; }
|
||||
public float SellPriceModifier { get; }
|
||||
public Color Color { get; }
|
||||
|
||||
public StoreBalanceStatus(float percentage, float sellPriceModifier, Color color)
|
||||
{
|
||||
PercentageOfInitialBalance = percentage;
|
||||
SellPriceModifier = sellPriceModifier;
|
||||
Color = color;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"LocationType (" + Identifier + ")";
|
||||
@@ -163,6 +194,26 @@ namespace Barotrauma
|
||||
portraits.Add(portrait);
|
||||
}
|
||||
break;
|
||||
case "store":
|
||||
StoreMaxReputationModifier = subElement.GetAttributeFloat("maxreputationmodifier", StoreMaxReputationModifier);
|
||||
StoreSellPriceModifier = subElement.GetAttributeFloat("sellpricemodifier", StoreSellPriceModifier);
|
||||
DailySpecialPriceModifier = subElement.GetAttributeFloat("dailyspecialpricemodifier", DailySpecialPriceModifier);
|
||||
RequestGoodPriceModifier = subElement.GetAttributeFloat("requestgoodpricemodifier", RequestGoodPriceModifier);
|
||||
StoreInitialBalance = subElement.GetAttributeInt("initialbalance", StoreInitialBalance);
|
||||
StorePriceModifierRange = subElement.GetAttributeInt("pricemodifierrange", StorePriceModifierRange);
|
||||
var balanceStatusElements = subElement.GetChildElements("balancestatus");
|
||||
if (balanceStatusElements.Any())
|
||||
{
|
||||
StoreBalanceStatuses.Clear();
|
||||
foreach (var balanceStatusElement in balanceStatusElements)
|
||||
{
|
||||
float percentage = balanceStatusElement.GetAttributeFloat("percentage", 1.0f);
|
||||
float modifier = balanceStatusElement.GetAttributeFloat("sellpricemodifier", 1.0f);
|
||||
Color color = balanceStatusElement.GetAttributeColor("color", Color.White);
|
||||
StoreBalanceStatuses.Add(new StoreBalanceStatus(percentage, modifier, color));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,8 +472,11 @@ namespace Barotrauma
|
||||
|
||||
foreach (LocationConnection connection in Connections)
|
||||
{
|
||||
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);
|
||||
//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);
|
||||
float difficulty = connection.CenterPos.X / Width * 100;
|
||||
float random = difficulty > 10 ? 5 : 0;
|
||||
connection.Difficulty = MathHelper.Clamp(difficulty + Rand.Range(-random, random, Rand.RandSync.Server), 1.0f, 100.0f);
|
||||
}
|
||||
|
||||
AssignBiomes();
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Extensions;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -22,6 +23,8 @@ namespace Barotrauma
|
||||
public readonly Map Map;
|
||||
public readonly RadiationParams Params;
|
||||
|
||||
private Affliction radiationAffliction;
|
||||
|
||||
private float radiationTimer;
|
||||
|
||||
private float increasedAmount;
|
||||
@@ -93,6 +96,8 @@ namespace Barotrauma
|
||||
increasedAmount = lastIncrease = amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void UpdateRadiation(float deltaTime)
|
||||
{
|
||||
if (!(GameMain.GameSession?.IsCurrentLocationRadiated() ?? false)) { return; }
|
||||
@@ -105,6 +110,8 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
radiationAffliction ??= new Affliction(AfflictionPrefab.RadiationSickness, Params.RadiationDamageAmount);
|
||||
|
||||
radiationTimer = Params.RadiationDamageDelay;
|
||||
|
||||
foreach (Character character in Character.CharacterList)
|
||||
@@ -113,7 +120,11 @@ namespace Barotrauma
|
||||
|
||||
if (IsEntityRadiated(character))
|
||||
{
|
||||
health.ApplyAffliction(null, new Affliction(AfflictionPrefab.RadiationSickness, Params.RadiationDamageAmount));
|
||||
foreach (Limb limb in character.AnimController.Limbs)
|
||||
{
|
||||
AttackResult attackResult = limb.AddDamage(limb.SimPosition, radiationAffliction.ToEnumerable(), playSound: false);
|
||||
character.CharacterHealth.ApplyDamage(limb, attackResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user