Skip to content

Commit

Permalink
Merge branch 'master' into 1380-BurstFire-Stacking-Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackDog86 committed Jan 7, 2025
2 parents 3b87511 + 7bdf62b commit 7456517
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,16 @@ static function X2AbilityTemplate RevivalProtocol()

Template.AbilityTargetConditions.AddItem(new class'X2Condition_RevivalProtocol');

Template.AddTargetEffect(RemoveAdditionalEffectsForRevivalProtocolAndRestorativeMist());
// Start Issue #1435
/// HL-Docs: ref:Bugfixes; issue:1435
/// Fix bug that allows Revival Protocol to remove effects that are normally removed by a Medikit heal,
/// despite this functionality not being mentioned in the in-game localization,
/// and units with these effects not being valid targets for this ability, unless they are also mentally impaired.
/// The bug was caused by Firaxis reusing the `RemoveAdditionalEffectsForRevivalProtocolAndRestorativeMist()` function,
/// which makes sense for Restoration, as that ability also applies Medikit heal,
/// but not for Revival Protocol, which is only supposed to remove mental impairments.
Template.AddTargetEffect(RemoveImpairingEffectsByDamageTypeForRevivalProtocol_CH());
// End Issue #1435

// Start Issue #1414
/// HL-Docs: ref:Bugfixes; issue:1414
Expand Down Expand Up @@ -2154,7 +2163,24 @@ static function X2Effect_RemoveEffects RemoveAdditionalEffectsForRevivalProtocol

return RemoveEffects;
}
// Start Issue #1435 - New function for Revival Protocol which no longer removes medikit-healable status effects.
static function X2Effect_RemoveEffects RemoveImpairingEffectsByDamageTypeForRevivalProtocol_CH()
{
local X2Effect_RemoveEffectsByDamageType RemoveEffects;

RemoveEffects = new class'X2Effect_RemoveEffectsByDamageType';
RemoveEffects.EffectNamesToRemove.AddItem(class'X2AbilityTemplateManager'.default.DisorientedName);
RemoveEffects.EffectNamesToRemove.AddItem(class'X2AbilityTemplateManager'.default.PanickedName);
RemoveEffects.EffectNamesToRemove.AddItem(class'X2StatusEffects'.default.UnconsciousName);
RemoveEffects.EffectNamesToRemove.AddItem(class'X2AbilityTemplateManager'.default.DazedName);
RemoveEffects.EffectNamesToRemove.AddItem(class'X2AbilityTemplateManager'.default.ObsessedName);
RemoveEffects.EffectNamesToRemove.AddItem(class'X2AbilityTemplateManager'.default.BerserkName);
RemoveEffects.EffectNamesToRemove.AddItem(class'X2AbilityTemplateManager'.default.ShatteredName);
RemoveEffects.EffectNamesToRemove.AddItem(class'X2AbilityTemplateManager'.default.StunnedName);

return RemoveEffects;
}
// End Issue #1435
DefaultProperties
{
EverVigilantEffectName = "EverVigilantTriggered";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1230,15 +1230,32 @@ function NormalDamagePreview(StateObjectReference TargetRef, out WeaponDamageVal
MaxDamagePreview.Shred += MaxDamagePreview.Shred * BurstFire.NumExtraShots;
}
}

// Begin Issue #1394
/// HL-Docs: ref:Bugfixes; issue:1394
/// Abilities which do not specify a custom damage preview function will show rupture damage on the damage
/// preview, even if the ability is not capable of doing any damage (e.g. self target abilities like reload).
/// Checking that the previewed damage is non-zero before adding rupture damage to it mitigates this and improves
/// the display (mainly for modded gameplay, but it also occurs in niche base game circumstances e.g. if a ruptured
/// unit becomes mind controlled).
if (Rupture > 0)
{
MinDamagePreview.Damage += Rupture;
MaxDamagePreview.Damage += Rupture;
DamageModInfo.bIsRupture = true;
DamageModInfo.Value = Rupture;
MinDamagePreview.BonusDamageInfo.AddItem(DamageModInfo);
MaxDamagePreview.BonusDamageInfo.AddItem(DamageModInfo);
}

if (MinDamagePreview.Damage > 0)
{
MinDamagePreview.Damage += Rupture;
MinDamagePreview.BonusDamageInfo.AddItem(DamageModInfo);
}

if (MaxDamagePreview.Damage > 0)
{
MaxDamagePreview.Damage += Rupture;
MaxDamagePreview.BonusDamageInfo.AddItem(DamageModInfo);
}
}
// End Issue #1394

