Advertisement
RustyDios

ForKiruka_WeightAbilityNoXMB

Nov 30th, 2020 (edited)
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.79 KB | None | 0 0
  1. class WeightAbility extends X2Ability config(SlotOptions);
  2.  
  3. var config bool DisableWeightForPrimarySlot, DisableWeightForSecondarySlot;
  4. var config bool DisableWeightForAmmoSlot, DisableWeightForGrenadeSlot;
  5. var config bool DisableWeightForSparkGrenadeSlot, DisableWeightForAuxiliarySlot;
  6.  
  7. var config bool bShowAsPassiveIcon;
  8.  
  9. static function array<X2DataTemplate> CreateTemplates()
  10. {
  11.     local array<X2DataTemplate> Templates;
  12.    
  13.     Templates.AddItem(Create_IgnoreSlotWeight());
  14.  
  15.     return Templates;
  16. }
  17.  
  18. static function X2AbilityTemplate Create_IgnoreSlotWeight()
  19. {
  20.     local X2AbilityTemplate  Template;
  21.     local X2Effect_ReverseUtilityMobilityPenalites Effect;
  22.  
  23.     // create ability
  24.     `CREATE_X2ABILITY_TEMPLATE(Template, 'IgnoreSlotWeight');
  25.     Template.IconImage = "img:///UILibrary_XPerkIconPack.UIPerk_star_box";
  26.  
  27.     // basic setup
  28.     Template.AbilitySourceName = 'eAbilitySource_Item';
  29.     Template.eAbilityIconBehaviorHUD = EAbilityIconBehavior_NeverShow;
  30.     Template.Hostility = eHostility_Neutral;
  31.  
  32.     Template.AbilityToHitCalc = default.DeadEye;
  33.     Template.AbilityTargetStyle = default.SelfTarget;
  34.     Template.AbilityTriggers.AddItem(default.UnitPostBeginPlayTrigger);
  35.  
  36.     // effect setup
  37.     // This effect will grant +1 Mobility for each equipped item that grants -1 Mobility because of the SmallItemWeight ability
  38.     Effect = new class'X2Effect_ReverseUtilityMobilityPenalites';
  39.     Effect.EffectName = 'IgnoreSlotWeight_Passive';
  40.  
  41.       //normally I abhor in-line if statements but in some cases like this it makes the code so much cleaner to read
  42.     if (default.DisableWeightForPrimarySlot)       {    Effect.SlotsToCheck.AddItem(eInvSlot_PrimaryWeapon);      }
  43.     if (default.DisableWeightForSecondarySlot)     {    Effect.SlotsToCheck.AddItem(eInvSlot_SecondaryWeapon);    }
  44.     if (default.DisableWeightForAmmoSlot)          {    Effect.SlotsToCheck.AddItem(eInvSlot_AmmoPocket);         }
  45.     if (default.DisableWeightForGrenadeSlot)       {    Effect.SlotsToCheck.AddItem(eInvSlot_GrenadePocket);      }
  46.     if (default.DisableWeightForSparkGrenadeSlot)  {    Effect.SlotsToCheck.AddItem(eInvSlot_SparkGrenadePocket); }
  47.     if (default.DisableWeightForAuxiliarySlot)     {    Effect.SlotsToCheck.AddItem(eInvSlot_AuxiliaryWeapon);    }
  48.    
  49.     Effect.BuildPersistentEffect(1, true, false, false);
  50.     Effect.SetDisplayInfo(ePerkBuff_Passive, Template.LocFriendlyName, Template.LocLongDescription, Template.IconImage, default.bShowAsPassiveIcon,,Template.AbilitySourceName);
  51.     Template.AddTargetEffect(Effect);
  52.  
  53.     //gamestate and visibility
  54.     Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
  55.     //  NOTE: No visualization on purpose!
  56.  
  57.     Template.bCrossClassEligible = false;
  58.     Template.bDisplayInUITooltip = false;
  59.     Template.bDisplayInUITacticalText = false;
  60.    
  61.     return Template;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement