Advertisement
RustyDios

DodgeOnConcealBroken

Nov 3rd, 2020 (edited)
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.91 KB | None | 0 0
  1. class X2Ability_PsiClass_Extended extends X2Ability_PsiOperativeAbilitySet;
  2.  
  3. static function array<X2DataTemplate> CreateTemplates()
  4. {
  5.     local array<X2DataTemplate> Templates;
  6.  
  7.         Templates.AddItem(Meph_Busted());
  8.     Templates.AddItem(PurePassive('BustedTraining_Passive', "img:///UILibrary_PerkIcons.UIPerk_XXXXX", false , 'eAbilitySource_Psionic'));
  9.    
  10.     return Templates;
  11. }
  12.  
  13. // When your concealment is broken, gain a bonus to dodge for a few turns. Passive.
  14. static function X2AbilityTemplate Meph_Busted()
  15. {
  16.     local X2AbilityTemplate                 Template;
  17.     local X2Effect_PersistentStatChange     DodgeEffect;
  18.     local X2AbilityTrigger_EventListener    Trigger;
  19.  
  20.     `CREATE_X2ABILITY_TEMPLATE(Template, 'BustedTraining');
  21.  
  22.     Template.IconImage = "img:///UILibrary_PerkIcons.UIPerk_XXXXXX";
  23.     Template.AbilitySourceName = 'eAbilitySource_Psionic';
  24.     Template.eAbilityIconBehaviorHUD = EAbilityIconBehavior_NeverShow;
  25.     Template.Hostility = eHostility_Neutral;
  26.  
  27.     Template.AbilityToHitCalc = default.DeadEye;
  28.     Template.AbilityTargetStyle = default.SelfTarget;
  29.  
  30.     // Ability is triggered when individual concealment is broken
  31.     Trigger = new class'X2AbilityTrigger_EventListener';
  32.     Trigger.ListenerData.Deferral = ELD_OnStateSubmitted;
  33.     Trigger.ListenerData.EventID = 'UnitConcealmentBroken';
  34.     Trigger.ListenerData.Filter = eFilter_Unit;
  35.     Trigger.ListenerData.EventFn = class'XComGameState_Ability'.static.AbilityTriggerEventListener_Self;
  36.     Template.AbilityTriggers.AddItem(Trigger);
  37.  
  38.     // Ability is triggered when squad concealment is broken
  39.     Trigger = new class'X2AbilityTrigger_EventListener';
  40.     Trigger.ListenerData.Deferral = ELD_OnStateSubmitted;
  41.     Trigger.ListenerData.EventID = 'SquadConcealmentBroken';
  42.     Trigger.ListenerData.Filter = eFilter_Unit;
  43.     Trigger.ListenerData.EventFn = class'XComGameState_Ability'.static.AbilityTriggerEventListener_Self;
  44.     Template.AbilityTriggers.AddItem(Trigger);
  45.  
  46.     // Create a persistent stat change effect that grants a defense bonus
  47.     DodgeEffect = new class'X2Effect_PersistentStatChange';
  48.     DodgeEffect.EffectName = 'BustedTraining_Effect';
  49.     DodgeEffect.AddPersistentStatChange(eStat_Dodge, default.BUSTED_DODGE_BONUS);
  50.     DodgeEffect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.LocLongDescription, Template.IconImage, true, ,Template.AbilitySourceName);
  51.    
  52.     // Prevent the effect from applying to a unit more than once
  53.     DodgeEffect.DuplicateResponse = eDupe_Refresh;
  54.  
  55.     // The effect lasts for a specified duration
  56.     DodgeEffect.BuildPersistentEffect(default.BUSTED_DURATION, false, true, false, eGameRule_PlayerTurnBegin);
  57.    
  58.     Template.AddShooterEffect(DodgeEffect);
  59.  
  60.     Template.AdditionalAbilities.AddItem('BustedTraining_Passive');
  61.     //Template.SetUIStatMarkup(class'XLocalizedData'.default.DodgeLabel, eStat_Dodge, default.BUSTED_DODGE_BONUS);
  62.  
  63.     return Template;
  64. }
  65.  
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement