Advertisement
RustyDios

SpectreImmuneSuggestionForCX

Feb 26th, 2021
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.01 KB | None | 0 0
  1. static function X2AbilityTemplate CreateSpectreImmunitiesAbility()
  2. {
  3.     local X2AbilityTemplate Template;
  4.     local X2AbilityTrigger_UnitPostBeginPlay Trigger;
  5.     local X2Effect_DamageImmunity DamageImmunity;
  6.  
  7.     `CREATE_X2ABILITY_TEMPLATE(Template, 'SpectreImmunities');
  8.     Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_immunities";
  9.  
  10.     Template.AbilitySourceName = 'eAbilitySource_Perk';
  11.     Template.eAbilityIconBehaviorHUD = EAbilityIconBehavior_NeverShow;
  12.     Template.Hostility = eHostility_Neutral;
  13.  
  14.     Template.AbilityToHitCalc = default.DeadEye;
  15.  
  16.     Template.AbilityTargetStyle = default.SelfTarget;
  17.  
  18.     Trigger = new class'X2AbilityTrigger_UnitPostBeginPlay';
  19.     Template.AbilityTriggers.AddItem(Trigger);
  20.  
  21.     // Build the immunities
  22.     DamageImmunity = new class'X2Effect_DamageImmunity';
  23.     DamageImmunity.BuildPersistentEffect(1, true, true, true);
  24.     DamageImmunity.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.GetMyLongDescription(), Template.IconImage,,,Template.AbilitySourceName);
  25.     DamageImmunity.ImmuneTypes.AddItem('Poison');
  26.     DamageImmunity.ImmuneTypes.AddItem('Fire');
  27.  
  28.     if (!IsModLoaded('RoboticSpectre'))
  29.     {
  30.         DamageImmunity.ImmuneTypes.AddItem('Mental');
  31.     }
  32.  
  33.     DamageImmunity.ImmuneTypes.AddItem('Acid');
  34.     DamageImmunity.ImmuneTypes.AddItem('EleriumPoisoning');
  35.     DamageImmunity.ImmuneTypes.AddItem(class'X2Item_DefaultDamageTypes'.default.ParthenogenicPoisonType);
  36.     DamageImmunity.ImmuneTypes.AddItem(class'X2Item_DefaultDamageTypes'.default.KnockbackDamageType);
  37.     Template.AddTargetEffect(DamageImmunity);
  38.  
  39.     Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
  40.  
  41.     return Template;
  42. }
  43.  
  44. static private function bool IsModLoaded(name ModName)
  45. {
  46.     local XComOnlineEventMgr    EventManager;
  47.     local int                   Index;
  48.  
  49.     EventManager = `ONLINEEVENTMGR;
  50.  
  51.     for (Index = EventManager.GetNumDLC() - 1; Index >= 0; Index--)
  52.     {
  53.         if (EventManager.GetDLCNames(Index) == ModName)
  54.         {
  55.             return true;
  56.         }
  57.     }
  58.     return false;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement