Client LuaCsForBarotrauma
AbilityConditionIsAiming.cs
1
using
Barotrauma
.
Items
.
Components
;
2
using
System.Xml.Linq;
3
4
namespace
Barotrauma.Abilities
5
{
6
class
AbilityConditionIsAiming
:
AbilityConditionDataless
7
{
8
private
enum
WeaponType
9
{
10
Any
= 0,
11
Melee = 1,
12
Ranged = 2
13
};
14
15
private
readonly
bool
hittingCountsAsAiming;
16
17
private
readonly WeaponType weapontype;
18
public
AbilityConditionIsAiming
(
CharacterTalent
characterTalent
,
ContentXElement
conditionElement) : base(
characterTalent
, conditionElement)
19
{
20
hittingCountsAsAiming = conditionElement.
GetAttributeBool
(
"hittingcountsasaiming"
,
false
);
21
switch
(conditionElement.
GetAttributeString
(
"weapontype"
,
""
))
22
{
23
case
"melee"
:
24
weapontype = WeaponType.Melee;
25
break
;
26
case
"ranged"
:
27
weapontype = WeaponType.Ranged;
28
break
;
29
}
30
}
31
32
protected
override
bool
MatchesConditionSpecific
()
33
{
34
if
(
character
.
AnimController
is
HumanoidAnimController
animController)
35
{
36
foreach
(
Item
item
in
character
.
HeldItems
)
37
{
38
switch
(weapontype)
39
{
40
case
WeaponType.Melee:
41
var meleeWeapon = item.GetComponent<
MeleeWeapon
>();
42
if
(meleeWeapon !=
null
)
43
{
44
if
(animController.IsAimingMelee || (meleeWeapon.Hitting && hittingCountsAsAiming)) {
return
true
; }
45
}
46
break
;
47
case
WeaponType.Ranged:
48
if
(animController.IsAiming && item.GetComponent<
RangedWeapon
>() !=
null
) {
return
true
; }
49
break
;
50
default
:
51
if
(animController.IsAiming || animController.IsAimingMelee) {
return
true
; }
52
break
;
53
}
54
}
55
}
56
57
return
false
;
58
}
59
}
60
}
Barotrauma.Abilities.AbilityConditionDataless
Definition:
AbilityConditionDataless.cs:4
Barotrauma.Abilities.AbilityCondition.character
Character character
Definition:
AbilityCondition.cs:9
Barotrauma.Abilities.AbilityCondition.characterTalent
CharacterTalent characterTalent
Definition:
AbilityCondition.cs:8
Barotrauma.Abilities.AbilityConditionIsAiming
Definition:
AbilityConditionIsAiming.cs:7
Barotrauma.Abilities.AbilityConditionIsAiming.MatchesConditionSpecific
override bool MatchesConditionSpecific()
Definition:
AbilityConditionIsAiming.cs:32
Barotrauma.Abilities.AbilityConditionIsAiming.AbilityConditionIsAiming
AbilityConditionIsAiming(CharacterTalent characterTalent, ContentXElement conditionElement)
Definition:
AbilityConditionIsAiming.cs:18
Barotrauma.Character.AnimController
readonly AnimController AnimController
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:406
Barotrauma.Character.HeldItems
IEnumerable< Item >?? HeldItems
Items the character has in their hand slots. Doesn't return nulls and only returns items held in both...
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:808
Barotrauma.CharacterTalent
Definition:
CharacterTalent.cs:8
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeString
string? GetAttributeString(string key, string? def)
Barotrauma.ContentXElement.GetAttributeBool
bool GetAttributeBool(string key, bool def)
Barotrauma.HumanoidAnimController
Definition:
HumanoidAnimController.cs:12
Barotrauma.Item
Definition:
BarotraumaShared/SharedSource/Items/Item.cs:26
Barotrauma.Items.Components.MeleeWeapon
Definition:
MeleeWeapon.cs:13
Barotrauma.Items.Components.RangedWeapon
Definition:
BarotraumaShared/SharedSource/Items/Components/Holdable/RangedWeapon.cs:13
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma.Items.Components
Definition:
BarotraumaShared/SharedSource/Items/Components/DockingPort.cs:15
Barotrauma.Items
Definition:
BarotraumaShared/SharedSource/Items/Components/DockingPort.cs:15
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma.AttackContext.Any
@ Any
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
AbilityConditionals
AbilityConditionData
AbilityConditionIsAiming.cs
Generated by
1.9.1