diff --git a/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Effect_ApplyWeaponDamage.uc b/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Effect_ApplyWeaponDamage.uc index acb3439c3..c21b6e72b 100644 --- a/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Effect_ApplyWeaponDamage.uc +++ b/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Effect_ApplyWeaponDamage.uc @@ -588,7 +588,8 @@ simulated function GetDamagePreview(StateObjectReference TargetRef, XComGameStat EffectState = XComGameState_Effect(History.GetGameStateForObjectID(EffectRef.ObjectID)); EffectTemplate = EffectState.GetX2Effect(); - EffectDmg = EffectTemplate.GetAttackingDamageModifier(EffectState, SourceUnit, Damageable(TargetUnit), AbilityState, TestEffectParams, MinDamagePreview.Damage); + // Single line for Issue #1305 - use the Highlander version of GetAttackingDamageModifier(). + EffectDmg = EffectTemplate.GetAttackingDamageModifier_CH(EffectState, SourceUnit, Damageable(TargetUnit), AbilityState, TestEffectParams, MinDamagePreview.Damage, self); MinDamagePreview.Damage += EffectDmg; if( EffectDmg != 0 ) { @@ -596,7 +597,8 @@ simulated function GetDamagePreview(StateObjectReference TargetRef, XComGameStat DamageModInfo.Value = EffectDmg; MinDamagePreview.BonusDamageInfo.AddItem(DamageModInfo); } - EffectDmg = EffectTemplate.GetAttackingDamageModifier(EffectState, SourceUnit, Damageable(TargetUnit), AbilityState, TestEffectParams, MaxDamagePreview.Damage); + // Single line for Issue #1305 - use the Highlander version of GetAttackingDamageModifier(). + EffectDmg = EffectTemplate.GetAttackingDamageModifier_CH(EffectState, SourceUnit, Damageable(TargetUnit), AbilityState, TestEffectParams, MaxDamagePreview.Damage, self); MaxDamagePreview.Damage += EffectDmg; if( EffectDmg != 0 ) { @@ -1001,7 +1003,9 @@ simulated function int CalculateDamageAmount(const out EffectAppliedData ApplyEf EffectState = XComGameState_Effect(History.GetGameStateForObjectID(EffectRef.ObjectID)); EffectTemplate = EffectState.GetX2Effect(); - EffectDmg = EffectTemplate.GetAttackingDamageModifier(EffectState, kSourceUnit, kTarget, kAbility, ApplyEffectParameters, WeaponDamage, NewGameState); + + // Single line for Issue #1305 - use the Highlander version of GetAttackingDamageModifier(). + EffectDmg = EffectTemplate.GetAttackingDamageModifier_CH(EffectState, kSourceUnit, kTarget, kAbility, ApplyEffectParameters, WeaponDamage, self, NewGameState); if (EffectDmg != 0) { WeaponDamage += EffectDmg; diff --git a/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Effect_Persistent.uc b/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Effect_Persistent.uc index a545234cd..cac11a7f9 100644 --- a/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Effect_Persistent.uc +++ b/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Effect_Persistent.uc @@ -658,6 +658,18 @@ function GetToHitAsTargetModifiers(XComGameState_Effect EffectState, XComGameSta // CHL issue #467: function added to allow mods to modify the outcome of X2AbilityToHitCalc_StatCheck function GetToHitAsTargetModifiersForStatCheck(XComGameState_Effect EffectState, XComGameState_Unit Attacker, XComGameState_Unit Target, XComGameState_Ability AbilityState, class ToHitType, out array ShotModifiers); function bool UniqueToHitAsTargetModifiers() { return false; } + +// Start Issue #1305 +/// HL-Docs: feature:DamageEffectForDamageModifierHooks; issue:1305; tags:tactical +/// Adds an improved version of GetAttackingDamageModifier() that always gets the Damage Effect. +/// The regular version of the hook gets the Damage Effect only when the effect is getting applied, +/// which prevents the hook from being able to provide an accurate contextual damage preview. +function int GetAttackingDamageModifier_CH(XComGameState_Effect EffectState, XComGameState_Unit Attacker, Damageable TargetDamageable, XComGameState_Ability AbilityState, const out EffectAppliedData AppliedData, const int CurrentDamage, X2Effect_ApplyWeaponDamage WeaponDamageEffect, optional XComGameState NewGameState) +{ + return GetAttackingDamageModifier(EffectState, Attacker, TargetDamageable, AbilityState, AppliedData, CurrentDamage, NewGameState); +} +// End Issue #1305 + function int GetAttackingDamageModifier(XComGameState_Effect EffectState, XComGameState_Unit Attacker, Damageable TargetDamageable, XComGameState_Ability AbilityState, const out EffectAppliedData AppliedData, const int CurrentDamage, optional XComGameState NewGameState) { return 0; } function int GetDefendingDamageModifier(XComGameState_Effect EffectState, XComGameState_Unit Attacker, Damageable TargetDamageable, XComGameState_Ability AbilityState, const out EffectAppliedData AppliedData, const int CurrentDamage, X2Effect_ApplyWeaponDamage WeaponDamageEffect, optional XComGameState NewGameState) { return 0; } function int GetBaseDefendingDamageModifier(XComGameState_Effect EffectState, XComGameState_Unit Attacker, Damageable TargetDamageable, XComGameState_Ability AbilityState, const out EffectAppliedData AppliedData, const int BaseDamage, X2Effect_ApplyWeaponDamage WeaponDamageEffect, optional XComGameState NewGameState) { return 0; }