From 9e3d337b2d79cdfdbb5c1c4e37063af3a92feca6 Mon Sep 17 00:00:00 2001 From: BlackDog86 <122568778+BlackDog86@users.noreply.github.com> Date: Wed, 1 Jan 2025 22:43:59 +0000 Subject: [PATCH 1/2] Add X2Condition_Restoration to CHL --- .../Classes/X2Condition_Restoration.uc | 45 +++++++++++++++++++ .../X2WOTCCommunityHighlander.x2proj | 3 ++ 2 files changed, 48 insertions(+) create mode 100644 X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Condition_Restoration.uc diff --git a/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Condition_Restoration.uc b/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Condition_Restoration.uc new file mode 100644 index 000000000..93fc8b3fe --- /dev/null +++ b/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Condition_Restoration.uc @@ -0,0 +1,45 @@ +class X2Condition_Restoration extends X2Condition; + +// Begin Issue #1436 +// This function adjusts the targetting conditions for the restoration ability. If the unit either: +// 1. Requires Healing +// 2. Has a mental status effect +// 3. Has an effect which can normally be removed by a medikit +// They are now valid targets for the ability. +event name CallMeetsCondition(XComGameState_BaseObject kTarget) +{ + local XComGameState_Unit TargetUnit; + local name HealType; + + TargetUnit = XComGameState_Unit(kTarget); + if (TargetUnit == none) + { + return 'AA_NotAUnit'; + } + + if (TargetUnit.IsBeingCarried() || TargetUnit.IsDead() || TargetUnit.IsBleedingOut()) + { + return 'AA_UnitIsImmune'; + } + + if (TargetUnit.GetCurrentStat(eStat_HP) < TargetUnit.GetMaxStat(eStat_HP)) + { + return 'AA_Success'; + } + + if (TargetUnit.IsPanicked() || TargetUnit.IsUnconscious() || TargetUnit.IsDisoriented() || TargetUnit.IsDazed() || TargetUnit.IsStunned()) + { + return 'AA_Success'; + } + + foreach class'X2Ability_DefaultAbilitySet'.default.MedikitHealEffectTypes(HealType) + { + if (TargetUnit.IsUnitAffectedByDamageType(HealType)) + { + return 'AA_Success'; + } + } + + return 'AA_UnitIsImmune'; +} +// End Issue #1436 diff --git a/X2WOTCCommunityHighlander/X2WOTCCommunityHighlander.x2proj b/X2WOTCCommunityHighlander/X2WOTCCommunityHighlander.x2proj index c3f01b1db..a4b532b2b 100644 --- a/X2WOTCCommunityHighlander/X2WOTCCommunityHighlander.x2proj +++ b/X2WOTCCommunityHighlander/X2WOTCCommunityHighlander.x2proj @@ -595,6 +595,9 @@ Content + + Content + Content From 31bf74a00fe8b3324137afe679af61b61dfcfbba Mon Sep 17 00:00:00 2001 From: BlackDog86 <122568778+BlackDog86@users.noreply.github.com> Date: Wed, 1 Jan 2025 22:53:01 +0000 Subject: [PATCH 2/2] Update SpecialistAbilitySet to use new Restoration Targeting Conditions --- .../Classes/X2Ability_SpecialistAbilitySet.uc | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Ability_SpecialistAbilitySet.uc b/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Ability_SpecialistAbilitySet.uc index d83cb7337..5872a24db 100644 --- a/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Ability_SpecialistAbilitySet.uc +++ b/X2WOTCCommunityHighlander/Src/XComGame/Classes/X2Ability_SpecialistAbilitySet.uc @@ -1179,8 +1179,10 @@ static function X2AbilityTemplate RestorativeMist() local X2AbilityTemplate Template; local X2AbilityCost_ActionPoints ActionPointCost; local X2Condition_UnitProperty HealTargetCondition; - local X2Condition_UnitStatCheck UnitStatCheckCondition; - local X2Condition_UnitEffects UnitEffectsCondition; + // Start Issue #1436 - Variables no longer needed - now handled by X2Condition_Restoration + //local X2Condition_UnitStatCheck UnitStatCheckCondition; + //local X2Condition_UnitEffects UnitEffectsCondition; + // End Issue #1436 local X2Effect_ApplyMedikitHeal MedikitHeal; local X2AbilityCharges Charges; local X2AbilityCost_Charges ChargeCost; @@ -1220,20 +1222,31 @@ static function X2AbilityTemplate RestorativeMist() HealTargetCondition = new class'X2Condition_UnitProperty'; HealTargetCondition.ExcludeHostileToSource = true; HealTargetCondition.ExcludeFriendlyToSource = false; - HealTargetCondition.ExcludeFullHealth = true; + // Single line for Issue #1436 - Remove ExcludeFullHealth from Targeting conditions - Now handled by X2Condition_Restoration + //HealTargetCondition.ExcludeFullHealth = true; HealTargetCondition.RequireSquadmates = true; HealTargetCondition.ExcludeDead = false; //See comment below... HealTargetCondition.ExcludeRobotic = true; // restorative mist can't affect robots Template.AbilityMultiTargetConditions.AddItem(HealTargetCondition); - + + // Start Issue #1436 + /// HL-Docs: ref:Bugfixes; issue:1436 + /// Targeting conditions for the Restoration ability do not allow the ability to target units + /// which have mental status effects but are not otherwise injured (or affected by an effect which can be + /// removed by a medikit). This fix re-works the targeting conditions so that such units can be properly + /// targeted. + //Hack: Do this instead of ExcludeDead, to only exclude properly-dead or bleeding-out units. - UnitStatCheckCondition = new class'X2Condition_UnitStatCheck'; + /*UnitStatCheckCondition = new class'X2Condition_UnitStatCheck'; UnitStatCheckCondition.AddCheckStat(eStat_HP, 0, eCheck_GreaterThan); Template.AbilityMultiTargetConditions.AddItem(UnitStatCheckCondition); UnitEffectsCondition = new class'X2Condition_UnitEffects'; UnitEffectsCondition.AddExcludeEffect(class'X2StatusEffects'.default.BleedingOutName, 'AA_UnitIsImpaired'); - Template.AbilityMultiTargetConditions.AddItem(UnitEffectsCondition); + Template.AbilityMultiTargetConditions.AddItem(UnitEffectsCondition);*/ + + Template.AbilityMultiTargetConditions.AddItem(new class'X2Condition_Restoration'); + // End Issue #1436 //Healing effects follow... MedikitHeal = new class'X2Effect_ApplyMedikitHeal';