Unstable 0.1500.4.0 (Shrek edition)

This commit is contained in:
Markus Isberg
2021-09-23 21:29:31 +09:00
parent 5a6bbcc79e
commit 3043a9a7bc
124 changed files with 3571 additions and 1848 deletions
@@ -340,7 +340,7 @@ namespace Barotrauma
//ensures that the attack hits the correct limb and that the direction of the hit can be determined correctly in the AddDamage methods
Vector2 dir = worldPosition - limb.WorldPosition;
Vector2 hitPos = limb.WorldPosition + (dir.LengthSquared() <= 0.001f ? Rand.Vector(1.0f) : Vector2.Normalize(dir)) * 0.01f;
AttackResult attackResult = c.AddDamage(hitPos, modifiedAfflictions, attack.Stun * distFactor, false, attacker: attacker);
AttackResult attackResult = c.AddDamage(hitPos, modifiedAfflictions, attack.Stun * distFactor, false, attacker: attacker, damageMultiplier: attack.DamageMultiplier);
damages.Add(limb, attackResult.Damage);
if (attack.StatusEffects != null && attack.StatusEffects.Any())
@@ -2563,10 +2563,18 @@ namespace Barotrauma
if (PositionsOfInterest.Any(p => p.PositionType == PositionType.Cave))
{
positionType = PositionType.Cave;
if (allValidLocations.Any(l => l.Edge.NextToCave))
{
allValidLocations.RemoveAll(l => !l.Edge.NextToCave);
}
}
else if (PositionsOfInterest.Any(p => p.PositionType == PositionType.SidePath))
{
positionType = PositionType.SidePath;
if (allValidLocations.Any(l => l.Edge.NextToSidePath))
{
allValidLocations.RemoveAll(l => !l.Edge.NextToSidePath);
}
}
var poi = PositionsOfInterest.GetRandom(p => p.PositionType == positionType, randSync: Rand.RandSync.Server);
@@ -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;
@@ -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))
{
@@ -1111,6 +1113,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();
@@ -671,7 +671,7 @@ namespace Barotrauma
SelectedConnection.Passed = true;
CurrentLocation = SelectedLocation;
CurrentLocation.Discovered = true;
CurrentLocation.Discover();
SelectedLocation = null;
CurrentLocation.CreateStore();
@@ -702,7 +702,7 @@ namespace Barotrauma
Location prevLocation = CurrentLocation;
CurrentLocation = Locations[index];
CurrentLocation.Discovered = true;
CurrentLocation.Discover();
if (prevLocation != CurrentLocation)
{
@@ -1055,7 +1055,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
@@ -24,6 +24,11 @@ namespace Barotrauma
/// The item isn't available in stores unless the level's difficulty is above this value
/// </summary>
public readonly int MinLevelDifficulty;
/// <summary>
/// The cost of item when sold by the store. Higher modifier means the item costs more to buy from the store.
/// </summary>
public readonly float BuyingPriceMultiplier = 1f;
/// <summary>
/// Support for the old style of determining item prices
@@ -34,6 +39,7 @@ namespace Barotrauma
{
Price = element.GetAttributeInt("buyprice", 0);
MinLevelDifficulty = element.GetAttributeInt("minleveldifficulty", 0);
BuyingPriceMultiplier = element.GetAttributeFloat("buyingpricemultiplier", 1f);
CanBeBought = true;
var minAmount = GetMinAmount(element);
MinAvailableAmount = Math.Min(minAmount, CargoManager.MaxQuantity);
@@ -42,11 +48,12 @@ namespace Barotrauma
MaxAvailableAmount = Math.Max(maxAmount, MinAvailableAmount);
}
public PriceInfo(int price, bool canBeBought, int minAmount = 0, int maxAmount = 0, bool canBeSpecial = true, int minLevelDifficulty = 0)
public PriceInfo(int price, bool canBeBought, int minAmount = 0, int maxAmount = 0, bool canBeSpecial = true, int minLevelDifficulty = 0, float buyingPriceMultiplier = 1f)
{
Price = price;
CanBeBought = canBeBought;
MinAvailableAmount = Math.Min(minAmount, CargoManager.MaxQuantity);
BuyingPriceMultiplier = buyingPriceMultiplier;
maxAmount = Math.Min(maxAmount, CargoManager.MaxQuantity);
MaxAvailableAmount = Math.Max(maxAmount, minAmount);
MinLevelDifficulty = minLevelDifficulty;
@@ -62,6 +69,7 @@ namespace Barotrauma
var maxAmount = GetMaxAmount(element);
var minLevelDifficulty = element.GetAttributeInt("minleveldifficulty", 0);
var canBeSpecial = element.GetAttributeBool("canbespecial", true);
var buyingPriceMultiplier = element.GetAttributeFloat("buyingpricemultiplier", 1f);
var priceInfos = new List<Tuple<string, PriceInfo>>();
foreach (XElement childElement in element.GetChildElements("price"))
@@ -73,7 +81,7 @@ namespace Barotrauma
minAmount: sold ? GetMinAmount(childElement, minAmount) : 0,
maxAmount: sold ? GetMaxAmount(childElement, maxAmount) : 0,
canBeSpecial,
childElement.GetAttributeInt("minleveldifficulty", minLevelDifficulty))));
childElement.GetAttributeInt("minleveldifficulty", minLevelDifficulty), childElement.GetAttributeFloat("buyingpricemultiplier", buyingPriceMultiplier))));
}
var canBeBoughtAtOtherLocations = soldByDefault && element.GetAttributeBool("soldeverywhere", true);
@@ -81,7 +89,7 @@ namespace Barotrauma
minAmount: canBeBoughtAtOtherLocations ? minAmount : 0,
maxAmount: canBeBoughtAtOtherLocations ? maxAmount : 0,
canBeSpecial,
minLevelDifficulty);
minLevelDifficulty, buyingPriceMultiplier);
return priceInfos;
}