<commit_before>//---------------------------------------------------------------------------------------
//  FILE:    X2SitRepEffect_GrantAbilities.uc
//  AUTHOR:  <NAME>  --  11/1/2016
//  PURPOSE: Allows sitreps to give abilities to units
//           
//---------------------------------------------------------------------------------------
//  Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------

class X2SitRepEffect_GrantAbilities extends X2SitRepEffectTemplate;

var array<name> AbilityTemplateNames; // Abilities to grant

var array<name> CharacterTemplateNames; // Characters to grant abilities to
var array<ETeam> Teams; //CHL issue #445 allow mods to decide which team(s) receive this ability
var bool GrantToSoldiers; // If true, will grant the specified abilities to all soldier classes

// If you need different/more precise control of which units get which abilities, you can override
// this function with a subclass
function GetAbilitiesToGrant(XComGameState_Unit UnitState, out array<name> AbilityTemplates)
{
	AbilityTemplates.Length = 0;
	
	if(CharacterTemplateNames.Length == 0 && GrantToSoldiers == false
	|| CharacterTemplateNames.Find(UnitState.GetMyTemplateName()) != INDEX_NONE
	|| Teams.Find(UnitState.GetTeam()) != INDEX_NONE
	|| (GrantToSoldiers && UnitState.IsSoldier()))
	{
		AbilityTemplates = AbilityTemplateNames;
	}
	
}<commit_msg>better fix<commit_after>//---------------------------------------------------------------------------------------
//  FILE:    X2SitRepEffect_GrantAbilities.uc
//  AUTHOR:  <NAME>  --  11/1/2016
//  PURPOSE: Allows sitreps to give abilities to units
//           
//---------------------------------------------------------------------------------------
//  Copyright (c) 2016 Firaxis Games, Inc. All rights reserved.
//---------------------------------------------------------------------------------------

class X2SitRepEffect_GrantAbilities extends X2SitRepEffectTemplate;

var array<name> AbilityTemplateNames; // Abilities to grant

var array<name> CharacterTemplateNames; // Characters to grant abilities to
var array<ETeam> Teams; //CHL issue #445 allow mods to decide which team(s) receive this ability
var bool GrantToSoldiers; // If true, will grant the specified abilities to all soldier classes

// If you need different/more precise control of which units get which abilities, you can override
// this function with a subclass
function GetAbilitiesToGrant(XComGameState_Unit UnitState, out array<name> AbilityTemplates)
{
	AbilityTemplates.Length = 0;
	
	if (CharacterTemplateNames.Find(UnitState.GetMyTemplateName()) != INDEX_NONE
	|| (CharacterTemplateNames.Length == 0 && GrantToSoldiers == false)
	|| (GrantToSoldiers && UnitState.IsSoldier())
	|| Teams.Find(UnitState.GetTeam()) != INDEX_NONE)
	{
		AbilityTemplates = AbilityTemplateNames;
	}
}
{'fraction_non_alphanumeric': 0.2575136612021858, 'fraction_numerical': 0.012978142076502733, 'mean_word_length': 2.05422314911366, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1921786', 'n_tokens_mistral': 776, 'n_tokens_neox': 726, 'n_words': 222}