Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void CloneEntityMelee(Entity MeeToOoAttacker, Entity MeToOoAttacked, SobNpcSpawn MeeToOoAttackedsob, Attack attack)
- {
- // All That By MeToOo Dont CHange Please
- bool pass;
- uint atttacked = 0;
- if (MeToOoAttacked != null)
- {
- atttacked = MeToOoAttacked.UID;
- }
- uint atttacker = MeeToOoAttacker.UID;
- bool doWep1Spell = false, doWep2Spell = false;
- if (MeeToOoAttacker.Owner.Screen.TryGetValue(atttacked, out MeToOoAttacked))
- {
- CheckForExtraWeaponPowers(MeeToOoAttacker.Owner, MeToOoAttacked);
- if (!CanAttack(MeeToOoAttacker, MeToOoAttacked, null, attack.AttackType == Attack.Melee)) return;
- pass = false;
- if (MeeToOoAttacker.OnFatalStrike())
- {
- if (MeToOoAttacked.EntityFlag == EntityFlag.Monster)
- {
- pass = true;
- }
- }
- ushort range = MeeToOoAttacker.AttackRange;
- if (MeeToOoAttacker.Transformed)
- range = (ushort)MeeToOoAttacker.TransformationAttackRange;
- attack.Effect1 = Attack.AttackEffects1.None;
- #region epic ninja
- if (MeeToOoAttacker.EpicNinja())
- {
- if (MeeToOoAttacker.Owner.Spells.ContainsKey(12110))
- {
- var spell = Database.SpellTable.GetSpell(12110, MeeToOoAttacker.Owner);
- if (spell != null)
- {
- spell.CanKill = true;
- if (Kernel.Rate(spell.Percent))
- {
- SpellUse suse = new SpellUse(true);
- suse.Attacker = MeeToOoAttacker.UID;
- suse.SpellID = spell.ID;
- suse.SpellLevel = spell.Level;
- suse.X = MeeToOoAttacker.X;
- suse.Y = MeeToOoAttacker.Y;
- IMapObject lastAttacked = MeeToOoAttacker;
- if (Handle.CanAttack(MeeToOoAttacker, MeToOoAttacked, spell, false))
- {
- lastAttacked = MeToOoAttacked;
- uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeToOoAttacked, spell, ref attack);
- suse.Effect1 = attack.Effect1;
- Handle.ReceiveAttack(MeeToOoAttacker, MeToOoAttacked, attack, damages, spell);
- suse.AddTarget(MeToOoAttacked.UID, damages, attack);
- }
- foreach (Interfaces.IMapObject _obj in MeeToOoAttacker.Owner.Screen.Objects)
- {
- if (_obj == null) continue;
- if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
- {
- if (_obj.UID == MeToOoAttacked.UID) continue;
- var attacked1 = _obj as Entity;
- if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 5)
- {
- if (Handle.CanAttack(MeeToOoAttacker, attacked1, spell, false))
- {
- lastAttacked = attacked1;
- uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, attacked1, spell, ref attack);
- suse.Effect1 = attack.Effect1;
- if (damages == 0) break;
- Handle.ReceiveAttack(MeeToOoAttacker, attacked1, attack, damages, spell);
- suse.AddTarget(attacked1.UID, damages, attack);
- }
- }
- }
- else if (_obj.MapObjType == MapObjectType.SobNpc)
- {
- MeeToOoAttackedsob = _obj as SobNpcSpawn;
- if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, MeeToOoAttackedsob.X, MeeToOoAttackedsob.Y) <= 5)
- {
- if (Handle.CanAttack(MeeToOoAttacker, MeeToOoAttackedsob, spell))
- {
- lastAttacked = MeeToOoAttackedsob;
- uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeeToOoAttackedsob, ref attack);
- suse.Effect1 = attack.Effect1;
- if (damages == 0) break;
- Handle.ReceiveAttack(MeeToOoAttacker, MeeToOoAttackedsob, attack, damages, spell);
- suse.AddTarget(MeeToOoAttackedsob.UID, damages, attack);
- }
- }
- }
- }
- MeeToOoAttacker.Owner.SendScreen(suse, true);
- return;
- }
- }
- }
- #endregion
- uint damage = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeToOoAttacked, ref attack);
- attack.Damage = damage;
- if (MeeToOoAttacker.OnFatalStrike())
- {
- if (MeToOoAttacked.EntityFlag == EntityFlag.Monster)
- {
- var weaps = MeeToOoAttacker.Owner.Weapons;
- bool can = false;
- if (weaps.Item1 != null)
- if (weaps.Item1.ID / 1000 == 601)
- can = true;
- if (weaps.Item2 != null)
- if (weaps.Item2.ID / 1000 == 601)
- can = true;
- if (!can)
- return;
- ushort x = MeToOoAttacked.X;
- ushort y = MeToOoAttacked.Y;
- Map.UpdateCoordonatesForAngle(ref x, ref y, Kernel.GetAngle(MeToOoAttacked.X, MeToOoAttacked.Y, MeeToOoAttacker.X, MeeToOoAttacker.Y));
- MeeToOoAttacker.Shift(x, y);
- attack.X = x;
- attack.Y = y;
- //double dmg = (double)damage * 3.5;
- //damage = (uint)dmg;
- damage = damage / 2;
- attack.Damage = damage;
- attack.AttackType = Attack.FatalStrike;
- }
- }
- //over:
- // All That By MeToOo Dont CHange Please
- var weapons = MeeToOoAttacker.Owner.Weapons;
- if (weapons.Item1 != null)
- {
- ConquerItem rightweapon = weapons.Item1;
- ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0;
- bool wep1bs = false, wep2bs = false;
- if (wep1subyte == 421)
- {
- wep1bs = true;
- wep1subyte--;
- }
- ushort wep1spellid = 0, wep2spellid = 0;
- if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
- wep1spellid = Database.SpellTable.WeaponSpells[wep1subyte];
- Database.SpellInformation wep1spell = null, wep2spell = null;
- if (MeeToOoAttacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
- {
- wep1spell = Database.SpellTable.SpellInformations[wep1spellid][MeeToOoAttacker.Owner.Spells[wep1spellid].Level];
- doWep1Spell = Kernel.Rate(wep1spell.Percent);
- if (MeToOoAttacked.EntityFlag == EntityFlag.Player && wep1spellid == 10490)
- doWep1Spell = Kernel.Rate(5);
- }
- if (!doWep1Spell)
- {
- if (weapons.Item2 != null)
- {
- ConquerItem leftweapon = weapons.Item2;
- wep2subyte = (ushort)(leftweapon.ID / 1000);
- if (wep2subyte == 421)
- {
- wep2bs = true;
- wep2subyte--;
- }
- if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
- wep2spellid = Database.SpellTable.WeaponSpells[wep2subyte];
- if (MeeToOoAttacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
- {
- wep2spell = Database.SpellTable.SpellInformations[wep2spellid][MeeToOoAttacker.Owner.Spells[wep2spellid].Level];
- doWep2Spell = Kernel.Rate(wep2spell.Percent);
- if (MeToOoAttacked.EntityFlag == EntityFlag.Player && wep2spellid == 10490)
- doWep2Spell = Kernel.Rate(5);
- }
- }
- }
- #region 11960
- if (MeeToOoAttacker.EpicTrojan())
- {
- if (MeeToOoAttacker.Owner.Spells.ContainsKey(11960))
- {
- var spell = Database.SpellTable.GetSpell(11960, MeeToOoAttacker.Owner);
- if (spell != null)
- {
- spell.CanKill = true;
- if (Kernel.Rate(32))
- {
- SpellUse suse = new SpellUse(true);
- suse.Attacker = MeeToOoAttacker.UID;
- suse.SpellID = spell.ID;
- suse.SpellLevel = spell.Level;
- suse.X = MeeToOoAttacker.X;
- suse.Y = MeeToOoAttacker.Y;
- IMapObject lastAttacked = MeeToOoAttacker;
- foreach (Interfaces.IMapObject _obj in MeeToOoAttacker.Owner.Screen.Objects)
- {
- if (_obj == null) continue;
- if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
- {
- if (_obj.UID == MeToOoAttacked.UID) continue;
- var attacked1 = _obj as Entity;
- if (Kernel.GetDistance(MeeToOoAttacker.X, MeeToOoAttacker.Y, attacked1.X, attacked1.Y) <= 5)
- {
- if (Handle.CanAttack(MeeToOoAttacker, attacked1, spell, false))
- {
- lastAttacked = attacked1;
- uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, attacked1, spell, ref attack);
- suse.Effect1 = attack.Effect1;
- if (damages == 0) break;
- Handle.ReceiveAttack(MeeToOoAttacker, attacked1, attack, damages, spell);
- suse.AddTarget(attacked1.UID, damages, attack);
- byte num = 0;
- switch (spell.Level)
- {
- case 0: num = 5; break;
- case 1: num = 6; break;
- case 2: num = 7; break;
- case 3: num = 8; break;
- case 4: num = 9; break;
- case 5: num = 10; break;
- case 6: num = 11; break;
- case 7: num = 12; break;
- case 8: num = 14; break;
- case 9: num = 20; break;
- }
- if (MeeToOoAttacker.Stamina <= 150)
- {
- MeeToOoAttacker.Stamina += num;
- MeeToOoAttacker.Owner.Send(new Message("the~caster~has~a~100%~chance~to~recover~Stamina~by~" + num + ".", System.Drawing.Color.Red, Message.TopLeft));
- }
- }
- }
- }
- else if (_obj.MapObjType == MapObjectType.SobNpc)
- {
- MeeToOoAttackedsob = _obj as SobNpcSpawn;
- if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, MeeToOoAttackedsob.X, MeeToOoAttackedsob.Y) <= 5)
- {
- if (Handle.CanAttack(MeeToOoAttacker, MeeToOoAttackedsob, spell))
- {
- lastAttacked = MeeToOoAttackedsob;
- uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeeToOoAttackedsob, ref attack);
- suse.Effect1 = attack.Effect1;
- if (damages == 0) break;
- Handle.ReceiveAttack(MeeToOoAttacker, MeeToOoAttackedsob, attack, damages, spell);
- suse.AddTarget(MeeToOoAttackedsob.UID, damages, attack);
- }
- }
- }
- }
- MeeToOoAttacker.Owner.SendScreen(suse, true);
- return;
- }
- }
- }
- }
- #endregion
- #region 11990
- if (MeeToOoAttacker.EpicTrojan())
- {
- if (MeeToOoAttacker.Owner.Spells.ContainsKey(11990))
- {
- var spell = Database.SpellTable.GetSpell(11990, MeeToOoAttacker.Owner);
- if (spell != null)
- {
- spell.CanKill = true;
- if (Kernel.Rate(32))
- {
- SpellUse suse = new SpellUse(true);
- suse.Attacker = MeeToOoAttacker.UID;
- suse.SpellID = spell.ID;
- suse.SpellLevel = spell.Level;
- suse.X = MeeToOoAttacker.X;
- suse.Y = MeeToOoAttacker.Y;
- IMapObject lastAttacked = MeeToOoAttacker;
- if (Handle.CanAttack(MeeToOoAttacker, MeToOoAttacked, spell, false))
- {
- lastAttacked = MeToOoAttacked;
- uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeToOoAttacked, spell, ref attack);
- suse.Effect1 = attack.Effect1;
- Handle.ReceiveAttack(MeeToOoAttacker, MeToOoAttacked, attack, damages, spell);
- suse.AddTarget(MeToOoAttacked.UID, damages, attack);
- }
- foreach (Interfaces.IMapObject _obj in MeeToOoAttacker.Owner.Screen.Objects)
- {
- if (_obj == null) continue;
- if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
- {
- if (_obj.UID == MeToOoAttacked.UID) continue;
- var attacked1 = _obj as Entity;
- if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 5)
- {
- if (Handle.CanAttack(MeeToOoAttacker, attacked1, spell, false))
- {
- lastAttacked = attacked1;
- uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, attacked1, spell, ref attack);
- suse.Effect1 = attack.Effect1;
- if (damages == 0) break;
- Handle.ReceiveAttack(MeeToOoAttacker, attacked1, attack, damages, spell);
- suse.AddTarget(attacked1.UID, damages, attack);
- }
- }
- }
- else if (_obj.MapObjType == MapObjectType.SobNpc)
- {
- MeeToOoAttackedsob = _obj as SobNpcSpawn;
- if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, MeeToOoAttackedsob.X, MeeToOoAttackedsob.Y) <= 5)
- {
- if (Handle.CanAttack(MeeToOoAttacker, MeeToOoAttackedsob, spell))
- {
- lastAttacked = MeeToOoAttackedsob;
- uint damages = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeeToOoAttackedsob, ref attack);
- suse.Effect1 = attack.Effect1;
- if (damages == 0) break;
- Handle.ReceiveAttack(MeeToOoAttacker, MeeToOoAttackedsob, attack, damages, spell);
- suse.AddTarget(MeeToOoAttackedsob.UID, damages, attack);
- }
- }
- }
- }
- MeeToOoAttacker.Owner.SendScreen(suse, true);
- return;
- }
- }
- }
- }
- #endregion // All That By MeToOo Dont CHange Please
- }
- else
- {
- if (!MeeToOoAttacker.Transformed)
- {
- if (MeeToOoAttacker.EntityFlag == EntityFlag.Player && MeToOoAttacked.EntityFlag != EntityFlag.Player)
- if (damage > MeToOoAttacked.Hitpoints)
- {
- MeeToOoAttacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, MeToOoAttacked.Hitpoints), 0);
- }
- else
- {
- MeeToOoAttacker.Owner.IncreaseProficiencyExperience(damage, 0);
- }
- }
- }
- ReceiveAttack(MeeToOoAttacker, MeToOoAttacked, attack, damage, null);
- attack.AttackType = Attack.Melee;
- }
- } // All That By MeToOo Dont CHange Please
- else if (MeeToOoAttacker.Owner.Screen.TryGetSob(attack.Attacked, out MeeToOoAttackedsob))
- {
- CheckForExtraWeaponPowers(MeeToOoAttacker.Owner, null);
- if (CanAttack(MeeToOoAttacker, MeeToOoAttackedsob, null))
- {
- ushort range = MeeToOoAttacker.AttackRange;
- if (MeeToOoAttacker.Transformed)
- range = (ushort)MeeToOoAttacker.TransformationAttackRange;
- attack.Effect1 = Attack.AttackEffects1.None;
- uint damage = Game.Attacking.Calculate.Melee(MeeToOoAttacker, MeeToOoAttackedsob, ref attack);
- var weapons = MeeToOoAttacker.Owner.Weapons;
- if (weapons.Item1 != null)
- {
- ConquerItem rightweapon = weapons.Item1;
- ushort wep1subyte = (ushort)(rightweapon.ID / 1000), wep2subyte = 0;
- bool wep1bs = false, wep2bs = false;
- if (wep1subyte == 421)
- {
- wep1bs = true;
- wep1subyte--;
- }
- ushort wep1spellid = 0, wep2spellid = 0;
- if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
- wep1spellid = Database.SpellTable.WeaponSpells[wep1subyte];
- Database.SpellInformation wep1spell = null, wep2spell = null;
- if (MeeToOoAttacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
- {
- wep1spell = Database.SpellTable.SpellInformations[wep1spellid][MeeToOoAttacker.Owner.Spells[wep1spellid].Level];
- doWep1Spell = Kernel.Rate(wep1spell.Percent);
- }
- if (!doWep1Spell)
- {
- if (weapons.Item2 != null)
- {
- ConquerItem leftweapon = weapons.Item2;
- wep2subyte = (ushort)(leftweapon.ID / 1000);
- if (wep2subyte == 421)
- {
- wep2bs = true;
- wep2subyte--;
- }
- if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
- wep2spellid = Database.SpellTable.WeaponSpells[wep2subyte];
- if (MeeToOoAttacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
- {
- wep2spell = Database.SpellTable.SpellInformations[wep2spellid][MeeToOoAttacker.Owner.Spells[wep2spellid].Level];
- doWep2Spell = Kernel.Rate(wep2spell.Percent);
- }
- }
- }
- // All That By MeToOo Dont CHange Please
- }
- attack.Damage = damage;
- ReceiveAttack(MeeToOoAttacker, MeeToOoAttackedsob, attack, damage, null);
- // All That By MeToOo Dont CHange Please
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement