(f2e516dfe) v0.9.3.2
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Barotrauma
|
||||
public Entity Entity;
|
||||
public List<ISerializableEntity> Targets;
|
||||
public float Timer;
|
||||
public Character User;
|
||||
}
|
||||
|
||||
partial class StatusEffect
|
||||
@@ -432,7 +433,6 @@ namespace Barotrauma
|
||||
case PropertyConditional.Comparison.Or:
|
||||
foreach (ISerializableEntity target in targets)
|
||||
{
|
||||
if (target == null || target.SerializableProperties == null) { continue; }
|
||||
foreach (PropertyConditional pc in propertyConditionals)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(pc.TargetItemComponentName))
|
||||
@@ -449,7 +449,6 @@ namespace Barotrauma
|
||||
case PropertyConditional.Comparison.And:
|
||||
foreach (ISerializableEntity target in targets)
|
||||
{
|
||||
if (target == null || target.SerializableProperties == null) { continue; }
|
||||
foreach (PropertyConditional pc in propertyConditionals)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(pc.TargetItemComponentName))
|
||||
@@ -516,6 +515,7 @@ namespace Barotrauma
|
||||
if (existingEffect != null)
|
||||
{
|
||||
existingEffect.Timer = Math.Max(existingEffect.Timer, duration);
|
||||
existingEffect.User = user;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -554,6 +554,7 @@ namespace Barotrauma
|
||||
if (existingEffect != null)
|
||||
{
|
||||
existingEffect.Timer = Math.Max(existingEffect.Timer, duration);
|
||||
existingEffect.User = user;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -607,7 +608,8 @@ namespace Barotrauma
|
||||
Parent = this,
|
||||
Timer = duration,
|
||||
Entity = entity,
|
||||
Targets = targets
|
||||
Targets = targets,
|
||||
User = user
|
||||
};
|
||||
|
||||
DurationList.Add(element);
|
||||
@@ -641,6 +643,7 @@ namespace Barotrauma
|
||||
|
||||
if (target is Character character)
|
||||
{
|
||||
if (character.Removed) { continue; }
|
||||
character.LastDamageSource = entity;
|
||||
foreach (Limb limb in character.AnimController.Limbs)
|
||||
{
|
||||
@@ -651,6 +654,7 @@ namespace Barotrauma
|
||||
}
|
||||
else if (target is Limb limb)
|
||||
{
|
||||
if (limb.character.Removed) { continue; }
|
||||
limb.character.DamageLimb(entity.WorldPosition, limb, new List<Affliction>() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: affliction.Source);
|
||||
}
|
||||
}
|
||||
@@ -669,7 +673,7 @@ namespace Barotrauma
|
||||
targetLimb = limb;
|
||||
targetCharacter = limb.character;
|
||||
}
|
||||
if (targetCharacter != null)
|
||||
if (targetCharacter != null && !targetCharacter.Removed)
|
||||
{
|
||||
float prevVitality = targetCharacter.Vitality;
|
||||
targetCharacter.CharacterHealth.ReduceAffliction(targetLimb, reduceAffliction.First, reduceAmount);
|
||||
@@ -827,11 +831,13 @@ namespace Barotrauma
|
||||
|
||||
if (target is Character character)
|
||||
{
|
||||
character.AddDamage(character.WorldPosition, new List<Affliction>() { multipliedAffliction }, stun: 0.0f, playSound: false);
|
||||
if (character.Removed) { continue; }
|
||||
character.AddDamage(character.WorldPosition, new List<Affliction>() { multipliedAffliction }, stun: 0.0f, playSound: false, attacker: element.User);
|
||||
}
|
||||
else if (target is Limb limb)
|
||||
{
|
||||
limb.character.DamageLimb(limb.WorldPosition, limb, new List<Affliction>() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f);
|
||||
if (limb.character.Removed) { continue; }
|
||||
limb.character.DamageLimb(limb.WorldPosition, limb, new List<Affliction>() { multipliedAffliction }, stun: 0.0f, playSound: false, attackImpulse: 0.0f, attacker: element.User);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,12 +854,12 @@ namespace Barotrauma
|
||||
targetLimb = limb;
|
||||
targetCharacter = limb.character;
|
||||
}
|
||||
if (targetCharacter != null)
|
||||
if (targetCharacter != null && !targetCharacter.Removed)
|
||||
{
|
||||
float prevVitality = targetCharacter.Vitality;
|
||||
targetCharacter.CharacterHealth.ReduceAffliction(targetLimb, reduceAffliction.First, reduceAffliction.Second * deltaTime);
|
||||
#if SERVER
|
||||
GameMain.Server.KarmaManager.OnCharacterHealthChanged(targetCharacter, element.Parent.user, prevVitality - targetCharacter.Vitality);
|
||||
GameMain.Server.KarmaManager.OnCharacterHealthChanged(targetCharacter, element.User, prevVitality - targetCharacter.Vitality);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -861,7 +867,7 @@ namespace Barotrauma
|
||||
|
||||
element.Timer -= deltaTime;
|
||||
|
||||
if (element.Timer > 0.0f) continue;
|
||||
if (element.Timer > 0.0f) { continue; }
|
||||
DurationList.Remove(element);
|
||||
}
|
||||
}
|
||||
@@ -873,20 +879,17 @@ namespace Barotrauma
|
||||
CoroutineManager.StopCoroutines("statuseffect");
|
||||
DelayedEffect.DelayList.Clear();
|
||||
DurationList.Clear();
|
||||
#if CLIENT
|
||||
//ActiveLoopingSounds.Clear();
|
||||
#endif
|
||||
}
|
||||
|
||||
public void AddTag(string tag)
|
||||
{
|
||||
if (tags.Contains(tag)) return;
|
||||
if (tags.Contains(tag)) { return; }
|
||||
tags.Add(tag);
|
||||
}
|
||||
|
||||
public bool HasTag(string tag)
|
||||
{
|
||||
if (tag == null) return true;
|
||||
if (tag == null) { return true; }
|
||||
|
||||
return (tags.Contains(tag) || tags.Contains(tag.ToLowerInvariant()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user