Advertisement
shekohex

Shadow Clone Attack

Sep 4th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.28 KB | None | 0 0
  1.                 #region  Shadow Clone Attack
  2.                 case 2812:
  3.                     {
  4.                         var attackd = BitConverter.ReadUint(packet, 4);
  5.                         var clonecount = packet[8];
  6.                         for (int i = 0; i < clonecount; i++)
  7.                         {
  8.                             var attackr = BitConverter.ReadUint(packet, 9 + (i * 4));
  9.                             var attack = client.Entity.AttackPacket;
  10.                             if (attack == null)
  11.                                 return;
  12.                             attack.Attacker = attackr;
  13.                             attack.Attacked = attackd;
  14.  
  15.                             if (client.Entity.MyClones.Count == 0)
  16.                                 return;
  17.                             if (attackr == client.Entity.UID)
  18.                                 return;
  19.                             Entity Clone = null;
  20.                             if (client.Entity.MyClones.TryGetValue(attackr, out Clone))
  21.                             {
  22.                                 Entity attacked = null;
  23.                                 SobNpcSpawn attackedsob = null;
  24.                                 if (client.Screen.TryGetValue(attackd, out attacked))
  25.                                 {
  26.                                     if (Game.Attacking.Handle.CanAttack(client.Entity, attacked, null, attack.AttackType == GamePackets.Attack.Melee))
  27.                                     {
  28.                                         var spell = Database.SpellTable.GetSpell(attack.MagicType, (byte)attack.MagicLevel);
  29.                                         uint damage = 0;
  30.                                         if (attack.AttackType == GamePackets.Attack.Melee)
  31.                                             damage = Game.Attacking.Calculate.Melee(client.Entity, attacked, spell, ref attack);
  32.                                         else if (attack.AttackType == GamePackets.Attack.Ranged)
  33.                                             damage = Game.Attacking.Calculate.Ranged(client.Entity, attacked, ref attack);
  34.                                         else
  35.                                             damage = Game.Attacking.Calculate.Magic(client.Entity, attackedsob, spell, ref attack);
  36.  
  37.                                         damage = (uint)((double)damage * 0.6);
  38.                                         Game.Attacking.Handle.ReceiveAttack(Clone, attacked, attack, damage, spell);
  39.                                         attack.Damage = damage;
  40.                                         client.SendScreen(attack);
  41.                                     }
  42.                                 }
  43.                                 else if (client.Screen.TryGetSob(attackd, out attackedsob))
  44.                                 {
  45.                                     if (Game.Attacking.Handle.CanAttack(client.Entity, attackedsob, null))
  46.                                     {
  47.                                         var spell = Database.SpellTable.GetSpell(attack.MagicType, (byte)attack.MagicLevel);
  48.                                         uint damage = 0;
  49.                                         if (attack.AttackType == GamePackets.Attack.Melee)
  50.                                             damage = Game.Attacking.Calculate.Melee(client.Entity, attackedsob, ref attack);
  51.                                         else if (attack.AttackType == GamePackets.Attack.Ranged)
  52.                                             damage = Game.Attacking.Calculate.Ranged(client.Entity, attackedsob, ref attack);
  53.                                         if (attack.AttackType == GamePackets.Attack.Magic)
  54.                                             damage = Game.Attacking.Calculate.Magic(client.Entity, attackedsob, spell, ref attack);
  55.  
  56.                                         damage = (uint)((double)damage * 0.6);
  57.                                         Game.Attacking.Handle.ReceiveAttack(Clone, attackedsob, attack, damage, spell);
  58.                                         attack.Damage = damage;
  59.                                         client.SendScreen(attack);
  60.                                     }
  61.                                 }
  62.                             }
  63.                         }
  64.                         break;
  65.                     }
  66.                 #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement