Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static event OnPostTemplatesCreated()
- {
- local X2AbilityTemplateManager AllAbilities; //holder for all abilities
- //KAREN !! Get all the (template) managers !!
- AllAbilities = class'X2AbilityTemplateManager'.static.GetAbilityTemplateManager();
- if (default.b_SomeConfigValueForControl)
- {
- //values here can be pulled from config if needed, default.iAP
- ChangeCosts(AllAbilities.FindAbilityTemplate('AbilityName'), iAP, bFree, bTurn, iChrg, iCool);
- }
- }
- //function to obliterate and rebuild an abilities costs array
- static function ChangeCosts(X2AbilityTemplate Template, int AP, bool bFree, bool bEndsTurn, iNumCharges, iCooldown)
- {
- local X2AbilityCost_ActionPoints APCost;
- local X2AbilityCooldown Cooldown;
- local X2AbilityCharges Charges;
- local X2AbilityCost_Charges ChargeCost;
- if (Template != none)
- {
- //reset
- Template.AbilityCosts.Length = 0;
- Template.AbilityCooldown = none;
- Template.AbilityCharges = none;
- //create and add new AP costs
- APCost = new class'X2AbilityCost_ActionPoints';
- APCost.iNumPoints = AP;
- APCost.bFreeCost = bFree; //free cost evaluates AP required
- APCost.bConsumeAllPoints = bEndsTurn;
- Template.AbilityCosts.AddItem(APCost);
- //create and add new charges cost if needed
- if (iNumCharges > 0)
- {
- ChargeCost = new class'X2AbilityCost_Charges';
- ChargeCost.NumCharges = 1;
- Template.AbilityCosts.AddItem(ChargeCost);
- Charges = new class'X2AbilityCharges';
- Charges.InitialCharges = iNumCharges;
- Template.AbilityCharges = Charges
- }
- //create and add new cooldown if needed
- if (iCooldown > 0)
- {
- Cooldown = new class'X2AbilityCooldown';
- Cooldown.iNumTurns = iCooldown; //a 1 turn cooldown can be used to avoid same-turn spamming of free abilities
- Template.AbilityCooldown = Cooldown;
- }
- `LOG("ChangeCosts was completed for" @Template.LocFriendlyName, default.b_SomeConfigValueForControl, 'ModJam');
- }
- }
Add Comment
Please, Sign In to add comment