Client LuaCsForBarotrauma
CharacterAbilityModifyAttackData.cs
1 using System.Collections.Generic;
2 
3 namespace Barotrauma.Abilities
4 {
6  {
7  private readonly List<Affliction> afflictions = new List<Affliction>();
8 
9  private readonly float addedDamageMultiplier;
10  private readonly float addedPenetration;
11  private readonly bool implode;
12 
13  public CharacterAbilityModifyAttackData(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
14  {
15  if (abilityElement.GetChildElement("afflictions") is ContentXElement afflictionElements)
16  {
17  afflictions = CharacterAbilityGroup.ParseAfflictions(CharacterTalent, afflictionElements);
18  }
19  addedDamageMultiplier = abilityElement.GetAttributeFloat("addeddamagemultiplier", 0f);
20  addedPenetration = abilityElement.GetAttributeFloat("addedpenetration", 0f);
21  implode = abilityElement.GetAttributeBool("implode", false);
22  }
23 
24  protected override void ApplyEffect(AbilityObject abilityObject)
25  {
26  if (abilityObject is AbilityAttackData attackData)
27  {
28  if (attackData.Afflictions == null)
29  {
30  attackData.Afflictions = afflictions;
31  }
32  else
33  {
34  attackData.Afflictions.AddRange(afflictions);
35  }
36  attackData.DamageMultiplier += addedDamageMultiplier;
37  attackData.AddedPenetration += addedPenetration;
38 
39  attackData.ShouldImplode = implode;
40  }
41  else
42  {
44  }
45  }
46  }
47 }
static List< Affliction > ParseAfflictions(CharacterTalent characterTalent, ContentXElement afflictionElements)
CharacterAbilityModifyAttackData(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
float GetAttributeFloat(string key, float def)
ContentXElement? GetChildElement(string name)
bool GetAttributeBool(string key, bool def)