Advertisement
Treedestroyed

Legacy Mode

Oct 23rd, 2018
1,298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //////////////////////////////////////////////
  2. // Legacy Mode mutator by HUNTER 23.10.2018 //
  3. //////////////////////////////////////////////
  4.  
  5. class LegacyModeMut extends KFMutator
  6.     config ( LegacyMode );
  7.  
  8. var config bool bLegacyBalance;
  9.  
  10. var config int MaxMonsters;
  11. var config int TraderTime;
  12.  
  13. var config float SpawnRateMod;
  14. var config float MovementSpeedMod;
  15. var config float WaveCountMod;
  16. var config float DoshKillMod;
  17. var config float MediumAttackChance;
  18. var config float HardAttackChance;
  19.  
  20. function InitMutator( string Options, out string ErrorMessage )
  21. {
  22.     super.InitMutator( Options, ErrorMessage );
  23.    
  24.     KFGameInit();
  25.     SaveConfig();
  26.  
  27.     `log("Legacy Mode mutator initialized");
  28. }
  29.  
  30. function PostBeginPlay()
  31. {
  32.     if ( WorldInfo.Game.BaseMutator == None )
  33.         WorldInfo.Game.BaseMutator = Self;
  34.     else WorldInfo.Game.BaseMutator.AddMutator( Self );
  35. }
  36.  
  37. function AddMutator( Mutator M )
  38. {
  39.     if ( M != Self )
  40.     {
  41.         if ( M.Class == Class )
  42.             M.Destroy();
  43.         else super.AddMutator( M );
  44.     }
  45. }
  46.  
  47. function KFGameInit()
  48. {
  49.     local int i, j;
  50.     local KFGameInfo KFGI;
  51.     local KFGameDifficulty_Legacy KFDI;
  52.  
  53.     KFGI = KFGameInfo( WorldInfo.Game );
  54.     KFDI = KFGameDifficulty_Legacy ( KFGI.DifficultyInfo );
  55.    
  56.     if ( KFGI != None )
  57.     {
  58.         KFGI.PlayerControllerClass = class'KFPlayerController_Legacy';
  59.         KFGI.KFGFxManagerClass = class'KFGFxMoviePlayer_Manager_Legacy';
  60.        
  61.         KFGI.SpawnManagerClasses[0] = class'KFAISpawnManager_Short_Legacy';
  62.         KFGI.SpawnManagerClasses[1] = class'KFAISpawnManager_Normal_Legacy';
  63.         KFGI.SpawnManagerClasses[2] = class'KFAISpawnManager_Long_Legacy';
  64.        
  65.         KFGI.DifficultyInfo = new( KFGI ) class'KFGameDifficulty_Legacy';
  66.         KFGI.DifficultyInfo.SetDifficultySettings( KFGI.GameDifficulty );
  67.     }
  68.    
  69.     if ( KFGI.SpawnManager != None )
  70.     {
  71.         for ( i = 0; i < KFGI.SpawnManager.PerDifficultyMaxMonsters.length; i++ )
  72.         {
  73.             for ( j = 0; j < KFGI.SpawnManager.PerDifficultyMaxMonsters[i].MaxMonsters.length ; j++ )
  74.                 KFGI.SpawnManager.PerDifficultyMaxMonsters[i].MaxMonsters[j] = MaxMonsters;
  75.         }
  76.     }
  77.    
  78.     if ( KFDI != None && KFGI.DifficultyInfo != None )
  79.     {
  80.         KFDI.LegacySettings.TraderTime = TraderTime;
  81.         KFDI.LegacySettings.SpawnRateModifier = SpawnRateMod;
  82.         KFDI.LegacySettings.MovementSpeedMod = MovementSpeedMod;
  83.         KFDI.LegacySettings.WaveCountMod = WaveCountMod;
  84.         KFDI.LegacySettings.DoshKillMod = DoshKillMod;
  85.         KFDI.LegacySettings.MediumAttackChance = MediumAttackChance;
  86.         KFDI.LegacySettings.HardAttackChance = HardAttackChance;
  87.     }
  88.    
  89.     bLegacyBalance = true;
  90.    
  91.     if ( bLegacyBalance )
  92.     {
  93.         MaxMonsters = 48;
  94.         TraderTime = 75;
  95.         SpawnRateMod = 0.35f;
  96.         MovementSpeedMod = 1.f;
  97.         WaveCountMod = 2.3f;
  98.         DoshKillMod = 1.5;
  99.         MediumAttackChance = 0.85f;
  100.         HardAttackChance = 1.5f;
  101.     }
  102.    
  103.     SaveConfig();
  104.    
  105.     SetTimer( 1.0, false, nameof( AdjustBossWave ));
  106. }
  107.  
  108. function AdjustBossWave()
  109. {
  110.     local KFGameInfo KFGI;
  111.     local KFGameReplicationInfo KFGRI;
  112.  
  113.     KFGI = KFGameInfo( WorldInfo.Game );
  114.     KFGRI = KFGameReplicationInfo( WorldInfo.GRI );
  115.    
  116.     if ( KFGRI.WaveNum == KFGRI.WaveMax && KFGRI.IsBossWave() )
  117.     {
  118.         KFGI.SpawnManager.TimeUntilNextSpawn = 10;
  119.         SetTimer( 5.0, false, nameof( AdjustBossList ));
  120.     }
  121. }
  122.  
  123. function AdjustBossList()
  124. {
  125.     local KFGameInfo KFGI;
  126.     local array < class < KFPawn_Monster > > BossList;
  127.     local byte RandChoice;
  128.    
  129.     KFGI = KFGameInfo( WorldInfo.Game );
  130.    
  131.     RandChoice = Rand(2);
  132.        
  133.     if ( RandChoice == 0 )
  134.         BossList.AddItem(class'KFPawn_ZedHans');
  135.        
  136.     if ( RandChoice == 1 )
  137.         BossList.AddItem(class'KFPawn_ZedPatriarch');
  138.  
  139.     KFGI.NumAISpawnsQueued += KFGI.SpawnManager.SpawnSquad( BossList );
  140.     KFGI.SpawnManager.TimeUntilNextSpawn = KFGI.SpawnManager.CalcNextGroupSpawnTime();
  141. }
  142.  
  143. function bool CheckRelevance( Actor Other )
  144. {
  145.     local bool SuperRelevant;
  146.     local KFDroppedPickup PlayerWeapon;
  147.  
  148.     SuperRelevant = super.CheckRelevance( Other );
  149.  
  150.     if ( !SuperRelevant )
  151.         return SuperRelevant;
  152.  
  153.     PlayerWeapon = KFDroppedPickup( Other );
  154.  
  155.     if ( PlayerWeapon != None )
  156.     {
  157.         PlayerWeapon.Lifespan = 2147483647;
  158.         return SuperRelevant;
  159.     }
  160.  
  161.     return SuperRelevant;
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement