Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -6,7 +6,10 @@ namespace Barotrauma
{
public readonly Identifier Identifier;
public const float MaximumSkill = 100.0f;
/// <summary>
/// The "normal" maximum skill level. It's possible to go above this with certain talents, see <see cref="SkillSettings.MaximumSkillWithTalents"/>.
/// </summary>
public const float DefaultMaximumSkill = 100.0f;
private float level;
@@ -27,9 +30,21 @@ namespace Barotrauma
public LocalizedString DisplayName { get; private set; }
public void IncreaseSkill(float value, bool increasePastMax)
/// <summary>
/// Increase the skill level by a value. Handles clamping the level above the maximum.
/// Note that if the skill level is already above maximum (if it for example has been set by console commands), it's allowed to stay at that level, but not to increase further.
/// </summary>
/// <param name="value">How much to increase the skill.</param>
/// <param name="canIncreasePastDefaultMaximumSkill">Can the skill level increase above <see cref="DefaultMaximumSkill"/>, or can it go all the way to <see cref="SkillSettings.MaximumSkillWithTalents"/>?</param>
public void IncreaseSkill(float value, bool canIncreasePastDefaultMaximumSkill)
{
Level = MathHelper.Clamp(level + value, 0.0f, increasePastMax ? SkillSettings.Current.MaximumSkillWithTalents : MaximumSkill);
float currentMaximum = canIncreasePastDefaultMaximumSkill ? SkillSettings.Current.MaximumSkillWithTalents : DefaultMaximumSkill;
if (Level > currentMaximum && value > 0)
{
//level above max already (set with console commands?), don't allow increasing it further and don't clamp it below max either
return;
}
Level = MathHelper.Clamp(level + value, 0.0f, currentMaximum);
}
private readonly Identifier iconJobId;
@@ -40,10 +55,12 @@ namespace Barotrauma
public readonly float PriceMultiplier = 1.0f;
public Skill(SkillPrefab prefab, Rand.RandSync randSync)
public Skill(SkillPrefab prefab, bool isPvP, Rand.RandSync randSync)
{
Identifier = prefab.Identifier;
Level = Rand.Range(prefab.LevelRange.Start, prefab.LevelRange.End, randSync);
var levelRange = prefab.GetLevelRange(isPvP);
Level = Rand.Range(levelRange.Start, levelRange.End, randSync);
iconJobId = GetIconJobId();
PriceMultiplier = prefab.PriceMultiplier;
DisplayName = TextManager.Get("SkillName." + Identifier);