Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restoration Targeting Fix #1440

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1188,8 +1188,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;
Expand Down Expand Up @@ -1229,20 +1231,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';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
class X2Condition_Restoration extends X2Condition;

BlackDog86 marked this conversation as resolved.
Show resolved Hide resolved
// 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
3 changes: 3 additions & 0 deletions X2WOTCCommunityHighlander/X2WOTCCommunityHighlander.x2proj
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@
<Content Include="Src\XComGame\Classes\X2ChosenActionTemplate.uc">
<SubType>Content</SubType>
</Content>
<Content Include="Src\XComGame\Classes\X2Condition_Restoration.uc">
<SubType>Content</SubType>
</Content>
<Content Include="Src\XComGame\Classes\X2Condition_RevivalProtocol.uc">
<SubType>Content</SubType>
</Content>
Expand Down
Loading