if (DestructibleState != none)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4101,6 +4101,10 @@ function bool HasItemInInventoryOrLoadout(X2ItemTemplate ItemTemplate, optional
function bool HasUnModifiedItem(XComGameState AddToGameState, X2ItemTemplate ItemTemplate, out XComGameState_Item ItemState, optional bool bLoot = false, optional XComGameState_Item CombatSimTest)
{
local int idx;
// Start Issue #1352 - New variables for combat sim stacking behavior
local int StatBoostidx;
local bool bhasIdenticalStatBoosts;
// End Issue #1352

if(bLoot)
{
Expand Down Expand Up @@ -4149,10 +4153,27 @@ function bool HasUnModifiedItem(XComGameState AddToGameState, X2ItemTemplate Ite
{
if(ItemState.GetMyTemplate().ItemCat == 'combatsim')
{
if(ItemState.StatBoosts.Length > 0 && CombatSimTest.StatBoosts.Length > 0 && ItemState.StatBoosts[0].Boost == CombatSimTest.StatBoosts[0].Boost && ItemState.StatBoosts[0].StatType == CombatSimTest.StatBoosts[0].StatType)
// Begin Issue #1352
/// HL-Docs: ref:Bugfixes; issue:1352
/// Fixes a bug that caused PCS items which did not have exactly one stat boost, to not stack properly in the UI
/// by making HasUnModifiedItem() properly compare items with multiple stat boosts or no stat boosts at all.
bhasIdenticalStatBoosts = true;
if (CombatSimTest.StatBoosts.Length != 0)
{
for (StatBoostidx = 0; StatBoostidx < ItemState.StatBoosts.Length; StatBoostidx++)
{
if (ItemState.StatBoosts[StatBoostidx].Boost != CombatSimTest.StatBoosts[StatBoostidx].Boost || ItemState.StatBoosts[StatBoostidx].StatType != CombatSimTest.StatBoosts[StatBoostidx].StatType)
{
bhasIdenticalStatBoosts = false;
break;
}
}
}
if (bhasIdenticalStatBoosts)
{
return true;
}
// End Issue #1352
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,10 +792,14 @@ simulated function bool HasBeenModified()
return true;
//end issue #104

WeaponTemplate = X2WeaponTemplate( m_ItemTemplate );

// Single line for Issues #93 and #306
if ((WeaponTemplate != none) && (GetNumUpgradeSlots() > 0) && (GetMyWeaponUpgradeCount() > 0))
WeaponTemplate = X2WeaponTemplate( m_ItemTemplate );
/// HL-Docs: ref:Bugfixes; issue:1429
/// Fix bug that caused weapons that have weapon upgrades installed, despite not having any weapon upgrade slots,
/// to stack in the HQ inventory, causing them to lose their installed upgrades when equipped. The fix removes the
/// check for the number of weapon upgrade slots on the weapon from the logic that determines whether the item has
/// been modified or not, and leaves just the check for number of installed weapon upgrades.
// Single line for Issues #93, #306 and #1429
if ((WeaponTemplate != none) /* && (GetNumUpgradeSlots() > 0)*/ && (GetMyWeaponUpgradeCount() > 0))
return true;

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3101,6 +3101,9 @@ function bool ClickToPath()
local int ActionIndex;
local int TargetIndex;
local string ConfirmSound;
// Variables for Issue #1420
local X2TargetingMethod_ArcWave ArcWaveTargetingMethod;
local AvailableTarget AdditionalTargets;

if(`XCOMVISUALIZATIONMGR.VisualizerBlockingAbilityActivation())
{
Expand All @@ -3125,6 +3128,34 @@ function bool ClickToPath()
// and the targeted unit's location
TargetIndex = UnitCache.AvailableActions[ActionIndex].AvailableTargets.Find('PrimaryTarget', PathingPawn.LastTargetObject.GetReference());
PathingPawn.GetWaypointTiles(WaypointTiles);

// Start Issue #1420
/// HL-Docs: ref:Bugfixes; issue:1420
/// Abilities using X2TargetingMethod_ArcWave will now validate its additional targets when making a right-click pathing attack
ArcWaveTargetingMethod = X2TargetingMethod_ArcWave(new AbilityState.GetMyTemplate().TargetingMethod);

if (ArcWaveTargetingMethod != None)
{
// Initialize the targetingmethod and set variables that were set incorrectly by parent class
ArcWaveTargetingMethod.Init(UnitCache.AvailableActions[ActionIndex], TargetIndex);
ArcWaveTargetingMethod.DirectSetTarget(TargetIndex);
ArcWaveTargetingMethod.LastDestination = PathingPawn.LastDestinationTile;

AdditionalTargets = UnitCache.AvailableActions[ActionIndex].AvailableTargets[TargetIndex];

// Set the amount of additional targets
if (ArcWaveTargetingMethod.GetAdditionalTargets(AdditionalTargets))
{
UnitCache.AvailableActions[ActionIndex].AvailableTargets[TargetIndex] = AdditionalTargets;
}

// Cancel the side-effects caused by initialization of targeting method
`CAMERASTACK.RemoveCamera(ArcWaveTargetingMethod.LookAtCamera);
`PRES.GetTacticalHUD().CancelTargetingAction();
ArcWaveTargetingMethod.Canceled();
}
// End Issue #1420

if(TargetIndex != INDEX_NONE && class'XComGameStateContext_Ability'.static.ActivateAbility(UnitCache.AvailableActions[ActionIndex], TargetIndex,,, PathingPawn.PathTiles, WaypointTiles))
{
//If there is a ConfirmSound for the melee ability, play it
Expand Down

0 comments on commit 7456517

Please sign in to comment.