static function X2AbilityTemplate JLImpersonalEdge()
{
local X2AbilityTemplate Template;
local X2Effect_AddAmmo AddAmmoEffect;
local X2AbilityTrigger_EventListener EventListenerTrigger;
`CREATE_X2ABILITY_TEMPLATE(Template, 'JLImpersonalEdge');
//BEGIN AUTOGENERATED CODE: Template Overrides 'FullThrottle'
Template.IconImage = "img:///MusashiCombatKnifeMod_LW.UI.UIPerk_hailstorm";
//END AUTOGENERATED CODE: Template Overrides 'FullThrottle'
Template.AbilitySourceName = 'eAbilitySource_Perk';
Template.eAbilityIconBehaviorHUD = eAbilityIconBehavior_NeverShow;
Template.Hostility = eHostility_Neutral;
Template.AbilityToHitCalc = default.DeadEye;
Template.AbilityTargetStyle = default.SelfTarget;
EventListenerTrigger = new class'X2AbilityTrigger_EventListener';
EventListenerTrigger.ListenerData.Deferral = ELD_OnStateSubmitted;
EventListenerTrigger.ListenerData.EventID = 'UnitDied';
EventListenerTrigger.ListenerData.Filter = eFilter_None;
EventListenerTrigger.ListenerData.EventFn = JLImpersonalEdgeListener;
Template.AbilityTriggers.AddItem(EventListenerTrigger);
AddAmmoEffect = new class 'X2Effect_AddAmmo';
AddAmmoEffect.ExtraAmmoAmount = default.KNIFE_JUGGLER_EXTRA_AMMO;
Template.AddTargetEffect(AddAmmoEffect);
Template.bSkipFireAction = true;
Template.bShowActivation = true;
Template.BuildNewGameStateFn = TypicalAbility_BuildGameState;
Template.BuildVisualizationFn = TypicalAbility_BuildVisualization;
return Template;
}
static function EventListenerReturn JLImpersonalEdgeListener(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackData)
{
local XComGameStateContext_Ability AbilityContext;
local XComGameState_Item ItemState;
local XComGameState_Ability TriggerAbilityState;
AbilityContext = XComGameStateContext_Ability(GameState.GetContext());
TriggerAbilityState = XComGameState_Ability(CallbackData);
ItemState = XComGameState_Item(`XCOMHISTORY.GetGameStateForObjectID(AbilityContext.InputContext.ItemObject.ObjectID));
if (AbilityContext != None && AbilityContext.InterruptionStatus != eInterruptionStatus_Interrupt)
{
// were we the killer?
if (AbilityContext.InputContext.SourceObject.ObjectID == TriggerAbilityState.OwnerStateObject.ObjectID)
{
if(X2WeaponTemplate(ItemState.GetMyTemplate()) != none && X2WeaponTemplate(ItemState.GetMyTemplate()).WeaponCat == 'throwingknife')
{
return TriggerAbilityState.AbilityTriggerEventListener_Self(EventData, EventSource, GameState, EventID, CallbackData);
}
}
}
return ELR_NoInterrupt;
}