Client LuaCsForBarotrauma
CharacterAbilityByTheBook.cs
1
using
System.Collections.Generic;
2
using
System.Linq;
3
4
namespace
Barotrauma.Abilities
5
{
6
class
CharacterAbilityByTheBook
:
CharacterAbility
7
{
8
private
readonly
int
moneyAmount;
9
private
readonly
int
experienceAmount;
10
private
readonly
int
max;
11
12
public
CharacterAbilityByTheBook
(
CharacterAbilityGroup
characterAbilityGroup,
ContentXElement
abilityElement) : base(characterAbilityGroup, abilityElement)
13
{
14
moneyAmount = abilityElement.
GetAttributeInt
(
"moneyamount"
, 0);
15
experienceAmount = abilityElement.
GetAttributeInt
(
"experienceamount"
, 0);
16
max = abilityElement.
GetAttributeInt
(
"max"
, 0);
17
}
18
19
protected
override
void
ApplyEffect
()
20
{
21
IEnumerable<Character> enemyCharacters =
Character
.
CharacterList
.Where(c => !
Character
.
IsFriendly
(c));
22
23
int
timesGiven = 0;
24
foreach
(
Character
enemyCharacter
in
enemyCharacters)
25
{
26
if
(!enemyCharacter.
IsHuman
) {
continue
; }
27
if
(enemyCharacter.
Submarine
==
null
||
28
(
Submarine
.
MainSub
!=
null
&& enemyCharacter.
Submarine
!=
Submarine
.
MainSub
))
29
{
30
continue
;
31
}
32
if
(enemyCharacter.
IsDead
) {
continue
; }
33
if
(!enemyCharacter.
LockHands
) {
continue
; }
34
Character
.
GiveMoney
(moneyAmount);
35
GameAnalyticsManager.AddMoneyGainedEvent(moneyAmount, GameAnalyticsManager.MoneySource.Ability,
CharacterTalent
.
Prefab
.
Identifier
.Value);
36
foreach
(
Character
character
in
Character
.
GetFriendlyCrew
(
Character
))
37
{
38
character.
Info
?.
GiveExperience
(experienceAmount);
39
}
40
timesGiven++;
41
if
(max > 0 && timesGiven >= max) {
break
; }
42
}
43
44
}
45
}
46
}
Barotrauma.Abilities.CharacterAbilityByTheBook
Definition:
CharacterAbilityByTheBook.cs:7
Barotrauma.Abilities.CharacterAbilityByTheBook.ApplyEffect
override void ApplyEffect()
Definition:
CharacterAbilityByTheBook.cs:19
Barotrauma.Abilities.CharacterAbilityByTheBook.CharacterAbilityByTheBook
CharacterAbilityByTheBook(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Definition:
CharacterAbilityByTheBook.cs:12
Barotrauma.Abilities.CharacterAbilityGroup
Definition:
CharacterAbilityGroup.cs:9
Barotrauma.Abilities.CharacterAbility
Definition:
CharacterAbility.cs:7
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.IsDead
bool IsDead
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:1147
Barotrauma.Character.CharacterList
static readonly List< Character > CharacterList
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:33
Barotrauma.Character.IsFriendly
bool IsFriendly(Character other)
Barotrauma.Character.GiveMoney
void GiveMoney(int amount)
Shows visual notification of money gained by the specific player. Useful for mid-mission monetary gai...
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:5768
Barotrauma.Character.IsHuman
bool IsHuman
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:518
Barotrauma.Character.LockHands
bool? LockHands
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:674
Barotrauma.Character.Info
CharacterInfo Info
Definition:
BarotraumaShared/SharedSource/Characters/Character.cs:556
Barotrauma.CharacterInfo.GiveExperience
void GiveExperience(int amount)
Definition:
BarotraumaShared/SharedSource/Characters/CharacterInfo.cs:1385
Barotrauma.CharacterTalent
Definition:
CharacterTalent.cs:8
Barotrauma.CharacterTalent.Prefab
readonly TalentPrefab Prefab
Definition:
CharacterTalent.cs:12
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.GetAttributeInt
int GetAttributeInt(string key, int def)
Barotrauma.Entity.Submarine
Submarine Submarine
Definition:
Entity.cs:53
Barotrauma.Prefab.Identifier
readonly Identifier Identifier
Definition:
Prefab.cs:34
Barotrauma.Submarine
Definition:
BarotraumaShared/SharedSource/Map/Submarine.cs:25
Barotrauma.Submarine.MainSub
static Submarine MainSub
Note that this can be null in some situations, e.g. editors and missions that don't load a submarine.
Definition:
BarotraumaShared/SharedSource/Map/Submarine.cs:70
Barotrauma.Abilities
Definition:
AbilityCondition.cs:5
Barotrauma
BarotraumaShared
SharedSource
Characters
Talents
Abilities
CustomAbilities
CharacterAbilityByTheBook.cs
Generated by
1.9.1