Unstable 1.2.4.0
This commit is contained in:
@@ -1214,6 +1214,21 @@ namespace Barotrauma
|
||||
return (int)(salary * Job.Prefab.PriceMultiplier);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Increases the characters skill at a rate proportional to their current skill.
|
||||
/// If you want to increase the skill level by a specific amount instead, use <see cref="IncreaseSkillLevel"/>
|
||||
/// </summary>
|
||||
public void ApplySkillGain(Identifier skillIdentifier, float baseGain, bool gainedFromAbility = false, float maxGain = 2f)
|
||||
{
|
||||
float skillLevel = Job.GetSkillLevel(skillIdentifier);
|
||||
// The formula is too generous on low skill levels, hence the minimum divider.
|
||||
float skillDivider = MathF.Pow(Math.Max(skillLevel, 15f), SkillSettings.Current.SkillIncreaseExponent);
|
||||
IncreaseSkillLevel(skillIdentifier, Math.Min(baseGain / skillDivider, maxGain), gainedFromAbility);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Increase the skill by a specific amount. Talents may affect the actual, final skill increase.
|
||||
/// </summary>
|
||||
public void IncreaseSkillLevel(Identifier skillIdentifier, float increase, bool gainedFromAbility = false)
|
||||
{
|
||||
if (Job == null || (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) || Character == null) { return; }
|
||||
@@ -1222,9 +1237,7 @@ namespace Barotrauma
|
||||
{
|
||||
increase *= SkillSettings.Current.AssistantSkillIncreaseMultiplier;
|
||||
}
|
||||
|
||||
increase *= 1f + Character.GetStatValue(StatTypes.SkillGainSpeed);
|
||||
|
||||
increase = GetSkillSpecificGain(increase, skillIdentifier);
|
||||
|
||||
float prevLevel = Job.GetSkillLevel(skillIdentifier);
|
||||
@@ -1902,13 +1915,30 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the combined stat value of the identifier "all" and the specified identifier.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The "all" identifier works like the "any" identifier in outpost modules where it doesn't literally mean everything but
|
||||
/// is an unique identifier that indicates that it should target everything. For example if we wanted to make a talent
|
||||
/// that increases the fabrication quality of every single item we could use something like:
|
||||
/// <CharacterAbilityGivePermanentStat stattype="IncreaseFabricationQuality" statidentifier="all" />
|
||||
/// (Granted IncreaseFabricationQuality doesn't support the "all" identifier so if we need this in vanilla it needs to be implemented in code)
|
||||
/// </remarks>
|
||||
public float GetSavedStatValueWithAll(StatTypes statType, Identifier statIdentifier)
|
||||
=> GetSavedStatValue(statType, Tags.StatIdentifierTargetAll) +
|
||||
GetSavedStatValue(statType, statIdentifier);
|
||||
|
||||
public float GetSavedStatValueWithBotsInMp(StatTypes statType, Identifier statIdentifier)
|
||||
=> GetSavedStatValueWithBotsInMp(statType, statIdentifier, GameSession.GetSessionCrewCharacters(CharacterType.Bot));
|
||||
|
||||
public float GetSavedStatValueWithBotsInMp(StatTypes statType, Identifier statIdentifier, IReadOnlyCollection<Character> bots)
|
||||
{
|
||||
float statValue = GetSavedStatValue(statType, statIdentifier);
|
||||
|
||||
if (GameMain.NetworkMember is null) { return statValue; }
|
||||
|
||||
foreach (Character bot in GameSession.GetSessionCrewCharacters(CharacterType.Bot))
|
||||
foreach (Character bot in bots)
|
||||
{
|
||||
int botStatValue = (int)bot.Info.GetSavedStatValue(statType, statIdentifier);
|
||||
statValue = Math.Max(statValue, botStatValue);
|
||||
|
||||
Reference in New Issue
Block a user