Advertisement
Guest User

Untitled

a guest
Apr 27th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function float GetReactionAdjust(XComGameState_Unit Shooter, XComGameState_Unit Target)
  2. {
  3.     local XComGameStateHistory History;
  4.     local XComGameState_Unit OldTarget;
  5.     local UnitValue ConcealedValue;
  6.     local int PathIndex, ChainStartIdx;
  7.     local XComGameStateContext_Ability AbilityContext;
  8.     local bool FoundContext;
  9.  
  10.     History = `XCOMHISTORY;
  11.  
  12.     //  No penalty if the shooter went into Overwatch while concealed.
  13.     if (Shooter.GetUnitValue(class'X2Ability_DefaultAbilitySet'.default.ConcealedOverwatchTurn, ConcealedValue))
  14.     {
  15.         if (ConcealedValue.fValue > 0)
  16.             return 0;
  17.     }
  18.     `log("Finding correct AbilityContext:");
  19.     foreach History.IterateContextsByClassType(class'XComGameStateContext_Ability', AbilityContext,,, ChainStartIdx)
  20.     {
  21.         If (ChainStartIdx == 0) ChainStartIdx=AbilityContext.EventChainStartIndex// What we're reacting to can't possibly be further back than this!
  22.                                                                                     // Also note the current reaction isn't in history (indeed, the AI may just be checking hit chances), so can't just ask it directly
  23.         `log(AbilityContext);
  24.         if(AbilityContext.InputContext.SourceObject.ObjectID==Target.ObjectID)
  25.         {
  26.             FoundContext = true;
  27.             break;
  28.         }
  29.     }
  30.     `log(`showvar(FoundContext));
  31.     if(FoundContext)
  32.     {
  33.         PathIndex = AbilityContext.GetMovePathIndex(Target.ObjectID);// Ok, did we move?
  34.         `log(`showvar(PathIndex));
  35.         if (PathIndex!=INDEX_NONE) `log(`showvar(AbilityContext.InputContext.MovementPaths[PathIndex].CostIncreases.Length));
  36.         If (PathIndex!=INDEX_NONE && AbilityContext.InputContext.MovementPaths[PathIndex].CostIncreases.Length!=0)//Dash check
  37.         {
  38.             return REACTION_DASHING_FINALMOD;
  39.         }
  40.     }
  41.     return default.REACTION_FINALMOD;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement