Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int killerStr; // Killers Strength
- int killerDex; // Killers Dexterity
- int killerToughness; // Killers Toughness
- int killerSpeed; // Killers Speed
- int victimHealth; // Victims health
- int victimDex; // Victims Dexterity
- int victimStr; // Victims Strength
- int victimToughness; // Victims Toughness
- int victimSpeed; // Victims Speed
- int Damage;
- int AwardXP;
- public void Melee(Actor actor, Actor target, int Delay)
- {
- if (actor.Human)
- {
- // Bare Bones Hard Coded Delay
- // I would make Dynamic Later based on weapon and stats
- if (Delay >= 1000)
- {
- string chatOutput = "YOU ATTACK AT: " + Delay + ".";
- actor.Output(chatOutput, System.Drawing.Color.Red);
- UserScripts.Attack.SetSingleGlobal(actor, "Delay", 250); // Update Actor Global
- killerStr = actor.GetAttribute("Strength");
- killerDex = actor.GetAttribute("Dexterity");
- killerToughness = actor.GetAttribute("Toughness");
- killerSpeed = actor.GetAttribute("Speed");
- victimHealth = target.GetAttribute("Health");
- victimDex = target.GetAttribute("Dexterity");
- victimStr = target.GetAttribute("Strength");
- victimToughness = target.GetAttribute("Toughness");
- victimSpeed = target.GetAttribute("Speed");
- Damage = (killerStr + 5) - victimToughness;
- if (Damage < 0)
- {
- Damage = 0;
- }
- AwardXP = actor.Level + 25;
- if (killerSpeed > victimDex)
- {
- target.SetAttribute("Health", victimHealth - Damage); // Change the victims health to apply damage
- chatOutput = "You have hit your target for: " + Damage + ".";
- actor.Output(chatOutput, System.Drawing.Color.Green);
- //actor.Output("You have hit your target for: " + Damage);
- }
- else
- {
- chatOutput = "You have missed your target! You fail!.";
- actor.Output(chatOutput, System.Drawing.Color.Yellow);
- //actor.Output("You have missed your target! You fail!");
- }
- if (target.GetAttribute("Health") < 1)
- {
- chatOutput = "You killed your victim!.";
- actor.Output(chatOutput, System.Drawing.Color.Red);
- target.Kill();
- //actor.Output("You killed your victim!");
- int CurXP = 0;
- PacketReader reader = new PacketReader(actor.Globals["XP"]);
- CurXP = reader.ReadInt32();
- string TempName = reader.ReadString();
- actor.Output(CurXP.ToString());
- int TempXP = CurXP + AwardXP;
- PacketWriter writer = new PacketWriter();
- writer.Write(TempXP);
- actor.Globals["XP"] = writer.ToArray();
- actor.Output(CurXP.ToString());
- int curLevel = actor.Level;
- if (CurXP >= actor.Level * 10)
- {
- actor.Level = curLevel + 1;
- }
- }
- }
- }
- }
- }
- public class NPCCombat : ScriptBase
- {
- int killerStr; // Killers Strength
- int killerDex; // Killers Dexterity
- int killerToughness; // Killers Toughness
- int killerSpeed; // Killers Speed
- int victimHealth; // Victims health
- int victimDex; // Victims Dexterity
- int victimStr; // Victims Strength
- int victimToughness; // Victims Toughness
- int victimSpeed; // Victims Speed
- int Damage;
- int AwardXP;
- public void Melee(Actor actor, Actor target, int Delay)
- {
- if (!actor.Human)
- {
- // Bare Bones Hard Coded Delay
- // I would make Dynamic Later based on weapon and stats
- if (Delay >= 1000)
- {
- string chatOutput = "YOUR BEING ATTACKED AT: " + Delay + ".";
- target.Output(chatOutput, System.Drawing.Color.Red);
- UserScripts.Attack.SetSingleGlobal(actor, "Delay", 250); // Update Actor Global
- killerStr = actor.GetAttribute("Strength");
- killerDex = actor.GetAttribute("Dexterity");
- killerToughness = actor.GetAttribute("Toughness");
- killerSpeed = actor.GetAttribute("Speed");
- victimHealth = target.GetAttribute("Health");
- victimDex = target.GetAttribute("Dexterity");
- victimStr = target.GetAttribute("Strength");
- victimToughness = target.GetAttribute("Toughness");
- victimSpeed = target.GetAttribute("Speed");
- Damage = (killerStr + 5) - victimToughness - 2;
- if (Damage < 0)
- {
- Damage = 0;
- }
- AwardXP = actor.Level + 25;
- if (killerSpeed > victimDex)
- {
- target.SetAttribute("Health", victimHealth - Damage); // Change the victims health to apply damage
- chatOutput = "You have Been Hit for: " + Damage + ".";
- target.Output(chatOutput, System.Drawing.Color.Green);
- //actor.Output("You have hit your target for: " + Damage);
- }
- else
- {
- chatOutput = "NPC Missed.";
- actor.Output(chatOutput, System.Drawing.Color.Yellow);
- //actor.Output("You have missed your target! You fail!");
- }
- if (victimHealth < 1)
- {
- target.Kill();
- target.Output("You have been killed!");
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment