Guest User

Untitled

a guest
Dec 7th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.59 KB | None | 0 0
  1. int killerStr; // Killers Strength
  2. int killerDex; // Killers Dexterity
  3. int killerToughness; // Killers Toughness
  4. int killerSpeed; // Killers Speed
  5.  
  6. int victimHealth; // Victims health
  7. int victimDex; // Victims Dexterity
  8. int victimStr; // Victims Strength
  9. int victimToughness; // Victims Toughness
  10. int victimSpeed; // Victims Speed
  11. int Damage;
  12. int AwardXP;
  13. public void Melee(Actor actor, Actor target, int Delay)
  14. {
  15. if (actor.Human)
  16. {
  17. // Bare Bones Hard Coded Delay
  18. // I would make Dynamic Later based on weapon and stats
  19. if (Delay >= 1000)
  20. {
  21. string chatOutput = "YOU ATTACK AT: " + Delay + ".";
  22. actor.Output(chatOutput, System.Drawing.Color.Red);
  23. UserScripts.Attack.SetSingleGlobal(actor, "Delay", 250); // Update Actor Global
  24. killerStr = actor.GetAttribute("Strength");
  25. killerDex = actor.GetAttribute("Dexterity");
  26. killerToughness = actor.GetAttribute("Toughness");
  27. killerSpeed = actor.GetAttribute("Speed");
  28.  
  29. victimHealth = target.GetAttribute("Health");
  30. victimDex = target.GetAttribute("Dexterity");
  31. victimStr = target.GetAttribute("Strength");
  32. victimToughness = target.GetAttribute("Toughness");
  33. victimSpeed = target.GetAttribute("Speed");
  34. Damage = (killerStr + 5) - victimToughness;
  35. if (Damage < 0)
  36. {
  37. Damage = 0;
  38. }
  39. AwardXP = actor.Level + 25;
  40. if (killerSpeed > victimDex)
  41. {
  42. target.SetAttribute("Health", victimHealth - Damage); // Change the victims health to apply damage
  43. chatOutput = "You have hit your target for: " + Damage + ".";
  44. actor.Output(chatOutput, System.Drawing.Color.Green);
  45. //actor.Output("You have hit your target for: " + Damage);
  46. }
  47. else
  48. {
  49. chatOutput = "You have missed your target! You fail!.";
  50. actor.Output(chatOutput, System.Drawing.Color.Yellow);
  51. //actor.Output("You have missed your target! You fail!");
  52. }
  53. if (target.GetAttribute("Health") < 1)
  54. {
  55. chatOutput = "You killed your victim!.";
  56. actor.Output(chatOutput, System.Drawing.Color.Red);
  57. target.Kill();
  58. //actor.Output("You killed your victim!");
  59. int CurXP = 0;
  60. PacketReader reader = new PacketReader(actor.Globals["XP"]);
  61. CurXP = reader.ReadInt32();
  62. string TempName = reader.ReadString();
  63. actor.Output(CurXP.ToString());
  64. int TempXP = CurXP + AwardXP;
  65.  
  66. PacketWriter writer = new PacketWriter();
  67. writer.Write(TempXP);
  68. actor.Globals["XP"] = writer.ToArray();
  69. actor.Output(CurXP.ToString());
  70. int curLevel = actor.Level;
  71. if (CurXP >= actor.Level * 10)
  72. {
  73. actor.Level = curLevel + 1;
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. public class NPCCombat : ScriptBase
  81. {
  82. int killerStr; // Killers Strength
  83. int killerDex; // Killers Dexterity
  84. int killerToughness; // Killers Toughness
  85. int killerSpeed; // Killers Speed
  86.  
  87. int victimHealth; // Victims health
  88. int victimDex; // Victims Dexterity
  89. int victimStr; // Victims Strength
  90. int victimToughness; // Victims Toughness
  91. int victimSpeed; // Victims Speed
  92. int Damage;
  93. int AwardXP;
  94. public void Melee(Actor actor, Actor target, int Delay)
  95. {
  96. if (!actor.Human)
  97. {
  98. // Bare Bones Hard Coded Delay
  99. // I would make Dynamic Later based on weapon and stats
  100. if (Delay >= 1000)
  101. {
  102. string chatOutput = "YOUR BEING ATTACKED AT: " + Delay + ".";
  103. target.Output(chatOutput, System.Drawing.Color.Red);
  104. UserScripts.Attack.SetSingleGlobal(actor, "Delay", 250); // Update Actor Global
  105. killerStr = actor.GetAttribute("Strength");
  106. killerDex = actor.GetAttribute("Dexterity");
  107. killerToughness = actor.GetAttribute("Toughness");
  108. killerSpeed = actor.GetAttribute("Speed");
  109.  
  110. victimHealth = target.GetAttribute("Health");
  111. victimDex = target.GetAttribute("Dexterity");
  112. victimStr = target.GetAttribute("Strength");
  113. victimToughness = target.GetAttribute("Toughness");
  114. victimSpeed = target.GetAttribute("Speed");
  115. Damage = (killerStr + 5) - victimToughness - 2;
  116. if (Damage < 0)
  117. {
  118. Damage = 0;
  119. }
  120. AwardXP = actor.Level + 25;
  121. if (killerSpeed > victimDex)
  122. {
  123. target.SetAttribute("Health", victimHealth - Damage); // Change the victims health to apply damage
  124. chatOutput = "You have Been Hit for: " + Damage + ".";
  125. target.Output(chatOutput, System.Drawing.Color.Green);
  126. //actor.Output("You have hit your target for: " + Damage);
  127. }
  128. else
  129. {
  130. chatOutput = "NPC Missed.";
  131. actor.Output(chatOutput, System.Drawing.Color.Yellow);
  132. //actor.Output("You have missed your target! You fail!");
  133. }
  134. if (victimHealth < 1)
  135. {
  136. target.Kill();
  137. target.Output("You have been killed!");
  138. }
  139. }
  140. }
  141. }
  142. }
Add Comment
Please, Sign In to add comment