Advertisement
Guest User

Ability Silly Vehicle Vitality

a guest
Oct 9th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. Class AbilitySillyVehicleVitality extends AbilityVehicleVitality
  2. Abstract;
  3.  
  4. static function bool AbilityIsAllowed(GameInfo Game, MutUT2004RPG RPGMut)
  5. {
  6. Return Game.bAllowVehicles;
  7. }
  8.  
  9. //Mechanic lvl 2
  10. //Support lvl 3
  11. static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
  12. {
  13. if (CurrentLevel <= 1 && Data.Abilities.length > 0 && class<RPGClass>(Data.Abilities[0]) != None &&
  14. (class<RPGClass>(Data.Abilities[0]).default.ClassIDNumber == 5 || class<AbilityClassSupport>(Data.Abilities[0]) != None))
  15. {
  16. Return Super(RPGAbility).Cost(Data, CurrentLevel);
  17. }
  18. else if (Data.Abilities.Length > 0 && class<AbilityClassSupport>(Data.Abilities[0]) != None)
  19. {
  20. Return Super(RPGAbility).Cost(Data, CurrentLevel);
  21. }
  22.  
  23. Return 0;
  24. }
  25.  
  26. /* Modify the owning player's current vehicle. Called by MutUT2004RPG.DriverEnteredVehicle() serverside
  27. * and RPGStatsInv.ClientEnteredVehicle() clientside.
  28. */
  29. static simulated function ModifyVehicle(Vehicle V, int AbilityLevel)
  30. {
  31. local float HealthPerc;
  32. local int OldMax;
  33. local int NewMax;
  34. local InvVehicleNfo Nfo;
  35. local Inventory Inv;
  36.  
  37.  
  38. //log(V$"Vitality Hi ");
  39.  
  40. //FixMe: both ClientModifyVehicle and ServerModifyVehicle calls this (this is called twice).
  41. /*if (Role != Role_Authority)
  42. Return;*/
  43. OldMax = V.HealthMax;
  44. HealthPerc = float(V.Health) / V.HealthMax;
  45. V.HealthMax *= (1.0 + (0.05 * float(AbilityLevel)));
  46. V.Health = V.HealthMax * HealthPerc;
  47. NewMax = V.HealthMax;
  48.  
  49. Inv = V.FindInventoryType(class'InvVehicleNfo');
  50. if (Inv == None)
  51. {
  52. //log(V$" Making Nfo ");
  53.  
  54. Nfo = V.spawn(class'InvVehicleNfo', V,,,rot(0,0,0));
  55.  
  56. //if (Nfo == None)
  57. //log(V$" No Nfo -1 ");
  58.  
  59. Nfo.GiveTo(V);
  60.  
  61. //if (Nfo == None)
  62. //log(V$" No Nfo 0 ");
  63. }
  64. else
  65. {
  66. //log(V$" Nfo already done "$Inv);
  67.  
  68. Nfo = InvVehicleNfo(Inv);
  69. }
  70.  
  71. if (Nfo == None)
  72. {
  73. log(V$" No Nfo 1 ");
  74. return;
  75. }
  76. Nfo.VitalityBonus = NewMax - OldMax;
  77. Nfo.VitalityLevel = AbilityLevel;
  78. Nfo.CurrHpMax = NewMax;
  79.  
  80. //log(Nfo.CurrHpMax);
  81. //Inv = V.FindInventoryType(class'InvVehicleNfo');
  82. //if (Inv == None)
  83. //{
  84. //log(V$" No Nfo 2 ");
  85. //return;
  86. //}
  87. }
  88.  
  89. /* Remove any modifications to this vehicle, because the player is no longer driving it.
  90. */
  91. static simulated function UnModifyVehicle(Vehicle V, int AbilityLevel)
  92. {
  93. local int DefaultHealth;
  94. local float HealthPerc;
  95. //local float DefLinkHealMult; // Why change it on exit when you are not touching it on entry ?
  96.  
  97. local InvVehicleNfo Nfo;
  98. local Inventory Inv;
  99.  
  100. //log(V$"Vitality bye ");
  101. HealthPerc = float(V.Health) / V.HealthMax;
  102.  
  103. if (ASVehicleFactory(V.ParentFactory) != None)
  104. {
  105. DefaultHealth = ASVehicleFactory(V.ParentFactory).VehicleHealth;
  106. //DefLinkHealMult = ASVehicleFactory(V.ParentFactory).VehicleLinkHealMult;
  107. }
  108. else
  109. {
  110. DefaultHealth = V.default.Health;
  111. //DefLinkHealMult = V.default.LinkHealMult;
  112. }
  113.  
  114.  
  115. //V.LinkHealMult = DefLinkHealMult;
  116.  
  117. Inv = V.FindInventoryType(class'InvVehicleNfo');
  118. if (Inv == None)
  119. {
  120. log(V$" No Nfo 3 ");
  121. V.HealthMax = DefaultHealth;
  122. V.Health = HealthPerc * V.HealthMax;
  123. return;
  124. }
  125. Nfo = InvVehicleNfo(Inv);
  126. if (Nfo == None)
  127. {
  128. log(V$" No Nfo 4 ");
  129. V.HealthMax = DefaultHealth;
  130. V.Health = HealthPerc * V.HealthMax;
  131. return;
  132. }
  133.  
  134. V.HealthMax = DefaultHealth; //V.HealthMax - Nfo.VitalityBonus;
  135. V.Health = HealthPerc * V.HealthMax;
  136.  
  137. //Nfo.VitalityBonus = 0;
  138. Nfo.VitalityLevel = 0;
  139. //log(V$" bye bye "$V.HealthMax);
  140. }
  141.  
  142. defaultproperties
  143. {
  144. AbilityName="Silly Vehicle Vitality"
  145. Description="This skill will increase vehicle health 5% per level. Exiting the vehicle will result in faster repairing. You must be the driver for this skill to take affect.|The Mechanic class may purchase up to level 2. The Support class may purchase all levels.|(Max level: 3)."
  146. StartingCost=5
  147. MaxLevel=3
  148. PackageName="SillyRPG"
  149. ClassFilterName="Misc Abilities"
  150. RequiredRanking(0)=4
  151. RequiredRanking(1)=4
  152. RequiredRanking(2)=4
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement