Client LuaCsForBarotrauma
CharacterAbilityTandemFire.cs
1
using
Microsoft.Xna.Framework;
2
3
namespace
Barotrauma.Abilities
4
{
5
class
CharacterAbilityTandemFire
:
CharacterAbilityApplyStatusEffectsToNearestAlly
6
{
7
// this should just be its own class, misleading to inherit here
8
private
readonly Identifier tag;
9
public
CharacterAbilityTandemFire
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
10
{
11
tag = abilityElement.
GetAttributeIdentifier
(
"tag"
, Identifier.Empty);
12
}
13
14
protected
override
void
ApplyEffect
()
15
{
16
if
(!SelectedItemHasTag(
Character
, tag)) {
return
; }
17
18
Character
closestCharacter =
null
;
19
float
closestDistance =
squaredMaxDistance
;
20
21
foreach
(
Character
crewCharacter
in
Character
.
GetFriendlyCrew
(
Character
))
22
{
23
if
(crewCharacter !=
Character
&&
24
Vector2.DistanceSquared(
Character
.
WorldPosition
, crewCharacter.
WorldPosition
) is
float
tempDistance && tempDistance < closestDistance &&
25
SelectedItemHasTag(crewCharacter, tag))
26
{
27
closestCharacter = crewCharacter;
28
closestDistance = tempDistance;
29
}
30
}
31
32
if
(closestCharacter ==
null
) {
return
; }
33
34
if
(closestDistance <
squaredMaxDistance
)
35
{
36
ApplyEffectSpecific
(
Character
);
37
ApplyEffectSpecific
(closestCharacter);
38
}
39
40
static
bool
SelectedItemHasTag(
Character
character, Identifier tag) =>
41
(character.
SelectedItem
!=
null
&& character.
SelectedItem
.
HasTag
(tag)) ||
42
(character.
SelectedSecondaryItem
!=
null
&& character.
SelectedSecondaryItem
.
HasTag
(tag));
43
}
44
}
45
}
Barotrauma.Abilities.CharacterAbilityApplyStatusEffects.ApplyEffectSpecific
void ApplyEffectSpecific(Character targetCharacter, Limb targetLimb=null)
Definition:
CharacterAbilityApplyStatusEffects.cs:32
Barotrauma.Abilities.CharacterAbilityApplyStatusEffectsToNearestAlly
Definition:
CharacterAbilityApplyStatusEffectsToNearestAlly.cs:7
Barotrauma.Abilities.CharacterAbilityApplyStatusEffectsToNearestAlly.squaredMaxDistance
float squaredMaxDistance
Definition:
CharacterAbilityApplyStatusEffectsToNearestAlly.cs:8
Barotrauma.Abilities.CharacterAbilityGroup
Definition:
CharacterAbilityGroup.cs:9
Barotrauma.Abilities.CharacterAbilityTandemFire
Definition:
CharacterAbilityTandemFire.cs:6
Barotrauma.Abilities.CharacterAbilityTandemFire.ApplyEffect
override void ApplyEffect()
Definition:
CharacterAbilityTandemFire.cs:14
Barotrauma.Abilities.CharacterAbilityTandemFire.CharacterAbilityTandemFire
CharacterAbilityTandemFire(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityTandemFire.cs:9
Barotrauma.Character
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:32
Barotrauma.Character.GetFriendlyCrew
static IEnumerable< Character > GetFriendlyCrew(Character character)
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:5738
Barotrauma.Character.SelectedItem
Item????????? SelectedItem
The primary selected item. It can be any device that character interacts with. This excludes items li...
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:1060
Barotrauma.Character.SelectedSecondaryItem
Item SelectedSecondaryItem
The secondary selected item. It's an item other than a device (see SelectedItem), e....
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:1114
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeIdentifier
Identifier GetAttributeIdentifier(string key, string def)
Barotrauma.Entity.WorldPosition
virtual Vector2 WorldPosition
Definition:
Entity.cs:49
Barotrauma.Item.HasTag
bool HasTag(Identifier tag)
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:1873
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
CustomAbilities
CharacterAbilityTandemFire.cs
Generated by
1.9.1