Client LuaCsForBarotrauma
CharacterAbilityInsurancePolicy.cs
1 namespace Barotrauma.Abilities
2 {
4  {
5  public override bool AppliesEffectOnIntervalUpdate => true;
6 
7  private readonly int moneyPerMission;
8 
9  public CharacterAbilityInsurancePolicy(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
10  {
11  moneyPerMission = abilityElement.GetAttributeInt("moneypermission", 0);
12  }
13 
14  protected override void ApplyEffect(AbilityObject abilityObject)
15  {
16  if (Character?.Info is CharacterInfo info && GameMain.GameSession?.GameMode is CampaignMode campaign)
17  {
18  int totalAmount = moneyPerMission * info.MissionsCompletedSinceDeath;
19  campaign.Bank.Give(totalAmount);
20  GameAnalyticsManager.AddMoneyGainedEvent(totalAmount, GameAnalyticsManager.MoneySource.Ability, CharacterTalent.Prefab.Identifier.Value);
21  }
22  }
23  }
24 }
CharacterAbilityInsurancePolicy(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
Stores information about the Character that is needed between rounds in the menu etc....
readonly TalentPrefab Prefab
int GetAttributeInt(string key, int def)
static GameSession?? GameSession
Definition: GameMain.cs:88
readonly Identifier Identifier
Definition: Prefab.cs:34