Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.34 KB | None | 0 0
  1. using Server.Items;
  2. using System;
  3. using System.Collections.Generic;
  4.  
  5. namespace Server.SurvivalUO.Mobiles.Quest.Bartok
  6. {
  7.  
  8. public class FandaghRing : Server.Items.SilverRing
  9. {
  10. public override bool IsArtifact { get { return true; } }
  11.  
  12. public FandaghRing() : base()
  13. {
  14. this.Attributes.BonusStr = 8;
  15. this.Attributes.WeaponDamage = 15;
  16. this.Attributes.RegenHits = 5;
  17. }
  18.  
  19. public override string DefaultName
  20. {
  21. get
  22. {
  23. return "Fandagh's Ring";
  24. }
  25. }
  26.  
  27.  
  28.  
  29. public FandaghRing(Serial serial) : base(serial) { }
  30.  
  31.  
  32. public override void Serialize(GenericWriter writer)
  33. {
  34. base.Serialize(writer);
  35.  
  36. writer.Write((int)0); // version
  37. }
  38.  
  39. public override void Deserialize(GenericReader reader)
  40. {
  41. base.Deserialize(reader);
  42.  
  43. int version = reader.ReadInt();
  44. }
  45.  
  46. }
  47.  
  48. public class Fandagh : Server.Mobiles.OrcBrute
  49. {
  50.  
  51.  
  52. private bool m_Stunning;
  53.  
  54. [Constructable]
  55. public Fandagh() : base()
  56. {
  57. this.SetHits(1526, 1600);
  58. this.Hue = 133;
  59. this.Name = "Fandagh";
  60. this.SetSkill(SkillName.MagicResist, 200, 200.0);
  61.  
  62. this.SetResistance(ResistanceType.Physical, 60, 60);
  63. this.SetResistance(ResistanceType.Fire, 85, 85);
  64. this.SetResistance(ResistanceType.Cold, 85, 85);
  65. this.SetResistance(ResistanceType.Poison, 85, 85);
  66. this.SetResistance(ResistanceType.Energy, 85, 85);
  67. }
  68.  
  69. public Fandagh(Serial serial) : base(serial) { }
  70.  
  71.  
  72. public override bool ReduceSpeedWithDamage
  73. {
  74. get
  75. {
  76. return false;
  77. }
  78. }
  79.  
  80. public override bool IsScaryToPets
  81. {
  82. get
  83. {
  84. return true;
  85. }
  86. }
  87.  
  88. public override bool AutoDispel
  89. {
  90. get
  91. {
  92. return !this.Controlled;
  93. }
  94. }
  95. public override bool BleedImmune
  96. {
  97. get
  98. {
  99. return true;
  100. }
  101. }
  102. public override bool BardImmune
  103. {
  104. get
  105. {
  106. return !Core.AOS || this.Controlled;
  107. }
  108. }
  109. public override Poison PoisonImmune
  110. {
  111. get
  112. {
  113. return Poison.Lethal;
  114. }
  115. }
  116.  
  117.  
  118. public override void OnGaveMeleeAttack(Mobile defender)
  119. {
  120. base.OnGaveMeleeAttack(defender);
  121.  
  122. if (!this.m_Stunning && 0.3 > Utility.RandomDouble())
  123. {
  124. this.m_Stunning = true;
  125.  
  126. defender.Animate(21, 6, 1, true, false, 0);
  127. this.PlaySound(0xEE);
  128. defender.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "You have been stunned by a colossal blow!");
  129.  
  130. BaseWeapon weapon = this.Weapon as BaseWeapon;
  131. if (weapon != null)
  132. weapon.OnHit(this, defender);
  133.  
  134. if (defender.Alive)
  135. {
  136. defender.Frozen = true;
  137. Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(Recover_Callback), defender);
  138. }
  139. }
  140. }
  141. private void Recover_Callback(object state)
  142. {
  143. Mobile defender = state as Mobile;
  144.  
  145. if (defender != null)
  146. {
  147. defender.Frozen = false;
  148. defender.Combatant = null;
  149. defender.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "You recover your senses.");
  150. }
  151.  
  152. this.m_Stunning = false;
  153. }
  154.  
  155. public override void GenerateLoot()
  156. {
  157. this.AddLoot(LootPack.FilthyRich);
  158. var random = new Random();
  159. if (random.NextDouble() > 0.95)
  160. {
  161.  
  162. FandaghRing item = new FandaghRing();
  163. this.Backpack.AddItem(item);
  164. }
  165. }
  166.  
  167. public override void OnDamage(int amount, Mobile from, bool willKill)
  168. {
  169. if (new Random().NextDouble() > 0.8)
  170. {
  171. SpawnOrcs();
  172. }
  173. base.OnDamage(amount, from, willKill);
  174. }
  175.  
  176. private void SpawnOrcs()
  177. {
  178. Map map = this.Map;
  179. int noOrcs = new Random().Next(3, 4);
  180. if (map != null)
  181. {
  182. for (int i = 0; i < noOrcs; i += 1)
  183. {
  184. double rx = 0.5;
  185. double ry = 0.5;
  186.  
  187. int dist = 0;
  188. bool ok = false;
  189. int x = 0, y = 0, z = 0;
  190.  
  191. while (!ok && dist < 10)
  192. {
  193. int rdist = 10 + dist;
  194.  
  195. x = this.X + (int)(rx * rdist);
  196. y = this.Y + (int)(ry * rdist);
  197. z = map.GetAverageZ(x, y);
  198.  
  199. if (!(ok = map.CanFit(x, y, this.Z, 16, false, false)))
  200. ok = map.CanFit(x, y, z, 16, false, false);
  201.  
  202. if (dist >= 0)
  203. dist = -(dist + 1);
  204. else
  205. dist = -(dist - 1);
  206. }
  207.  
  208. if (!ok)
  209. continue;
  210.  
  211. Server.Mobiles.OrcishMage spawn = new Server.Mobiles.OrcishMage();
  212. spawn.Team = this.Team;
  213. spawn.Summoned = true;
  214. spawn.SummonMaster = this;
  215. spawn.MoveToWorld(new Point3D(x, y, z), map);
  216.  
  217. }
  218. }
  219. }
  220.  
  221. public override void Serialize(GenericWriter writer)
  222. {
  223. base.Serialize(writer);
  224.  
  225. writer.Write((int)0); // version
  226. }
  227.  
  228. public override void Deserialize(GenericReader reader)
  229. {
  230. base.Deserialize(reader);
  231.  
  232. int version = reader.ReadInt();
  233. }
  234.  
  235. }
  236. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement