(6eeea9b7c) v0.9.10.0.0
This commit is contained in:
@@ -81,7 +81,7 @@ namespace Barotrauma
|
||||
|
||||
if (element.StartTimer > 0.0f) { continue; }
|
||||
|
||||
element.Parent.Apply(1.0f, element.Entity, element.Targets, element.WorldPosition);
|
||||
element.Parent.Apply(deltaTime, element.Entity, element.Targets, element.WorldPosition);
|
||||
DelayList.Remove(element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,44 +193,64 @@ namespace Barotrauma
|
||||
string[] readTags = valStr.Split(',');
|
||||
int matches = 0;
|
||||
foreach (string tag in readTags)
|
||||
if (target is Item item && item.HasTag(tag)) matches++;
|
||||
|
||||
{
|
||||
if (target is Item item && item.HasTag(tag))
|
||||
{
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
//If operator is == then it needs to match everything, otherwise if its != there must be zero matches.
|
||||
return Operator == OperatorType.Equals ? matches >= readTags.Length : matches <= 0;
|
||||
}
|
||||
case ConditionType.HasStatusTag:
|
||||
if (target == null) { return Operator == OperatorType.NotEquals; }
|
||||
|
||||
List<DurationListElement> durations = StatusEffect.DurationList.FindAll(d => d.Targets.Contains(target));
|
||||
List<DelayedListElement> delays = DelayedEffect.DelayList.FindAll(d => d.Targets.Contains(target));
|
||||
|
||||
bool success = false;
|
||||
if (durations.Count > 0 || delays.Count > 0)
|
||||
if (StatusEffect.DurationList.Any(d => d.Targets.Contains(target)) || DelayedEffect.DelayList.Any(d => d.Targets.Contains(target)))
|
||||
{
|
||||
string[] readTags = valStr.Split(',');
|
||||
foreach (DurationListElement duration in durations)
|
||||
foreach (DurationListElement duration in StatusEffect.DurationList)
|
||||
{
|
||||
if (!duration.Targets.Contains(target)) { continue; }
|
||||
int matches = 0;
|
||||
foreach (string tag in readTags)
|
||||
if (duration.Parent.HasTag(tag)) matches++;
|
||||
|
||||
{
|
||||
if (duration.Parent.HasTag(tag))
|
||||
{
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
success = Operator == OperatorType.Equals ? matches >= readTags.Length : matches <= 0;
|
||||
if (cancelStatusEffect > 0 && success)
|
||||
{
|
||||
StatusEffect.DurationList.Remove(duration);
|
||||
if (cancelStatusEffect != 2) //cancelStatusEffect 1 = only cancel once, cancelStatusEffect 2 = cancel all of matching tags
|
||||
}
|
||||
if (cancelStatusEffect != 2)
|
||||
{
|
||||
//cancelStatusEffect 1 = only cancel once, cancelStatusEffect 2 = cancel all of matching tags
|
||||
return success;
|
||||
}
|
||||
}
|
||||
foreach (DelayedListElement delay in delays)
|
||||
foreach (DelayedListElement delay in DelayedEffect.DelayList)
|
||||
{
|
||||
if (!delay.Targets.Contains(target)) { continue; }
|
||||
int matches = 0;
|
||||
foreach (string tag in readTags)
|
||||
if (delay.Parent.HasTag(tag)) matches++;
|
||||
|
||||
{
|
||||
if (delay.Parent.HasTag(tag))
|
||||
{
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
success = Operator == OperatorType.Equals ? matches >= readTags.Length : matches <= 0;
|
||||
if (cancelStatusEffect > 0 && success)
|
||||
{
|
||||
DelayedEffect.DelayList.Remove(delay);
|
||||
if (cancelStatusEffect != 2) //ditto
|
||||
}
|
||||
if (cancelStatusEffect != 2)
|
||||
{
|
||||
//ditto
|
||||
return success;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Operator == OperatorType.NotEquals)
|
||||
@@ -242,7 +262,7 @@ namespace Barotrauma
|
||||
case ConditionType.SpeciesName:
|
||||
if (target == null) { return Operator == OperatorType.NotEquals; }
|
||||
if (!(target is Character targetCharacter)) { return false; }
|
||||
return (Operator == OperatorType.Equals) == (targetCharacter.SpeciesName == valStr);
|
||||
return (Operator == OperatorType.Equals) == targetCharacter.SpeciesName.Equals(valStr, StringComparison.OrdinalIgnoreCase);
|
||||
case ConditionType.EntityType:
|
||||
switch (valStr)
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
class CharacterSpawnInfo : ISerializableEntity
|
||||
public class CharacterSpawnInfo : ISerializableEntity
|
||||
{
|
||||
public string Name => $"Character Spawn Info ({SpeciesName})";
|
||||
public Dictionary<string, SerializableProperty> SerializableProperties { get; set; }
|
||||
@@ -188,6 +188,11 @@ namespace Barotrauma
|
||||
private set;
|
||||
}
|
||||
|
||||
public IEnumerable<CharacterSpawnInfo> SpawnCharacters
|
||||
{
|
||||
get { return spawnCharacters; }
|
||||
}
|
||||
|
||||
private readonly List<Pair<string, float>> reduceAffliction;
|
||||
|
||||
//only applicable if targeting NearbyCharacters or NearbyItems
|
||||
@@ -313,7 +318,7 @@ namespace Barotrauma
|
||||
break;
|
||||
case "conditionalcomparison":
|
||||
case "comparison":
|
||||
if (!Enum.TryParse(attribute.Value, out conditionalComparison))
|
||||
if (!Enum.TryParse(attribute.Value, ignoreCase: true, out conditionalComparison))
|
||||
{
|
||||
DebugConsole.ThrowError("Invalid conditional comparison type \"" + attribute.Value + "\" in StatusEffect (" + parentDebugName + ")");
|
||||
}
|
||||
@@ -688,7 +693,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Vector2 position = worldPosition ?? (entity.Removed ? Vector2.Zero : entity.WorldPosition);
|
||||
if (targetLimbs?.FirstOrDefault(l => l != LimbType.None) is LimbType l)
|
||||
if (worldPosition == null && targetLimbs?.FirstOrDefault(l => l != LimbType.None) is LimbType l)
|
||||
{
|
||||
if (entity is Character c)
|
||||
{
|
||||
@@ -745,13 +750,20 @@ namespace Barotrauma
|
||||
{
|
||||
if (target is Entity targetEntity)
|
||||
{
|
||||
if (targetEntity.Removed) continue;
|
||||
if (targetEntity.Removed) { continue; }
|
||||
}
|
||||
|
||||
if (target is Limb limb)
|
||||
{
|
||||
position = limb.WorldPosition + Offset;
|
||||
}
|
||||
|
||||
for (int i = 0; i < propertyNames.Length; i++)
|
||||
{
|
||||
if (target == null || target.SerializableProperties == null ||
|
||||
!target.SerializableProperties.TryGetValue(propertyNames[i], out SerializableProperty property)) continue;
|
||||
if (target == null || target.SerializableProperties == null || !target.SerializableProperties.TryGetValue(propertyNames[i], out SerializableProperty property))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ApplyToProperty(target, property, propertyEffects[i], deltaTime);
|
||||
}
|
||||
}
|
||||
@@ -767,7 +779,10 @@ namespace Barotrauma
|
||||
foreach (Affliction affliction in Afflictions)
|
||||
{
|
||||
Affliction multipliedAffliction = affliction;
|
||||
if (!disableDeltaTime) multipliedAffliction = affliction.CreateMultiplied(deltaTime);
|
||||
if (!disableDeltaTime)
|
||||
{
|
||||
multipliedAffliction = affliction.CreateMultiplied(deltaTime);
|
||||
}
|
||||
|
||||
if (target is Character character)
|
||||
{
|
||||
@@ -775,18 +790,21 @@ namespace Barotrauma
|
||||
character.LastDamageSource = entity;
|
||||
foreach (Limb limb in character.AnimController.Limbs)
|
||||
{
|
||||
if (limb.Removed) { continue; }
|
||||
if (limb.IsSevered) { continue; }
|
||||
if (targetLimbs != null && !targetLimbs.Contains(limb.type)) { continue; }
|
||||
limb.character.DamageLimb(position, limb, multipliedAffliction.ToEnumerable(), stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
|
||||
limb.character.TrySeverLimbJoints(limb, SeverLimbsProbability);
|
||||
AttackResult result = limb.character.DamageLimb(position, limb, multipliedAffliction.ToEnumerable(), stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
|
||||
limb.character.TrySeverLimbJoints(limb, SeverLimbsProbability, result.Damage, allowBeheading: true);
|
||||
//only apply non-limb-specific afflictions to the first limb
|
||||
if (!affliction.Prefab.LimbSpecific) { break; }
|
||||
}
|
||||
}
|
||||
else if (target is Limb limb)
|
||||
{
|
||||
if (limb.IsSevered) { continue; }
|
||||
if (limb.character.Removed || limb.Removed) { continue; }
|
||||
limb.character.DamageLimb(position, limb, multipliedAffliction.ToEnumerable(), stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
|
||||
limb.character.TrySeverLimbJoints(limb, SeverLimbsProbability);
|
||||
AttackResult result = limb.character.DamageLimb(position, limb, multipliedAffliction.ToEnumerable(), stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
|
||||
limb.character.TrySeverLimbJoints(limb, SeverLimbsProbability, result.Damage, allowBeheading: true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user