Advertisement
XConquer

Untitled

Jul 1st, 2015
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 23.21 KB | None | 0 0
  1.   #region Epico Ninja
  2.                                 #region TwilightDance
  3.                                 case 12070:
  4.                                     {
  5.                                         if (CanUseSpell(spell, attacker.Owner))
  6.                                         {
  7.                                             PrepareSpell(spell, attacker.Owner);
  8.                                             SpellUse suse = new SpellUse(true);
  9.                                             suse.Attacker = attacker.UID;
  10.                                             suse.SpellID = spell.ID;
  11.                                             suse.SpellLevel = spell.Level;
  12.                                             ushort _X = attacker.X, _Y = attacker.Y;
  13.                                             ushort _tX = X, _tY = Y;
  14.                                             byte dist = (byte)spell.Distance;
  15.                                             var Array = attacker.Owner.Screen.Objects;
  16.                                             InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist,
  17.                                                                                InLineAlgorithm.Algorithm.DDA);
  18.                                             X = attacker.X;
  19.                                             Y = attacker.Y;
  20.                                             var count = (double)algo.lcoords.Count / 3;
  21.                                             int i = 0;
  22.                                             for (i = 0; i < 4; i++)
  23.                                             {
  24.                                                 var selected = i * (int)count;
  25.                                                 selected = Math.Min(algo.lcoords.Count - 1, selected);
  26.                                                 X = (ushort)algo.lcoords[selected].X;
  27.                                                 Y = (ushort)algo.lcoords[selected].Y;
  28.  
  29.                                                 suse.X = X;//
  30.                                                 suse.Y = Y;
  31.                                                 if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Player, null])
  32.                                                     return;
  33.                                                 double disth = 6.3;
  34.                                                 if (attacker.MapID == DeathMatch.MAPID) disth = 1;
  35.                                                 foreach (Interfaces.IMapObject _obj in Array)
  36.                                                 {
  37.                                                     bool hit = false;
  38.                                                     for (int j = 0; j < i; j++)
  39.                                                         if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
  40.                                                             hit = true;
  41.                                                     if (hit)
  42.                                                     {
  43.                                                         if (_obj.MapObjType == MapObjectType.Monster)
  44.                                                         {
  45.                                                             attacked = _obj as Entity;
  46.                                                             if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
  47.                                                             {
  48.                                                                 uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
  49.                                                                 damage = (damage * 2) / 2;
  50.                                                                 switch (i)
  51.                                                                 {
  52.                                                                     case 1:
  53.                                                                    //     damage *= 9 / 10;
  54.                                                                         break;
  55.                                                                     case 2:
  56.                                                                     //    damage *= 10 / 10;
  57.                                                                         break;
  58.                                                                     default:
  59.                                                                    //     damage *= 12 / 13;
  60.                                                                         break;
  61.                                                                 }
  62.  
  63.                                                                 ReceiveAttack(attacker, attacked, attack, ref damage, spell);
  64.  
  65.  
  66.                                                                 suse.AddTarget(attacked, damage, attack);
  67.                                                             }
  68.                                                         }
  69.                                                         else if (_obj.MapObjType == MapObjectType.Player)
  70.                                                         {
  71.                                                             attacked = _obj as Entity;
  72.                                                             if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
  73.                                                             {
  74.                                                                 uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
  75.                                                               //  damage = (damage * 5) / 10;
  76.                                                                 ReceiveAttack(attacker, attacked, attack, ref damage, spell);
  77.  
  78.  
  79.                                                                 suse.AddTarget(attacked, damage, attack);
  80.                                                             }
  81.                                                         }
  82.                                                         else if (_obj.MapObjType == MapObjectType.SobNpc)
  83.                                                         {
  84.                                                             attackedsob = _obj as SobNpcSpawn;
  85.                                                             if (CanAttack(attacker, attackedsob, spell))
  86.                                                             {
  87.                                                                 var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
  88.  
  89.                                                                 ReceiveAttack(attacker, attacked, attack, ref damage, spell);
  90.  
  91.  
  92.                                                                 suse.AddTarget(attacked, damage, attack);
  93.                                                             }
  94.                                                         }
  95.                                                     }
  96.                                                 }
  97.  
  98.                                                 SendTwilightEffect(suse, X, Y);
  99.                                                 var map = attacker.Owner.Map;
  100.                                                 FloorItem floorItem = new FloorItem(true);
  101.                                                 attacker.Owner.SendScreen(suse, true);
  102.                                                 System.Threading.Thread.Sleep(250);
  103.                                                 floorItem.Type = FloorItem.RemoveEffect;
  104.                                                 map.RemoveFloorItem(floorItem);
  105.                                                 attacker.Owner.SendScreenSpawn(floorItem, true);
  106.  
  107.                                             }
  108.                                         }
  109.                                         break;
  110.                                     }
  111.                                 #endregion
  112.                                 #region SuperTwofoldBlade
  113.                                 case 12080:
  114.                                     {
  115.                                         if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(500))
  116.                                         {
  117.                                             if (CanUseSpell(spell, attacker.Owner))
  118.                                             {
  119.                                                 ushort Xx, Yx;
  120.                                                 if (attacked != null)
  121.                                                 {
  122.                                                     Xx = attacked.X;
  123.                                                     Yx = attacked.Y;
  124.                                                 }
  125.                                                 else
  126.                                                 {
  127.                                                     Xx = attackedsob.X;
  128.                                                     Yx = attackedsob.Y;
  129.                                                 }
  130.                                                 if (Kernel.GetDistance(attacker.X, attacker.Y, Xx, Yx) <= spell.Distance)
  131.                                                 {
  132.                                                     if (attackedsob == null)
  133.                                                         if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.Fly))
  134.                                                             return;
  135.                                                     if (attacker.ContainsFlag(Network.GamePackets.Update.Flags.Fly))
  136.                                                         return;
  137.                                                     PrepareSpell(spell, attacker.Owner);
  138.  
  139.                                                     SpellUse suse = new SpellUse(true);
  140.                                                     suse.Attacker = attacker.UID;
  141.                                                     suse.SpellID = spell.ID;
  142.                                                     suse.SpellLevel = spell.Level;
  143.                                                     suse.X = X;
  144.                                                     suse.Y = Y;
  145.                                                     //suse.SpellLevelHu = client_Spell.LevelHu2;
  146.                                                     bool send = false;
  147.  
  148.                                                     if (attackedsob == null)
  149.                                                     {
  150.                                                         if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
  151.                                                         {
  152.                                                             attack.Effect1 = Attack.AttackEffects1.None;
  153.                                                             uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
  154.                                                             damage = (uint)((damage)* 1);
  155.                                                             var dist = Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y);
  156.                                                             if (dist <= 3)
  157.                                                             {
  158.                                                                 damage *= 2;
  159.                                                             }
  160.                                                             else
  161.                                                             {
  162.                                                                 damage = (uint)(damage * 9 / 11d);
  163.                                                             }
  164.                                                             suse.Effect1 = attack.Effect1;
  165.                                                             ReceiveAttack(attacker, attacked, attack, ref damage, spell);
  166.  
  167.                                                             suse.AddTarget(attacked, damage, attack);
  168.                                                             send = true;
  169.  
  170.                                                             if (attacker.Owner.Spells.ContainsKey(11230) && !attacked.Dead)
  171.                                                             {
  172.                                                                 var s = attacker.Owner.Spells[11230];
  173.                                                                 var spellz = Database.SpellTable.SpellInformations[s.ID][s.Level];
  174.                                                                 if (spellz != null)
  175.                                                                 {
  176.                                                                     if (CM.Arg.Kernel.Rate(spellz.Percent))
  177.                                                                     {
  178.                                                                         SpellUse ssuse = new SpellUse(true);
  179.                                                                         ssuse.Attacker = attacker.UID;
  180.                                                                         ssuse.SpellID = spellz.ID;
  181.  
  182.                                                                         ssuse.SpellLevel = spellz.Level;
  183.                                                                         damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
  184.                                                                         ssuse.AddTarget(attacked, new SpellUse.DamageClass().Damage = damage, attack);
  185.                                                                         ReceiveAttack(attacker, attacked, attack, ref damage, spellz);
  186.                                                                         attacker.Owner.SendScreen(ssuse, true);
  187.                                                                     }
  188.                                                                 }
  189.                                                             }
  190.                                                         }
  191.                                                     }
  192.                                                     else
  193.                                                     {
  194.                                                         if (CanAttack(attacker, attackedsob, spell))
  195.                                                         {
  196.                                                             attack.Effect1 = Attack.AttackEffects1.None;
  197.                                                             uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
  198.                                                             damage = (uint)(damage * spell.PowerPercent);
  199.                                                             ReceiveAttack(attacker, attackedsob, attack, damage, spell);
  200.                                                             suse.Effect1 = attack.Effect1;
  201.  
  202.                                                             suse.AddTarget(attackedsob, damage, attack);
  203.                                                             send = true;
  204.                                                         }
  205.                                                     }
  206.                                                     if (send)
  207.                                                         attacker.Owner.SendScreen(suse, true);
  208.                                                     attacker.SpellStamp = Time32.Now;
  209.                                                 }
  210.                                                 else
  211.                                                 {
  212.                                                     attacker.AttackPacket = null;
  213.                                                 }
  214.                                             }
  215.                                         }
  216.                                         break;
  217.                                     }
  218.  
  219.  
  220.                                 #endregion
  221.                                 #region ShadowClone
  222.                                 case 12090:
  223.                                     {
  224.                                         attacker.AttackPacket = null;
  225.                                         if (attacker.MyClones.Count > 0)
  226.                                         {
  227.                                             var clones = attacker.MyClones.Values.ToArray();
  228.                                             for (int i = 0; i < clones.Length; i++)
  229.                                             {
  230.                                                 var item = clones[i];
  231.                                                 if (item == null)
  232.                                                     continue;
  233.                                                 Data data = new Data(true);
  234.                                                 data.UID = item.UID;
  235.                                                 data.ID = Network.GamePackets.Data.RemoveEntity;
  236.                                                 attacker.Owner.SendScreen(data);
  237.                                                 attacker.MyClones[item.UID] = null;
  238.                                             }
  239.                                             attacker.MyClones.Clear();
  240.                                         }
  241.                                         else
  242.                                         {
  243.                                             if (CanUseSpell(spell, attacker.Owner))
  244.                                             {
  245.                                                 PrepareSpell(spell, attacker.Owner);
  246.                                                 SpellUse spellUse = new SpellUse(true);
  247.                                                 spellUse.Attacker = attacker.UID;
  248.                                                 spellUse.SpellID = spell.ID;
  249.                                                 spellUse.SpellLevel = spell.Level;
  250.                                                 spellUse.X = X;
  251.                                                 spellUse.Y = Y;
  252.  
  253.  
  254.                                                 attacker.AddClone("ShadowClone", 3);
  255.                                                 attacker.AddClone("ShadowClone", 10003);
  256.                                                 foreach (var item in attacker.MyClones.Values)
  257.                                                     spellUse.AddTarget(item, 0, attack);
  258.  
  259.                                                 attacker.Owner.SendScreen(spellUse, true);
  260.                                             }
  261.  
  262.                                         }
  263.                                         break;
  264.                                     }
  265.                                 #endregion
  266.                                 #region FatalSpin
  267.                                 case 12110:
  268.                                     {
  269.                                         if (CanUseSpell(spell, attacker.Owner))
  270.                                         {
  271.                                             PrepareSpell(spell, attacker.Owner);
  272.                                             Game.Attacking.InLineAlgorithm ila = new CM.Arg.Game.Attacking.InLineAlgorithm(attacker.X,
  273.                                         X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
  274.                                             SpellUse suse = new SpellUse(true);
  275.                                             suse.Attacker = attacker.UID;
  276.                                             suse.SpellID = SpellID;
  277.                                             suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
  278.                                             suse.X = X;
  279.                                             suse.Y = Y;
  280.                                             //suse.SpellLevelHu = client_Spell.LevelHu2;
  281.                                             foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
  282.                                             {
  283.                                                 if (_obj == null)
  284.                                                     continue;
  285.                                                 if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
  286.                                                 {
  287.                                                     attacked = _obj as Entity;
  288.                                                     if (ila.InLine(attacked.X, attacked.Y))
  289.                                                     {
  290.                                                         if (!CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
  291.                                                             continue;
  292.  
  293.                                                         attack.Effect1 = Attack.AttackEffects1.None;
  294.                                                         uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
  295.                                                         damage = (uint)((damage) / 6);
  296.                                                         suse.Effect1 = attack.Effect1;
  297.  
  298.                                                         attack.Damage = damage;
  299.  
  300.                                                         ReceiveAttack(attacker, attacked, attack, ref damage, spell);
  301.  
  302.                                                         suse.AddTarget(attacked, damage, attack);
  303.                                                     }
  304.                                                 }
  305.                                                 else if (_obj.MapObjType == MapObjectType.SobNpc)
  306.                                                 {
  307.                                                     attackedsob = _obj as SobNpcSpawn;
  308.  
  309.                                                     if (ila.InLine(attackedsob.X, attackedsob.Y))
  310.                                                     {
  311.                                                         if (!CanAttack(attacker, attackedsob, spell))
  312.                                                             continue;
  313.  
  314.                                                         attack.Effect1 = Attack.AttackEffects1.None;
  315.                                                         uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
  316.                                                         // damage = (uint)(damage * spell.PowerPercent);
  317.                                                         damage = (uint)((damage) / 6);
  318.                                                         attack.Damage = damage;
  319.  
  320.                                                         ReceiveAttack(attacker, attackedsob, attack, damage, spell);
  321.  
  322.                                                         suse.AddTarget(attackedsob, damage, attack);
  323.                                                     }
  324.                                                 }
  325.                                             }
  326.                                             attacker.Owner.SendScreen(suse, true);
  327.                                         }
  328.                                         break;
  329.                                     }
  330.                                 #endregion
  331.                                 #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement