Advertisement
Guest User

Untitled

a guest
Oct 17th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. function name PAShakeUpApplyChance(const out EffectAppliedData ApplyEffectParameters, XComGameState_BaseObject kNewTargetState, XComGameState NewGameState)
  2. {
  3. // this mimics the panic hit roll without actually BEING the panic hit roll
  4. local XComGameState_Unit TargetUnit;
  5. local name ImmuneName;
  6. local int TargetRoll, RandRoll;
  7. local XMBValue_Visibility Value;
  8. local int BadGuysValue;
  9.  
  10. Value = new class'XMBValue_Visibility';
  11. Value.bCountEnemies = true;
  12. Value.bSquadsight = true;
  13.  
  14. TargetUnit = XComGameState_Unit(kNewTargetState);
  15. if (TargetUnit != none)
  16. {
  17. foreach class'X2AbilityToHitCalc_PanicCheck'.default.PanicImmunityAbilities(ImmuneName)
  18. {
  19. if (TargetUnit.FindAbility(ImmuneName).ObjectID != 0)
  20. {
  21. return 'AA_UnitIsImmune';
  22. }
  23. if (default.PAShakeUp_BerserkerImmunity) {
  24. if (TargetUnit.GetMyTemplate().CharacterGroupName == 'Berserker')
  25. {
  26. return 'AA_UnitIsImmune';
  27. }
  28. }
  29. }
  30.  
  31. BadGuysValue = Value * default.PAShakeUp_DECREASE_PER_VISIBLE_ENEMY;
  32.  
  33. TargetRoll = default.PAShakeUp_BASE_CHANCE - BadGuysValue;
  34. RandRoll = `SYNC_RAND(100);
  35. if (RandRoll < TargetRoll)
  36. {
  37. return 'AA_Success';
  38. }
  39. }
  40.  
  41. return 'AA_EffectChanceFailed';
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement