Skip to content

Commit

Permalink
Implement Issue #990
Browse files Browse the repository at this point in the history
  • Loading branch information
ps2guides committed May 21, 2023
1 parent cfc3fb0 commit d24eb04
Showing 1 changed file with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ static function X2AbilityTemplate SKULLOuch()

Listener = new class'X2AbilityTrigger_EventListener';
Listener.ListenerData.Deferral = ELD_OnStateSubmitted;
Listener.ListenerData.EventFn = class'XComGameState_Ability'.static.AbilityTriggerEventListener_Self;
Listener.ListenerData.EventFn = static.AbilityTriggerEventListener_HackReward; // Issue #990
Listener.ListenerData.EventID = class'X2HackRewardTemplateManager'.default.HackAbilityEventName;
Listener.ListenerData.Filter = eFilter_None;
Template.AbilityTriggers.AddItem(Listener);
Expand Down Expand Up @@ -464,7 +464,7 @@ static function ApplyEffectsToTemplate(X2AbilityTemplate Template, EffectTargetS
else
{
Template.AbilityTargetStyle = default.SelfTarget;
Listener.ListenerData.EventFn = class'XComGameState_Ability'.static.AbilityTriggerEventListener_Self;
Listener.ListenerData.EventFn = static.AbilityTriggerEventListener_HackReward; // Issue #990
}
Listener.ListenerData.EventID = class'X2HackRewardTemplateManager'.default.HackAbilityEventName;
Listener.ListenerData.Filter = eFilter_None;
Expand Down Expand Up @@ -576,7 +576,7 @@ static function X2AbilityTemplate HackRewardIntegratedComms()
Listener = new class'X2AbilityTrigger_EventListener';
Listener.ListenerData.Deferral = ELD_OnStateSubmitted;
Template.AbilityTargetStyle = default.SelfTarget;
Listener.ListenerData.EventFn = class'XComGameState_Ability'.static.AbilityTriggerEventListener_Self;
Listener.ListenerData.EventFn = static.AbilityTriggerEventListener_HackReward; // Issue #990
Listener.ListenerData.EventID = class'X2HackRewardTemplateManager'.default.HackAbilityEventName;
Listener.ListenerData.Filter = eFilter_None;
Template.AbilityTriggers.AddItem(Listener);
Expand Down Expand Up @@ -618,7 +618,7 @@ static function X2AbilityTemplate HackRewardDisguisedSignals()
Listener = new class'X2AbilityTrigger_EventListener';
Listener.ListenerData.Deferral = ELD_OnStateSubmitted;
Template.AbilityTargetStyle = default.SelfTarget;
Listener.ListenerData.EventFn = class'XComGameState_Ability'.static.AbilityTriggerEventListener_Self;
Listener.ListenerData.EventFn = static.AbilityTriggerEventListener_HackReward; // Issue #990
Listener.ListenerData.EventID = class'X2HackRewardTemplateManager'.default.HackAbilityEventName;
Listener.ListenerData.Filter = eFilter_None;
Template.AbilityTriggers.AddItem(Listener);
Expand Down Expand Up @@ -731,3 +731,21 @@ static function X2AbilityTemplate BuildDamageImmunityAbility(Name TemplateName,

return Template;
}

// Start Issue #990
/// HL-Docs: ref:Bugfixes; issue:990
/// Trigger the hack reward ability only if it's present in the Game State.
/// This prevents hack rewards from being granted multiple times.
static private function EventListenerReturn AbilityTriggerEventListener_HackReward(Object EventData, Object EventSource, XComGameState GameState, name InEventID, Object CallbackData)
{
local XComGameState_Ability AbilityState;

AbilityState = XComGameState_Ability(CallbackData);
if (AbilityState != none && GameState.GetGameStateForObjectID(AbilityState.ObjectID) != none)
{
AbilityState.AbilityTriggerAgainstSingleTarget(AbilityState.OwnerStateObject, false);
}

return ELR_NoInterrupt;
}
// End Issue #990

0 comments on commit d24eb04

Please sign in to comment.