v1.4.4.1 (Blood in the Water Update)
This commit is contained in:
@@ -1,22 +1,35 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
/// <summary>
|
||||
/// Gives an affliction to a specific character.
|
||||
/// </summary>
|
||||
class AfflictionAction : EventAction
|
||||
{
|
||||
[Serialize("", IsPropertySaveable.Yes)]
|
||||
[Serialize("", IsPropertySaveable.Yes, description: "Identifier of the affliction.")]
|
||||
public Identifier Affliction { get; set; }
|
||||
|
||||
[Serialize(0.0f, IsPropertySaveable.Yes)]
|
||||
[Serialize(0.0f, IsPropertySaveable.Yes, description: "Strength of the affliction.")]
|
||||
public float Strength { get; set; }
|
||||
|
||||
[Serialize(LimbType.None, IsPropertySaveable.Yes)]
|
||||
[Serialize(LimbType.None, IsPropertySaveable.Yes, description: "Type of the limb(s) to apply the affliction on. Only valid if the affliction is limb-specific.")]
|
||||
public LimbType LimbType { get; set; }
|
||||
|
||||
[Serialize("", IsPropertySaveable.Yes)]
|
||||
[Serialize("", IsPropertySaveable.Yes, description: "Tag of the character to apply the affliction on.")]
|
||||
public Identifier TargetTag { get; set; }
|
||||
|
||||
public AfflictionAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element) { }
|
||||
[Serialize(false, IsPropertySaveable.Yes, description: "Should the strength be multiplied by the maximum vitality of the target?")]
|
||||
public bool MultiplyByMaxVitality { get; set; }
|
||||
|
||||
public AfflictionAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element)
|
||||
{
|
||||
if (Affliction.IsEmpty)
|
||||
{
|
||||
DebugConsole.ThrowError($"Error in {nameof(AfflictionAction)}: affliction not defined (use the attribute \"{nameof(Affliction)}\").",
|
||||
contentPackage: element.ContentPackage);
|
||||
}
|
||||
}
|
||||
|
||||
private bool isFinished = false;
|
||||
|
||||
@@ -40,27 +53,32 @@ namespace Barotrauma
|
||||
{
|
||||
if (target != null && target is Character character)
|
||||
{
|
||||
float strength = Strength;
|
||||
if (MultiplyByMaxVitality)
|
||||
{
|
||||
strength *= character.MaxVitality;
|
||||
}
|
||||
if (LimbType != LimbType.None)
|
||||
{
|
||||
var limb = character.AnimController.GetLimb(LimbType);
|
||||
if (Strength > 0.0f)
|
||||
if (strength > 0.0f)
|
||||
{
|
||||
character.CharacterHealth.ApplyAffliction(limb, afflictionPrefab.Instantiate(Strength), ignoreUnkillability: true);
|
||||
character.CharacterHealth.ApplyAffliction(limb, afflictionPrefab.Instantiate(strength), ignoreUnkillability: true);
|
||||
}
|
||||
else if (Strength < 0.0f)
|
||||
else if (strength < 0.0f)
|
||||
{
|
||||
character.CharacterHealth.ReduceAfflictionOnLimb(limb, Affliction, -Strength);
|
||||
character.CharacterHealth.ReduceAfflictionOnLimb(limb, Affliction, -strength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Strength > 0.0f)
|
||||
if (strength > 0.0f)
|
||||
{
|
||||
character.CharacterHealth.ApplyAffliction(null, afflictionPrefab.Instantiate(Strength), ignoreUnkillability: true);
|
||||
character.CharacterHealth.ApplyAffliction(null, afflictionPrefab.Instantiate(strength), ignoreUnkillability: true);
|
||||
}
|
||||
else if (Strength < 0.0f)
|
||||
else if (strength < 0.0f)
|
||||
{
|
||||
character.CharacterHealth.ReduceAfflictionOnAllLimbs(Affliction, -Strength);
|
||||
character.CharacterHealth.ReduceAfflictionOnAllLimbs(Affliction, -strength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user