Build 0.20.4.0
This commit is contained in:
@@ -24,7 +24,8 @@ namespace Barotrauma
|
||||
HasSpecifierTag,
|
||||
Affliction,
|
||||
EntityType,
|
||||
LimbType
|
||||
LimbType,
|
||||
SkillRequirement
|
||||
}
|
||||
|
||||
public enum Comparison
|
||||
@@ -73,6 +74,7 @@ namespace Barotrauma
|
||||
case "targetcontainer":
|
||||
case "targetgrandparent":
|
||||
case "targetcontaineditem":
|
||||
case "skillrequirement":
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
@@ -110,6 +112,11 @@ namespace Barotrauma
|
||||
{
|
||||
Type = ConditionType.Uncertain;
|
||||
}
|
||||
|
||||
if (attribute.Parent.GetAttributeBool("skillrequirement", false))
|
||||
{
|
||||
Type = ConditionType.SkillRequirement;
|
||||
}
|
||||
|
||||
AttributeValue = valueString;
|
||||
SplitAttributeValue = valueString.Split(',');
|
||||
@@ -305,25 +312,20 @@ namespace Barotrauma
|
||||
if (health == null) { return false; }
|
||||
var affliction = health.GetAffliction(AttributeName.ToIdentifier());
|
||||
float afflictionStrength = affliction == null ? 0.0f : affliction.Strength;
|
||||
if (FloatValue.HasValue)
|
||||
{
|
||||
float value = FloatValue.Value;
|
||||
switch (Operator)
|
||||
{
|
||||
case OperatorType.Equals:
|
||||
return afflictionStrength == value;
|
||||
case OperatorType.GreaterThan:
|
||||
return afflictionStrength > value;
|
||||
case OperatorType.GreaterThanEquals:
|
||||
return afflictionStrength >= value;
|
||||
case OperatorType.LessThan:
|
||||
return afflictionStrength < value;
|
||||
case OperatorType.LessThanEquals:
|
||||
return afflictionStrength <= value;
|
||||
case OperatorType.NotEquals:
|
||||
return afflictionStrength != value;
|
||||
}
|
||||
}
|
||||
|
||||
return ValueMatchesRequirement(afflictionStrength);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case ConditionType.SkillRequirement:
|
||||
{
|
||||
if (target == null) { return Operator == OperatorType.NotEquals; }
|
||||
|
||||
if (target is Character targetChar)
|
||||
{
|
||||
float skillLevel = targetChar.GetSkillLevel(AttributeName.ToIdentifier());
|
||||
|
||||
return ValueMatchesRequirement(skillLevel);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -332,6 +334,30 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValueMatchesRequirement(float testedValue)
|
||||
{
|
||||
if (FloatValue.HasValue)
|
||||
{
|
||||
float value = FloatValue.Value;
|
||||
switch (Operator)
|
||||
{
|
||||
case OperatorType.Equals:
|
||||
return testedValue == value;
|
||||
case OperatorType.GreaterThan:
|
||||
return testedValue > value;
|
||||
case OperatorType.GreaterThanEquals:
|
||||
return testedValue >= value;
|
||||
case OperatorType.LessThan:
|
||||
return testedValue < value;
|
||||
case OperatorType.LessThanEquals:
|
||||
return testedValue <= value;
|
||||
case OperatorType.NotEquals:
|
||||
return testedValue != value;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool MatchesTagCondition(ISerializableEntity target)
|
||||
{
|
||||
if (!(target is Item item)) { return Operator == OperatorType.NotEquals; }
|
||||
|
||||
@@ -877,10 +877,9 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public IReadOnlyList<ISerializableEntity> GetNearbyTargets(Vector2 worldPosition, List<ISerializableEntity> targets = null)
|
||||
public void AddNearbyTargets(Vector2 worldPosition, List<ISerializableEntity> targets)
|
||||
{
|
||||
targets ??= new List<ISerializableEntity>();
|
||||
if (Range <= 0.0f) { return targets; }
|
||||
if (Range <= 0.0f) { return; }
|
||||
if (HasTargetType(TargetType.NearbyCharacters))
|
||||
{
|
||||
foreach (Character c in Character.CharacterList)
|
||||
@@ -917,7 +916,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
return targets;
|
||||
|
||||
bool CheckDistance(ISpatialEntity e)
|
||||
{
|
||||
@@ -1362,7 +1360,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (breakLimb)
|
||||
{
|
||||
targetLimb.character.TrySeverLimbJoints(targetLimb, severLimbsProbability: 1, damage: -1, allowBeheading: true, attacker: user);
|
||||
targetLimb.character.TrySeverLimbJoints(targetLimb, severLimbsProbability: 1, damage: -1, allowBeheading: true, ignoreSeveranceProbabilityModifier: true, attacker: user);
|
||||
}
|
||||
if (hideLimb)
|
||||
{
|
||||
@@ -2163,7 +2161,7 @@ namespace Barotrauma
|
||||
if (result.Afflictions != null && result.Afflictions.Any(a => a.Prefab == limbAffliction.Prefab) &&
|
||||
(!affliction.Prefab.LimbSpecific || limb.character.CharacterHealth.GetAfflictionLimb(affliction) == limb))
|
||||
{
|
||||
if (type == ActionType.OnUse)
|
||||
if (type == ActionType.OnUse || type == ActionType.OnSuccess)
|
||||
{
|
||||
limbAffliction.AppliedAsSuccessfulTreatmentTime = Timing.TotalTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user