Advertisement
KrasimirTsvetkov

Medic Perk Progress

Dec 13th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. simulated function ProcessTouch(Actor Other, Vector HitLocation)
  2. {
  3.     local KFPlayerReplicationInfo PRI;
  4.     local int MedicReward;
  5.     local KFHumanPawn Healed;
  6.     local float HealSum; // for modifying based on perks
  7.  
  8.     if ( Other == none || Other == Instigator || Other.Base == Instigator )
  9.         return;
  10.  
  11.     if( Role == ROLE_Authority )
  12.     {
  13.         Healed = KFHumanPawn(Other);
  14.  
  15.         if( Healed != none )
  16.         {
  17.             HitHealTarget(HitLocation, -vector(Rotation));
  18.         }
  19.  
  20.         if( Instigator != none && Healed != none && Healed.Health > 0 &&
  21.             Healed.Health <  Healed.HealthMax )
  22.         {
  23.  
  24.             MedicReward = HealBoostAmount;
  25.  
  26.             PRI = KFPlayerReplicationInfo(Instigator.PlayerReplicationInfo);
  27.  
  28.             if ( PRI != none && PRI.ClientVeteranSkill != none )
  29.             {
  30.                 MedicReward *= PRI.ClientVeteranSkill.Static.GetHealPotency(PRI);
  31.             }
  32.  
  33.             HealSum = MedicReward;
  34.  
  35.             if ( (Healed.Health + Healed.healthToGive + MedicReward) > Healed.HealthMax )
  36.             {
  37.                 MedicReward = Healed.HealthMax - (Healed.Health + Healed.healthToGive);
  38.                 if ( MedicReward < 0 )
  39.                 {
  40.                     MedicReward = 0;
  41.                 }
  42.             }
  43.  
  44.             Healed.GiveHealth(HealSum, Healed.HealthMax);
  45.  
  46.             if ( PRI != None )
  47.             {
  48.                 if ( MedicReward > 0 && KFSteamStatsAndAchievements(PRI.SteamStatsAndAchievements) != none && (KFPCServ.bDisableHeal == False)) //Add progress if the bDisableHeal is set to False (Unchecked by default)
  49.                 {
  50.                     KFSteamStatsAndAchievements(PRI.SteamStatsAndAchievements).AddDamageHealed(MedicReward, true);
  51.                 }
  52.  
  53.                 // Give the medic reward money as a percentage of how much of the person's health they healed
  54.                 MedicReward = int((FMin(float(MedicReward),Healed.HealthMax)/Healed.HealthMax) * 60); // Increased to 80 in Balance Round 6, reduced to 60 in Round 7
  55.  
  56.                 PRI.Score += MedicReward;
  57.                 PRI.ThreeSecondScore += MedicReward;
  58.  
  59.                 PRI.Team.Score += MedicReward;
  60.  
  61.                 if ( KFHumanPawn(Instigator) != none )
  62.                 {
  63.                     KFHumanPawn(Instigator).AlphaAmount = 255;
  64.                 }
  65.  
  66.                 if( MP5SD(Instigator.Weapon) != none )
  67.                 {
  68.                     MP5SD(Instigator.Weapon).ClientSuccessfulHealMP5SDLLI(Healed.PlayerReplicationInfo.PlayerName);
  69.                 }
  70.             }
  71.         }
  72.     }
  73.     else if( KFHumanPawn(Other) != none )
  74.     {
  75.         bHidden = true;
  76.         SetPhysics(PHYS_None);
  77.         return;
  78.     }
  79.  
  80.     Explode(HitLocation,-vector(Rotation));
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement