Guest User

Untitled

a guest
Jun 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.41 KB | None | 0 0
  1. using System;
  2. using Server;
  3. using Server.Items;
  4. using Server.Spells;
  5. using Server.Mobiles;
  6.  
  7. namespace Server.Misc
  8. {
  9. public class RegenRates
  10. {
  11. [CallPriority(10)]
  12. public static void Configure()
  13. {
  14. Mobile.DefaultHitsRate = TimeSpan.FromSeconds(11.0);
  15. Mobile.DefaultStamRate = TimeSpan.FromSeconds(5.0);
  16. Mobile.DefaultManaRate = TimeSpan.FromSeconds(2.0);
  17.  
  18. Mobile.StamRegenRateHandler = new RegenRateHandler(Mobile_StaminaRegenRate);
  19. Mobile.HitsRegenRateHandler = new RegenRateHandler(Mobile_HitsRegenRate);
  20. }
  21.  
  22. private static TimeSpan Mobile_StaminaRegenRate(Mobile from)
  23. {
  24. if (from is BaseMount)
  25. return TimeSpan.FromSeconds(2.5);
  26. else
  27. return Mobile.DefaultStamRate;
  28. }
  29.  
  30. private static TimeSpan Mobile_HitsRegenRate(Mobile from)
  31. {
  32. double scale = 1.0 - (from.Hunger / 40.0);
  33. if (scale < 0.5)
  34. scale = 0.5;
  35. else if (scale > 1.0)
  36. scale = 1.0;
  37. return TimeSpan.FromSeconds(Mobile.DefaultHitsRate.TotalSeconds * scale);
  38. }
  39.  
  40.  
  41. // private static TimeSpan Mobile_ManaRegenRate( Mobile from )
  42. // {
  43. // if ( from.Skills == null )
  44. // return Mobile.DefaultManaRate;
  45.  
  46. // if ( !from.Meditating )
  47. // CheckBonusSkill( from, from.Mana, from.ManaMax, SkillName.Meditation );
  48.  
  49. // double rate;
  50. // double armorPenalty = GetArmorOffset( from );
  51.  
  52. // if ( Core.AOS )
  53. // {
  54. // double medPoints = from.Int + (from.Skills[SkillName.Meditation].Value * 3);
  55.  
  56. // medPoints *= ( from.Skills[SkillName.Meditation].Value < 100.0 ) ? 0.025 : 0.0275;
  57.  
  58. // CheckBonusSkill( from, from.Mana, from.ManaMax, SkillName.Focus );
  59.  
  60. // double focusPoints = (from.Skills[SkillName.Focus].Value * 0.05);
  61.  
  62. // if ( armorPenalty > 0 )
  63. // medPoints = 0; // In AOS, wearing any meditation-blocking armor completely removes meditation bonus
  64.  
  65. // double totalPoints = focusPoints + medPoints + (from.Meditating ? (medPoints > 13.0 ? 13.0 : medPoints) : 0.0);
  66.  
  67. // if( (from is BaseCreature && ((BaseCreature)from).IsParagon) || from is Leviathan )
  68. // totalPoints += 40;
  69.  
  70. // int cappedPoints = AosAttributes.GetValue( from, AosAttribute.RegenMana );
  71.  
  72. // if ( CheckTransform( from, typeof( VampiricEmbraceSpell ) ) )
  73. // cappedPoints += 3;
  74. // else if ( CheckTransform( from, typeof( LichFormSpell ) ) )
  75. // cappedPoints += 13;
  76.  
  77. // if( Core.ML && from is PlayerMobile )
  78. // cappedPoints = Math.Min( cappedPoints, 18 );
  79.  
  80. // totalPoints += cappedPoints;
  81.  
  82. // if ( totalPoints < -1 )
  83. // totalPoints = -1;
  84.  
  85. // if ( Core.ML )
  86. // totalPoints = Math.Floor( totalPoints );
  87.  
  88. // rate = 1.0 / (0.1 * (2 + totalPoints));
  89. // }
  90. // else
  91. // {
  92. // double medPoints = (from.Int + from.Skills[SkillName.Meditation].Value) * 0.5;
  93.  
  94. // if ( medPoints <= 0 )
  95. // rate = 7.0;
  96. // else if ( medPoints <= 100 )
  97. // rate = 7.0 - (239*medPoints/2400) + (19*medPoints*medPoints/48000);
  98. // else if ( medPoints < 120 )
  99. // rate = 1.0;
  100. // else
  101. // rate = 0.75;
  102.  
  103. // rate += armorPenalty;
  104.  
  105. // if ( from.Meditating )
  106. // rate *= 0.5;
  107.  
  108. // if ( rate < 0.5 )
  109. // rate = 0.5;
  110. // else if ( rate > 7.0 )
  111. // rate = 7.0;
  112. // }
  113.  
  114. // return TimeSpan.FromSeconds( rate );
  115. // }
  116.  
  117. // public static double GetArmorOffset( Mobile from )
  118. // {
  119. // double rating = 0.0;
  120.  
  121. // if ( !Core.AOS )
  122. // rating += GetArmorMeditationValue( from.ShieldArmor as BaseArmor );
  123.  
  124. // rating += GetArmorMeditationValue( from.NeckArmor as BaseArmor );
  125. // rating += GetArmorMeditationValue( from.HandArmor as BaseArmor );
  126. // rating += GetArmorMeditationValue( from.HeadArmor as BaseArmor );
  127. // rating += GetArmorMeditationValue( from.ArmsArmor as BaseArmor );
  128. // rating += GetArmorMeditationValue( from.LegsArmor as BaseArmor );
  129. // rating += GetArmorMeditationValue( from.ChestArmor as BaseArmor );
  130.  
  131. // return rating / 4;
  132. // }
  133.  
  134. // private static double GetArmorMeditationValue( BaseArmor ar )
  135. // {
  136. // if ( ar == null || ar.ArmorAttributes.MageArmor != 0 || ar.Attributes.SpellChanneling != 0 )
  137. // return 0.0;
  138.  
  139. // switch ( ar.MeditationAllowance )
  140. // {
  141. // default:
  142. // case ArmorMeditationAllowance.None: return ar.BaseArmorRatingScaled;
  143. // case ArmorMeditationAllowance.Half: return ar.BaseArmorRatingScaled / 2.0;
  144. // case ArmorMeditationAllowance.All: return 0.0;
  145. // }
  146. // }
  147. // }
  148. //}
Add Comment
Please, Sign In to add comment