Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Shadow Clone Attack
- case 2812:
- {
- var attackd = BitConverter.ReadUint(packet, 4);
- var clonecount = packet[8];
- for (int i = 0; i < clonecount; i++)
- {
- var attackr = BitConverter.ReadUint(packet, 9 + (i * 4));
- var attack = client.Entity.AttackPacket;
- if (attack == null)
- return;
- attack.Attacker = attackr;
- attack.Attacked = attackd;
- if (client.Entity.MyClones.Count == 0)
- return;
- if (attackr == client.Entity.UID)
- return;
- Entity Clone = null;
- if (client.Entity.MyClones.TryGetValue(attackr, out Clone))
- {
- Entity attacked = null;
- SobNpcSpawn attackedsob = null;
- if (client.Screen.TryGetValue(attackd, out attacked))
- {
- if (Game.Attacking.Handle.CanAttack(client.Entity, attacked, null, attack.AttackType == GamePackets.Attack.Melee))
- {
- var spell = Database.SpellTable.GetSpell(attack.MagicType, (byte)attack.MagicLevel);
- uint damage = 0;
- if (attack.AttackType == GamePackets.Attack.Melee)
- damage = Game.Attacking.Calculate.Melee(client.Entity, attacked, spell, ref attack);
- else if (attack.AttackType == GamePackets.Attack.Ranged)
- damage = Game.Attacking.Calculate.Ranged(client.Entity, attacked, ref attack);
- else
- damage = Game.Attacking.Calculate.Magic(client.Entity, attackedsob, spell, ref attack);
- damage = (uint)((double)damage * 0.6);
- Game.Attacking.Handle.ReceiveAttack(Clone, attacked, attack, damage, spell);
- attack.Damage = damage;
- client.SendScreen(attack);
- }
- }
- else if (client.Screen.TryGetSob(attackd, out attackedsob))
- {
- if (Game.Attacking.Handle.CanAttack(client.Entity, attackedsob, null))
- {
- var spell = Database.SpellTable.GetSpell(attack.MagicType, (byte)attack.MagicLevel);
- uint damage = 0;
- if (attack.AttackType == GamePackets.Attack.Melee)
- damage = Game.Attacking.Calculate.Melee(client.Entity, attackedsob, ref attack);
- else if (attack.AttackType == GamePackets.Attack.Ranged)
- damage = Game.Attacking.Calculate.Ranged(client.Entity, attackedsob, ref attack);
- if (attack.AttackType == GamePackets.Attack.Magic)
- damage = Game.Attacking.Calculate.Magic(client.Entity, attackedsob, spell, ref attack);
- damage = (uint)((double)damage * 0.6);
- Game.Attacking.Handle.ReceiveAttack(Clone, attackedsob, attack, damage, spell);
- attack.Damage = damage;
- client.SendScreen(attack);
- }
- }
- }
- }
- break;
- }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement