1 using Microsoft.Xna.Framework;
3 using System.Collections.Generic;
23 StrikingPowerMultiplier,
24 StrikingSpeedMultiplier,
28 private readonly Dictionary<StatType, float> statValues =
new Dictionary<StatType, float>();
30 private int qualityLevel;
35 get {
return qualityLevel; }
38 if (value == qualityLevel) {
return; }
41 qualityLevel = MathHelper.Clamp(value, 0,
MaxQuality);
44 if (wasInFullCondition && statValues.ContainsKey(
StatType.Condition))
53 foreach (XElement subElement
in element.Elements())
55 switch (subElement.Name.ToString().ToLower())
60 string statTypeString = subElement.GetAttributeString(
"stattype",
"");
61 if (!Enum.TryParse(statTypeString,
true, out
StatType statType))
64 contentPackage: element.ContentPackage);
66 float statValue = subElement.GetAttributeFloat(
"value", 0f);
67 statValues.TryAdd(statType, statValue);
75 if (!statValues.ContainsKey(statType)) {
return 0.0f; }
76 return statValues[statType] * qualityLevel;
85 if (submarine?.Info ==
null || level ==
null || submarine.
Info.
Type ==
SubmarineType.Player) {
return 0; }
93 difficultyFactor = 0.0f;
96 return ToolBox.SelectWeightedRandom(Enumerable.Range(0,
MaxQuality + 1), q => GetCommonness(q, difficultyFactor), randSync);
98 static float GetCommonness(
int quality,
float difficultyFactor)
100 return quality
switch
103 1 => MathHelper.Lerp(0.0f, 1f, difficultyFactor),
104 2 => MathHelper.Lerp(0.0f, 1f, Math.Max(difficultyFactor-0.15f, 0f)),
105 3 => MathHelper.Lerp(0.0f, 1f, Math.Max(difficultyFactor-0.35f, 0f)),
float ActualMaxDifficulty
void RecalculateConditionValues()
Recalculates the item's maximum condition, condition percentage and whether it's in full condition....
The base class for components holding the different functionalities of the item
static int GetSpawnedItemQuality(Submarine submarine, Level level, Rand.RandSync randSync=Rand.RandSync.ServerAndClient)
Get a random quality for an item spawning in some sub, taking into account the type of the submarine ...
float GetValue(StatType statType)
Quality(Item item, ContentXElement element)
readonly LevelData LevelData
readonly CharacterTeamType OutpostTeam
readonly Identifier Identifier
@ RepairToolStructureRepairMultiplier
Increases the repair speed of repair tools that fix submarine walls by a percentage.
@ RepairToolDeattachTimeMultiplier
Increase the detach speed of items like minerals that require a tool to detach from the wall by a per...
@ RepairSpeed
Increases the repair speed of the character by a percentage.
@ RepairToolStructureDamageMultiplier
Increases the wall damage of tools that destroy submarine walls like plasma cutter by a percentage.