MahmoudMano |
2020-04-19 07:04 PM |
سستم اتاكات سرفر Devil Power فكسد 100%
السلام عليكم ورحمه الله وبركاتو
النهارضه معايا موضوع مهم جدا جدا وهوا اتاكات يعني معظم مشاكل الناس فيها وانا النهارضه هنزلكم كل الاتكات فكسد لكل الشخصيات ومتحدد قيم فيها لكل التبرعات حتي اللي مش متبرع وباذن الله هيعجبكم نخش بقا علي المفيد
كود PHP:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;
using System.Text;
using Mr_Panda.Network.GamePackets;
using Mr_Panda.Game.ConquerStructures;
using Mr_Panda.Network;
using Mr_Panda.Interfaces;
using System.Drawing;
using Mr_Panda.Database;
using Mr_Panda.Copra;
using Mr_Panda.Game.Features.Tournaments;
using Mr_Panda.MaTrix;
namespace Mr_Panda.Game.Attacking
{
public class Handle
{
public static List<Location> GetLocation(int X, int Y)
{
List<Location> myList = new List<Location>();
var distance = 6;
myList.Add(new Location() { X = (short)(X + -distance), Y = (short)(Y + -distance) });
myList.Add(new Location() { X = (short)(X + -distance), Y = (short)(Y + distance) });
myList.Add(new Location() { X = (short)(X + distance), Y = (short)(Y + distance) });
myList.Add(new Location() { X = (short)(X + distance), Y = (short)(Y + -distance) });
return myList;
}
public static List<Location> GetLocation2(int X, int Y)
{
List<Location> myList = new List<Location>();
var distance = 6;
myList.Add(new Location() { X = (short)(X + -distance), Y = (short)(Y + -distance) });
myList.Add(new Location() { X = (short)(X + -distance), Y = (short)(Y + distance) });
//myList.Add(new Location() { X = (short)(X + distance), Y = (short)(Y + distance) });
myList.Add(new Location() { X = (short)(X + distance), Y = (short)(Y + -distance) });
return myList;
}
public struct Location
{
public short X;
public short Y;
}
private Attack attack;
private Entity attacker, attacked;
public Handle(Attack attack, Entity attacker, Entity attacked)
{
try
{
this.attack = attack;
this.attacker = attacker;
this.attacked = attacked;
this.Execute();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
#region Interations
public class InteractionRequest
{
public InteractionRequest(Network.GamePackets.Attack attack, Game.Entity a_client)
{
Client.GameState client = a_client.Owner;
client.Player.InteractionInProgress = false;
client.Player.InteractionWith = attack.Attacked;
client.Player.InteractionType = 0;
client.InteractionEffect = attack.ResponseDamage;
if (Kernel.GamePool.ContainsKey(attack.Attacked))
{
Client.GameState clienttarget = Kernel.GamePool[attack.Attacked];
clienttarget.Player.InteractionInProgress = false;
clienttarget.Player.InteractionWith = client.Player.UID;
clienttarget.Player.InteractionType = 0;
clienttarget.InteractionEffect = attack.ResponseDamage;
attack.Attacker = client.Player.UID;
attack.X = clienttarget.Player.X;
attack.Y = clienttarget.Player.Y;
attack.AttackType = 46;
clienttarget.Send(attack);
clienttarget.Send(attack);
}
}
}
public class InteractionEffect
{
public InteractionEffect(Network.GamePackets.Attack attack, Game.Entity a_client)
{
Client.GameState client = a_client.Owner;
if (Kernel.GamePool.ContainsKey(client.Player.InteractionWith))
{
Client.GameState clienttarget = Kernel.GamePool[client.Player.InteractionWith];
if (clienttarget.Player.X == client.Player.X && clienttarget.Player.Y == client.Player.Y)
{
attack.Damage = client.Player.InteractionType;
attack.ResponseDamage = client.InteractionEffect;
clienttarget.Player.InteractionSet = true;
client.Player.InteractionSet = true;
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
attack.AttackType = 47;
attack.X = clienttarget.Player.X;
attack.Y = clienttarget.Player.Y;
clienttarget.Send(attack);
attack.AttackType = 49;
attack.Attacker = client.Player.UID;
attack.Attacked = clienttarget.Player.UID;
client.SendScreen(attack, true);
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
client.SendScreen(attack, true);
}
}
}
}
public class InteractionAccept
{
public InteractionAccept(Network.GamePackets.Attack attack, Game.Entity a_client)
{
Client.GameState client = a_client.Owner;
if (client.Player.ContainsFlag(Network.GamePackets.Update.Flags.Ride))
client.Player.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
if (client.Player.InteractionWith != attack.Attacked)
return;
attack.ResponseDamage = client.InteractionEffect;
client.Player.InteractionSet = false;
if (Kernel.GamePool.ContainsKey(attack.Attacked))
{
Client.GameState clienttarget = Kernel.GamePool[attack.Attacked];
if (clienttarget.Player.ContainsFlag(Network.GamePackets.Update.Flags.Ride))
clienttarget.Player.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
clienttarget.Player.InteractionSet = false;
if (clienttarget.Player.InteractionWith != client.Player.UID)
return;
if (clienttarget.Player.Body == 1003 || clienttarget.Player.Body == 1004)
{
attack.Attacker = client.Player.UID;
attack.X = client.Player.X;
attack.Y = client.Player.Y;
clienttarget.Send(attack);
clienttarget.Player.InteractionInProgress = true;
client.Player.InteractionInProgress = true;
clienttarget.Player.InteractionType = attack.Damage;
clienttarget.Player.InteractionX = client.Player.X;
clienttarget.Player.InteractionY = client.Player.Y;
client.Player.InteractionType = attack.Damage;
client.Player.InteractionX = client.Player.X;
client.Player.InteractionY = client.Player.Y;
if (clienttarget.Player.X == client.Player.X && clienttarget.Player.Y == client.Player.Y)
{
attack.Damage = client.Player.InteractionType;
clienttarget.Player.InteractionSet = true;
client.Player.InteractionSet = true;
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
attack.AttackType = 47;
attack.X = clienttarget.Player.X;
attack.Y = clienttarget.Player.Y;
attack.ResponseDamage = clienttarget.InteractionEffect;
clienttarget.Send(attack);
attack.AttackType = 49;
attack.Attacker = client.Player.UID;
attack.Attacked = clienttarget.Player.UID;
client.SendScreen(attack, true);
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
client.SendScreen(attack, true);
}
}
else
{
attack.AttackType = 47;
attack.Attacker = client.Player.UID;
attack.X = client.Player.X;
attack.Y = client.Player.Y;
clienttarget.Send(attack);
clienttarget.Player.InteractionInProgress = true;
client.Player.InteractionInProgress = true;
clienttarget.Player.InteractionType = attack.Damage;
clienttarget.Player.InteractionX = clienttarget.Player.X;
clienttarget.Player.InteractionY = clienttarget.Player.Y;
client.Player.InteractionType = attack.Damage;
client.Player.InteractionX = clienttarget.Player.X;
client.Player.InteractionY = clienttarget.Player.Y;
if (clienttarget.Player.X == client.Player.X && clienttarget.Player.Y == client.Player.Y)
{
clienttarget.Player.InteractionSet = true;
client.Player.InteractionSet = true;
attack.Attacker = clienttarget.Player.UID;
attack.Attacked = client.Player.UID;
attack.X = clienttarget.Player.X;
attack.Y = clienttarget.Player.Y;
attack.ResponseDamage = clienttarget.InteractionEffect;
clienttarget.Send(attack);
attack.AttackType = 49;
client.SendScreen(attack, true);
attack.Attacker = client.Player.UID;
attack.Attacked = clienttarget.Player.UID;
client.SendScreen(attack, true);
}
}
}
}
}
public class InteractionStopEffect
{
public InteractionStopEffect(Network.GamePackets.Attack attack, Game.Entity a_client)
{
Client.GameState client = a_client.Owner;
if (Kernel.GamePool.ContainsKey(attack.Attacked))
{
Client.GameState clienttarget = Kernel.GamePool[attack.Attacked];
attack.Attacker = client.Player.UID;
attack.Attacked = clienttarget.Player.UID;
attack.Damage = client.Player.InteractionType;
attack.X = client.Player.X;
attack.Y = client.Player.Y;
attack.AttackType = 50;
client.SendScreen(attack, true);
attack.Attacker = clienttarget.Player.UID; ;
attack.Attacked = client.Player.UID;
clienttarget.SendScreen(attack, true);
client.Player.Teleport(client.Player.MapID, client.Player.X, client.Player.Y);
clienttarget.Player.Teleport(clienttarget.Player.MapID, clienttarget.Player.X, clienttarget.Player.Y);
client.Player.InteractionType = 0;
client.Player.InteractionWith = 0;
client.Player.InteractionInProgress = false;
clienttarget.Player.InteractionType = 0;
clienttarget.Player.InteractionWith = 0;
clienttarget.Player.InteractionInProgress = false;
}
}
}
public class InteractionRefuse
{
public InteractionRefuse(Network.GamePackets.Attack attack, Game.Entity a_client)
{
Client.GameState client = a_client.Owner;
client.Player.InteractionType = 0;
client.Player.InteractionWith = 0;
client.Player.InteractionInProgress = false;
if (Kernel.GamePool.ContainsKey(attack.Attacked))
{
Client.GameState clienttarget = Kernel.GamePool[attack.Attacked];
clienttarget.Player.InteractionType = 0;
clienttarget.Player.InteractionWith = 0;
clienttarget.Player.InteractionInProgress = false;
}
}
}
#endregion
public static void ShadowofChaser(Entity attacker, Entity attacked, Attack attack, byte oneortwo)
{
#region ShadowofChaser(Active)
IMapObject lastAttacked = attacked;
if (oneortwo == 1)
{
if (attacker.ContainsFlag4(Update.Flags4.ShadowofChaser) && attacker.IsChaser2())
{
#region FloorItem
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
flooritem.ItemID = FloorItem.ShadowofChaser;
flooritem.X = lastAttacked.X;
flooritem.MapID = attacker.MapID;
flooritem.Y = lastAttacked.Y;
flooritem.Type = FloorItem.Effect;
flooritem.mColor = 14;
flooritem.FlowerType = 3;
flooritem.Unknown37 = 1;
flooritem.Attack = attack;
flooritem.OwnerUID = attacker.UID;
flooritem.Owner = attacker.Owner;
flooritem.OwnerGuildUID = attacker.GuildID;
flooritem.OnFloor = Time32.Now;
flooritem.Name2 = "ShadowofChaser";
flooritem.ShadowofChaserAttacked = attacked;
flooritem.ShadowofChaserAttacker = attacker;
attacker.Owner.Map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
#endregion
return;
}
}
else if (oneortwo == 2)
{
var spell = Database.SpellTable.GetSpell(13090, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
if (CanAttack(attacker, attacked, spell, false))
{
lastAttacked = attacked;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack) * (spell.Power - 30000) / 100;
Handle.ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, null);
}
attacker.Owner.SendScreen(suse, true);
SpellUse suse2 = new SpellUse(true);
suse2.Attacker = attacker.UID;
suse2.SpellID = spell.ID;
suse2.SpellLevel = spell.Level;
suse2.X = attacked.X;
suse2.Y = attacked.Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
if (_obj == null) continue;
var attacked1 = _obj as Entity;
if (lastAttacked.UID == attacked1.UID) continue;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 4)
{
if (CanAttack(attacker, attacked1, spell, false))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked1, spell, ref attack) * (spell.Power - 30000) / 100;
ReceiveAttack(attacker, attacked1, attack, ref damage, spell);
suse2.AddTarget(attacked1, damage, null);
}
}
}
}
attacker.Owner.SendScreen(suse2, true);
}
#endregion
attacker.AttackPacket = null;
}
public Entity findClosestTarget(Entity attacker, ushort X, ushort Y, IEnumerable<Interfaces.IMapObject> Array)
{
Entity closest = attacker;
int dPrev = 10000, dist = 0;
foreach (var _obj in Array)
{
if (_obj == null) continue;
if (_obj.MapObjType != MapObjectType.Entity && _obj.MapObjType != MapObjectType.Monster) continue;
dist = Kernel.GetDistance(X, Y, _obj.X, _obj.Y);
if (dist < dPrev)
{
dPrev = dist;
closest = (Entity)_obj;
}
}
return closest;
}
public static IEnumerable<Client.GameState> EntityinRange(Entity attacker, Entity attacked)
{
var dictionary = Kernel.GamePool.Values.ToArray();
return dictionary.Where((Entity) => Entity.Player.MapID == attacked.MapID && Kernel.GetDistance(Entity.Player.X, Entity.Player.Y, attacker.X, attacker.Y) <= 7);
}
public static void QuitSteedRace(Entity attacker)
{
attacker.Owner.MessageBox("Do you want to quit the steed race?", (pClient) =>
{
pClient.Player.Teleport(1002, 301, 279);
pClient.Player.RemoveFlag(Update.Flags.Ride);
});
//attacker.Owner.Send(new NpcReply(NpcReply.MessageBox, "Do you want to quit the steed race?"));
//attacker.Owner.MessageOK = (pClient) =>
//{
// pClient.Entity.Teleport(1002, 301, 279);
// pClient.Entity.RemoveFlag(Update.Flags.Ride);
//};
//attacker.Owner.MessageCancel = null;
}
public static List<ushort> GetWeaponSpell(SpellInformation spell)
{
return Database.SpellTable.WeaponSpells.Values.Where(p => p.Contains(spell.ID)).FirstOrDefault();
}
public static void RageOfWarTrap(FloorItem item)
{
var attack = new Attack(true);
var spell = Database.SpellTable.GetSpell(12930, item.Owner);
var suse = new SpellUse(true);
attack.Attacker = suse.Attacker = item.Owner.Player.UID;
attack.SpellID = suse.SpellID = spell.ID;
suse.X = item.X;
suse.Y = item.Y;
suse.SpellLevel = spell.Level;
suse.SpellEffect = 1;
Sector sector = new Sector(item.X, item.Y, item.X, item.Y);
sector.Arrange(spell.Sector, 3);
Entity attacked = null;
foreach (Interfaces.IMapObject _obj in item.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(item.Owner.Player, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(item.Owner.Player, attacked, ref attack);
attack.Damage = damage;
suse.Effect1 = attack.Effect1;
ReceiveAttack(item.Owner.Player, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
}
item.Owner.SendScreen(suse, true);
}
public static IEnumerable<Client.GameState> EntityinRange(FloorItem item, int dist)
{
var dictionary = Kernel.GamePool.Values.ToArray();
return dictionary.Where((Entity) => Entity.Player.MapID == item.MapID && Kernel.GetDistance(Entity.Player.X, Entity.Player.Y, item.X, item.Y) <= dist).OrderBy(Entity => Kernel.GetDistance(Entity.Player.X, Entity.Player.Y, item.X, item.Y));
}
public static void StomperMelee(FloorItem item, ushort SpellID)
{
Attack attack = new Attack(true);
attack.Attacker = item.Owner.Player.UID;
var spell = Database.SpellTable.GetSpell(SpellID, item.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = SpellID == 12990 ? item.UID : item.Owner.Player.UID;
suse.SpellID = SpellID;
attack.SpellID = suse.SpellLevel = spell.Level;
suse.SpecialEffect = 1;
if (SpellID == 12990)
{
suse.X = item.Start;
suse.Y = item.End;
foreach (Interfaces.IMapObject _obj in item.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
if (_obj == null) continue;
var attacked1 = _obj as Entity;
if (CanAttack(item.Owner.Player, attacked1, spell, false))
{
{
var spellange = Enums.HorrorofStomperAngle(item.Angle);
ushort xxxx = item.X;
ushort yyyy = item.Y;
Map.Pushback(ref xxxx, ref yyyy, spellange, 7);
Fan sector = new Fan(item.X, item.Y, xxxx, yyyy, spell.Range, spell.Sector);
if (sector.IsInFan(attacked1.X, attacked1.Y))
{
var damage = Game.Attacking.Calculate.Melee(item.Owner.Player, attacked1, ref attack);
damage = (uint)(damage * 0.6);
ReceiveAttack(item.Owner.Player, attacked1, attack, ref damage, spell);
suse.AddTarget(attacked1.UID, damage, null);
continue;
}
}
{
var spellange = Enums.OppositeAngle(Enums.HorrorofStomperAngle(item.Angle));
ushort xxxx = item.X;
ushort yyyy = item.Y;
Map.Pushback(ref xxxx, ref yyyy, spellange, 7);
Fan sector = new Fan(item.X, item.Y, xxxx, yyyy, spell.Range, spell.Sector);
if (sector.IsInFan(attacked1.X, attacked1.Y))
{
var damage = Game.Attacking.Calculate.Melee(item.Owner.Player, attacked1, ref attack);
damage = (uint)(damage * 0.6);
ReceiveAttack(item.Owner.Player, attacked1, attack, ref damage, spell);
item.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked1.Hitpoints), 626);
suse.AddTarget(attacked1.UID, damage, null);
}
}
}
}
}
}
else
{
suse.X = item.X;
suse.Y = item.Y;
foreach (Interfaces.IMapObject _obj in item.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
if (_obj == null) continue;
var attacked1 = _obj as Entity;
if (Kernel.GetDistance(item.X, item.Y, attacked1.X, attacked1.Y) <= spell.Range)
{
if (CanAttack(item.Owner.Player, attacked1, spell, false))
{
var damage = Game.Attacking.Calculate.Melee(item.Owner.Player, attacked1, ref attack);
damage = (uint)(damage * 0.6);
ReceiveAttack(item.Owner.Player, attacked1, attack, ref damage, spell);
item.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked1.Hitpoints), 626);
suse.AddTarget(attacked1.UID, damage, null);
}
}
}
}
}
item.Owner.SendScreen(suse.ToArray(), true);
item.Owner.Player.AttackPacket = null;
}
public static void FlameLotus(FloorItem item, int count = 0)
{
var client = item.Owner;
if (!client.Spells.ContainsKey(12380))
return;
var spell = SpellTable.GetSpell(client.Spells[12380].ID, client.Spells[12380].Level);
if (count == 0)
{
switch (spell.Level)
{
case 0: count = 5; break;
case 1: count = 8; break;
case 2: count = 11; break;
case 3: count = 14; break;
case 4: count = 17; break;
case 5: count = 20; break;
case 6: count = 25; break;
}
}
var targets = EntityinRange(item, spell.Range).ToArray();
targets = targets.Where(p => CanAttack(client.Player, p.Player, null, true)).ToArray();
targets = targets.Take(count).ToArray();
var attack = new Attack(true);
attack.Attacker = item.Owner.Player.UID;
attack.AttackType = Attack.Melee;
foreach (var target in targets)
{
uint damage = Game.Attacking.Calculate.Magic(client.Player, target.Player, ref attack);
if (client.Spells.ContainsKey(1002))
{
var spell2 = SpellTable.GetSpell(client.Spells[1002].ID, client.Spells[1002].Level);
damage = Game.Attacking.Calculate.Magic(client.Player, target.Player, spell2, ref attack);
}
attack.Damage = damage;
attack.Attacked = target.Player.UID;
attack.X = target.Player.X;
attack.Y = target.Player.Y;
ReceiveAttack(client.Player, target.Player, attack, ref damage, spell);
client.Player.AttackPacket = null;
}
}
public static void AuroraLotus(FloorItem item, int count = 0)
{
var client = item.Owner;
if (!client.Spells.ContainsKey(12370))
return;
var spell = SpellTable.GetSpell(client.Spells[12370].ID, client.Spells[12370].Level);
if (count == 0)
{
switch (spell.Level)
{
case 0: count = 5; break;
case 1: count = 8; break;
case 2: count = 11; break;
case 3: count = 14; break;
case 4: count = 17; break;
case 5: count = 20; break;
case 6: count = 25; break;
}
}
var deads = EntityinRange(item, spell.Range).Where(p => p.Player.Dead).ToArray();
if (client.Team != null)
deads = deads.Where(p => client.Team.Contain(p.Player.UID)).ToArray();
else if (client.Guild != null)
if (client.Guild.Members != null && client.Guild.Ally != null)
deads = deads.Where(p => client.Guild.Members.ContainsKey(p.Player.UID) || client.Guild.Ally.ContainsKey(p.Player.GuildID)).ToArray();
else
deads = deads.Where(p => client.Guild.ID == p.Player.GuildID).ToArray();
deads = deads.Take(count).ToArray();
if (deads != null)
{
foreach (var player in deads)
{
player.Player.Action = Mr_Panda.Game.Enums.ConquerAction.None;
player.ReviveStamp = Time32.Now;
player.Attackable = false;
player.Player.TransformationID = 0;
player.Player.RemoveFlag(Update.Flags.Dead);
client.Player.revhere = 0;
player.Player.RemoveFlag(Update.Flags.Ghost);
player.Player.Hitpoints = player.Player.MaxHitpoints;
player.Player.Ressurect();
player.BlessTouch(client);
}
}
}
private void TwilightAction(Entity attacker, SpellUse suse, SpellInformation spell, ushort X, ushort Y)
{
byte dist = 18;
var map = attacker.Owner.Map;
var algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist);
var count = (double)algo.lcoords.Count / 3;
int i = 1;
Program.World.DelayedTask.StartDelayedTask(() =>
{
var selected = i * (int)count;
selected = Math.Min(algo.lcoords.Count - 1, selected);
X = (ushort)algo.lcoords[selected].X;
Y = (ushort)algo.lcoords[selected].Y;
FloorItem floorItem = new FloorItem(true);
floorItem.ItemID = FloorItem.Twilight;
floorItem.ItemColor = (Enums.Color)(i + 1);
floorItem.MapID = attacker.MapID;
floorItem.Type = FloorItem.Effect;
floorItem.X = X;
floorItem.Y = Y;
floorItem.OnFloor = Time32.Now;
floorItem.Owner = attacker.Owner;
while (map.Npcs.ContainsKey(floorItem.UID))
floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
map.AddFloorItem(floorItem);
attacker.Owner.SendScreenSpawn(floorItem, true);
if (i != 0)
{
Data data = new Network.GamePackets.Data(true);
data.UID = attacker.UID;
data.X = X;
data.Y = Y;
data.ID = 434;
data.wParam1 = attacker.X;
data.wParam2 = attacker.Y;
attacker.Owner.SendScreen(data, true);
//double percent = 1;
//switch (i)
//{
// case 1:
// percent = 0.92;
// break;
// case 2:
// percent = 1.02;
// break;
// case 3:
// percent = 1.2;
// break;
//}
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
bool hit = false;
var selected2 = Math.Max(0, i - 1) * (int)count;
selected2 = Math.Min(algo.lcoords.Count - 1, selected2);
if (Kernel.GetDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[selected].X, (ushort)algo.lcoords[selected].Y) <= 3)
hit = true;
//for (int j = selected2; j < selected; j++)
// if (Kernel.GetDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= spell.Range)
// hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (uint)(damage * 0.7);
//damage = (uint)((double)(damage * percent));
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
var attackedsob = _obj as SobNpcSpawn;
if (CanAttack(attacker, attackedsob, spell))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
if (suse.Targets.Count > 0)
attacker.Owner.SendScreen(suse, true);
suse.Targets.Clear();
}
i++;
}, 0, 2, 500);
}
private void Execute()
{
#region interactions
if (attack != null)
{
switch (attack.AttackType)
{
case (uint)Network.GamePackets.Attack.InteractionRequest:
new InteractionRequest(attack, attacker);
return;
case (uint)Network.GamePackets.Attack.InteractionEffect:
new InteractionEffect(attack, attacker);
return;
case (uint)Network.GamePackets.Attack.InteractionAccept:
new InteractionAccept(attack, attacker);
return;
case (uint)Network.GamePackets.Attack.InteractionRefuse:
new InteractionRefuse(attack, attacker);
return;
case (uint)Network.GamePackets.Attack.InteractionStopEffect:
new InteractionStopEffect(attack, attacker);
return;
}
}
#endregion
#region Monster -> Entity \ Monster
if (attack == null)
{
if (attacker.EntityFlag != EntityFlag.Monster)
return;
if (attacked == null) return;
if (attacked.EntityFlag == EntityFlag.Entity)
{
if (attacker.Companion && attacker.Name != "Thundercloud")
{
if (Constants.PKForbiddenMaps.Contains(attacker.MapID))
return;
}
#region ThunderCloud
if (attacker.Name == "Thundercloud")
{
Console.WriteLine("Test 1");
if (Kernel.GamePool.ContainsKey(attacker.OwnerUID))
{
Console.WriteLine("Test 2");
var owner = Kernel.GamePool[attacker.OwnerUID];
var spell = Database.SpellTable.GetSpell(12840, owner);
var spell2 = Database.SpellTable.GetSpell(12970, owner);
byte percent = 0;
if (spell2 != null)
{
if (spell2.Level == 0) percent = 130;
if (spell2.Level == 1) percent = 140;
if (spell2.Level == 2) percent = 150;
if (spell2.Level == 3) percent = 160;
if (spell2.Level == 4) percent = 170;
if (spell2.Level == 5) percent = 180;
if (spell2.Level == 6) percent = 200;
}
attack = new Attack(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.AttackType = Network.GamePackets.Attack.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Damage = 1;
uint damage2 = (uint)(Calculate.Melee(owner.Player, attacked, ref attack) * spell.FirstDamage / 100);
if (attacker.SpawnPacket[50] == 128)//ThunderBolt
damage2 = (uint)(damage2 * percent / 100);
SpellUse suse2 = new SpellUse(true);
suse2.Attacker = attacker.UID;
suse2.Attacker1 = attacked.UID;
suse2.SpellID = 13190;
suse2.X = attacked.X;
suse2.Y = attacked.Y;
suse2.AddTarget(attacked, damage2, attack);
attacker.MonsterInfo.SendScreen(suse2);
if (attacked.Hitpoints <= damage2)
{
attacked.Die(attacker);
attack.ResponseDamage = damage2;
attacker.MonsterInfo.SendScreen(attack);
}
else
{
attacked.Hitpoints -= damage2;
}
return;
}
else
return;
}
#endregion
#region ThunderCloudSight
if (attacker != null && Kernel.Maps[attacker.MapID] != null)
{
foreach (var th in Kernel.Maps[attacker.MapID].Entities.Values.Where(i => i.Name == "Thundercloud"))
{
if (th.OwnerUID == attacked.UID)
{
if (attacker == null || Kernel.GetDistance(attacker.X, attacker.Y, th.X, th.Y) > th.MonsterInfo.AttackRange || attacker.Dead) break;
th.MonsterInfo.InSight = attacker.UID;
break;
}
}
}
#endregion
if (!attacked.Owner.Attackable)
return;
if (attacked.Dead)
return;
//#region BackFire
//if (attacked.ContainsFlag3(Network.GamePackets.Update.Flags3.BackFire))
//{
// attacked.RemoveFlag3(Update.Flags3.BackFire);
// var spellz = Database.SpellTable.GetSpell(12680, attacker.Owner);
// var attackz = new Attack(true);
// attackz.Attacker = attacked.UID;
// attackz.Attacked = attacker.UID;
// uint damages = attacked.Hitpoints / 110 * (uint)(spellz != null ? spellz.Power : 0);
// if (damages > 40000) damages = 40000;
// attackz.Damage = damages;
// attackz.AttackType = 57;
// attacked.Owner.SendScreen(attackz, true);
// if (attacker.Hitpoints <= damages)
// {
// attacker.Die(attacked);
// }
// else
// {
// attacker.Hitpoints -= damages;
// }
// if (attacked.Stamina <= ((attacked.HeavenBlessing > 0) ? 150 : 100))
// {
// attacked.Stamina += 30;
// }
// else attacked.Stamina = (byte)((attacked.HeavenBlessing > 0) ? 150 : 100);
// return;
//}
//#endregion
if (attacker.Mesh == 952)
{
attacker.MonstersSpells = new List<ushort>()
{
10363,// ca scateru cred
10364,//doar attack
10360,//range 10
10362,//range 13
10361//range 6
};
//this.Timer = Map.MonsterTimers.Add(this);
}
if (attacker.Mesh == 951)
{
attacker.MonstersSpells = new List<ushort>()
{
10372,
10373,
30012,
30014,
30013,
30011
};
}
if (attacker.Mesh == 984)
{
attacker.MonstersSpells = new List<ushort>()
{
7,
20,
21,
10372,
10373,
30012,
30014,
30013,
30011
};
}
#region NemesisTyrant
if (attacker.Name == "RoyalCamle")
{
uint rand = (uint)Mr_Panda.Kernel.Random.Next(1, 4);
switch (rand)
{
case 1:
attacker.MonsterInfo.SpellID = 10001;
break;
case 2:
attacker.MonsterInfo.SpellID = 30010;
break;
case 3:
attacker.MonsterInfo.SpellID = 10001;
break;
case 4:
attacker.MonsterInfo.SpellID = 30010;
break;
}
if (Kernel.Rate(5))
{
attacker.MonsterInfo.SpellID = 30011;
}
if (Kernel.Rate(5))
{
attacker.MonsterInfo.SpellID = 30012;
}
#region IceThrom AngerCop
if (attacker.MonsterInfo.SpellID == 30010 || attacker.MonsterInfo.SpellID == 10001)
{
uint damage = 0;
damage += (uint)Kernel.Random.Next(15000, 20000);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region Chill
if (attacker.MonsterInfo.SpellID == 30011)
{
SpellUse suse = new SpellUse(true);
attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(2700, 5000);
suse.Effect1 = attack.Effect1;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.ChaosStamp = Time32.Now;
attacked.Owner.Player.ChaosTime = 5;
var upd = new GameCharacterUpdates(true);
upd.UID = attacked.UID;
upd.Add(GameCharacterUpdates.Flustered, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag(Update.Flags.Confused);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 14))
{
if (obj.MapObjType == MapObjectType.Entity)
{
if (obj.Owner.Player.ContainsFlag(Update.Flags.Dead))
continue;
attacked = obj as Entity;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.ChaosStamp = Time32.Now;
attacked.Owner.Player.ChaosTime = 10;
var upd = new GameCharacterUpdates(true);
upd.UID = attacked.UID;
upd.Add(GameCharacterUpdates.Flustered, 0, 10);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag(Update.Flags.Confused);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region AngerCrop
if (attacker.MonsterInfo.SpellID == 30012)
{
SpellUse suse = new SpellUse(true);
attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(2700, 5000);
suse.Effect1 = attack.Effect1;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.Player.BlockStamp = Time32.Now;
attacked.Owner.Player.BlockTime = 5;
GameCharacterUpdates update = new GameCharacterUpdates(true);
update.UID = attacked.UID;
update.Add(GameCharacterUpdates.Freeze, 0, 5);
attacked.Owner.SendScreen(update, true);
attacked.AddFlag(Update.Flags.Freeze);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 10))
{
if (obj.MapObjType == MapObjectType.Entity)
{
if (obj.Owner.Player.ContainsFlag(Update.Flags.Dead))
continue;
attacked = obj as Entity;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.Player.BlockStamp = Time32.Now;
attacked.Owner.Player.BlockTime = 5;
GameCharacterUpdates update = new GameCharacterUpdates(true);
update.UID = attacked.UID;
update.Add(GameCharacterUpdates.Freeze, 0, 5);
attacked.Owner.SendScreen(update, true);
attacked.AddFlag(Update.Flags.Freeze);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
}
#endregion
#region NemesisTyrant
if (attacker.Name == "GuildWarMonster")
{
uint rand = (uint)Mr_Panda.Kernel.Random.Next(1, 4);
switch (rand)
{
case 1:
attacker.MonsterInfo.SpellID = 10001;
break;
case 2:
attacker.MonsterInfo.SpellID = 30010;
break;
case 3:
attacker.MonsterInfo.SpellID = 10001;
break;
case 4:
attacker.MonsterInfo.SpellID = 30010;
break;
}
if (Kernel.Rate(5))
{
attacker.MonsterInfo.SpellID = 30011;
}
if (Kernel.Rate(5))
{
attacker.MonsterInfo.SpellID = 30012;
}
#region IceThrom AngerCop
if (attacker.MonsterInfo.SpellID == 30010 || attacker.MonsterInfo.SpellID == 10001)
{
uint damage = 0;
damage += (uint)Kernel.Random.Next(8000, 10000);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region Chill
if (attacker.MonsterInfo.SpellID == 30011)
{
SpellUse suse = new SpellUse(true);
attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(2700, 5000);
suse.Effect1 = attack.Effect1;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.ChaosStamp = Time32.Now;
attacked.Owner.Player.ChaosTime = 5;
var upd = new GameCharacterUpdates(true);
upd.UID = attacked.UID;
upd.Add(GameCharacterUpdates.Flustered, 0, 5);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag(Update.Flags.Confused);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 14))
{
if (obj.MapObjType == MapObjectType.Entity)
{
if (obj.Owner.Player.ContainsFlag(Update.Flags.Dead))
continue;
attacked = obj as Entity;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.ChaosStamp = Time32.Now;
attacked.Owner.Player.ChaosTime = 10;
var upd = new GameCharacterUpdates(true);
upd.UID = attacked.UID;
upd.Add(GameCharacterUpdates.Flustered, 0, 10);
attacked.Owner.SendScreen(upd, true);
attacked.Owner.Player.AddFlag(Update.Flags.Confused);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
#region AngerCrop
if (attacker.MonsterInfo.SpellID == 30012)
{
SpellUse suse = new SpellUse(true);
attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = 0;
damage += (uint)Kernel.Random.Next(2700, 5000);
suse.Effect1 = attack.Effect1;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.Player.BlockStamp = Time32.Now;
attacked.Owner.Player.BlockTime = 5;
GameCharacterUpdates update = new GameCharacterUpdates(true);
update.UID = attacked.UID;
update.Add(GameCharacterUpdates.Freeze, 0, 5);
attacked.Owner.SendScreen(update, true);
attacked.AddFlag(Update.Flags.Freeze);
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked.UID, damage, attack);
foreach (var obj in attacked.Owner.Screen.Objects)
{
if (Calculations.InBox(obj.X, obj.Y, attacker.X, attacker.Y, 10))
{
if (obj.MapObjType == MapObjectType.Entity)
{
if (obj.Owner.Player.ContainsFlag(Update.Flags.Dead))
continue;
attacked = obj as Entity;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.Player.BlockStamp = Time32.Now;
attacked.Owner.Player.BlockTime = 5;
GameCharacterUpdates update = new GameCharacterUpdates(true);
update.UID = attacked.UID;
update.Add(GameCharacterUpdates.Freeze, 0, 5);
attacked.Owner.SendScreen(update, true);
attacked.AddFlag(Update.Flags.Freeze);
}
suse.AddTarget(attacked.UID, damage, attack);
}
}
}
attacked.Owner.SendScreen(suse, true);
}
#endregion
}
#endregion
if (attacker.MonstersSpells != null)
{
ushort usespell = 0;
byte rand = (byte)Kernel.Random.Next(0, attacker.MonstersSpells.Count);
if (rand >= attacker.MonstersSpells.Count)
usespell = attacker.MonstersSpells[0];
usespell = attacker.MonstersSpells[rand];
this.attack = new Attack(true);
this.attack.Effect1 = Attack.AttackEffects1.None;
this.attack = new Attack(true);
this.attack.Attacker = this.attacker.UID;
this.attack.Attacked = this.attacker.MonsterInfo.ID;
this.attack.X = this.attacked.X;
this.attack.Y = this.attacked.Y;
this.attack.AttackType = 52;
this.attack.SpellID = usespell;
this.attacker.MonsterInfo.SendScreen(this.attack);
attacker.MonsterInfo.SpellID = usespell;
switch (usespell)
{
case 7:
attacker.MonsterInfo.SpellID = 10361;
attacked.AddFlag((ulong)Update.Flags.Stun);
attacked.ShockStamp = Time32.Now;
attacked.Shock = 5;
var upd1 = new GameCharacterUpdates(true);
upd1.UID = attacked.UID;
upd1.Add(GameCharacterUpdates.SoulShacle, 0, 5);
attacked.Owner.SendScreen(upd1, true);
break;
case 20:
attacker.MonsterInfo.SpellID = 10360;
attacked.AddFlag((ulong)Update.Flags.Stun);
attacked.ShockStamp = Time32.Now;
attacked.Shock = 5;
var upd = new GameCharacterUpdates(true);
upd.UID = attacked.UID;
upd.Add(GameCharacterUpdates.Dizzy, 0, 5);
attacked.Owner.SendScreen(upd, true);
break;
case 21:
attacker.MonsterInfo.SpellID = 10361;
attacked.AddFlag((ulong)Update.Flags.Stun);
attacked.ShockStamp = Time32.Now;
attacked.Shock = 5;
upd1 = new GameCharacterUpdates(true);
upd1.UID = attacked.UID;
upd1.Add(GameCharacterUpdates.Dizzy, 0, 5);
attacked.Owner.SendScreen(upd1, true);
break;
//bamsher
case 10372:
case 10373:
case 30012:
case 30014:
case 30013:
case 30011:
case 10364:
case 10363:
case 10360:
case 10361:
case 10362:
default:
{
{
var Inrage = EntityinRange(attacker, attacked);
SpellUse suse = new SpellUse(true);
attack = new Attack(true);
bool geteffect = (Kernel.Random.Next() % 100) > 50;
if (geteffect)
attack.Effect1 = Attack.AttackEffects1.WaterResist;
else
attack.Effect1 = Attack.AttackEffects1.None;
suse.Effect1 = attack.Effect1;
suse.Attacker = attacker.UID;
suse.SpellID = usespell;
suse.X = attacked.X;
suse.Y = attacked.Y;
foreach (var attk in Inrage)
{
var attackedd = attk.Player;
if (attackedd.Dead)
continue;
if (attackedd.ContainsFlag(Update.Flags.Stun))
continue;
if (attackedd.ContainsFlag(Update.Flags.ChaosCycle))
continue;
if (attackedd.ContainsFlag(Update.Flags.Freeze))
continue;
if (attackedd.ContainsFlag(Update.Flags.FreezeSmall))
continue;
if (attackedd.ContainsFlag(Update.Flags.Frightened))
continue;
uint damage = Calculate.CalculateBossDamage(attacker, attacked, usespell);//Calculate.Magic(attacker, attk.Entity, usespell, 0, ref attack);
if (attackedd.Hitpoints <= damage)
{
attackedd.Die(attacker);
}
else
{
#region Chill
if (attacker.MonsterInfo.SpellID == 30011)
{
attackedd.Hitpoints -= damage;
attackedd.Owner.FrightenStamp = Time32.Now;
upd = new GameCharacterUpdates(true);
upd.UID = attackedd.UID;
upd.Add(GameCharacterUpdates.Flustered, 0, 5);
attackedd.Owner.SendScreen(upd, true);
attackedd.Owner.Player.AddFlag((ulong)Update.Flags.ChaosCycle);
}
#endregion
#region AngerCrop
else if (attacker.MonsterInfo.SpellID == 30012)
{
attackedd.Owner.Player.FrozenStamp = Time32.Now;
attackedd.Owner.Player.FrozenTime = 5;
GameCharacterUpdates update = new GameCharacterUpdates(true);
update.UID = attackedd.UID;
update.Add(GameCharacterUpdates.Freeze, 0, 5);
attackedd.Owner.SendScreen(update, true);
attackedd.AddFlag(Update.Flags.Freeze);
}
#endregion
#region 2nd skill
else if (attacker.MonsterInfo.SpellID == 7013)
{
attackedd.Owner.FrightenStamp = Time32.Now;
attackedd.Owner.Player.Fright = 5;
upd = new GameCharacterUpdates(true);
upd.UID = attackedd.UID;
upd.Add(GameCharacterUpdates.Dizzy, 0, 5);
attackedd.Owner.SendScreen(upd, true);
attackedd.Owner.Player.AddFlag((ulong)Update.Flags.FreezeSmall);
}
#endregion
attackedd.Hitpoints -= damage;
}
suse.AddTarget(attk.Player, damage, attack);
}
attacked.Owner.SendScreen(suse, true);
}
break;
}
}
return;
}
else if (attacker.MonsterInfo.SpellID == 0)// from this bracket to the next die delay replce this with urs
{
attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
attack.AttackType = Attack.Melee;
uint damage = Calculate.MonsterDamage(attacker, attacked, ref attack, false);
//#region RevengeTaill
//if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
//{
// if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
// {
// var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
// if (damage <= spelll.Power)
// {
// SpellUse suses = new SpellUse(true);
// suses.Attacker = attacked.UID;
// suses.Attacker1 = attacker.UID;
// suses.SpellID = 13030;
// suses.SpellEffect = 1;
// suses.AddTarget(attacker, damage, null);
// if (attacker.Hitpoints <= damage)
// {
// attacker.Die(attacked);
// }
// else
// {
// attacker.Hitpoints -= damage;
// }
// attacked.Owner.SendScreen(suses, true);
// }
// }
//}
//#endregion
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.Damage = damage;
attack.X = attacked.X;
attack.Y = attacked.Y;
if (attacked.Hitpoints <= damage)
{
attacked.Owner.SendScreen(attack, true);
attacked.Die(attacker.UID);
}
else
{
attacked.Hitpoints -= damage;
attacked.Owner.SendScreen(attack, true);
}
}
else
{
SpellUse suse = new SpellUse(true);
attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Calculate.MonsterDamage(attacker, attacked, attacker.MonsterInfo.SpellID);
//#region RevengeTaill
//if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
//{
// if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
// {
// var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
// if (damage <= spelll.Power)
// {
// SpellUse suses = new SpellUse(true);
// suses.Attacker = attacked.UID;
// suses.Attacker1 = attacker.UID;
// suses.SpellID = 13030;
// suses.SpellEffect = 1;
// suses.AddTarget(attacker, damage, null);
// if (attacker.Hitpoints <= damage)
// {
// attacker.Die(attacked);
// }
// else
// {
// attacker.Hitpoints -= damage;
// }
// attacked.Owner.SendScreen(suses, true);
// }
// }
//}
//#endregion
suse.Effect1 = attack.Effect1;
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker.UID);
}
else
{
attacked.Hitpoints -= damage;
}
if (attacker.Companion)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked, damage, attack);
attacked.Owner.SendScreen(suse, true);
this.attack = new Attack(true);
this.attack.Effect1 = Attack.AttackEffects1.None;
this.attack = new Attack(true);
this.attack.Attacker = this.attacker.UID;
this.attack.Attacked = this.attacker.MonsterInfo.ID;
this.attack.X = this.attacked.X;
this.attack.Y = this.attacked.Y;
this.attack.AttackType = 52;
this.attack.SpellID = this.attacker.MonsterInfo.SpellID;
this.attacker.MonsterInfo.SendScreen(this.attack);
}
}
else
{
if (attacker.MonsterInfo.SpellID == 0)
{
attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
attack.AttackType = Attack.Melee;
#region ThunderCloud
if (attacker.Name == "Thundercloud")
{
if (Kernel.GamePool.ContainsKey(attacker.OwnerUID))
{
var owner = Kernel.GamePool[attacker.OwnerUID];
var spell = Database.SpellTable.GetSpell(12840, owner);
var spell2 = Database.SpellTable.GetSpell(12970, owner);
uint damage2 = (uint)(Calculate.Melee(owner.Player, attacked, ref attack, 0) * (spell.Level < 8 ? spell.FirstDamage : 50) / 100);
if (attacker.SpawnPacket[50] == 128)
damage2 = (uint)(damage2 * spell2.FirstDamage);
SpellUse suse2 = new SpellUse(true);
suse2.Attacker = attacker.UID;
suse2.Attacker1 = attacked.UID;
suse2.SpellID = 13190;
suse2.X = attacked.X;
suse2.Y = attacked.Y;
suse2.AddTarget(attacked, damage2, attack);
attacker.MonsterInfo.SendScreen(suse2);
if (attacked.Hitpoints <= damage2)
{
attacked.Die(attacker);
attack = new Attack(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.AttackType = Network.GamePackets.Attack.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Damage = 1;
attack.ResponseDamage = damage2;
attacker.MonsterInfo.SendScreen(attack);
}
else
{
attacked.Hitpoints -= damage2;
}
return;
}
else
return;
}
#endregion
uint damage = Calculate.MonsterDamage(attacker, attacked, ref attack, false);
//#region RevengeTaill
//if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
//{
// if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
// {
// var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
// if (damage <= spelll.Power)
// {
// SpellUse suses = new SpellUse(true);
// suses.Attacker = attacked.UID;
// suses.Attacker1 = attacker.UID;
// suses.SpellID = 13030;
// suses.SpellEffect = 1;
// suses.AddTarget(attacker, damage, null);
// if (attacker.Hitpoints <= damage)
// {
// attacker.Die(attacked);
// }
// else
// {
// attacker.Hitpoints -= damage;
// }
// attacked.Owner.SendScreen(suses, true);
// }
// }
//}
//#endregion
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.Damage = damage;
attack.X = attacked.X;
attack.Y = attacked.Y;
attacked.MonsterInfo.SendScreen(attack);
if (attacker.Companion)
if (damage > attacked.Hitpoints)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
else
attacker.Owner.IncreaseExperience(damage, true);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
attack = new Attack(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.AttackType = Network.GamePackets.Attack.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attacked.MonsterInfo.SendScreen(attack);
}
else
{
attacked.Hitpoints -= damage;
}
}
else
{
SpellUse suse = new SpellUse(true);
attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Calculate.MonsterDamage(attacker, attacked, attacker.MonsterInfo.SpellID);
//#region RevengeTaill
//if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
//{
// if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
// {
// var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
// if (damage <= spelll.Power)
// {
// SpellUse suses = new SpellUse(true);
// suses.Attacker = attacked.UID;
// suses.Attacker1 = attacker.UID;
// suses.SpellID = 13030;
// suses.SpellEffect = 1;
// suses.AddTarget(attacker, damage, null);
// if (attacker.Hitpoints <= damage)
// {
// attacker.Die(attacked);
// }
// else
// {
// attacker.Hitpoints -= damage;
// }
// attacked.Owner.SendScreen(suses, true);
// }
// }
//}
//#endregion
suse.Effect1 = attack.Effect1;
suse.Attacker = attacker.UID;
suse.SpellID = attacker.MonsterInfo.SpellID;
suse.X = attacked.X;
suse.Y = attacked.Y;
suse.AddTarget(attacked, damage, attack);
attacked.MonsterInfo.SendScreen(suse);
if (attacker.Companion)
if (damage > attacked.Hitpoints)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
else
attacker.Owner.IncreaseExperience(damage, true);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
attack = new Attack(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.AttackType = Network.GamePackets.Attack.Kill;
attack.X = attacked.X;
attack.Y = attacked.Y;
attacked.MonsterInfo.SendScreen(attack);
}
else
{
attacked.Hitpoints -= damage;
}
}
}
}
#endregion
#region Entity -> Entity \ Monster \ Sob Npc
else
{
#region Merchant
if (attack.AttackType == Attack.MerchantAccept || attack.AttackType == Attack.MerchantRefuse)
{
attacker.AttackPacket = null;
return;
}
#endregion
#region Marriage
if (attack.AttackType == Attack.MarriageAccept || attack.AttackType == Attack.MarriageRequest)
{
if (attack.AttackType == Attack.MarriageRequest)
{
Client.GameState Spouse = null;
uint takeout = attack.Attacked;
if (takeout == attacker.UID)
takeout = attack.Attacker;
if (Kernel.GamePool.TryGetValue(takeout, out Spouse))
{
if (attacker.Spouse != "None" || Spouse.Player.Spouse != "None")
{
attacker.Owner.Send(new Message("You cannot marry someone that is already married with someone else!", System.Drawing.Color.Black, Message.TopLeft));
}
else
{
uint id1 = attacker.Mesh % 10, id2 = Spouse.Player.Mesh % 10;
if (id1 <= 2 && id2 >= 3 || id1 >= 2 && id2 <= 3)
{
attack.X = Spouse.Player.X;
attack.Y = Spouse.Player.Y;
Spouse.Send(attack);
}
else
{
attacker.Owner.Send(new Message("You cannot marry someone of your gender!", System.Drawing.Color.Black, Message.TopLeft));
}
}
}
}
else
{
Client.GameState Spouse = null;
if (Kernel.GamePool.TryGetValue(attack.Attacked, out Spouse))
{
if (attacker.Spouse != "None" || Spouse.Player.Spouse != "None")
{
attacker.Owner.Send(new Message("You cannot marry someone that is already married with someone else!", System.Drawing.Color.Black, Message.TopLeft));
}
else
{
if (attacker.Mesh % 10 <= 2 && Spouse.Player.Mesh % 10 >= 3 || attacker.Mesh % 10 >= 3 && Spouse.Player.Mesh % 10 <= 2)
{
Spouse.Player.Spouse = attacker.Name;
attacker.Spouse = Spouse.Player.Name;
Message message = null;
if (Spouse.Player.Mesh % 10 >= 3)
message = new Message("Joy and happiness! " + Spouse.Player.Name + " and " + attacker.Name + " have joined together in the holy marriage. We wish them a stone house.", System.Drawing.Color.BurlyWood, Message.Center);
else
message = new Message("Joy and happiness! " + attacker.Name + " and " + attacker.Spouse + " have joined together in the holy marriage. We wish them a stone house.", System.Drawing.Color.BurlyWood, Message.Center);
foreach (Client.GameState client in Program.Values)
{
client.Send(message);
}
Spouse.Player.Update(_String.Effect, "firework-2love", true);
attacker.Update(_String.Effect, "firework-2love", true);
}
else
{
attacker.Owner.Send(new Message("You cannot marry someone of your gender!", System.Drawing.Color.Black, Message.TopLeft));
}
}
}
}
}
#endregion
#region Attacking
else
{
attacker.Owner.Attackable = true;
Entity attacked = null;
SobNpcSpawn attackedsob = null;
FloorItem attackedItem = null;
#region Checks
if (attack.Attacker != attacker.UID)
return;
if (attacker.EntityFlag != EntityFlag.Entity)
return;
attacker.RemoveFlag(Update.Flags.Invisibility);
bool pass = false;
if (attack.AttackType == Attack.Melee)
{
if (attacker.OnFatalStrike())
{
if (attack.Attacked < 600000)
{
pass = true;
}
}
}
ushort decrease = 0;
if (attacker.OnCyclone())
decrease = 1;//Ahmed Samak : to fix the cyclone in scatter issue .. the value replaced from 700 to 1;
if (attacker.OnSuperman())
decrease = 300;
if (!pass && attack.AttackType != Attack.Magic)
{
int milliSeconds = 1000 - decrease;
if (milliSeconds < 0 || milliSeconds > 5000)
milliSeconds = 0;
if (Time32.Now < attacker.AttackStamp.AddMilliseconds(milliSeconds))
return;
attacker.AttackStamp = Time32.Now;
}
if (attacker.Dead)
{
if (attacker.AttackPacket != null)
attacker.AttackPacket = null;
return;
}
if (attacker.Owner.InQualifier())
{
if (Time32.Now < attacker.Owner.ImportTime().AddSeconds(12))
{
return;
}
}
if (attacker.Owner.ChampionGroup != null)
{
if (Time32.Now < attacker.Owner.ChampionGroup.ImportTime.AddSeconds(12))
{
return;
}
}
bool doWep1Spell = false, doWep2Spell = false;
restart:
#region Extract attack information
ushort SpellID = 0, X = 0, Y = 0;
uint Target = 0;
if (attack.AttackType == Attack.Magic)
{
if (!attack.Decoded)
{
#region GetSkillID
SpellID = Convert.ToUInt16(((long)attack.ToArray()[28] & 0xFF) | (((long)attack.ToArray()[29] & 0xFF) << 8));
SpellID ^= (ushort)0x915d;
SpellID ^= (ushort)attacker.UID;
SpellID = (ushort)(SpellID << 0x3 | SpellID >> 0xd);
SpellID -= 0xeb42;
#endregion
#region GetCoords
X = (ushort)((attack.ToArray()[20] & 0xFF) | ((attack.ToArray()[21] & 0xFF) << 8));
X = (ushort)(X ^ (uint)(attacker.UID & 0xffff) ^ 0x2ed6);
X = (ushort)(((X << 1) | ((X & 0x8000) >> 15)) & 0xffff);
X = (ushort)((X | 0xffff0000) - 0xffff22ee);
Y = (ushort)((attack.ToArray()[22] & 0xFF) | ((attack.ToArray()[23] & 0xFF) << 8));
Y = (ushort)(Y ^ (uint)(attacker.UID & 0xffff) ^ 0xb99b);
Y = (ushort)(((Y << 5) | ((Y & 0xF800) >> 11)) & 0xffff);
Y = (ushort)((Y | 0xffff0000) - 0xffff8922);
#endregion
#region GetTarget
Target = ((uint)attack.ToArray()[16] & 0xFF) | (((uint)attack.ToArray()[17] & 0xFF) << 8) | (((uint)attack.ToArray()[18] & 0xFF) << 16) | (((uint)attack.ToArray()[19] & 0xFF) << 24);
Target = ((((Target & 0xffffe000) >> 13) | ((Target & 0x1fff) << 19)) ^ 0x5F2D2463 ^ attacker.UID) - 0x746F4AE6;
#endregion
attack.X = X;
attack.Y = Y;
attack.Damage = SpellID;
attack.Attacked = Target;
attack.Decoded = true;
}
else
{
X = attack.X;
Y = attack.Y;
SpellID = (ushort)attack.Damage;
Target = attack.Attacked;
}
}
#endregion
if (!pass && attack.AttackType == Attack.Magic)
{
if (!(doWep1Spell || doWep2Spell))
{
if (SpellID == 11960 || SpellID == 1045 || SpellID == 1046 || SpellID == 11005 || SpellID == 11000 || SpellID == 1100 || SpellID == 1002 || SpellID == 11070 || SpellID == 12080 || SpellID == 10381 || SpellID == 1095 || SpellID == 1090 || SpellID == 12110) // FB and SS
{
//do checks
}
else
{
int milliSeconds = 1000 - decrease;
if (milliSeconds < 0 || milliSeconds > 5000)
milliSeconds = 0;
if (Time32.Now < attacker.AttackStamp.AddMilliseconds(milliSeconds))
return;
}
attacker.AttackStamp = Time32.Now;
}
}
#endregion
if (attacker.ContainsFlag(Update.Flags.Ride) && attacker.Owner.Equipment.TryGetItem(18) == null)
{
if (attack.AttackType != Attack.Magic)
attacker.RemoveFlag(Update.Flags.Ride);
else
if (!(SpellID == 7003 || SpellID == 7002))
attacker.RemoveFlag(Update.Flags.Ride);
}
if (attacker.ContainsFlag(Update.Flags.CastPray))
attacker.RemoveFlag(Update.Flags.CastPray);
if (attacker.ContainsFlag(Update.Flags.Praying))
attacker.RemoveFlag(Update.Flags.Praying);
#region Dash
if (SpellID == 1051)
{
if (Kernel.GetDistance(attack.X, attack.Y, attacker.X, attacker.Y) > 4)
{
attacker.Owner.Disconnect();
return;
}
attacker.X = attack.X; attacker.Y = attack.Y;
ushort x = attacker.X, y = attacker.Y;
Game.Map.UpdateCoordonatesForAngle(ref x, ref y, (Enums.ConquerAngle)Target);
foreach (Interfaces.IMapObject obj in attacker.Owner.Screen.Objects)
{
if (obj == null)
continue;
if (obj.X == x && obj.Y == y && (obj.MapObjType == MapObjectType.Monster || obj.MapObjType == MapObjectType.Entity))
{
Entity entity = obj as Entity;
if (!entity.Dead)
{
Target = obj.UID;
break;
}
}
}
}
#endregion
#region CounterKill
if (attack.AttackType == Attack.CounterKillSwitch)
{
if (attacked != null)
if (attacked.ContainsFlag(Update.Flags.Fly)) { attacker.AttackPacket = null; return; }
if (attacker != null)
if (attacker.ContainsFlag(Update.Flags.Fly)) { attacker.AttackPacket = null; return; }
if (attacker.Owner.Spells.ContainsKey(6003))
{
if (!attacker.CounterKillSwitch)
{
if (Time32.Now >= attacker.CounterKillStamp.AddSeconds(30))
{
attacker.CounterKillStamp = Time32.Now;
attacker.CounterKillSwitch = true;
Attack m_attack = new Attack(true);
m_attack.Attacked = attacker.UID;
m_attack.Attacker = attacker.UID;
m_attack.AttackType = Attack.CounterKillSwitch;
m_attack.Damage = 1;
m_attack.X = attacker.X;
m_attack.Y = attacker.Y;
m_attack.Send(attacker.Owner);
}
}
else
{
attacker.CounterKillSwitch = false;
Attack m_attack = new Attack(true);
m_attack.Attacked = attacker.UID;
m_attack.Attacker = attacker.UID;
m_attack.AttackType = Attack.CounterKillSwitch;
m_attack.Damage = 0;
m_attack.X = attacker.X;
m_attack.Y = attacker.Y;
m_attack.Send(attacker.Owner);
}
attacker.Owner.IncreaseSpellExperience(100, 6003);
attacker.AttackPacket = null;
}
}
#endregion
#region Melee
else if (attack.AttackType == Attack.Melee)
{
if (attacker.Assassin() || attacker.IsBowEquipped || attacker.IsChaser1())
{
attack.AttackType = Attack.Ranged;
new Game.Attacking.Handle(attack, attacker, attacked);
return;
}
if (attacker.Owner.Screen.TryGetValue(attack.Attacked, out attacked))
{
if (attacker.LeeLong())
{
attacker.Owner.IncreaseProficiencyExperience(10, 617);
}
#region Up - Down Sweep & Strike
int rate = 0;
if (attacker.Owner.Spells.ContainsKey(10490)) rate = 100 - Database.SpellTable.GetSpell(10490, attacker.Owner).Percent;
if (Kernel.Rate(rate))
{
if (attack.SpellID >= 12580 && attack.SpellID <= 12600 && attacker.EpicMonk())
{
var spell = Database.SpellTable.GetSpell(attack.SpellID, attacker.Owner);
if (spell != null)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = attack.SpellID;
suse.SpellLevel = spell.ID;
suse.X = attacker.X;
suse.Y = attacker.Y;
Fan fan = new Fan(attacker.X, attacker.Y, attacked.X, attacked.Y, spell.Range, spell.Sector);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= 7)
{
if (CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damages = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damages = (damages * 22) / 100;
attack.Attacked = attacked.UID;
attack.Damage = damages;
suse.Effect1 = attack.Effect1;
suse.AddTarget(_obj, damages, attack);
ReceiveAttack(attacker, attacked, attack, ref damages, null);
}
}
}
}
attacker.SendScreen(suse);
attacker.AttackPacket = null;
return;
}
}
}
else if (attacker.Owner.Spells.ContainsKey(10490) && attacker.Monk())
{
var spell = Database.SpellTable.GetSpell(10490, attacker.Owner);
if (Kernel.Rate(spell.MonsterPower - 55) && attacker.Owner.Spells.ContainsKey(12570) && attacker.EpicMonk())
{
spell = Database.SpellTable.GetSpell(12570, attacker.Owner);
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse2 = new SpellUse(true);
suse2.Attacker = attacker.UID;
suse2.SpellID = spell.ID;
suse2.SpellLevel = spell.Level;
if (attacked != null)
{
suse2.X = attacked.X;
suse2.Y = attacked.Y;
}
else
{
suse2.X = attackedsob.X;
suse2.Y = attackedsob.Y;
}
suse2.SpellEffect = 1;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (damage * 22) / 100;
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse2.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (damage * 22) / 100;
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse2.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (damage * 22) / 100;
attack.Damage = 0;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse2.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse2, true);
attacker.AttackPacket = null;
return;
}
}
else
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
TryTrip suse = new TryTrip(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
// if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
damage = (damage * 22) / 100;
suse.Attacked = attackedsob.UID;
attack.Damage = 0;
suse.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
attacker.Owner.SendScreen(suse, true);
}
}
else
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
uint damage = Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (damage * 22) / 100;
suse.Attacked = attacked.UID;
suse.Damage = damage;
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
attacker.Owner.SendScreen(suse, true);
}
}
attacker.AttackPacket = null; return;
}
}
}
attacker.AttackPacket = null;
return;
}
#endregion
#region ScarofEarth
if (attacker.Owner.Spells.ContainsKey(12670) && attacker.EpicWarrior())
{
var spell = Database.SpellTable.GetSpell(12670, attacker.Owner);
if (spell != null)
{
int Rate = spell.Percent;
if (attacked.EntityFlag == Game.EntityFlag.Entity)
{
int diff = attacked.BattlePower - attacker.BattlePower;
if (diff < 0) diff = 0;
Rate -= (byte)(diff * 5);
if (Rate < 0) Rate = 0;
}
if (Kernel.Rate(Rate))
{
if (CanUseSpell(spell, attacker.Owner))
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = 12670;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (attacked.UID == attacker.UID) continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) <= 5)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.780);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, null);
}
}
}
else if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (attacked.UID == attacker.UID) continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) <= 5)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, null);
}
}
}
}
attacker.AttackPacket = null;
attacker.Owner.SendScreen(suse, true);
return;
}
}
}
}
#endregion
#region EarthSweep
if (attack.SpellID == 12220 || attack.SpellID == 12210)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = attack.SpellID;
suse.SpellLevel = 0;
suse.X = attacker.X;
suse.Y = attacker.Y;
Fan fan = new Fan(attacker.X, attacker.Y, attacked.X, attacked.Y, 7, 180);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster ||
_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= 7)
{
if (CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker,
attacked, ref attack);
attack.Attacked = 0;
attack.Damage = damage;
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, null);
suse.AddTarget(attacked, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
attack = null;
return;
}
#endregion
#region EpicMonk
if (attack.SpellID == 12580 || attack.SpellID == 12590 || attack.SpellID == 12600)
{
Fan fan = new Fan(attacker.X, attacker.Y, attacked.X, attacked.Y, 7, 240);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= 7)
{
if (CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.780);
attack.Attacked = attacker.UID;
attack.Attacked = attacked.UID;
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, null);
}
}
}
}
attacker.AttackPacket = null;
attack = null;
return;
}
#endregion
#region Stomper(Melee)
#region Anger-Horror-Peace~of~Stomper(Windwalker-Stomper-Passive)
var lastattacked = attacked;
var spell5 = Database.SpellTable.GetSpell(12980, attacker.Owner);
if (Kernel.Rate(spell5.Percent) && attacker.Owner.Spells.ContainsKey(12980) && attacker.IsStomper2())
{
#region AngerofStomper
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell5.ID;
suse.SpellLevel = spell5.Level;
suse.X = lastattacked.X;
suse.Y = lastattacked.Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
attacked = _obj as Entity;
if (attacked == null) continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) <= spell5.Range)
{
if (_obj.MapObjType == MapObjectType.Entity)
{
if (!CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee)) continue;
attack.Effect1 = Attack.AttackEffects1.None;
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 1.100);
suse.Effect1 = attack.Effect1;
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell5);
suse.AddTarget(attacked, damage, attack);
}
else if (_obj.MapObjType == MapObjectType.Monster)
{
if (!CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee)) continue;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.780);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell5);
suse.AddTarget(attacked.UID, damage, attack);
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell5.Range)
{
if (CanAttack(attacker, attackedsob, spell5))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (damage * 22) / 100;
attack.Damage = 0;
ReceiveAttack(attacker, attackedsob, attack, damage, spell5);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
attacker.AttackPacket = null;
attacker.Owner.SendScreen(suse, true);
}
#endregion
#region HorrorofStomper
{
var spell2 = Database.SpellTable.GetSpell(12990, attacker.Owner);
if (!attacker.Owner.Spells.ContainsKey(12990)) return;
attack.Damage = 0;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell2.ID;
suse.SpellLevel = spell2.Level;
suse.X = lastattacked.X;
suse.Y = lastattacked.Y;
attacker.AttackPacket = null;
attacker.Owner.SendScreen(suse, true);
#region Flooritem
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
flooritem.ItemID = 1530;
flooritem.X = lastattacked.X;
flooritem.Y = lastattacked.Y;
flooritem.Type = FloorItem.Effect;
flooritem.mColor = 14;
flooritem.OwnerUID = attacker.UID;
flooritem.OwnerGuildUID = attacker.GuildID;
flooritem.FlowerType = 3;
flooritem.Unknown37 = 1;
flooritem.X2 = attacker.X;
flooritem.MapObjType = MapObjectType.FloorSpell;
flooritem.Y2 = attacker.Y;
flooritem.Angle = attacker.Facing;
flooritem.MapID = map.ID;
flooritem.Attack = attack;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
#endregion
}
#endregion
#region PeaceofStomper
{
var spell3 = Database.SpellTable.GetSpell(13000, attacker.Owner);
if (!attacker.Owner.Spells.ContainsKey(13000)) return;
attack.Damage = 0;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellLevel = spell3.Level;
suse.SpellID = spell3.ID;
suse.X = lastattacked.X;
suse.Y = lastattacked.Y;
attacker.AttackPacket = null;
attacker.Owner.SendScreen(suse, true);
#region Flooritem
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
flooritem.ItemID = 1540;
flooritem.X = lastattacked.X;
flooritem.Y = lastattacked.Y;
flooritem.X2 = attacker.X;
flooritem.Y2 = attacker.Y;
flooritem.Type = FloorItem.Effect;
flooritem.mColor = 14;
flooritem.OwnerUID = attacker.UID;
flooritem.OwnerGuildUID = attacker.GuildID;
flooritem.FlowerType = 3;
flooritem.Unknown37 = 1;
flooritem.MapID = map.ID;
flooritem.MapObjType = MapObjectType.FloorSpell;
flooritem.Attack = attack;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
#endregion
}
#endregion
return;
}
#endregion
else if (attacker.IsStomper1())
{
#region Sector-Circle-Rectangle(Windwalker-Stomper-Melee)
if (attack.SpellID == 13040 || attack.SpellID == 13050)
{
#region Sector
if (attack.SpellID == 13040)
{
var spell = Database.SpellTable.GetSpell(13040, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = attack.SpellID;
suse.X = attacker.X;
suse.Y = attacker.Y;
var angle = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
Map.UpdateCoordonatesForAngle(ref X, ref Y, angle);
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell.Range, spell.Sector);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 7)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Entity || _obj.MapObjType == MapObjectType.Monster)
{
if (_obj == null)
continue;
attacked = _obj as Entity;
if (attacked == null) continue;
if (!CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee)) continue;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
attack.Damage = 0;
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
}
}
}
#endregion
#region Circle
if (attack.SpellID == 13050)
{
var spell = Database.SpellTable.GetSpell(13050, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = attack.SpellID;
suse.X = attacker.X;
suse.Y = attacker.Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Entity || _obj.MapObjType == MapObjectType.Monster)
{
if (_obj == null)
continue;
attacked = _obj as Entity;
if (attacked == null) continue;
if (!CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee)) continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) > 5) continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
attack.Damage = 0;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
attacker.Owner.SendScreen(suse, true);
return;
}
#endregion
}
#endregion
}
#endregion
CheckForExtraWeaponPowers(attacker.Owner, attacked);
if (!CanAttack(attacker, attacked, null, attack.AttackType == Attack.Melee)) return;
pass = false;
if (attacker.OnFatalStrike())
{
if (attacked.EntityFlag == EntityFlag.Monster)
{
pass = true;
}
}
ushort range = attacker.AttackRange;
if (attacker.Transformed)
range = (ushort)attacker.TransformationAttackRange;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= range || pass)
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.780);
attack.Damage = damage;
if (attacker.OnFatalStrike())
{
if (attacked.EntityFlag == EntityFlag.Monster)
{
var weaps = attacker.Owner.Weapons;
bool can = false;
if (weaps.Item1 != null)
if (weaps.Item1 != null) if (weaps.Item1.ID / 1000 == 601 || weaps.Item1.ID / 1000 == 616) can = true; if (weaps.Item2 != null) if (weaps.Item2.ID / 1000 == 601 || weaps.Item2.ID / 1000 == 616) can = true;
can = true;
if (weaps.Item2 != null)
if (weaps.Item1 != null) if (weaps.Item1.ID / 1000 == 601 || weaps.Item1.ID / 1000 == 616) can = true; if (weaps.Item2 != null) if (weaps.Item2.ID / 1000 == 601 || weaps.Item2.ID / 1000 == 616) can = true;
can = true;
if (!can)
return;
ushort x = attacked.X;
ushort y = attacked.Y;
Map.UpdateCoordonatesForAngle(ref x, ref y, Kernel.GetAngle(attacked.X, attacked.Y, attacker.X, attacker.Y));
attacker.Shift(x, y);
attack.X = x;
attack.Y = y;
attack.Damage = damage;
attack.AttackType = Attack.FatalStrike;
}
}
var weapons = attacker.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 || wep1subyte == 620)
{
wep1bs = true;
wep1subyte = 420;
}
ushort wep1spellid = 0, wep2spellid = 0;
Database.SpellInformation wep1spell = null, wep2spell = null;
if (wep1subyte == 622)
{
if (attacker.WrathoftheEmperor == true)
{
if (attacker.WrathoftheEmperorStamp <= DateTime.Now.AddMilliseconds(1500))
{
wep1spellid = 12570;
}
attacker.WrathoftheEmperor = false;
}
}
if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
{
var weaponskill = Database.SpellTable.WeaponSpells[wep1subyte];
for (int i = 0; i < weaponskill.Count; i++)
{
if (!doWep1Spell)
{
wep1spellid = weaponskill[i];
if (attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
{
wep1spell = Database.SpellTable.SpellInformations[wep1spellid][attacker.Owner.Spells[wep1spellid].Level];
doWep1Spell = Kernel.Rate(wep1spell.Percent);
if (attacked.EntityFlag == EntityFlag.Entity && wep1spellid == 10490)
doWep1Spell = Kernel.Rate(5);
}
}
}
}
if (!doWep1Spell)
{
if (weapons.Item2 != null)
{
ConquerItem leftweapon = weapons.Item2;
wep2subyte = (ushort)(leftweapon.ID / 1000);
if (wep2subyte == 421 || wep2subyte == 620)
{
wep2bs = true;
wep2subyte = 420;
}
if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
{
var weaponskill2 = Database.SpellTable.WeaponSpells[wep2subyte];
for (int i = 0; i < weaponskill2.Count; i++)
{
if (!doWep2Spell)
{
wep2spellid = weaponskill2[i];
if (attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
{
wep2spell = Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level];
doWep2Spell = Kernel.Rate(wep2spell.Percent);
if (attacked.EntityFlag == EntityFlag.Entity && wep2spellid == 10490)
doWep2Spell = Kernel.Rate(5);
}
}
}
}
}
}
if (!attacker.Transformed)
{
if (doWep1Spell)
{
attack.AttackType = Attack.Magic;
attack.Decoded = true;
attack.weaponspell = true;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Attacked = attacked.UID;
attack.Damage = wep1spell.ID;
goto restart;
}
if (doWep2Spell)
{
attack.AttackType = Attack.Magic;
attack.Decoded = true;
attack.weaponspell = true;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Attacked = attacked.UID;
attack.Damage = wep2spell.ID;
goto restart;
}
if (wep1bs)
wep1subyte++;
if (attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag != EntityFlag.Entity)
if (damage > attacked.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), wep2subyte);
}
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.Owner.IncreaseProficiencyExperience(damage, wep2subyte);
}
}
}
}
else
{
if (!attacker.Transformed)
{
if (attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag != EntityFlag.Entity)
if (damage > attacked.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), 0);
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, 0);
}
}
}
ReceiveAttack(attacker, attacked, attack, ref damage, null);
attack.AttackType = Attack.Melee;
}
else
{
attacker.AttackPacket = null;
}
}
else if (attacker.Owner.Screen.TryGetSob(attack.Attacked, out attackedsob))
{
CheckForExtraWeaponPowers(attacker.Owner, null);
if (CanAttack(attacker, attackedsob, null))
{
ushort range = attacker.AttackRange;
if (attacker.Transformed)
range = (ushort)attacker.TransformationAttackRange;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= range)
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
var weapons = attacker.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 || wep1subyte == 620)
{
wep1bs = true;
wep1subyte = 420;
}
ushort wep1spellid = 0, wep2spellid = 0;
Database.SpellInformation wep1spell = null, wep2spell = null;
if (Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
{
var wep1 = Database.SpellTable.WeaponSpells[wep1subyte];
for (int i = 0; i < wep1.Count; i++)
{
if (!doWep1Spell)
{
wep1spellid = wep1[i];
if (attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
{
wep1spell = Database.SpellTable.SpellInformations[wep1spellid][attacker.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 || wep2subyte == 620)
{
wep2bs = true;
wep2subyte = 420;
}
if (Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
{
var wep2 = Database.SpellTable.WeaponSpells[wep2subyte];
for (int i = 0; i < wep2.Count; i++)
{
wep2spellid = wep2[i];
if (attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
{
wep2spell = Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level];
doWep2Spell = Kernel.Rate(wep2spell.Percent);
}
}
}
}
}
if (!attacker.Transformed)
{
if (doWep1Spell)
{
attack.AttackType = Attack.Magic;
attack.Decoded = true;
attack.weaponspell = true;
attack.X = attackedsob.X;
attack.Y = attackedsob.Y;
attack.Attacked = attackedsob.UID;
attack.Damage = wep1spell.ID;
goto restart;
}
if (doWep2Spell)
{
attack.AttackType = Attack.Magic;
attack.Decoded = true;
attack.weaponspell = true;
attack.X = attackedsob.X;
attack.Y = attackedsob.Y;
attack.Attacked = attackedsob.UID;
attack.Damage = wep2spell.ID;
goto restart;
}
if (attacker.MapID == 1039)
{
if (wep1bs)
wep1subyte++;
if (attacker.EntityFlag == EntityFlag.Entity)
if (damage > attackedsob.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), wep2subyte);
}
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, wep1subyte);
if (wep2subyte != 0)
{
if (wep2bs)
wep2subyte++;
attacker.Owner.IncreaseProficiencyExperience(damage, wep2subyte);
}
}
}
}
}
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, null);
}
else
{
attacker.AttackPacket = null;
}
}
}
else
{
attacker.AttackPacket = null;
}
}
#endregion
#region Ranged
else if (attack.AttackType == Attack.Ranged)
{
if (attacker.Owner.Screen.TryGetValue(attack.Attacked, out attacked))
{
CheckForExtraWeaponPowers(attacker.Owner, attacked);
if (!CanAttack(attacker, attacked, null, false))
return;
var weapons = attacker.Owner.Weapons;
if (weapons.Item1 == null) return;
if ((weapons.Item1.ID / 1000 != 500 && weapons.Item1.ID / 1000 != 613) && !attacker.IsChaser1())
return;
if (weapons.Item1.ID / 1000 == 500)
if (weapons.Item2 != null && !attacker.IsChaser1())
if (!PacketHandler.IsArrow(weapons.Item2.ID))
return;
#region Kinetic Spark
if (attacker.ContainsFlag3((ulong)Update.Flags3.KineticSpark))
{
var spell = Database.SpellTable.GetSpell(11590, attacker.Owner);
if (spell != null)
{
spell.CanKill = true;
if (Kernel.Rate(spell.Percent))
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacker.X;
suse.Y = attacker.Y;
IMapObject lastAttacked = attacker;
uint p = 0;
if (Handle.CanAttack(attacker, attacked, spell, false))
{
lastAttacked = attacked;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (uint)((damage) / 1.50);
suse.Effect1 = attack.Effect1;
if (attacker.SpiritFocus)
{
damage = (uint)(damage * attacker.SpiritFocusPercent);
attacker.SpiritFocus = false;
}
damage = damage - damage * (p += 20) / 100;
Handle.ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
if (_obj.UID == attacked.UID) continue;
var attacked1 = _obj as Entity;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 5)
{
if (Handle.CanAttack(attacker, attacked1, spell, false))
{
lastAttacked = attacked1;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked1, spell, ref attack);
suse.Effect1 = attack.Effect1;
if (attacker.SpiritFocus)
{
damage = (uint)(damage * attacker.SpiritFocusPercent);
attacker.SpiritFocus = false;
}
damage = damage - damage * (p += 20) / 100;
if (damage == 0) break;
ReceiveAttack(attacker, attacked1, attack, ref damage, spell);
suse.AddTarget(attacked1, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attackedsob.X, attackedsob.Y) <= 5)
{
if (Handle.CanAttack(attacker, attackedsob, spell))
{
lastAttacked = attackedsob;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
if (attacker.SpiritFocus)
{
damage = (uint)(damage * attacker.SpiritFocusPercent);
attacker.SpiritFocus = false;
}
damage = damage - damage * (p += 20) / 100;
if (damage == 0) break;
Handle.ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
return;
}
}
}
#endregion
#region ShadowofChaser
if (attacker.ContainsFlag4(Update.Flags4.ShadowofChaser) && attacker.IsChaser2())
{
var spell = Database.SpellTable.GetSpell(13090, attacker.Owner);
if (spell != null)
{
spell.CanKill = true;
if (Kernel.Rate(spell.Percent))
{
ShadowofChaser(attacker, attacked, attack, 1);
return;
}
}
}
#endregion
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= Constants.pScreenDistance)
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = 0;
if (!attacker.Assassin() && !attacker.IsChaser1())
damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack) * 300;
else
damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = damage - (uint)(damage * .50);
attack.Damage = damage;
if (attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag != EntityFlag.Entity)
if (damage > attacked.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attacked.Hitpoints), (ushort)(weapons.Item1.ID / 1000));
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, (ushort)(weapons.Item1.ID / 1000));
}
ReceiveAttack(attacker, attacked, attack, ref damage, null);
}
}
else if (attacker.Owner.Screen.TryGetSob(attack.Attacked, out attackedsob))
{
if (CanAttack(attacker, attackedsob, null))
{
var weapons = attacker.Owner.Weapons;
if (weapons.Item1 == null) return;
if (weapons.Item1.ID / 1000 != 500 && weapons.Item1.ID / 1000 != 613) return;
if (attacker.MapID != 1039)
{
if (weapons.Item1.ID / 1000 == 500)
{
if (weapons.Item2 == null)
{
attacker.SendSysMesage("please make sure you equipment an arrow");
return;
}
else
{
if (!PacketHandler.IsArrow(weapons.Item2.ID))
{
attacker.SendSysMesage("please make sure you equipment an arrow");
return;
}
}
}
}
#region Kinetic Spark
if (attacker.ContainsFlag3((ulong)Update.Flags3.KineticSpark))
{
var spell = Database.SpellTable.GetSpell(11590, attacker.Owner);
if (spell != null)
{
spell.CanKill = true;
if (Kernel.Rate(spell.Percent))
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacker.X;
suse.Y = attacker.Y;
IMapObject lastAttacked = attacker;
uint p = 0;
if (Handle.CanAttack(attacker, attackedsob, spell))
{
lastAttacked = attackedsob;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (uint)((damage) / 1);
suse.Effect1 = attack.Effect1;
if (attacker.SpiritFocus)
{
damage = (uint)(damage * attacker.SpiritFocusPercent);
attacker.SpiritFocus = false;
}
damage = damage - damage * (p += 20) / 100;
Handle.ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
var attacked1 = _obj as Entity;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attacked1.X, attacked1.Y) <= 5)
{
if (Handle.CanAttack(attacker, attacked1, spell, false))
{
lastAttacked = attacked1;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked1, spell, ref attack);
suse.Effect1 = attack.Effect1;
if (attacker.SpiritFocus)
{
damage = (uint)(damage * attacker.SpiritFocusPercent);
attacker.SpiritFocus = false;
}
damage = damage - damage * (p += 20) / 100;
if (damage == 0) break;
ReceiveAttack(attacker, attacked1, attack, ref damage, spell);
suse.AddTarget(attacked1, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
if (_obj.UID == Target) continue;
var attackedsob1 = _obj as SobNpcSpawn;
if (Kernel.GetDistance(lastAttacked.X, lastAttacked.Y, attackedsob1.X, attackedsob1.Y) <= 5)
{
if (Handle.CanAttack(attacker, attackedsob1, spell))
{
lastAttacked = attackedsob1;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob1, ref attack);
suse.Effect1 = attack.Effect1;
if (attacker.SpiritFocus)
{
damage = (uint)(damage * attacker.SpiritFocusPercent);
attacker.SpiritFocus = false;
}
damage = damage - damage * (p += 20) / 100;
if (damage == 0) break;
Handle.ReceiveAttack(attacker, attackedsob1, attack, damage, spell);
suse.AddTarget(attackedsob1, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
return;
}
}
}
#endregion
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= Constants.pScreenDistance)
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = 0;
if (!attacker.Assassin() && !attacker.IsChaser1())
damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack) / 2;
else
damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack) / 2;
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, null);
if (damage > attackedsob.Hitpoints)
{
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damage, attackedsob.Hitpoints), (ushort)(weapons.Item1.ID / 1000));
}
else
{
attacker.Owner.IncreaseProficiencyExperience(damage, (ushort)(weapons.Item1.ID / 1000));
}
}
}
}
else
{
attacker.AttackPacket = null;
}
}
#endregion
#region Magic
else if (attack.AttackType == Attack.Magic)
{
CheckForExtraWeaponPowers(attacker.Owner, attacked);
uint Experience = 100;
bool shuriken = false;
ushort spellID = SpellID;
if (SpellID >= 3090 && SpellID <= 3306)
spellID = 3090;
if (spellID == 6012)
shuriken = true;
if (attacker == null)
return;
if (attacker.Owner == null)
{
attacker.AttackPacket = null;
return;
}
if (attacker.Owner.Spells == null)
{
attacker.Owner.Spells = new SafeDictionary<ushort, Interfaces.ISkill>();
attacker.AttackPacket = null;
return;
}
if (attacker.Owner.Account.State == AccountTable.AccountState.ProjectManager)
{
attacker.Owner.Send("Spell ID: " + spellID);
}
if (attacker.Owner.Spells[spellID] == null && spellID != 6012)
{
attacker.AttackPacket = null;
return;
}
Database.SpellInformation spell = null;
if (shuriken)
spell = Database.SpellTable.SpellInformations[6010][0];
else
{
byte choselevel = 0;
if (spellID == SpellID)
choselevel = attacker.Owner.Spells[spellID].Level;
if (Database.SpellTable.SpellInformations[SpellID] != null && !Database.SpellTable.SpellInformations[SpellID].ContainsKey(choselevel))
choselevel = (byte)(Database.SpellTable.SpellInformations[SpellID].Count - 1);
spell = Database.SpellTable.SpellInformations[SpellID][choselevel];
}
if (spell == null)
{
attacker.AttackPacket = null;
return;
}
attacked = null;
attackedsob = null;
if (attacker.Owner.Screen.TryGetValue(Target, out attacked) || attacker.Owner.Screen.TryGetSob(Target, out attackedsob) || Target == attacker.UID || spell.Sort != 1)
{
if (Target == attacker.UID)
attacked = attacker;
if (attacked != null)
{
if (attacked.Dead && spell.Sort != Database.SpellSort.Revive && spell.ID != 10405 && spell.ID != 10425)
{
attacker.AttackPacket = null;
return;
}
}
if (Target >= 400000 && Target <= 600000 || Target >= 800000)
{
if (attacked == null && attackedsob == null)
return;
}
else if (Target != 0 && attacked == null && attackedsob == null && attackedItem == null)
return;
if (attacked != null)
{
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (spell.CanKill)
{
if (attacked.MonsterInfo.InSight == 0)
{
attacked.MonsterInfo.InSight = attacker.UID;
}
}
}
}
if (!attacker.Owner.Spells.ContainsKey(spellID))
{
if (spellID != 6012)
return;
}
var weapons = attacker.Owner.Weapons;
if (spell != null)
{
if (spell.OnlyWithThisWeaponSubtype.Count != 0)
{
uint firstwepsubtype, secondwepsubtype;
if (weapons.Item1 != null)
{
firstwepsubtype = weapons.Item1.ID / 1000;
if (firstwepsubtype == 421) firstwepsubtype = 420;
if (weapons.Item2 != null)
{
secondwepsubtype = weapons.Item2.ID / 1000;
if (!spell.OnlyWithThisWeaponSubtype.Contains((ushort)firstwepsubtype))
{
if (!spell.OnlyWithThisWeaponSubtype.Contains((ushort)secondwepsubtype) && (spell.ID != 1046 && secondwepsubtype != 614 && firstwepsubtype != 614/*To Fix The Bug With ScentSword*/))
{
attacker.AttackPacket = null;
return;
}
}
}
else
{
if (!spell.OnlyWithThisWeaponSubtype.Contains((ushort)firstwepsubtype))
{
attacker.AttackPacket = null;
return;
}
}
}
else
{
attacker.AttackPacket = null;
return;
}
}
}
Interfaces.ISkill client_Spell;
if (!attacker.Owner.Spells.TryGetValue(spell.ID, out client_Spell))
if (!attacker.Owner.Spells.TryGetValue(spellID, out client_Spell))
return;
#region Allowed Skills
if (!attacker.Owner.Fake)
{
var xspell = GetWeaponSpell(spell);
// var xspell = Database.SpellTable.WeaponSpells.Values.Where(p => p.Contains(spell.ID)).FirstOrDefault();
if (xspell != null)
{
if (!attack.weaponspell && spell.Sort == SpellSort.SingleWeaponSkill)
{
attacker.AttackPacket = null;
return;
}
}
if (attacker.Owner.LobbyGroup != null)
{
if (attacker.Owner.LobbyGroup.MatchType == Lobby.MatchType.FBSS)
{
if (spellID != 1045 && spellID != 1046 && spellID != 11005)
{
attacker.AttackPacket = null;
return;
}
}
}
if (spellID == 1045 || spellID == 1046)
{
if (attack.Attacked != 0)
{
attacker.AttackPacket = null;
return;
}
}
}
#endregion
switch (spellID)
{
#region Single magic damage spells
case 11030:
case 1000:
case 1001:
case 1002:
case 1150:
case 1160:
case 1180:
case 1320:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (spell.ID == 10310)
{
if (Time32.Now > attacker.EagleEyeStamp.AddSeconds(20))
return;
attacker.EagleEyeStamp = Time32.Now;
}
if (attacked != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
damage = (uint)(damage * 1.3);
if (spell.ID == 11030)
{
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
}
suse.Effect1 = attack.Effect1;
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(1900))
{
if (spell.ID == 1002)
{
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.BreakTouch(attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
damage = (uint)(damage * 1.3);
}
}
suse.AddTarget(attacked, damage, attack);
attacker.Owner.Player.IsEagleEyeShooted = true;
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(suse, true);
else
attacked.MonsterInfo.SendScreen(suse);
var attackd = attacked as Entity;
if (Kernel.BlackSpoted.ContainsKey(attackd.UID) && spell.ID == 11030)
{
attacker.Owner.Player.IsEagleEyeShooted = false;
if (attacker.Owner.Spells.ContainsKey(11130))
{
var s = attacker.Owner.Spells[11130];
var sspell = Database.SpellTable.SpellInformations[s.ID][s.Level];
if (spell != null)
{
attacker.EagleEyeStamp = Time32.Now;
attacker.Owner.Player.IsEagleEyeShooted = false;
SpellUse ssuse = new SpellUse(true);
ssuse.Attacker = attacker.UID;
ssuse.SpellID = sspell.ID;
ssuse.SpellLevel = sspell.Level;
ssuse.AddTarget(attacker.Owner.Player, new SpellUse.DamageClass().Damage = 11030, attack);
if (attacker.EntityFlag == EntityFlag.Entity)
{
attacker.Owner.SendScreen(ssuse, true);
}
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
}
}
else
{
attacker.AttackPacket = null;
}
break;
}
#endregion
#region Single heal/meditation spells
case 1190:
case 1195:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
uint damage = spell.Power;
if (spell.ID == 1190)
{
Experience = damage = Math.Min(damage, attacker.MaxHitpoints - attacker.Hitpoints);
attacker.Hitpoints += damage;
}
else
{
Experience = damage = Math.Min(damage, (uint)(attacker.MaxMana - attacker.Mana));
attacker.Mana += (ushort)damage;
}
suse.AddTarget(attacker, spell.Power, attack);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Multi heal spells
case 1005:
case 1055:
case 1170:
case 1175:
{
if (CanUseSpell(spell, attacker.Owner))
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attackedsob != null)
{
if (attacker.MapID == 1038)
break;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance)
{
PrepareSpell(spell, attacker.Owner);
uint damage = spell.Power;
damage = Math.Min(damage, attackedsob.MaxHitpoints - attackedsob.Hitpoints);
attackedsob.Hitpoints += damage;
Experience += damage;
suse.AddTarget(attackedsob, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
else
{
if (spell.Multi)
{
if (attacker.Owner.Team != null)
{
PrepareSpell(spell, attacker.Owner);
foreach (Client.GameState teammate in attacker.Owner.Team.Teammates)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, teammate.Player.X, teammate.Player.Y) <= spell.Distance)
{
uint damage = spell.Power;
damage = Math.Min(damage, teammate.Player.MaxHitpoints - teammate.Player.Hitpoints);
teammate.Player.Hitpoints += damage;
Experience += damage;
suse.AddTarget(teammate.Player, damage, attack);
if (spell.NextSpellID != 0)
{
attack.Damage = spell.NextSpellID;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket = null;
}
}
}
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(suse, true);
else
attacked.MonsterInfo.SendScreen(suse);
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
PrepareSpell(spell, attacker.Owner);
uint damage = spell.Power;
damage = Math.Min(damage, attacked.MaxHitpoints - attacked.Hitpoints);
attacked.Hitpoints += damage;
Experience += damage;
suse.AddTarget(attacked, damage, attack);
if (spell.NextSpellID != 0)
{
attack.Damage = spell.NextSpellID;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket = null;
}
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(suse, true);
else
attacked.MonsterInfo.SendScreen(suse);
}
else
{
attacker.AttackPacket = null;
}
}
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
PrepareSpell(spell, attacker.Owner);
uint damage = spell.Power;
damage = Math.Min(damage, attacked.MaxHitpoints - attacked.Hitpoints);
attacked.Hitpoints += damage;
Experience += damage;
suse.AddTarget(attacked, damage, attack);
if (spell.NextSpellID != 0)
{
attack.Damage = spell.NextSpellID;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket = null;
}
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(suse, true);
else
attacked.MonsterInfo.SendScreen(suse);
}
else
{
attacker.AttackPacket = null;
}
}
}
}
else
{
attacker.AttackPacket = null;
}
break;
}
#endregion
#region AuroraLotus
case 12370:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.Owner.SendScreen(suse, true);
FloorItem item = new FloorItem(true);
item.UID = FloorItem.FloorUID.Next;
item.ItemID = FloorItem.AuroraLotus;
item.MapID = attacker.MapID;
item.X = X;
item.Y = Y;
item.ItemColor = (Game.Enums.Color)25;
item.Type = FloorItem.Effect;
item.mColor = 13;
item.OwnerUID = attacker.UID;
item.OwnerGuildUID = attacker.GuildID;
item.Name = spell.Name;
item.Owner = attacker.Owner;
item.OnFloor = Time32.Now;
item.FlowerType = 3;
item.Timer = Kernel.Gettime();
attacker.Owner.Map.AddFloorItem(item);
attacker.Owner.SendScreenSpawn(item, true);
attacker.Energy = 0;
}
break;
}
#endregion
#region FlameLotus
case 12380:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.Owner.SendScreen(suse, true);
FloorItem item = new FloorItem(true);
item.UID = FloorItem.FloorUID.Next;
item.ItemID = FloorItem.FlameLotus;
item.MapID = attacker.MapID;
item.X = X;
item.Y = Y;
item.ItemColor = (Game.Enums.Color)25;
item.Type = FloorItem.Effect;
item.mColor = 13;
item.OwnerUID = attacker.UID;
item.OwnerGuildUID = attacker.GuildID;
item.Name = spell.Name;
item.Owner = attacker.Owner;
item.OnFloor = Time32.Now;
item.FlowerType = 3;
item.Timer = Kernel.Gettime();
attacker.Owner.Map.AddFloorItem(item);
attacker.Owner.SendScreenSpawn(item, true);
attacker.Energy = 0;
}
break;
}
#endregion
#region Revive
case 1050:
case 1100:
{
if (attackedsob != null)
return;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <=
spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked, 0, attack);
attacked.Owner.Player.Action =
Game.Enums.ConquerAction.None;
attacked.Owner.ReviveStamp = Time32.Now;
attacked.Owner.Attackable = false;
attacked.Owner.Player.TransformationID = 0;
attacked.Owner.Player.RemoveFlag((ulong)Update.Flags.Dead);
attacked.Owner.Player.RemoveFlag((ulong)Update.Flags.Ghost);
attacked.Owner.Player.Hitpoints = attacked.Owner.Player.MaxHitpoints;
attacked.Ressurect();
attacked.Owner.SendScreen(suse, true);
if (attacker.Owner.Spells.ContainsKey(12390))
{
if (Kernel.Rate(Database.SpellTable.GetSpell(12390, attacker.Owner).Percent))
{
SpellUse susee = new SpellUse(true);
susee.Attacker = attacker.UID;
susee.SpellID = 12390;
susee.SpellLevel = attacker.Owner.Spells[12390].Level;
susee.X = attacked.X;
susee.Y = attacked.Y;
attacked.Owner.SendScreen(susee, true);
attacked.AddFlag((ulong)Update.Flags.Stigma);
attacked.StigmaStamp = Time32.Now;
attacked.StigmaIncrease = 15;
attacked.StigmaTime = 60;
attacked.MagicShieldStamp = Time32.Now;
attacked.MagicShieldIncrease = 15;
attacked.MagicShieldTime = 60;
attacked.LoadTopStatus();
attacked.AddFlag(Update.Flags.MagicShield);
attacked.AddFlag(Update.Flags.StarOfAccuracy);
attacked.AccuracyStamp = Time32.Now;
attacked.AccuracyTime = 60;
}
}
}
}
break;
}
#endregion
#region Linear spells
case 11000:
case 11005:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, client_Spell.LevelHu2);
damage = (damage * 46) / 100;
suse.Effect1 = attack.Effect1;
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (damage * 46) / 100;
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Linear spells
case 1045:
case 1046:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
SpellUse suse = new SpellUse(true);
attacker.Stamina -= 0;//////////////
attacker.Stamina += 150;//////////
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, client_Spell.LevelHu2);
damage = (damage * 46) / 100;
suse.Effect1 = attack.Effect1;
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (damage * 46) / 100;
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region XPSpells inoffensive
case 1015:
case 1020:
case 1025:
case 1110:
case 6011:
case 10390:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked.UID, 0, attack);
if (spell.ID == 6011)
{
attacked.FatalStrikeStamp = Time32.Now;
attacked.FatalStrikeTime = 60;
attacked.AddFlag((ulong)Update.Flags.FatalStrike);
attacker.RemoveFlag((ulong)Update.Flags.Ride);
}
else if (spell.ID == 1110 || spell.ID == 1025 || spell.ID == 10390)
{
if (!attacked.OnKOSpell())
attacked.KOCount = 0;
attacked.KOSpell = spell.ID;
if (spell.ID == 1110)
{
attacked.CycloneStamp = Time32.Now;
attacked.CycloneTime = 20;
attacked.AddFlag((ulong)Update.Flags.Cyclone);
}
else if (spell.ID == 10390)
{
attacked.OblivionStamp = Time32.Now;
attacked.OblivionTime = 20;
attacked.AddFlag2((ulong)Update.Flags2.Oblivion);
}
else
{
attacked.SupermanStamp = Time32.Now;
attacked.SupermanTime = 20;
attacked.AddFlag((ulong)Update.Flags.Superman);
}
}
else if (spell.ID == 1020)
{
attacked.ShieldStamp = Time32.Now;
attacked.MagicShieldStamp = Time32.Now;
attacked.MagicShieldTime = 0;
attacked.ShieldTime = 0;
attacked.AddFlag((ulong)Update.Flags.MagicShield);
attacked.ShieldStamp = Time32.Now;
attacked.ShieldIncrease = spell.PowerPercent;
attacked.ShieldTime = 60;
}
else
{
attacked.AccuracyStamp = Time32.Now;
attacked.StarOfAccuracyStamp = Time32.Now;
attacked.StarOfAccuracyTime = 0;
attacked.AccuracyTime = 0;
attacked.AddFlag((ulong)Update.Flags.StarOfAccuracy);
attacked.AccuracyStamp = Time32.Now;
attacked.AccuracyTime = (byte)spell.Duration;
}
attacked.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Circle spells
case 1010:
case 1120:
case 1125:
case 3090:
case 5001:
case 8030:
case 1115:
{
if (spell.ID == 10315)
{
if (attacker.Owner.Weapons.Item1 == null) return;
if (attacker.Owner.Weapons.Item1.IsTwoHander()) return;
}
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
UInt16 ox, oy;
ox = attacker.X;
oy = attacker.Y;
if (spellID == 10315)
{
Attack npacket = new Attack(true);
npacket.Attacker = attacker.UID;
npacket.AttackType = 53;
npacket.X = X;
npacket.Y = Y;
Writer.WriteUInt16(spell.ID, 28, npacket.ToArray());
Writer.WriteByte(spell.Level, 30, npacket.ToArray());
attacker.Owner.SendScreen(npacket, true);
attacker.X = X;
attacker.Y = Y;
attacker.SendSpawn(attacker.Owner);
}
List<IMapObject> objects = new List<IMapObject>();
if (attacker.Owner.Screen.Objects.Count() > 0)
objects = GetObjects(ox, oy, attacker.Owner);
if (objects != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
if (spellID == 10315)
{
foreach (IMapObject objs in objects.ToArray())
{
if (objs == null)
continue;
if (objs.MapObjType == MapObjectType.Monster || objs.MapObjType == MapObjectType.Entity)
{
attacked = objs as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, client_Spell.LevelHu2);
damage = (uint)(damage * 0.5);
suse.Effect1 = attack.Effect1;
if (spell.Power > 0)
{
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
damage = (uint)(damage * 0.5);
suse.Effect1 = attack.Effect1;
}
if (spell.ID == 8030)
{
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack, client_Spell.LevelHu2);
}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (objs.MapObjType == MapObjectType.SobNpc)
{
attackedsob = objs as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
if (spell.Power > 0)
{
damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack);
}
attack.Effect1 = Attack.AttackEffects1.None;
if (spell.ID == 8030)
damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
else
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
if (spell.ID == 1115)
{
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
damage = (uint)(damage * 0.55);
}
else if (spell.Power > 0)
{
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
if (spell.Power > 0)
damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack);
attack.Effect1 = Attack.AttackEffects1.None;
if (spell.ID == 8030)
damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
}
attacker.Owner.SendScreen(suse, true);
Mr_Panda.Game.Calculations.IsBreaking(attacker.Owner, ox, oy);
}
break;
}
#endregion
#region Buffers
case 1075:
case 1085:
case 1090:
case 1095:
case 3080:
case 10405:
case 30000:
{
if (attackedsob != null)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attackedsob, 0, null);
attacker.Owner.SendScreen(suse, true);
}
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked, 0, null);
if (spell.ID == 1075 || spell.ID == 1085)
{
if (spell.ID == 1075)
{
attacked.AddFlag(Update.Flags.Invisibility);
attacked.InvisibilityStamp = Time32.Now;
attacked.InvisibilityTime = (byte)spell.Duration;
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.Send(Constants.Invisibility(spell.Duration));
}
else
{
attacked.AccuracyStamp = Time32.Now;
attacked.StarOfAccuracyStamp = Time32.Now;
attacked.StarOfAccuracyTime = 0;
attacked.AccuracyTime = 0;
attacker.Stamina -= 0;//////////////
attacker.Stamina += 150;//////////
attacked.AddFlag(Update.Flags.StarOfAccuracy);
attacked.StarOfAccuracyStamp = Time32.Now;
attacked.StarOfAccuracyTime = (byte)spell.Duration;
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.Send(Constants.Accuracy(spell.Duration));
}
}
else
{
if (spell.ID == 1090)
{
attacked.ShieldTime = 0;
attacked.ShieldStamp = Time32.Now;
attacked.MagicShieldStamp = Time32.Now;
attacked.MagicShieldTime = 0;
attacked.AddFlag(Update.Flags.MagicShield);
attacked.MagicShieldStamp = Time32.Now;
attacked.MagicShieldIncrease = 1.1f;//spell.PowerPercent;
attacked.MagicShieldTime = (byte)spell.Duration;
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.Send(Constants.Shield(spell.PowerPercent, spell.Duration));
}
else if (spell.ID == 1095)
{
attacked.AddFlag(Update.Flags.Stigma);
attacked.StigmaStamp = Time32.Now;
attacked.StigmaIncrease = spell.PowerPercent;
attacked.StigmaTime = (byte)spell.Duration;
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.Send(Constants.Stigma(spell.PowerPercent, spell.Duration));
}
else if (spell.ID == 30000)
{
if (attacked.ContainsFlag2(Update.Flags2.AzureShield))
{
return;
}
if (spell.Level == 0)
attacked.AzureShieldDefence = 3000;
else
attacked.AzureShieldDefence = (ushort)(3000 * spell.Level);
attacked.AzureShieldLevel = spell.Level;
attacked.MagicShieldStamp = Time32.Now;
attacked.AzureShieldStamp = DateTime.Now;
attacked.AddFlag2(Update.Flags2.AzureShield);
attacked.MagicShieldTime = spell.Percent;
attacked.AzureShieldPacket();
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.Send(Constants.Shield(12000, attacked.MagicShieldTime));
}
if (spell.ID == 10405 && attacked.Dead)
{
if (attacked.EntityFlag != EntityFlag.Entity) break;
if (!attacked.ContainsFlag2(Update.Flags2.SoulShackle))
{
if ((attacked.BattlePower - attacker.BattlePower) > 20) break;
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.FreeSoul;
byte chance = 0;
new MsgRefineEffect().HandleFreeSoul(attacker, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
break;
}
#endregion
attacker.SpellStamp = Time32.Now;
attacked.AddFlag(Update.Flags.Dead);
attacked.AddFlag2(Update.Flags2.SoulShackle);
attacked.ShackleStamp = Time32.Now;
attacked.ShackleTime = 90;
Network.GamePackets.Update upgrade = new Network.GamePackets.Update(true);
upgrade.UID = attacked.UID;
upgrade.Append((byte)Network.GamePackets.Update.DataType.SoulShackle, 111, 90, 0, spell.Level);
attacked.Owner.Send(upgrade.ToArray());
if (attacked.EntityFlag == EntityFlag.Entity) attacked.Owner.Send(Constants.Shackled(attacked.ShackleTime));
}
}
}
}
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(suse, true);
else
attacked.MonsterInfo.SendScreen(suse);
}
}
}
break;
}
#endregion
#region Percent
case 3050:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attackedsob != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
uint damage = Game.Attacking.Calculate.Percent(attackedsob, spell.PowerPercent);
attackedsob.Hitpoints -= damage;
suse.AddTarget(attackedsob, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
PrepareSpell(spell, attacker.Owner);
uint damage = Game.Attacking.Calculate.Percent(attacked, spell.PowerPercent);
if (attacked.Owner != null)
{
attacker.Owner.UpdateQualifier(attacker.Owner, attacked.Owner, damage);
}
attacked.Hitpoints -= damage;
suse.AddTarget(attacked, damage, attack);
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(suse, true);
else
attacked.MonsterInfo.SendScreen(suse);
}
}
}
}
break;
}
#endregion
#region ExtraXP
case 1040:
{
if (CanUseSpell(spell, attacker.Owner))
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
PrepareSpell(spell, attacker.Owner);
if (attacker.Owner.Team != null)
{
foreach (Client.GameState teammate in attacker.Owner.Team.Teammates)
{
if (teammate.Player.UID != attacker.UID)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, teammate.Player.X, teammate.Player.Y) <= 18)
{
teammate.XPCount += 20;
suse.AddTarget(teammate.Player, 20, null);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region WeaponSpells
#region Circle
case 5010:
case 7020:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
if (suse.SpellID != 10415)
{
suse.X = X;
suse.Y = Y;
}
else
{
suse.X = 6;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (attacked.ContainsFlag(Update.Flags.Fly))
return;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Single target
// case 11140://WindStorm
// case 10490:
// {
// if (CanUseSpell(spell, attacker.Owner))
// {
// PrepareSpell(spell, attacker.Owner);
//
// TryTrip suse = new TryTrip(true);
// suse.Attacker = attacker.UID;
// suse.SpellID = spell.ID;
// suse.SpellLevel = spell.Level;
//
// if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
// {
// if (attackedsob != null)
// {
// if (CanAttack(attacker, attackedsob, spell))
// {
// suse.Attacked = attackedsob.UID;
// PrepareSpell(spell, attacker.Owner);
// attack.Effect1 = Attack.AttackEffects1.None;
// uint AllDamage = 0;
// uint damage1 = 0;
// uint damage2 = 0;
// uint damage = 0;
// Network.GamePackets.Attack.AttackEffects1 Eff1 = 0;
// Network.GamePackets.Attack.AttackEffects1 Eff2 = 0;
// Network.GamePackets.Attack.AttackEffects1 Eff3 = 0;
// damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
// AllDamage += damage;
// Eff1 = attack.Effect1;
// attack.Effect1 = Attack.AttackEffects1.None;
// if (attackedsob.Hitpoints <= AllDamage)
// {
// suse.Effect1 = attack.Effect1;
// suse.Damage += damage;
//
// }
// else
// {
// damage1 = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
// Eff2 = attack.Effect1;
// attack.Effect1 = Attack.AttackEffects1.None;
// AllDamage += damage1;
// if (attackedsob.Hitpoints <= AllDamage)
// {
// suse.Effect1 = attack.Effect1;
// suse.Effect2 = attack.Effect2;
// suse.Damage += damage;
// }
// else
// {
// damage2 = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
// Eff3 = attack.Effect1;
// attack.Effect1 = Attack.AttackEffects1.None;
// AllDamage += damage2;
// // suse.Effect1 = attack.Effect1;
// suse.Effect2 = attack.Effect2;
// suse.Damage = damage;
//
// }
// }
// if (spellID == 10490)
// {
// if (attacker.EpicMonk())
// {
// if (attacker.Owner.Spells.ContainsKey(12570))
// {
// attacker.WrathoftheEmperor = true;
// attacker.WrathoftheEmperorStamp = DateTime.Now;
// }
// }
// }
// ReceiveAttack(attacker, attackedsob, attack, AllDamage, spell);
//
// }
// }
// else
// {
// if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
// {
// suse.Attacked = attacked.UID;
// PrepareSpell(spell, attacker.Owner);
// attack.Effect1 = Attack.AttackEffects1.None;
// uint AllDamage = 0;
// uint damage1 = 0;
// uint damage2 = 0;
// uint damage = 0;
// Network.GamePackets.Attack.AttackEffects1 Eff1 = 0;
// Network.GamePackets.Attack.AttackEffects1 Eff3 = 0;
// damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
// damage = (uint)(damage * 0.5);
// AllDamage += damage;
// Eff1 = attack.Effect1;
// attack.Effect1 = Attack.AttackEffects1.None;
// if (attacked.Hitpoints <= AllDamage)
// {
// suse.Effect1 = attack.Effect1;
// suse.Damage += damage;
// }
// else
// {
// damage1 = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
// damage = (uint)(damage * 0.5);
// AllDamage += damage;
// Eff3 = attack.Effect1;
// attack.Effect1 = Attack.AttackEffects1.None;
// AllDamage += damage1;
// if (attacked.Hitpoints <= AllDamage)
// {
// suse.Effect1 = attack.Effect1;
// suse.Effect2 = attack.Effect2;
// suse.Damage += damage;
// }
// else
// {
// damage2 = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
// damage = (uint)(damage * 0.5);
// Eff3 = attack.Effect1;
// attack.Effect1 = Attack.AttackEffects1.None;
// AllDamage += damage2;
// suse.Effect1 = attack.Effect1;
// suse.Effect2 = attack.Effect2;
// suse.Damage = damage;
// }
// }
// if (spellID == 10490)
// {
// if (attacker.EpicMonk())
// {
// if (attacker.Owner.Spells.ContainsKey(12570))
// {
// attacker.WrathoftheEmperor = true;
// attacker.WrathoftheEmperorStamp = DateTime.Now;
// }
// }
// }
// ReceiveAttack(attacker, attacked, attack, ref AllDamage, spell);
// }
// }
// //attacker.AttackPacket = null;
// }
// else
// {
// attacker.AttackPacket = null;
// }
// attacker.Owner.SendScreen(suse, true);
// }
// //attacker.AttackPacket = null;
// break;
// }
//case 1290:
// case 5030:
// case 5040:
// case 7000:
// case 7010:
// case 7030:
// case 7040:
// {
// if (CanUseSpell(spell, attacker.Owner))
// {
// PrepareSpell(spell, attacker.Owner);
//
// SpellUse suse = new SpellUse(true);
// suse.Attacker = attacker.UID;
// suse.SpellID = spell.ID;
// suse.SpellLevel = spell.Level;
// //suse.SpellLevelHu = client_Spell.LevelHu2;
// suse.X = X;
// suse.Y = Y;
//
// if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
// {
// if (attackedsob != null)
// {
// if (CanAttack(attacker, attackedsob, spell))
// {
// PrepareSpell(spell, attacker.Owner);
// attack.Effect1 = Attack.AttackEffects1.None;
// uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
// ReceiveAttack(attacker, attackedsob, attack, damage, spell);
//
// suse.AddTarget(attackedsob, damage, attack);
// }
// }
// else
// {
// if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
// {
// PrepareSpell(spell, attacker.Owner);
//
// attack.Effect1 = Attack.AttackEffects1.None;
// uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
// damage = (uint)(damage * 0.5);
// suse.Effect1 = attack.Effect1;
//
// ReceiveAttack(attacker, attacked, attack, ref damage, spell);
//
// suse.AddTarget(attacked, damage, attack);
// }
// }
// attacker.AttackPacket = null;
// }
// else
// {
// attacker.AttackPacket = null;
// }
// attacker.Owner.SendScreen(suse, true);
// }
// attacker.AttackPacket = null;
// break;
// }
#endregion
#region Single target
case 11140:
case 10490:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
TryTrip suse = new TryTrip(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
if (spellID == 10490)
{
if (attacker.EpicMonk())
{
if (attacker.Owner.Spells.ContainsKey(12570))
{
attacker.WrathoftheEmperor = true;
attacker.WrathoftheEmperorStamp = DateTime.Now;
}
}
}
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.Damage = damage;
suse.Attacked = attackedsob.UID;
}
}
else
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (spell.ID == 11140)
{
attack.Effect1 = Attack.AttackEffects1.None;
//var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack) / 1;
damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack) / 2;
}
if (spell.ID == 10490)
{
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, client_Spell.LevelHu2);
}
if (spellID == 10490)
{
if (attacker.EpicMonk())
{
if (attacker.Owner.Spells.ContainsKey(12570))
{
attacker.WrathoftheEmperor = true;
attacker.WrathoftheEmperorStamp = DateTime.Now;
}
}
}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.Damage = damage;
suse.Attacked = attacked.UID;
}
}
// attacker.AttackPacket = null;
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
// attacker.AttackPacket = null;
break;
}
case 1290:
case 5030:
case 5040:
case 7000:
case 7010:
case 7030:
case 7040:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.X = X;
suse.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
else
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
damage = (uint)(damage * 0.5);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
attacker.AttackPacket = null;
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
attacker.AttackPacket = null;
break;
}
#endregion
#region Sector
case 1250:
case 5050:
case 5020:
case 1300:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Range);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#endregion
#region Fly
case 8002:
case 8003:
{
if (attacker.Owner.Map.ID == 1645)
{
Kernel.SendWorldMessage(new Message("Mr: " + attacker.Name + " You Can`t Use Fly Here !!!", System.Drawing.Color.White, Message.Talk), Program.Values);
return;
}
if (attacker.Owner.Map.ID == 1645)
{
Kernel.SendWorldMessage(new Message("Mr: " + attacker.Name + " You Can`t Use Fly Here !!!", System.Drawing.Color.White, Message.Talk), Program.Values);
return;
}
if (CanUseSpell(spell, attacker.Owner))
{
if (attacker.MapID == 1950)
return;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacked.FlyStamp = Time32.Now;
attacked.FlyTime = (byte)spell.Duration;
suse.AddTarget(attacker, attacker.FlyTime, null);
attacker.AddFlag(Update.Flags.Fly);
attacker.RemoveFlag(Update.Flags.Ride);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Ninja Spells
case 6010:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.AddFlag(Update.Flags.ShurikenVortex);
attacker.RemoveFlag(Update.Flags.Ride);
attacker.ShurikenVortexStamp = Time32.Now;
attacker.ShurikenVortexTime = 20;
attacker.Owner.SendScreen(suse, true);
attacker.VortexPacket = new Attack(true);
attacker.VortexPacket.Decoded = true;
attacker.VortexPacket.Damage = 6012;
attacker.VortexPacket.AttackType = Attack.Magic;
attacker.VortexPacket.Attacker = attacker.UID;
}
break;
}
case 6012://VortexRespone
{
if (!attacker.ContainsFlag(Update.Flags.ShurikenVortex))
{
attacker.AttackPacket = null;
break;
}
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacker.X;
suse.Y = attacker.Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
// damage = (UInt32)((damage * 25) / 100);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
break;
}
case 6001:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj.MapObjType == MapObjectType.Entity || _obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (attacked.MapObjType == MapObjectType.Monster)
if (attacked.MonsterInfo.Boss)
continue;
if (Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
int potDifference = attacker.BattlePower - attacked.BattlePower;
int rate = spell.Percent + potDifference - 20;
if (Kernel.Rate(rate))
{
attacked.ToxicFogStamp = Time32.Now;
attacked.ToxicFogLeft = 20;
attacked.ToxicFogPercent = spell.PowerPercent;
attacked.AddFlag(Update.Flags.Poisoned);
suse.AddTarget(attacked, 1, null);
}
else
{
suse.AddTarget(attacked, 0, null);
suse.Targets[attacked.UID].Hit = false;
}
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
case 6000:
{
// if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(1))
{
if (CanUseSpell(spell, attacker.Owner))
{
ushort Xx, Yx;
if (attacked != null)
{
Xx = attacked.X;
Yx = attacked.Y;
}
else
{
Xx = attackedsob.X;
Yx = attackedsob.Y;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, Xx, Yx) <= 5)
{
if (attackedsob == null)
if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.Fly))
return;
//if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.Fly))
// return;
if (attacker.ContainsFlag(Network.GamePackets.Update.Flags.Fly))
return;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
bool send = false;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
send = true;
if (attacker.Owner.Spells.ContainsKey(11230) && !attacked.Dead)
{
var s = attacker.Owner.Spells[11230];
var spellz = Database.SpellTable.SpellInformations[s.ID][s.Level];
if (spellz != null)
{
if (Kernel.Rate(spellz.Percent))
{
SpellUse ssuse = new SpellUse(true);
ssuse.Attacker = attacker.UID;
ssuse.SpellID = spellz.ID;
ssuse.SpellLevel = spellz.Level;
damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack) / 2;
damage = 1000;
ssuse.AddTarget(attacked, new SpellUse.DamageClass().Damage = damage, attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spellz);
attacker.Owner.SendScreen(ssuse, true);
}
}
}
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.Effect1 = attack.Effect1;
suse.AddTarget(attackedsob, damage, attack);
send = true;
}
}
if (send)
attacker.Owner.SendScreen(suse, true);
attacker.SpellStamp = Time32.Now;
}
else
{
attacker.AttackPacket = null;
}
}
}
break;
}
case 6002:
{
if (attackedsob != null)
return;
if (attacked.EntityFlag == EntityFlag.Monster)
return;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
int potDifference = attacker.BattlePower - attacked.BattlePower;
int rate = spell.Percent + potDifference;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
if (CanAttack(attacker, attacked, spell, false))
{
suse.AddTarget(attacked, 1, attack);
if (Calculate.RateStatus(35))//Kernel.Rate(rate))
{
attacked.AddFlag2(Update.Flags2.EffectBall);
attacked.NoDrugsStamp = Time32.Now;
attacked.NoDrugsTime = (short)spell.Duration;
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.Send(Constants.NoDrugs(spell.Duration));
}
else
{
suse.Targets[attacked.UID].Hit = false;
suse.Targets[attacked.UID].Damage = spell.ID;
}
attacked.Owner.SendScreen(suse, true);
}
}
}
break;
}
case 6004:
{
if (attackedsob != null)
return;
if (attacked.EntityFlag == EntityFlag.Monster)
return;
if (!attacked.ContainsFlag(Update.Flags.Fly))
return;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
int potDifference = attacker.BattlePower - attacked.BattlePower;
int rate = spell.Percent + potDifference;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
if (CanAttack(attacker, attacked, spell, false))
{
uint dmg = Calculate.Percent(attacked, 0.1F);
suse.AddTarget(attacked, dmg, attack);
if (Kernel.Rate(rate))
{
attacked.Hitpoints -= dmg;
attacked.RemoveFlag(Update.Flags.Fly);
}
else
{
suse.Targets[attacked.UID].Hit = false;
}
attacked.Owner.SendScreen(suse, true);
}
}
}
break;
}
case 11180:
{
if (attacked != null)
{
if (attacked.ContainsFlag(Update.Flags.Fly))
return;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!Kernel.Rate(Math.Max(5, 100 - (attacked.BattlePower - attacker.BattlePower) / 5))) return;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.X = attacked.X;
suse.Y = attacked.Y;
ushort newx = attacker.X;
ushort newy = attacker.Y;
Map.Pushback(ref newx, ref newy, attacked.Facing, 5);
if (attacker.Owner.Map.Floor[newx, newy, MapObjectType.Entity, attacked])
{
suse.X = attacked.X = newx;
suse.Y = attacked.Y = newy;
}
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
if (CanAttack(attacker, attacked, spell, false))
{
tar.Damage = Calculate.Melee(attacker, attacked, ref attack) / 2;
suse.AddTarget(attacked, tar, attack);
ReceiveAttack(attacker, attacked, attack, ref tar.Damage, spell);
}
if (attacker.EntityFlag == EntityFlag.Entity)
attacker.Owner.SendScreen(suse, true);
}
}
}
break;
}
case 11170:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
foreach (var t in attacker.Owner.Screen.Objects)
{
if (t == null)
continue;
if (t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
{
var target = t as Entity;
if (Kernel.GetDistance(X, Y, target.X, target.Y) <= spell.Range)
{
if (CanAttack(attacker, target, spell, false))
{
tar.Damage = Calculate.Melee(attacker, target, spell, ref attack, client_Spell.LevelHu2) / 4;
tar.Hit = true;
suse.AddTarget(target, tar, attack);
ReceiveAttack(attacker, target, attack, ref tar.Damage, spell);
}
}
}
}
if (attacker.EntityFlag == EntityFlag.Entity)
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region InfernalEcho
case 12550:
{
if (CanUseSpell(spell, attacker.Owner))
{
var map = attacker.Owner.Map;
if (!map.Floor[X, Y, MapObjectType.Item, null]) return;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
suse.SpellEffect = 0;
suse.AddTarget(attacker, 0, null);
attacker.Owner.SendScreen(suse, true);
Random R = new Random();
int Nr = R.Next(1, 3);
switch (spell.Level)
{
#region case 0 - 1 - 2 - 3 - 4 - 5
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
{
var area2 = GetLocation2(attacker.X, attacker.Y);
int count = 3;
List<System.Drawing.Point> Area = new List<Point>();
for (int i = 0; i < 360; i += spell.Sector)
{
if (Area.Count >= count)
{
break;
}
int r = i;
var distance = Kernel.Random.Next(spell.Range, spell.Distance);
var x2 = (ushort)(X + (distance * Math.Cos(r)));
var y2 = (ushort)(Y + (distance * Math.Sin(r)));
System.Drawing.Point point = new System.Drawing.Point((int)x2, (int)y2);
if (!Area.Contains(point))
{
Area.Add(point);
}
else
{
i--;
}
}
if (Nr == 1)
{
foreach (var a in area2)
{
FloorItem item = new FloorItem(true);
item.ItemID = 1397;
item.MapID = attacker.MapID;
item.Type = FloorItem.Effect;
item.X = (ushort)a.X;
item.Y = (ushort)a.Y;
item.OnFloor = Time32.Now;
item.Owner = attacker.Owner;
item.UID = FloorItem.FloorUID.Next;
while (attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
item.UID = FloorItem.FloorUID.Next;
item.mColor = 14;
item.OwnerUID = attacker.UID;
item.OwnerGuildUID = attacker.GuildID;
item.FlowerType = 0;
item.Timer = Kernel.TqTimer(DateTime.Now.AddSeconds(3));
item.Name = "InfernalEcho";
attacker.Owner.SendScreenSpawn(item, true);
attacker.AttackPacket = null;
}
}
else if (Nr == 2)
{
foreach (var a in Area)
{
FloorItem item = new FloorItem(true);
item.ItemID = 1397;
item.MapID = attacker.MapID;
item.Type = FloorItem.Effect;
item.X = (ushort)a.X;
item.Y = (ushort)a.Y;
item.OnFloor = Time32.Now;
item.Owner = attacker.Owner;
item.UID = FloorItem.FloorUID.Next;
while (attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
item.UID = FloorItem.FloorUID.Next;
item.mColor = 14;
item.OwnerUID = attacker.UID;
item.OwnerGuildUID = attacker.GuildID;
item.FlowerType = 0;
item.Timer = Kernel.TqTimer(DateTime.Now.AddSeconds(3));
item.Name = "InfernalEcho";
attacker.Owner.SendScreenSpawn(item, true);
attacker.AttackPacket = null;
}
}
else if (Nr == 3)
{
foreach (var a in Area)
{
FloorItem item = new FloorItem(true);
item.ItemID = 1397;
item.MapID = attacker.MapID;
item.Type = FloorItem.Effect;
item.X = (ushort)a.X;
item.Y = (ushort)a.Y;
item.OnFloor = Time32.Now;
item.Owner = attacker.Owner;
item.UID = FloorItem.FloorUID.Next;
while (attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
item.UID = FloorItem.FloorUID.Next;
item.mColor = 14;
item.OwnerUID = attacker.UID;
item.OwnerGuildUID = attacker.GuildID;
item.FlowerType = 0;
item.Timer = Kernel.TqTimer(DateTime.Now.AddSeconds(3));
item.Name = "InfernalEcho";
attacker.Owner.SendScreenSpawn(item, true);
attacker.AttackPacket = null;
}
}
break;
}
#endregion
#region case 6
case 6:
{
var area2 = GetLocation(attacker.X, attacker.Y);
int count = 4;
List<System.Drawing.Point> Area = new List<Point>();
for (int i = 0; i < 360; i += spell.Sector)
{
if (Area.Count >= count)
{
break;
}
int r = i;
var distance = Kernel.Random.Next(spell.Range, spell.Distance);
var x2 = (ushort)(X + (distance * Math.Cos(r)));
var y2 = (ushort)(Y + (distance * Math.Sin(r)));
System.Drawing.Point point = new System.Drawing.Point((int)x2, (int)y2);
if (!Area.Contains(point))
{
Area.Add(point);
}
else
{
i--;
}
}
if (Nr == 1)
{
foreach (var a in area2)
{
FloorItem item = new FloorItem(true);
item.ItemID = 1397;
item.MapID = attacker.MapID;
item.Type = FloorItem.Effect;
item.X = (ushort)a.X;
item.Y = (ushort)a.Y;
item.OnFloor = Time32.Now;
item.Owner = attacker.Owner;
item.UID = FloorItem.FloorUID.Next;
while (attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
item.UID = FloorItem.FloorUID.Next;
item.mColor = 14;
item.OwnerUID = attacker.UID;
item.OwnerGuildUID = attacker.GuildID;
item.FlowerType = 0;
item.Timer = Kernel.TqTimer(DateTime.Now.AddSeconds(3));
item.Name = "InfernalEcho";
attacker.Owner.SendScreenSpawn(item, true);
attacker.AttackPacket = null;
}
}
else if (Nr == 2)
{
foreach (var a in Area)
{
FloorItem item = new FloorItem(true);
item.ItemID = 1397;
item.MapID = attacker.MapID;
item.Type = FloorItem.Effect;
item.X = (ushort)a.X;
item.Y = (ushort)a.Y;
item.OnFloor = Time32.Now;
item.Owner = attacker.Owner;
item.UID = FloorItem.FloorUID.Next;
while (attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
item.UID = FloorItem.FloorUID.Next;
item.mColor = 14;
item.OwnerUID = attacker.UID;
item.OwnerGuildUID = attacker.GuildID;
item.FlowerType = 0;
item.Timer = Kernel.TqTimer(DateTime.Now.AddSeconds(3));
item.Name = "InfernalEcho";
attacker.Owner.SendScreenSpawn(item, true);
attacker.AttackPacket = null;
}
}
else if (Nr == 3)
{
foreach (var a in Area)
{
FloorItem item = new FloorItem(true);
item.ItemID = 1397;
item.MapID = attacker.MapID;
item.Type = FloorItem.Effect;
item.X = (ushort)a.X;
item.Y = (ushort)a.Y;
item.OnFloor = Time32.Now;
item.Owner = attacker.Owner;
item.UID = FloorItem.FloorUID.Next;
while (attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
item.UID = FloorItem.FloorUID.Next;
item.mColor = 14;
item.OwnerUID = attacker.UID;
item.OwnerGuildUID = attacker.GuildID;
item.FlowerType = 0;
item.Timer = Kernel.TqTimer(DateTime.Now.AddSeconds(3));
item.Name = "InfernalEcho";
attacker.Owner.SendScreenSpawn(item, true);
attacker.AttackPacket = null;
}
}
break;
}
#endregion
}
}
break;
}
#endregion
#region WrathoftheEmperor
case 12570:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
suse.SpellEffect = 1;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= 2)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Ranged))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.7);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.7);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.7);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.5);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
attacked.Stunned = true;
attacked.StunStamp = Time32.Now;
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= 2)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region GraceofHeaven
case 12560:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
SpellID = 10425;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
attacker.Stamina += (byte)spell.Power;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= 12)
{
int R = Kernel.Random.Next(1, 10);
if (R != 4) continue;
if (attacked.ContainsFlag2((ulong)Update.Flags2.SoulShackle))
{
suse.AddTarget(attacked, 0, attack);
attacked.RemoveFlag2((ulong)Update.Flags2.SoulShackle);
}
}
}
}
attacker.Owner.IncreaseSpellExperience(10, 12560);
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region Riding
case 7001:
{
if (attacker.Owner.Map.ID == 1081 || attacker.Owner.Map.ID == 4444 || attacker.Owner.Map.ID == 1707 || attacker.Owner.Map.ID == 2233 || attacker.Owner.Map.ID == 9898 || attacker.Owner.Map.ID == 2233 || attacker.Owner.Map.ID == 16414 || attacker.Owner.Map.ID == 3691 || attacker.Owner.Map.ID == 3692 || attacker.Owner.Map.ID == 3693 || attacker.Owner.Map.ID == 3694 || attacker.Owner.Map.ID == 44444 || attacker.Owner.Map.ID == 2222 || attacker.Owner.Map.ID == 8899 || attacker.Owner.Map.ID == 1365 || attacker.Owner.Map.ID == 1366)
{
Kernel.SendWorldMessage(new Message("Mr: " + attacker.Name + " You Can`t Use Riding Here !!!", System.Drawing.Color.White, Message.Talk), Program.Values);
return;
}
if (attacker.Owner.Map.ID == 1507 || attacker.Owner.Map.ID == 881 || attacker.Owner.Map.ID == 882 || attacker.Owner.Map.ID == 883 || attacker.Owner.Map.ID == 884 || attacker.Owner.Map.ID == 1238 || attacker.Owner.Map.ID == 1459 || attacker.Owner.Map.ID == 1458 || attacker.Owner.Map.ID == 1460)
{
Kernel.SendWorldMessage(new Message("Mr: " + attacker.Name + " You Can`t Use Riding Here !!!", System.Drawing.Color.White, Message.Talk), Program.Values);
return;
}
if (attacker.ContainsFlag(Update.Flags.ShurikenVortex))
return;
if (!attacker.Owner.Equipment.Free(12))
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
UInt16 ox, oy;
ox = attacker.X;
oy = attacker.Y;
if (attacker.ContainsFlag(Update.Flags.Ride))
{
attacker.RemoveFlag(Update.Flags.Ride);
}
else
{
if (attacker.Owner.Map.ID == 1036 && attacker.Owner.Equipment.TryGetItem((byte)12).Plus < 6)
break;
if (attacker.Owner.Map.BaseID == 700)
break;
if (attacker.Stamina >= 1)
{
attacker.AddFlag(Update.Flags.Ride);
attacker.Stamina -= 1;
attacker.Vigor = (ushort)(attacker.Owner.MaxVigor / 2);
Network.GamePackets.Vigor vigor = new Network.GamePackets.Vigor(true);
vigor.Amount = attacker.Owner.Vigor;
vigor.Send(attacker.Owner);
}
}
suse.AddTarget(attacker, 0, attack);
attacker.Owner.SendScreen(suse, true);
}
break;
}
case 7002:
{//Spook
if (attacked.ContainsFlag(Update.Flags.Ride) && attacker.ContainsFlag(Update.Flags.Ride))
{
ConquerItem attackedSteed = null, attackerSteed = null;
if ((attackedSteed = attacked.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null)
{
if ((attackerSteed = attacker.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked, 0, attack);
if (attackedSteed.Plus < attackerSteed.Plus)
attacked.RemoveFlag(Update.Flags.Ride);
else if (attackedSteed.Plus == attackerSteed.Plus && attackedSteed.PlusProgress <= attackerSteed.PlusProgress)
attacked.RemoveFlag(Update.Flags.Ride);
else
suse.Targets[attacked.UID].Hit = false;
attacker.Owner.SendScreen(suse, true);
}
}
}
break;
}
case 7003:
{//WarCry
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
ConquerItem attackedSteed = null, attackerSteed = null;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Entity && _obj.UID != attacker.UID)
{
attacked = _obj as Entity;
if ((attackedSteed = attacked.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null)
{
if ((attackerSteed = attacker.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= attackedSteed.Plus)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
suse.AddTarget(attacked, 0, attack);
if (attackedSteed.Plus < attackerSteed.Plus)
attacked.RemoveFlag(Update.Flags.Ride);
else if (attackedSteed.Plus == attackerSteed.Plus && attackedSteed.PlusProgress <= attackerSteed.PlusProgress)
attacked.RemoveFlag(Update.Flags.Ride);
else
suse.Targets[attacked.UID].Hit = false;
}
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#region Dash
case 1051:
{
if (attacked != null)
{
if (!attacked.Dead)
{
var direction = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack = new Attack(true);
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Calculate.Melee(attacker, attacked, ref attack);
attack.AttackType = Attack.Dash;
attack.X = attacked.X;
attack.Y = attacked.Y;
attack.Attacker = attacker.UID;
attack.Attacked = attacked.UID;
attack.Damage = damage;
attack.ToArray()[27] = (byte)direction;
attacked.Move(direction);
attacker.Move(direction);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
attacker.Owner.SendScreen(attack, true);
}
}
}
break;
}
#endregion
#region RapidFire
case 8000:
{
if (attackedsob != null)
{
if (CanUseSpell(spell, attacker.Owner))
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.SpellLevel = spell.Level;
suse.X = attackedsob.X;
suse.Y = attackedsob.Y;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
suse.AddTarget(attackedsob, damage, attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
attacker.Owner.SendScreen(suse, true);
}
}
}
else
{
if (!attacked.Dead)
{
if (CanUseSpell(spell, attacker.Owner))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacked.X;
suse.Y = attacked.Y;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Calculate.Ranged(attacker, attacked, ref attack);
suse.AddTarget(attacked, damage, attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
attacker.Owner.SendScreen(suse, true);
}
}
}
}
break;
}
#endregion
#region FireOfHell
case 1165:
case 7014:
case 7017:
case 7015:
case 7011:
case 7012:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Distance);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
if (spell.ID == 1165)
{
if (attacked.EntityFlag == EntityFlag.Entity)
{
#region BreakingTouch
attacked.Owner.BreakTouch(attacker.Owner);
#endregion
}
}
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Scatter
case 8001:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Distance);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Ranged(attacker, attacked, spell, ref attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
if (damage == 0)
damage = 1;
damage = Game.Attacking.Calculate.Percent((int)damage, spell.PowerPercent);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region StarArrow
case 10313:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
//suse.SpellLevelHu = client_Spell.LevelHu2;
if (attacked != null)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
ushort _X = attacked.X, _Y = attacked.Y;
byte dist = 5;
var angle = Kernel.GetAngle(attacker.X, attacker.Y, attacked.X, attacked.Y);
while (dist != 0)
{
if (attacked.fMove(angle, ref _X, ref _Y))
{
X = _X;
Y = _Y;
}
else break;
dist--;
}
suse.X = attacked.X = X;
suse.Y = attacked.Y = Y;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
suse.X = attackedsob.X;
suse.Y = attackedsob.Y;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
if (damage == 0)
damage = 1;
damage = Game.Attacking.Calculate.Percent((int)damage, spell.PowerPercent);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Trasnformations
case 1270:
case 1280:
case 1350:
case 1360:
case 3321:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacker.MapID == 1036)
return;
if (attacker.MapID == 1950)
return;
bool wasTransformated = attacker.Transformed;
PrepareSpell(spell, attacker.Owner);
#region Atributes
switch (spell.ID)
{
case 3321://GM skill
{
attacker.TransformationMaxAttack = 2000000;
attacker.TransformationMinAttack = 2000000;
attacker.TransformationDefence = 65355;
attacker.TransformationMagicDefence = 65355;
attacker.TransformationDodge = 35;
attacker.TransformationTime = 65355;
attacker.TransformationID = 223;
attacker.Hitpoints = attacker.MaxHitpoints;
attacker.Mana = attacker.MaxMana;
break;
}
case 1350:
switch (spell.Level)
{
case 0:
{
attacker.TransformationMaxAttack = 182;
attacker.TransformationMinAttack = 122;
attacker.TransformationDefence = 1300;
attacker.TransformationMagicDefence = 94;
attacker.TransformationDodge = 35;
attacker.TransformationTime = 39;
attacker.TransformationID = 207;
break;
}
case 1:
{
attacker.TransformationMaxAttack = 200;
attacker.TransformationMinAttack = 134;
attacker.TransformationDefence = 1400;
attacker.TransformationMagicDefence = 96;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 49;
attacker.TransformationID = 207;
break;
}
case 2:
{
attacker.TransformationMaxAttack = 240;
attacker.TransformationMinAttack = 160;
attacker.TransformationDefence = 1500;
attacker.TransformationMagicDefence = 97;
attacker.TransformationDodge = 45;
attacker.TransformationTime = 59;
attacker.TransformationID = 207;
break;
}
case 3:
{
attacker.TransformationMaxAttack = 258;
attacker.TransformationMinAttack = 172;
attacker.TransformationDefence = 1600;
attacker.TransformationMagicDefence = 98;
attacker.TransformationDodge = 50;
attacker.TransformationTime = 69;
attacker.TransformationID = 267;
break;
}
case 4:
{
attacker.TransformationMaxAttack = 300;
attacker.TransformationMinAttack = 200;
attacker.TransformationDefence = 1900;
attacker.TransformationMagicDefence = 99;
attacker.TransformationDodge = 55;
attacker.TransformationTime = 79;
attacker.TransformationID = 267;
break;
}
}
break;
case 1270:
switch (spell.Level)
{
case 0:
{
attacker.TransformationMaxAttack = 282;
attacker.TransformationMinAttack = 179;
attacker.TransformationDefence = 73;
attacker.TransformationMagicDefence = 34;
attacker.TransformationDodge = 9;
attacker.TransformationTime = 34;
attacker.TransformationID = 214;
break;
}
case 1:
{
attacker.TransformationMaxAttack = 395;
attacker.TransformationMinAttack = 245;
attacker.TransformationDefence = 126;
attacker.TransformationMagicDefence = 45;
attacker.TransformationDodge = 12;
attacker.TransformationTime = 39;
attacker.TransformationID = 214;
break;
}
case 2:
{
attacker.TransformationMaxAttack = 616;
attacker.TransformationMinAttack = 367;
attacker.TransformationDefence = 180;
attacker.TransformationMagicDefence = 53;
attacker.TransformationDodge = 15;
attacker.TransformationTime = 44;
attacker.TransformationID = 214;
break;
}
case 3:
{
attacker.TransformationMaxAttack = 724;
attacker.TransformationMinAttack = 429;
attacker.TransformationDefence = 247;
attacker.TransformationMagicDefence = 53;
attacker.TransformationDodge = 15;
attacker.TransformationTime = 49;
attacker.TransformationID = 214;
break;
}
case 4:
{
attacker.TransformationMaxAttack = 1231;
attacker.TransformationMinAttack = 704;
attacker.TransformationDefence = 499;
attacker.TransformationMagicDefence = 50;
attacker.TransformationDodge = 20;
attacker.TransformationTime = 54;
attacker.TransformationID = 274;
break;
}
case 5:
{
attacker.TransformationMaxAttack = 1573;
attacker.TransformationMinAttack = 941;
attacker.TransformationDefence = 601;
attacker.TransformationMagicDefence = 53;
attacker.TransformationDodge = 25;
attacker.TransformationTime = 59;
attacker.TransformationID = 274;
break;
}
case 6:
{
attacker.TransformationMaxAttack = 1991;
attacker.TransformationMinAttack = 1107;
attacker.TransformationDefence = 1029;
attacker.TransformationMagicDefence = 55;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 64;
attacker.TransformationID = 274;
break;
}
case 7:
{
attacker.TransformationMaxAttack = 2226;
attacker.TransformationMinAttack = 1235;
attacker.TransformationDefence = 1029;
attacker.TransformationMagicDefence = 55;
attacker.TransformationDodge = 35;
attacker.TransformationTime = 69;
attacker.TransformationID = 274;
break;
}
}
break;
case 1360:
switch (spell.Level)
{
case 0:
{
attacker.TransformationMaxAttack = 1215;
attacker.TransformationMinAttack = 610;
attacker.TransformationDefence = 100;
attacker.TransformationMagicDefence = 96;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 59;
attacker.TransformationID = 217;
break;
}
case 1:
{
attacker.TransformationMaxAttack = 1310;
attacker.TransformationMinAttack = 650;
attacker.TransformationDefence = 400;
attacker.TransformationMagicDefence = 97;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 79;
attacker.TransformationID = 217;
break;
}
case 2:
{
attacker.TransformationMaxAttack = 1420;
attacker.TransformationMinAttack = 710;
attacker.TransformationDefence = 650;
attacker.TransformationMagicDefence = 98;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 89;
attacker.TransformationID = 217;
break;
}
case 3:
{
attacker.TransformationMaxAttack = 1555;
attacker.TransformationMinAttack = 780;
attacker.TransformationDefence = 720;
attacker.TransformationMagicDefence = 98;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 99;
attacker.TransformationID = 277;
break;
}
case 4:
{
attacker.TransformationMaxAttack = 1660;
attacker.TransformationMinAttack = 840;
attacker.TransformationDefence = 1200;
attacker.TransformationMagicDefence = 99;
attacker.TransformationDodge = 30;
attacker.TransformationTime = 109;
attacker.TransformationID = 277;
break;
}
}
break;
case 1280:
switch (spell.Level)
{
case 0:
{
attacker.TransformationMaxAttack = 930;
attacker.TransformationMinAttack = 656;
attacker.TransformationDefence = 290;
attacker.TransformationMagicDefence = 45;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 29;
attacker.TransformationID = 213;
break;
}
case 1:
{
attacker.TransformationMaxAttack = 1062;
attacker.TransformationMinAttack = 750;
attacker.TransformationDefence = 320;
attacker.TransformationMagicDefence = 46;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 34;
attacker.TransformationID = 213;
break;
}
case 2:
{
attacker.TransformationMaxAttack = 1292;
attacker.TransformationMinAttack = 910;
attacker.TransformationDefence = 510;
attacker.TransformationMagicDefence = 50;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 39;
attacker.TransformationID = 213;
break;
}
case 3:
{
attacker.TransformationMaxAttack = 1428;
attacker.TransformationMinAttack = 1000;
attacker.TransformationDefence = 600;
attacker.TransformationMagicDefence = 53;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 44;
attacker.TransformationID = 213;
break;
}
case 4:
{
attacker.TransformationMaxAttack = 1570;
attacker.TransformationMinAttack = 1100;
attacker.TransformationDefence = 700;
attacker.TransformationMagicDefence = 55;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 49;
attacker.TransformationID = 213;
break;
}
case 5:
{
attacker.TransformationMaxAttack = 1700;
attacker.TransformationMinAttack = 1200;
attacker.TransformationDefence = 880;
attacker.TransformationMagicDefence = 57;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 54;
attacker.TransformationID = 273;
break;
}
case 6:
{
attacker.TransformationMaxAttack = 1900;
attacker.TransformationMinAttack = 1300;
attacker.TransformationDefence = 1540;
attacker.TransformationMagicDefence = 59;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 59;
attacker.TransformationID = 273;
break;
}
case 7:
{
attacker.TransformationMaxAttack = 2100;
attacker.TransformationMinAttack = 1500;
attacker.TransformationDefence = 1880;
attacker.TransformationMagicDefence = 61;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 59;
attacker.TransformationID = 273;
break;
}
case 8:
{
attacker.TransformationMaxAttack = 2300;
attacker.TransformationMinAttack = 1600;
attacker.TransformationDefence = 1970;
attacker.TransformationMagicDefence = 63;
attacker.TransformationDodge = 40;
attacker.TransformationTime = 59;
attacker.TransformationID = 273;
break;
}
}
break;
}
#endregion
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
spellUse.AddTarget(attacker, (uint)0, attack);
attacker.Owner.SendScreen(spellUse, true);
attacker.TransformationStamp = Time32.Now;
attacker.TransformationMaxHP = 3000;
if (spell.ID == 1270)
attacker.TransformationMaxHP = 50000;
attacker.TransformationAttackRange = 3;
if (spell.ID == 1360)
attacker.TransformationAttackRange = 10;
if (!wasTransformated)
{
double maxHP = attacker.MaxHitpoints;
double HP = attacker.Hitpoints;
double point = HP / maxHP;
attacker.Hitpoints = (uint)(attacker.TransformationMaxHP * point);
}
attacker.Update(Update.MaxHitpoints, attacker.TransformationMaxHP, false);
}
break;
}
#endregion
#region Bless
case 9876:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
attacker.AddFlag(Update.Flags.CastPray);
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
spellUse.AddTarget(attacker, 0, attack);
attacker.Owner.SendScreen(spellUse, true);
}
break;
}
#endregion
#region Companions
case 4000:
case 4010:
case 4020:
case 4050:
case 4060:
case 4070:
case 12020:
case 12030:
case 12040:
case 12610:
case 12050:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
spellUse.AddTarget(attacker, 0, attack);
attacker.Owner.SendScreen(spellUse, true);
MonsterInformation information5 = null;
if (MonsterInformation.MonsterInformations.TryGetValue(spell.Power, out information5))
attacker.Owner.Pet.AddPet(information5);
}
break;
}
#endregion
#region MonkSpells
#region Auras
case 10424:
case 10423:
case 10422:
case 10421:
case 10420:
//Tyrant Aura
case 10395:
//Fend Aura
case 10410:
{
HandleAura(attacker, spell);
}
break;
#endregion
#region Compassion
case 10430:
{
if (CanUseSpell(spell, attacker.Owner))
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.Owner.Team != null)
{
PrepareSpell(spell, attacker.Owner);
foreach (Client.GameState teammate in attacker.Owner.Team.Teammates)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, teammate.Player.X, teammate.Player.Y) <= spell.Distance)
{
teammate.Player.RemoveFlag(Update.Flags.Poisoned);
suse.AddTarget(teammate.Player, 0, attack);
}
}
attacker.Owner.SendScreen(suse, true);
}
else
{
PrepareSpell(spell, attacker.Owner);
attacker.RemoveFlag(Update.Flags.Poisoned);
suse.AddTarget(attacker, 0, attack);
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(suse, true);
else
attacker.Owner.SendScreen(suse, true);
}
}
break;
}
#endregion
#region Serenity
case 10400:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
if (attacker == null) return;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacker, 0, attack);
attacked.ToxicFogLeft = 0;
attacked.NoDrugsTime = 0;
attacked.RemoveFlag2(Update.Flags2.SoulShackle);
attacked.RemoveFlag2(Update.Flags2.EffectBall);
attacked.lianhuaranLeft = 0;
// attacked.Owner.Send(new GameCharacterUpdates(true) { UID = attacked.UID, }
// .Remove(GameCharacterUpdates.SoulShacle));
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
case 10425:
{
if (CanUseSpell(spell, attacker.Owner))
{
//if (attacker.EpicMonk())
{
PrepareSpell(spell, attacker.Owner);
if (attacked == null) return;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID; // Mr.Lover __!__ For Other :D
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacked, 0, attack);
attacked.ToxicFogLeft = 0;
attacked.RemoveFlag2(Update.Flags2.SoulShackle);
Network.GamePackets.Update upgrade = new Network.GamePackets.Update(true);
upgrade.UID = attacked.UID;
upgrade.Append(Network.GamePackets.Update.SoulShackle
, 111// Mr.Lover __!__ For Other :D
, 0, 0, spell.Level);
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.Send(upgrade.ToArray());
attacked.RemoveFlag2(Update.Flags2.Congelado);
attacked.RemoveFlag2(Update.Flags2.EffectBall);
// attacked.lianhuaranLeft1 = 0;
attacked.NoDrugsTime = 0;// Mr.Lover __!__ For Other :D
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(suse, true);
else
attacker.Owner.SendScreen(suse, true);// Mr.Lover __!__ For Other :D
}
break;
}
break;
}
#region WhirlwindKick
case 10415:
{
if (Time32.Now < attacker.SpellStamp.AddMilliseconds(300))
{
attacker.AttackPacket = null; return;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 400)
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = 0;
suse.X = (ushort)Kernel.Random.Next(3, 10);
suse.Y = 0;
//suse.SpellLevelHu = client_Spell.LevelHu2;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 500)
{
for (int c = 0; c < attacker.Owner.Screen.Objects.Length; c++)
{
//For a multi threaded application, while we go through the collection
//the collection might change. We will make sure that we wont go off
//the limits with a check.
if (c >= attacker.Owner.Screen.Objects.Length)
break;
Interfaces.IMapObject _obj = attacker.Owner.Screen.Objects[c];
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Ranged))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.550);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.550);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.530);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.500);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
{
damage = (uint)(damage * 0.4900);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
{
damage = (uint)(damage * 0.450);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.450);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
attacked.Stunned = true;
attacked.StunStamp = Time32.Now;
suse.AddTarget(attacked, damage, attack);
}
}
}
}
attacker.AttackPacket = null;
}
else
{
attacker.AttackPacket = null; return;
}
attacker.Owner.SendScreen(suse, true);
attacker.SpellStamp = Time32.Now;
suse.Targets = new SafeDictionary<uint, SpellUse.DamageClass>();
attacker.AttackPacket = null; return;
}
attacker.AttackPacket = null;
}
attacker.AttackPacket = null; return;
}
#endregion
#endregion
#region PirateSpells
#region GaleBomb
case 11070:
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Map map;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
int num = 0;
switch (spell.Level)
{
case 0:
case 1:
num = 3;
break;
case 2:
case 3:
num = 4;
break;
default:
num = 5;
break;
}
int i = 0;
Kernel.Maps.TryGetValue(attacker.Owner.Map.BaseID, out map);
foreach (var t in attacker.Owner.Screen.Objects)
{
if (t == null)
continue;
if (t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
{
var target = t as Entity;
if (Kernel.GetDistance(X, Y, target.X, target.Y) <= spell.Range)
{
if (CanAttack(attacker, target, spell, false))
{
tar.Damage = Calculate.Ranged(attacker, target, spell, ref attack);
tar.Hit = true;
tar.newX = target.X;
tar.newY = target.Y;
Map.Pushback(ref tar.newX, ref tar.newY, attacker.Facing, 5);
if (map != null)
{
if (map.Floor[tar.newX, tar.newY, MapObjectType.Entity, attacker])
{
target.X = tar.newX;
target.Y = tar.newY;
}
else
{
tar.newX = target.X;
tar.newY = target.Y;
}
}
else
{
if (attacker.Owner.Map.Floor[tar.newX, tar.newY, MapObjectType.Entity, attacker])
{
target.X = tar.newX;
target.Y = tar.newY;
}
else
{
target.X = tar.newX;
target.Y = tar.newY;
}
}
suse.AddTarget(target, tar, attack);
ReceiveAttack(attacker, target, attack, ref tar.Damage, spell);
i++;
if (i > num) break;
}
}
}
}
if (attacker.EntityFlag == EntityFlag.Entity)
attacker.Owner.SendScreen(suse, true);
}
break;
#endregion
#region BladeTempest
case 11110:
{
if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(400))
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
// suse.SpellLevelHu = 0;
suse.SpellLevel = spell.Level;
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist,
InLineAlgorithm.Algorithm.DDA);
X = attacker.X;
Y = attacker.Y;
int i = 0;
for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Entity]
&& !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Entity, null])
return;
double disth = 2;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.733);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.733);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.722);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.660);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
{
damage = (uint)(damage * 0.630);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
{
damage = (uint)(damage * 0.450);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.450);
}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.780);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.760);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.722);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.660);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
{
damage = (uint)(damage * 0.550);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
{
damage = (uint)(damage * 0.450);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.450);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (CanAttack(attacker, attackedsob, spell))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.770);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.760);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.722);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.660);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
{
damage = (uint)(damage * 0.550);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
{
damage = (uint)(damage * 0.450);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.450);
}
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
}
break;
}
#endregion
#region Kraken`sRevenge
case 11100:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
int num = 0;
switch (spell.Level)
{
case 0:
case 1:
num = 3;
break;
case 2:
case 3:
num = 4;
break;
default:
num = 5;
break;
}
int i = 0;
BlackSpotPacket bsp = new BlackSpotPacket();
foreach (var t in attacker.Owner.Screen.Objects/*.OrderBy(x => Kernel.GetDistance(x.X, x.Y, attacker.Owner.Entity.X, attacker.Owner.Entity.Y))*/)
{
if (t == null)
continue;
if (t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
{
var target = t as Entity;
if (CanAttack(attacker, target, spell, false))
{
target.IsBlackSpotted = true;
target.BlackSpotStamp = Time32.Now;
target.BlackSpotStepSecs = spell.Duration;
Kernel.BlackSpoted.TryAdd(target.UID, target);
suse.AddTarget(target, new SpellUse.DamageClass(), attack);
i++;
if (i == num) break;
}
}
}
if (attacker.EntityFlag == EntityFlag.Entity)
attacker.Owner.SendScreen(suse, true);
foreach (var h in Program.Values)
{
foreach (var t in suse.Targets.Keys)
{
h.Send(bsp.ToArray(true, t));
}
}
}
break;
}
#endregion
#region ScurvyBomb
case 11040:
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Map map;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
int num = 0;
switch (spell.Level)
{
case 0:
case 1:
num = 3;
break;
case 2:
case 3:
num = 4;
break;
default:
num = 5;
break;
}
int i = 0;
Kernel.Maps.TryGetValue(attacker.Owner.Map.BaseID, out map);
foreach (var t in attacker.Owner.Screen.Objects)
{
if (t == null)
continue;
if (t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
{
var target = t as Entity;
if (Kernel.GetDistance(X, Y, target.X, target.Y) <= spell.Range)
{
if (CanAttack(attacker, target, spell, false))
{
tar.Damage = Calculate.Ranged(attacker, target, ref attack);
tar.Hit = true;
tar.newX = target.X;
tar.newY = target.Y;
Map.Pushback(ref tar.newX, ref tar.newY, attacker.Facing, 5);
if (map != null)
{
if (map.Floor[tar.newX, tar.newY, MapObjectType.Entity, attacker])
{
target.X = tar.newX;
target.Y = tar.newY;
}
else
{
tar.newX = target.X;
tar.newY = target.Y;
}
}
else
{
if (attacker.Owner.Map.Floor[tar.newX, tar.newY, MapObjectType.Entity, attacker])
{
target.X = tar.newX;
target.Y = tar.newY;
}
else
{
target.X = tar.newX;
target.Y = tar.newY;
}
}
suse.AddTarget(target, tar, attack);
ReceiveAttack(attacker, target, attack, ref tar.Damage, spell);
i++;
if (i > num) break;
}
}
}
}
if (attacker.EntityFlag == EntityFlag.Entity)
attacker.Owner.SendScreen(suse, true);
}
break;
#endregion
#region Cannon Barrage
case 11050:
{
if (attacker.Owner.Player.ContainsFlag(Mr_Panda.Network.GamePackets.Update.Flags.XPList))
{
attacker.Owner.Player.RemoveFlag(Mr_Panda.Network.GamePackets.Update.Flags.XPList);
attacker.Owner.Player.AddFlag2(Mr_Panda.Network.GamePackets.Update.Flags2.CannonBarrage);
attacker.Owner.Player.CannonBarrageStamp = Time32.Now;
return;
}
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
foreach (var t in attacker.Owner.Screen.Objects)
{
if (t == null)
continue;
if (t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
{
var target = t as Entity;
if (Kernel.GetDistance(attacker.Owner.Player.X, attacker.Owner.Player.Y, target.X, target.Y) <= spell.Range)
{
if (CanAttack(attacker, target, spell, false))
{
tar.Damage = Calculate.Ranged(attacker, target, ref attack, client_Spell.LevelHu2);
suse.AddTarget(target, tar, attack);
ReceiveAttack(attacker, target, attack, ref tar.Damage, spell);
}
}
}
}
if (attacker.EntityFlag == EntityFlag.Entity)
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#region Blackbeard`sRage
case 11060:
{
if (attacker.Owner.Player.ContainsFlag(Mr_Panda.Network.GamePackets.Update.Flags.XPList))
{
attacker.Owner.Player.RemoveFlag(Mr_Panda.Network.GamePackets.Update.Flags.XPList);
attacker.Owner.Player.AddFlag2(Mr_Panda.Network.GamePackets.Update.Flags2.BlackbeardsRage);
attacker.Owner.Player.BlackbeardsRageStamp = Time32.Now;
return;
}
int num = 0;
switch (spell.Level)
{
case 0:
case 1:
num = 3;
break;
case 2:
case 3:
num = 4;
break;
default:
num = 5;
break;
}
int i = 0;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
foreach (var t in attacker.Owner.Screen.Objects)
{
if (t == null)
continue;
if (t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
{
var target = t as Entity;
if (Kernel.GetDistance(attacker.Owner.Player.X, attacker.Owner.Player.Y, target.X, target.Y) <= spell.Range)
{
if (CanAttack(attacker, target, spell, false))
{
tar.Damage = Calculate.Ranged(attacker, target, ref attack, client_Spell.LevelHu2);
suse.AddTarget(target, tar, attack);
ReceiveAttack(attacker, target, attack, ref tar.Damage, spell);
i++;
if (i == num) break;
}
}
}
}
if (attacker.EntityFlag == EntityFlag.Entity)
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#endregion
#region MagicDefender
case 11200:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
if (attacker.Owner.Team != null)
{
foreach (var mate in attacker.Owner.Team.Teammates)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, mate.Player.X, mate.Player.Y) <= 4)
{
spellUse.AddTarget(mate.Player, 0, attack);
if (attacker.UID == mate.Player.UID)
mate.Player.MagicDefenderOwner = true;
mate.Player.HasMagicDefender = true;
mate.Player.MagicDefenderSecs = (byte)spell.Duration;
attacker.RemoveFlag3(Mr_Panda.Network.GamePackets.Update.Flags3.MagicDefender);
mate.Player.AddFlag3(Mr_Panda.Network.GamePackets.Update.Flags3.MagicDefender);
mate.Player.Update(mate.Player.StatusFlag, mate.Player.StatusFlag2, mate.Player.StatusFlag3, Update.MagicDefenderIcone, 0x80, mate.Player.MagicDefenderSecs, 0, false);
mate.Player.MagicDefenderStamp = Time32.Now;
}
}
}
else
{
spellUse.AddTarget(attacker, 0, null);
attacker.Owner.Player.HasMagicDefender = true;
attacker.Owner.Player.MagicDefenderOwner = true;
attacker.Owner.Player.MagicDefenderSecs = (byte)spell.Duration;
attacker.RemoveFlag3(Mr_Panda.Network.GamePackets.Update.Flags3.MagicDefender);
attacker.AddFlag3(Mr_Panda.Network.GamePackets.Update.Flags3.MagicDefender);
attacker.Owner.Player.Update(attacker.Owner.Player.StatusFlag, attacker.Owner.Player.StatusFlag2, attacker.Owner.Player.StatusFlag3, Update.MagicDefenderIcone, 0x80, attacker.Owner.Player.MagicDefenderSecs, 0, false);
attacker.Owner.Player.MagicDefenderStamp = Time32.Now;
}
attacker.Owner.SendScreen(spellUse, true);
}
break;
}
#endregion
#region DefensiveStance
case 11160:
{
if (Time32.Now >= attacker.DefensiveStanceStamp.AddSeconds(10))
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
attacker.Owner.SendScreen(spellUse, true);
if (attacker.IsDefensiveStance)
{
attacker.RemoveFlag2(Mr_Panda.Network.GamePackets.Update.Flags2.Fatigue);
attacker.IsDefensiveStance = false;
}
else
{
attacker.FatigueSecs = spell.Duration;
attacker.FatigueStamp = Time32.Now;
attacker.AddFlag2(Mr_Panda.Network.GamePackets.Update.Flags2.Fatigue);
attacker.Update(attacker.Owner.Player.StatusFlag, attacker.Owner.Player.StatusFlag2, attacker.Owner.Player.StatusFlag3, Update.DefensiveStance, 0x7E, (uint)spell.Duration, (uint)(spell.Level + 1), false);
attacker.IsDefensiveStance = true;
}
}
}
else
{
attacker.Owner.Send(new Message("You need to wait 10 seconds in order to cast the spell again!", Color.Red, Message.TopLeft));
}
break;
}
#endregion
#region ShieldBlock
case 10470: // Shield Block
{
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
attacker.Owner.SendScreen(spellUse, true);
if (attacker.IsShieldBlock)
{
Network.GamePackets.Update aupgrade = new Network.GamePackets.Update(true);
aupgrade.UID = attacker.UID;
aupgrade.Append(49
, 113
, (uint)0, 0, 0);
attacker.Owner.Send(aupgrade);
attacker.IsShieldBlock = false;
}
else
{
attacker.ShieldBlockStamp = Time32.Now;
attacker.ShieldBlockPercent = (ushort)spell.Power;
Network.GamePackets.Update aupgrade = new Network.GamePackets.Update(true);
aupgrade.UID = attacker.UID;
aupgrade.Append(49
, 113
, (uint)spell.Duration, spell.Power, spell.Level);
attacker.Owner.Send(aupgrade);
attacker.IsShieldBlock = true;
}
}
}
break;
}
#endregion
#region Assassin
#region Blistering Wave
case 11650:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!attacker.ContainsFlag3(Update.Flags3.Assassin))
return;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Distance);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.608);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.708);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.775);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.820);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region PathOfJoseph
case 11620:
{
var weps = attacker.Owner.Weapons;
if ((weps.Item1 != null && weps.Item1.ID / 1000 != 613) || (weps.Item2 != null && weps.Item2.ID / 1000 != 613))
{
attacker.Owner.Send(new Message("You need to wear only knifes!", Color.Red, Message.Talk));
return;
}
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
attacker.Owner.SendScreen(spellUse, true);
if (attacker.ContainsFlag3(Update.Flags3.Assassin))
{
attacker.RemoveFlag3(Update.Flags3.Assassin);
if (attacker.ContainsFlag3(Update.Flags3.BladeFlurry))
attacker.RemoveFlag3(Update.Flags3.BladeFlurry);
if (attacker.ContainsFlag3(Update.Flags3.KineticSpark))
attacker.RemoveFlag3(Update.Flags3.KineticSpark);
}
else
attacker.AddFlag3(Update.Flags3.Assassin);
break;
}
#endregion
#region Blade Furry
case 11610:
{
if (!attacker.ContainsFlag3(Update.Flags3.Assassin))
return;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.Y = Y;
if (attacker.ContainsFlag(Update.Flags.XPList))
{
attacker.AddFlag3(Update.Flags3.BladeFlurry);
attacker.BladeFlurryStamp = Time32.Now;
attacker.RemoveFlag(Update.Flags.XPList);
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
break;
}
#endregion
#region Mortal Wound
case 11660:
{
if (attacker.Stamina >= 60)
attacker.Stamina -= 60;
if (CanUseSpell(spell, attacker.Owner))
{
if (!attacker.ContainsFlag3(Update.Flags3.Assassin))
return;
if (Time32.Now > attacker.MortalWoundStamp.AddMilliseconds(300))
{
attacker.MortalWoundStamp = Time32.Now;
PrepareSpell(spell, attacker.Owner);
attacker.AttackPacket = null;
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.655);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.6);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.6);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.4);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (uint)(damage * 1.5);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
}
}
break;
}
#endregion
#region Spirit Focus
case 9000:
case 11670:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (spell.ID == 11670)
if (!attacker.ContainsFlag3(Update.Flags3.Assassin))
return;
PrepareSpell(spell, attacker.Owner);
attack = new Attack(true);
attack.Attacker = attacker.UID;
attack.Attacked = attacker.UID;
attack.AttackType = Attack.Magic;
attack.X = attacker.X;
attack.Y = attacker.Y;
attack.Damage = spell.ID;
attack.KOCount = spell.Level;
attacker.Owner.SendScreen(attack, true);
attacker.IntensifyPercent = spell.PowerPercent;
attacker.IntensifyStamp = Time32.Now;
}
break;
}
#endregion
#region Kinetic Spark
case 11590:
{
if (!attacker.ContainsFlag3(Update.Flags3.Assassin))
return;
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
attacker.Owner.SendScreen(spellUse, true);
if (attacker.ContainsFlag3(Update.Flags3.KineticSpark))
attacker.RemoveFlag3(Update.Flags3.KineticSpark);
else
attacker.AddFlag3(Update.Flags3.KineticSpark);
break;
}
#endregion
#region Dagger Storm
case 11600:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (!attacker.ContainsFlag3((ulong)Update.Flags3.Assassin)) return;
var map = attacker.Owner.Map;
if (!map.Floor[X, Y, MapObjectType.Item, null]) return;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.AddTarget(attacker, 0, null);
attacker.Owner.SendScreen(suse, true);
FloorItem flooritem = new FloorItem(true);
if (attacker.Owner.Spells[spellID].LevelHu2 == 1)
{
flooritem.ItemID = FloorItem.FuryofEgg;
flooritem.X = X;
flooritem.MapID = map.ID;
flooritem.Y = Y;
flooritem.Type = FloorItem.Effect;
flooritem.mColor = 10;
flooritem.OwnerUID = attacker.UID;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
flooritem.Name = "FuryofEgg";
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
}
else if (attacker.Owner.Spells[spellID].LevelHu2 == 2)
{
flooritem.ItemID = FloorItem.ShacklingIce;
flooritem.X = X;
flooritem.MapID = map.ID;
flooritem.Y = Y;
flooritem.Type = FloorItem.Effect;
flooritem.mColor = 10;
flooritem.OwnerUID = attacker.UID;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
flooritem.Name = "ShacklingIce";
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
}
else
{
flooritem.ItemID = FloorItem.DaggerStorm;
flooritem.X = X;
flooritem.MapID = map.ID;
flooritem.Y = Y;
flooritem.Type = FloorItem.Effect;
flooritem.mColor = 10;
flooritem.OwnerUID = attacker.UID;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
flooritem.Name = "DaggerStorm";
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
}
}
break;
}
#endregion
#endregion
#region ChainBolt
case 10309:
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacker.X;
suse.Y = attacker.Y;
if (attacked != null)
{
if (attacker.ContainsFlag2(Update.Flags2.ChainBoltActive))
{
PrepareSpell(spell, attacker.Owner);
suse.X = X;
suse.Y = Y;
int maxR = spell.Distance;
if (attacked != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= maxR)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
var damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
var Array = attacker.Owner.Screen.Objects;
var closestTarget = findClosestTarget(attacked, attacked.X, attacked.Y, Array);
ushort x = closestTarget.X, y = closestTarget.Y;
int targets = Math.Max((int)spell.Level, 1);
foreach (Interfaces.IMapObject _obj in Array)
{
if (targets == 0) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(x, y, attacked.X, attacked.Y) <= maxR)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
maxR = 6;
var damage2 = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack);
damage2 = (uint)(damage2 / 2);
ReceiveAttack(attacker, attacked, attack, ref damage2, spell);
suse.AddTarget(attacked, damage2, attack);
x = attacked.X;
y = attacked.Y;
targets--;
}
}
}
}
if (suse.Targets.Count == 0) return;
attacker.Owner.SendScreen(suse, true);
}
else
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
attacker.ChainboltStamp = Time32.Now;
attacker.ChainboltTime = spell.Duration;
attacker.AddFlag2(Update.Flags2.ChainBoltActive);
}
}
}
break;
}
#endregion
#region ChargingVortex
case 1260:
{
if (CanUseSpell(spell, attacker.Owner))
{
spell.UseStamina = 20;
PrepareSpell(spell, attacker.Owner);
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack, client_Spell.LevelHu2);
suse.Effect1 = attack.Effect1;
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#region RadiantPalm
case 10381:
{
if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(695))
{
if (CanUseSpell(spell, attacker.Owner))
{
attacker.SpellStamp = Time32.Now;
ushort Xx, Yx;
if (attacked != null)
{
Xx = attacked.X;
Yx = attacked.Y;
}
else
{
Xx = attackedsob.X;
Yx = attackedsob.Y;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, Xx, Yx) <= 7)
{
if (attackedsob == null)
if (attacked.ContainsFlag(Update.Flags.Fly))
return;
if (attacker.ContainsFlag(Update.Flags.Fly))
return;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
bool send = false;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.938);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.925);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.900);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.850);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
{
damage = (uint)(damage * 0.844);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
{
damage = (uint)(damage * 0.799);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.788);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
send = true;
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (uint)(damage * 180 / 100);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.Effect1 = attack.Effect1;
suse.AddTarget(attackedsob, damage, attack);
send = true;
}
}
if (send)
attacker.Owner.SendScreen(suse, true);
}
}
else
{
attacker.AttackPacket = null;
}
}
break;
}
#endregion
case 10315:
{
if (spell.ID == 10315)
{
if (attacker.Owner.Weapons.Item1 == null) return;
if (attacker.Owner.Weapons.Item1.IsTwoHander()) return;
}
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
UInt16 ox, oy;
ox = attacker.X;
oy = attacker.Y;
if (spellID == 10315)
{
Attack npacket = new Attack(true);
npacket.Attacker = attacker.UID;
npacket.AttackType = 53;
npacket.X = X;
npacket.Y = Y;
Writer.WriteUInt16(spell.ID, 28, npacket.ToArray());
Writer.WriteByte(spell.Level, 30, npacket.ToArray());
attacker.Owner.SendScreen(npacket, true);
attacker.X = X;
attacker.Y = Y;
attacker.SendSpawn(attacker.Owner);
attacker.Owner.Screen.Reload(npacket);
}
List<IMapObject> objects = new List<IMapObject>();
if (attacker.Owner.Screen.Objects.Count() > 0)
objects = GetObjects(ox, oy, attacker.Owner);
if (objects != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
if (spellID == 10315)
{
foreach (IMapObject objs in objects.ToArray())
{
if (objs == null) continue;
if (objs.MapObjType == MapObjectType.Monster || objs.MapObjType == MapObjectType.Entity)
{
attacked = objs as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 0.8);
suse.Effect1 = attack.Effect1;
if (spell.Power > 0)
{
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack);
suse.Effect1 = attack.Effect1;
}
if (spell.ID == 8030)
{
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (objs.MapObjType == MapObjectType.SobNpc)
{
attackedsob = objs as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
if (spell.Power > 0)
{
damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack);
}
attack.Effect1 = Attack.AttackEffects1.None;
if (spell.ID == 8030)
damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
else
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
suse.Effect1 = attack.Effect1;
if (spell.Power > 0)
{
attack.Effect1 = Attack.AttackEffects1.None;
damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack);
suse.Effect1 = attack.Effect1;
}
attack.Effect1 = Attack.AttackEffects1.None;
if (spell.ID == 8030)
damage = Game.Attacking.Calculate.Ranged(attacker, attacked, ref attack);
if (spell.ID == 1115)
damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
if (spell.Power > 0)
damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack);
attack.Effect1 = Attack.AttackEffects1.None;
if (spell.ID == 8030)
damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
}
attacker.Owner.SendScreen(suse, true);
Calculations.IsBreaking(attacker.Owner, ox, oy);
}
break;
}
#region ChargingVortex
case 11190:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacker.Owner.Map.Floor[X, Y, MapObjectType.InvalidCast, null])
break;
spell.UseStamina = 20;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
UInt16 ox, oy;
ox = attacker.X;
oy = attacker.Y;
attack.X = X;
attack.Y = Y;
attack.Attacker = attacker.UID;
attack.AttackType = 53;
attack.X = X;
attack.Y = Y;
attacker.Owner.SendScreen(attack, true);
attacker.X = X;
attacker.Y = Y;
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
var Array = attacker.Owner.Screen.Objects;
foreach (Interfaces.IMapObject _obj in Array)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(X, Y, attacked.X, attacked.Y) > spell.Range)
continue;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
Calculations.IsBreaking(attacker.Owner, ox, oy);
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#endregion
#region Heaven Blade
case 10310:
{
if (CanUseSpell(spell, attacker.Owner))
{
if (attacked != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, false))
{
PrepareSpell(spell, attacker.Owner);
var damage = Game.Attacking.Calculate.Magic(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
damage = (uint)(damage * 1.4);
if (Kernel.Rate(spell.Percent))
{
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
else
{
damage = 0;
suse.AddTarget(attacked, damage, attack);
}
attacker.Owner.SendScreen(suse, true);
}
}
else
{
attacker.AttackPacket = null;
}
}
else
{
if (attackedsob != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Distance)
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
var damage = Game.Attacking.Calculate.Magic(attacker, attackedsob, spell, ref attack);
if (Kernel.Rate(spell.Percent))
{
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
else
{
damage = 0;
suse.AddTarget(attackedsob, damage, attack);
}
attacker.Owner.SendScreen(suse, true);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
break;
}
#endregion
#region New Trojan
#region SuperCyclone
case 11970:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (!attacked.OnKOSpell())
attacked.KOCount = 0;
attacked.KOSpell = spell.ID;
suse.AddTarget(attacked, 0, attack);
attacked.SuperCycloneStamp = Time32.Now;
attacked.SuperCycloneTime = 40;
attacked.AddFlag3(Update.Flags3.SuperCyclone);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region FatalCross
case 11980:
{
if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(50))
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist,
InLineAlgorithm.Algorithm.DDA);
// X = attacker.X;
// Y = attacker.Y;
int i = algo.lcoords.Count;
/* for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Player]
&& !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}*/
//double disth = 1.5;
// if (attacker.MapID == DeathMatch.MAPID) disth = 1;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= 4)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (damage * 36) / 100;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.790);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.750);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.730);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.690);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
{
damage = (uint)(damage * 0.550);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
{
damage = (uint)(damage * 0.450);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.450);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (CanAttack(attacker, attackedsob, spell))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
}
break;
}
#endregion
#region BreathFocus
case 11960:
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.X = attacker.X;
suse.Y = attacker.Y;
suse.Targets.Add(attacker.UID, 1);
attacker.Owner.SendScreen(suse, true);
attacker.Stamina += (byte)spell.Power;
attacker.Owner.Send(new Message("Your Stamina has increased by " + spell.Power, Message.TopLeft));
break;
}
#endregion
#region MortalStrike
case 11990:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Range);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 1.0);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#endregion
#region Windwalker
#region Chaser
#region ShadowofChaser(Active)
case 13090:
{
if (attacker.ContainsFlag4(Update.Flags4.ShadowofChaser))
{
attacker.RemoveFlag4(Update.Flags4.ShadowofChaser);
attacker.AttackPacket = null;
break;
}
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.AddTarget(attacker, 0, null);
attack = new Attack(true);
attack.Attacker = attack.Attacked = attacker.UID;
attack.X = attacker.X; attack.Y = attacker.Y;
attack.AttackType = 24;
attack.SpellID = spell.ID;
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4(Update.Flags4.ShadowofChaser);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region ThunderCloud[Chaser]
case 12840:
{
if (CanUseSpell(spell, attacker.Owner))
{
attacker.GreenEffect = 10;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
var cl = new WindWalker.ThunderCloud(attacker.Owner, attack.X, attack.Y);
suse.AddTarget(cl.UID, 0, null);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region ThunderBolt[Chaser]
case 12970:
{
if (CanUseSpell(spell, attacker.Owner))
{
//attacker.GreenEffect = 10;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.AddTarget(attacker.UID, 0, null);
attacker.Owner.SendScreen(suse, true);
foreach (var Cloud in attacker.Owner.Map.Clouds.Values.ToList())
{
Cloud.ThunderBolt = true;
attacker.ThunderBolt = true;
//Cloud.DisposeCloud2(attacker.Owner);
if (Kernel.GetDistance(Cloud.X, Cloud.Y, attacker.Owner.Player.X, attacker.Owner.Player.Y) > 16) continue;
Cloud.SendSpawn2(attacker.Owner, false);
//ThunderCloud cl = new ThunderCloud(attacker.Owner, Cloud.X, Cloud.Y);
}
}
break;
}
#endregion
#region TripleBlasts(Passive)
case 12850:
if (attacker.Stamina >= 10)
attacker.Stamina -= 10;
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attackedsob == null ? attacked.UID : attackedsob.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, false))
{
if (attacker.ContainsFlag4(Update.Flags4.ShadowofChaser) && attacker.IsChaser2())
{
var spell2 = Database.SpellTable.GetSpell(13090, attacker.Owner);
if (spell2 != null)
{
spell2.CanKill = true;
if (Kernel.Rate(spell2.Percent))
{
ShadowofChaser(attacker, attacked, attack, 1);
break;
}
}
}
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.450);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.440);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.430);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.420);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
}
break;
}
#endregion
#region SwirlingStorm(Passive)
case 12890:
if (attacker.Stamina >= 15)
attacker.Stamina -= 15;
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Distance);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
byte dist = (byte)spell.Distance;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist, InLineAlgorithm.Algorithm.DDA);
int i = algo.lcoords.Count;
double disth = 3.0;
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Entity)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.570);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.560);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.550);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.5);
}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
}
else if (_obj.MapObjType == MapObjectType.Monster)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (uint)(damage * 0.9);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
attackedsob = _obj as SobNpcSpawn;
if (attackedsob == null) continue;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (uint)(damage * 0.3);
attack.Damage = 0;
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
else
{
attacker.AttackPacket = null;
}
break;
}
#endregion
#region Omnipotence(XP)
case 12860:
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.ContainsFlag(Update.Flags.XPList))
{
attacker.AddFlag4(Update.Flags4.Omnipotence);
attacker.OmnipotenceStamp = Time32.Now;
attacker.RemoveFlag(Update.Flags.XPList);
attacker.Owner.SendScreen(suse, true);
}
else
{
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (attacked == null) break;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack) / 10;
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (attackedsob == null) continue;
if (Kernel.GetDistance(attacker.X, attacker.Y, attackedsob.X, attackedsob.Y) <= spell.Range)
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (uint)(damage * 0.6);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (uint)(damage * 0.5);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
}
}
}
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
break;
}
#endregion
#region FrostGaze(I-II-III)
case 12830:
case 13070:
case 13080:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.Owner.SendScreen(suse, true);
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (attacked == null) break;
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Range)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
int Rate = 100;
int diff = attacked.BattlePower - attacker.BattlePower;
if (diff < 0) diff = 0;
Rate -= (byte)(diff * 5);
if (Rate < 0) Rate = 0;
if (Kernel.Rate(Rate))
{
if (attacked.Stamina >= (byte)spell.Power)
attacked.Stamina -= (byte)spell.Power;
else attacked.Stamina = 0;
}
}
}
}
}
}
break;
}
#endregion
#endregion
#region Stomper
#region ChillingSnow(Active)
case 12960:
{
if (attacker.ContainsFlag4(Update.Flags4.ChillingSnow))
{
attacker.RemoveFlag4(Update.Flags4.ChillingSnow);
attacker.AttackPacket = null;
break;
}
if (CanUseSpell(spell, attacker.Owner))
{
attacker.RemoveFlag4(Update.Flags4.HealingSnow);
attacker.RemoveFlag4(Update.Flags4.FreezingPelter);
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacker, 0, attack);
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4(Update.Flags4.ChillingSnow);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region HealingSnow(Active)
case 12950:
{
if (attacker.ContainsFlag4(Update.Flags4.HealingSnow))
{
attacker.RemoveFlag4(Update.Flags4.HealingSnow);
attacker.AttackPacket = null;
break;
}
if (CanUseSpell(spell, attacker.Owner))
{
attacker.RemoveFlag4(Update.Flags4.ChillingSnow);
attacker.RemoveFlag4(Update.Flags4.FreezingPelter);
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacker, 0, attack);
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4(Update.Flags4.HealingSnow);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region FreezingPelter(Active)
case 13020:
{
if (attacker.ContainsFlag4(Update.Flags4.FreezingPelter))
{
attacker.RemoveFlag4(Update.Flags4.FreezingPelter);
attacker.Owner.LoadItemStats();
attacker.AttackPacket = null;
break;
}
if (CanUseSpell(spell, attacker.Owner))
{
attacker.RemoveFlag4(Update.Flags4.ChillingSnow);
attacker.RemoveFlag4(Update.Flags4.HealingSnow);
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacker, 0, attack);
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4(Update.Flags4.FreezingPelter);
attacker.Owner.LoadItemStats();
attacker.AttackPacket = null;
}
break;
}
#endregion
#region RevengeTail(Active)
case 13030:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
suse.AddTarget(attacker, 0, attack);
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag4(Update.Flags4.RevengeTaill);
attacker.RevengeTaillStamp = Time32.Now;
attacker.AttackPacket = null;
}
break;
}
#endregion
#region BurntFrost[Stomper]
case 12940:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner); if (CanUseSpell(spell, attacker.Owner))
attacker.GreenEffect = 10;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(180, spell.Distance);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance + 5)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null) continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.580);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.570);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.560);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.550);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (attackedsob == null) continue;
//if (attackedsob == null) Console.WriteLine(Environment.StackTrace);
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region RageofWar(Passive)
case 12930:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Game.Attacking.InLineAlgorithm ila = new Game.Attacking.InLineAlgorithm(attacker.X,
X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
attacker.Owner.SendScreen(suse, true);
bool first = false;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) > 15) continue;
if (!first)
{
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
flooritem.ItemID = FloorItem.RageOfWarTrap;
flooritem.X = attacked.X;
flooritem.MapID = map.ID;
flooritem.Y = attacked.Y;
flooritem.MapObjType = MapObjectType.FloorSpell;
flooritem.Type = FloorItem.Effect;
flooritem.mColor = 15;
flooritem.OwnerUID = attacker.UID;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
flooritem.Name2 = "RageofWarTrap";
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
first = true;
}
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.738);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.700);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.650);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.600);
}
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
continue;
if (Kernel.GetDistance(attacked.X, attacked.Y, attacker.X, attacker.Y) > 11) continue;
if (!first)
{
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
flooritem.ItemID = FloorItem.RageOfWarTrap;
flooritem.X = attacked.X;
flooritem.MapID = map.ID;
flooritem.Y = attacked.Y;
flooritem.Type = FloorItem.Effect;
flooritem.MapObjType = MapObjectType.FloorSpell;
flooritem.mColor = 15;
flooritem.OwnerUID = attacker.UID;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
flooritem.Name2 = "RageofWarTrap";
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
first = true;
}
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack);
damage = (uint)(damage * 1.0);
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (attackedsob == null) continue;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell))
continue;
if (Kernel.GetDistance(attackedsob.X, attackedsob.Y, attacker.X, attacker.Y) > 11) continue;
if (!first)
{
var map = Kernel.Maps[attacker.MapID];
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
while (map.Npcs.ContainsKey(flooritem.UID))
flooritem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
flooritem.MapObjType = MapObjectType.FloorSpell;
flooritem.ItemID = FloorItem.RageOfWarTrap;
flooritem.X = attackedsob.X;
flooritem.MapID = map.ID;
flooritem.Y = attackedsob.Y;
flooritem.Type = FloorItem.Effect;
flooritem.mColor = 15;
flooritem.OwnerUID = attacker.UID;
flooritem.OnFloor = Time32.Now;
flooritem.Owner = attacker.Owner;
flooritem.Name2 = "RageofWarTrap";
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
first = true;
}
uint damage = (uint)(Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack) * (spell.Power - 30000) / 450);
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
}
break;
}
#endregion
#endregion
#endregion
#region EpicWarrior
case 12660:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.Owner.SendScreen(suse, true);
}
break;
}
#region Pounce
case 12770:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.SpellLevel = spell.Level;
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist,
InLineAlgorithm.Algorithm.DDA);
X = attacker.X;
Y = attacker.Y;
int i = 0;
for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Entity]
&& !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Entity, null])
return;
double disth = 1.5;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 1.100);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (CanAttack(attacker, attackedsob, spell))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#region ManiacDance
case 12700:
{
if (attacker.ContainsFlag(Update.Flags.XPList))
{
attacker.RemoveFlag(Update.Flags.XPList);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.ManiacDanceStamp = Time32.Now;
attacker.AddFlag3(Update.Flags3.WaniacDance);
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region BackFire
case 12680:
if (attacker.Stamina >= 10)
attacker.Stamina -= 10;
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
attack.Attacker = attack.Attacked = attacker.UID;
attack.X = attacker.X;
attack.Y = attacker.Y;
attack.AttackType = 24;
attack.Damage = 3000;
attacker.Owner.SendScreen(attack, true);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
attacker.BackFireStamp = Time32.Now;
attacker.AddFlag3(Update.Flags3.BackFire);
if (attacker.Stamina <= 70) attacker.Stamina += 30;
else attacker.Stamina = 100;
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region WaveofBlood
case 12690:
{
if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(1300))
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Range);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance + 1)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
byte dist = (byte)spell.Distance;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist, InLineAlgorithm.Algorithm.DDA);
int i = algo.lcoords.Count;
double disth = 3.0;
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.644);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.644);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.633);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.622);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
{
damage = (uint)(damage * 0.619);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
{
damage = (uint)(damage * 0.615);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.611);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
attackedsob = _obj as SobNpcSpawn;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
// damage = (damage * 75) / 100;
damage = (damage * 75) / 100;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
byte seconds = 8;
if (Time32.Now >= attacker.AngerCooldown.AddSeconds(seconds))
{
attacker.AngerCooldown = Time32.Now;
attacker.Update(90, seconds, false);
}
attacker.Owner.SendScreen(suse, true);
}
}
break;
}
#endregion
#endregion
#region New Ninja By Phoenix
#region TwilightDance
case 12070:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
// suse.Attacker1 = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
TwilightAction(attacker, suse, spell, X, Y);
attacker.Owner.SendScreen(suse, true);
attacker.AttackPacket = null;
}
break;
}
#endregion
#region SuperTwofoldBlade
case 12080:
{
if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(1030))
{
if (CanUseSpell(spell, attacker.Owner))
{
ushort Xx, Yx;
if (attacked != null)
{
Xx = attacked.X;
Yx = attacked.Y;
}
else
{
Xx = attackedsob.X;
Yx = attackedsob.Y;
}
if (Kernel.GetDistance(attacker.X, attacker.Y, Xx, Yx) <= spell.Distance)
{
if (attackedsob == null)
if (attacked.ContainsFlag(Update.Flags.Fly))
return;
if (attacker.ContainsFlag(Update.Flags.Fly))
return;
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
bool send = false;
if (attackedsob == null)
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.950);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.944);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.933);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.900);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
{
damage = (uint)(damage * 0.880);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
{
damage = (uint)(damage * 0.770);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.766);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
send = true;
if (attacker.Owner.Spells.ContainsKey(0) && !attacked.Dead)
{
var s = attacker.Owner.Spells[0];
var spellz = Database.SpellTable.SpellInformations[s.ID][s.Level];
if (spellz != null)
{
if (Kernel.Rate(spellz.Percent))
{
SpellUse ssuse = new SpellUse(true);
ssuse.Attacker = attacker.UID;
ssuse.SpellID = spellz.ID;
ssuse.SpellLevel = spellz.Level;
damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
ssuse.AddTarget(attacked, new SpellUse.DamageClass().Damage = damage, attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
attacker.Owner.SendScreen(ssuse, true);
}
}
}
}
}
else
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (uint)(damage * 110 / 110);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.Effect1 = attack.Effect1;
suse.AddTarget(attackedsob, damage, attack);
send = true;
}
}
if (send)
attacker.Owner.SendScreen(suse, true);
attacker.SpellStamp = Time32.Now;
}
else
{
attacker.AttackPacket = null;
}
}
}
break;
}
#endregion
#region ShadowClone
/*case 12090:
{
if (attacker.Owner.Map.ID == 6565 || attacker.Owner.Map.ID == 5555 || attacker.Owner.Map.ID == 2014)
{
Kernel.SendWorldMessage(new Message("Mr: " + attacker.Name + " You Can`t Use ThisSpell Here !!!", System.Drawing.Color.Red, Message.Talk), Program.Values);
return;
}
if (attacker.Owner.Map.ID == 6565 || attacker.Owner.Map.ID == 5555 || attacker.Owner.Map.ID == 2014)
{
Kernel.SendWorldMessage(new Message("Mr: " + attacker.Name + " You Can`t Use ThisSpell Here !!!", System.Drawing.Color.Red, Message.Talk), Program.Values);
return;
}
attacker.AttackPacket = null;
if (attacker.MyClones.Count > 0)
{
var clones = attacker.MyClones.Values.ToArray();
for (int i = 0; i < clones.Length; i++)
{
var item = clones[i];
if (item == null)
continue;
Data data = new Data(true);
data.UID = item.UID;
data.ID = Network.GamePackets.Data.RemoveEntity;
attacker.Owner.SendScreen(data);
// attacker.MyClones[item.UID] = null;
}
attacker.MyClones.Clear();
}
else
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
attacker.AddClone(3);
if (spell.Level >= 0)
attacker.AddClone(0);
foreach (var item in attacker.MyClones.Values)
spellUse.AddTarget(item, 0, attack);
attacker.Owner.SendScreen(spellUse, true);
}
}
break;
}*/
#endregion
#region FatalSpin
case 12110:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
X, attacker.Y, Y, (byte)spell.Distance, InLineAlgorithm.Algorithm.DDA);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
//suse.SpellLevelHu = client_Spell.LevelHu2;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (ila.InLine(attacked.X, attacked.Y))
{
if (!CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 1.100);
suse.Effect1 = attack.Effect1;
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
damage = (damage * 2);
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#endregion
#region LeeLong
#region DragonFlow
case 12270:
{
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.Attacker1 = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
spellUse.AddTarget(attacker, 1, attack);
attacker.Owner.SendScreen(spellUse, true);
if (attacker.ContainsFlag3((uint)Update.Flags3.DragonFlow))
attacker.RemoveFlag3((uint)Update.Flags3.DragonFlow);
else
attacker.AddFlag3((uint)Update.Flags3.DragonFlow);
attacker.DragonFlowStamp = attacker.DragonFlowStamp2 = Time32.Now;
break;
}
#endregion
#region DragonRoar
case 12280:
{
if (CanUseSpell(spell, attacker.Owner))
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
PrepareSpell(spell, attacker.Owner);
if (attacker.Owner.Team != null)
{
foreach (Client.GameState teammate in attacker.Owner.Team.Teammates)
{
if (teammate.Player.UID != attacker.UID)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, teammate.Player.X, teammate.Player.Y) <= spell.Range)
{
teammate.Player.Stamina += (byte)spell.Power;
suse.AddTarget(teammate.Player, spell.Power, null);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region DragonCyclone
case 12290:
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (attacker.ContainsFlag(Update.Flags.XPList))
{
attacker.RemoveFlag(Update.Flags.XPList);
attacker.AddFlag3(Update.Flags3.DragonCyclone);
attacker.DragonCycloneStamp = Time32.Now;
attacker.Owner.SendScreen(suse, true);
}
else
{
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist,
InLineAlgorithm.Algorithm.DDA);
X = attacker.X;
Y = attacker.Y;
int i = 0;
for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Entity]
&& !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Entity, null])
return;
double disth = 1.5;
// if (attacker.MapID == DeathMatch.MAPID) disth = 1;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.500);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.450);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.420);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.390);
}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (CanAttack(attacker, attackedsob, spell))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#region DragonSlash
case 12350:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.Attacker1 = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (ila.InLine(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.990);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.955);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.899);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.888);
}
suse.Effect1 = attack.Effect1;
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region AirKick
case 12320:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.SpellLevel = spell.Level;
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist,
InLineAlgorithm.Algorithm.DDA);
X = attacker.X;
Y = attacker.Y;
int i = 0;
for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Entity]
&& !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Entity, null])
return;
double disth = 0.5;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.510);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.500);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.490);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.480);
}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (CanAttack(attacker, attackedsob, spell))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#region AirSweep and AirRaid
case 12330:
case 12210:
case 12340:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
sector.Arrange(spell.Sector, spell.Range);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Range)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (sector.Inside(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.510);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.495);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.490);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.480);
}
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (sector.Inside(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region Speed Kick
case 12120:
case 12130:
case 12140:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
//suse.SpellLevelHu = client_Spell.LevelHu2;
suse.SpellLevel = spell.Level;
ushort _X = attacker.X, _Y = attacker.Y;
ushort _tX = X, _tY = Y;
byte dist = (byte)spell.Distance;
var Array = attacker.Owner.Screen.Objects;
InLineAlgorithm algo = new InLineAlgorithm(attacker.X, X, attacker.Y, Y, dist,
InLineAlgorithm.Algorithm.DDA);
X = attacker.X;
Y = attacker.Y;
int i = 0;
for (i = 0; i < algo.lcoords.Count; i++)
{
if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Entity]
&& !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
{
X = (ushort)algo.lcoords[i].X;
Y = (ushort)algo.lcoords[i].Y;
}
else
{
break;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Entity, null])
return;
double disth = 1.5;
foreach (Interfaces.IMapObject _obj in Array)
{
bool hit = false;
for (int j = 0; j < i; j++)
if (Kernel.GetDDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
hit = true;
if (hit)
{
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.510);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.500);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.490);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.480);
}
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (CanAttack(attacker, attackedsob, spell))
{
var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.PX = attacker.X;
attacker.PY = attacker.Y;
attacker.X = X;
attacker.Y = Y;
attacker.Owner.SendScreen(suse, true);
attacker.Owner.Screen.Reload(suse);
}
break;
}
#endregion
#region Cracking swipe
case 12170:
case 12160:
{
if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(5))
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
Fan sector = new Fan(attacker.X, attacker.Y, X, Y, spell.Range, spell.Sector);
if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= 15)
{
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (sector.IsInFan(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 0.680);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 0.680);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 0.655);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 0.644);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
{
damage = (uint)(damage * 0.633);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
{
damage = (uint)(damage * 0.622);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
{
damage = (uint)(damage * 0.611);
}
suse.Effect1 = attack.Effect1;
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (sector.IsInFan(attackedsob.X, attackedsob.Y))
{
if (CanAttack(attacker, attackedsob, spell))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
attacker.Owner.SendScreen(suse, true);
attacker.SpellStamp = Time32.Now;
}
}
break;
}
#endregion
#region Dragon Punch
case 12240:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
X, attacker.Y, Y, (byte)spell.Range, InLineAlgorithm.Algorithm.DDA);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = SpellID;
suse.SpellLevel = attacker.Owner.Spells[SpellID].Level;
suse.X = X;
suse.Y = Y;
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
{
if (_obj == null)
continue;
if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
{
attacked = _obj as Entity;
if (ila.InLine(attacked.X, attacked.Y))
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
{
damage = (uint)(damage * 1.100);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
{
damage = (uint)(damage * 1.200);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
{
damage = (uint)(damage * 1.300);
}
if (attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
{
damage = (uint)(damage * 1.200);
}
suse.Effect1 = attack.Effect1;
attack.Damage = damage;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as SobNpcSpawn;
if (ila.InLine(attackedsob.X, attackedsob.Y))
{
if (!CanAttack(attacker, attackedsob, spell))
continue;
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
attack.Damage = damage;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob, damage, attack);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}
#endregion
#region DragonFury
case 12220:
{
if (attacked != null)
{
if (Kernel.GetDistance(attacker.X, attacker.Y, attacked.X, attacked.Y) <= spell.Distance)
{
if (CanUseSpell(spell, attacker.Owner))
{
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = X;
suse.Y = Y;
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
PrepareSpell(spell, attacker.Owner);
attack.Effect1 = Attack.AttackEffects1.None;
var damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
damage = (uint)(damage * 1.100);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked, damage, attack);
attacker.Owner.Player.IsEagleEyeShooted = true;
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.SendScreen(suse, true);
else
attacked.MonsterInfo.SendScreen(suse);
if (attacked.EntityFlag == EntityFlag.Entity)
{
int potDifference = attacker.BattlePower - attacked.BattlePower;
int rate = spell.Percent + potDifference - 20;
if (Kernel.Rate(rate))
{
attacked.AddFlag3(Update.Flags3.DragonFury);
attacked.DragonFuryStamp = Time32.Now;
attacked.DragonFuryTime = spell.Duration;
Network.GamePackets.Update upgrade = new Network.GamePackets.Update(true);
upgrade.UID = attacked.UID;
upgrade.Append(74
, (uint)spell.Status
, (uint)spell.Duration, spell.Power, spell.Level);
attacker.Owner.Send(upgrade.ToArray());
if (attacked.EntityFlag == EntityFlag.Entity)
attacked.Owner.Send(upgrade);
else
attacked.MonsterInfo.SendScreen(upgrade);
}
}
}
}
}
}
break;
}
#endregion
#region DragonSwing
case 12200:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = attacker.UID;
spellUse.SpellID = spell.ID;
spellUse.SpellLevel = spell.Level;
spellUse.X = X;
spellUse.Y = Y;
attacker.Owner.SendScreen(spellUse, true);
if (attacker.OnDragonSwing)
{
attacker.OnDragonSwing = false;
attacker.RemoveFlag3(Update.Flags3.DragonSwing);
Update upgrade = new Update(true);
upgrade.UID = attacker.UID;
upgrade.Append(Update.DragonSwing, (uint)spell.Status, 0, 0, 0);
attacker.Owner.Send(upgrade.ToArray());
}
else
{
attacker.OnDragonSwing = true;
attacker.DragonSwingPower = spell.Level;
attacker.AddFlag3(Update.Flags3.DragonSwing);
Update upgrade = new Update(true);
upgrade.UID = attacker.UID;
upgrade.Append(Update.DragonSwing, (uint)spell.Duration, (uint)spell.Status, spell.Power, spell.Level);
attacker.Owner.Send(upgrade.ToArray());
attacker.DragonSwingStamp = Time32.Now;
}
}
break;
}
#endregion
#endregion
default:
{
if (attacker.Owner.Account.State == Mr_Panda.Database.AccountTable.AccountState.ProjectManager)
attacker.Owner.Send(new Message("Unknown Skill : " + spellID, System.Drawing.Color.CadetBlue, Message.Talk));
break;
}
}
attacker.Owner.IncreaseSpellExperience(Experience, spellID);
if (attacked != null && attacked.EntityFlag == EntityFlag.Monster && attacked.Hitpoints != 0)
{
Update update = new Update(true);
update.UID = attacked.UID;
update.Append(Update.MaxHitpoints, attacked.MaxHitpoints);
update.Append(Update.Hitpoints, attacked.Hitpoints);
foreach (Client.GameState client in Program.GamePool)
{
if (client.Map.ID == attacked.MapID)
{
if (Kernel.GetDistance(client.Player.X, client.Player.Y, attacked.X, attacked.Y) < Constants.nScreenDistance)
{
client.Send(update);
}
}
}
}
if (attacker.MapID == 1039)
{
if (spell.ID == 7001 || spell.ID == 9876)
{
attacker.AttackPacket = null;
return;
}
if (attacker.AttackPacket != null)
{
attack.Damage = spell.ID;
attacker.AttackPacket = attack;
var xspell = GetWeaponSpell(spell);
// var xspell = Database.SpellTable.WeaponSpells.Values.Where(p => p.Contains(spell.ID));
if (xspell != null)
{
if (attacker.AttackPacket == null)
{
attack.AttackType = Attack.Melee;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket.AttackType = Attack.Melee;
}
}
}
}
else
{
if (spell.NextSpellID != 0)
{
if (spell.NextSpellID >= 1000 && spell.NextSpellID <= 1002)
if (Target >= 1000000)
{
attacker.AttackPacket = null;
return;
}
attack.Damage = spell.NextSpellID;
attacker.AttackPacket = attack;
}
else
{
var xspell = GetWeaponSpell(spell);//Database.SpellTable.WeaponSpells.Values.Where(p => p.Contains(spell.ID));
if (xspell == null || spell.ID == 9876)
attacker.AttackPacket = null;
else
{
if (attacker.AttackPacket == null)
{
attack.AttackType = Attack.Melee;
attacker.AttackPacket = attack;
}
else
{
attacker.AttackPacket.AttackType = Attack.Melee;
}
}
}
}
}
else
{
attacker.AttackPacket = null;
}
if (attacker.AttackPacket == null)
{
if (spell.ID == 11960)
return;
if (attacker.Owner.Spells.ContainsKey(11960))
{
if (spell.ID == 9876 || spell.ID == 6002 || spell.ID == 10315 || spell.ID == 10311 || spell.ID == 10313 ||
spell.ID == 6003 || spell.ID == 10405 || spell.ID == 30000 || spell.ID == 10310 || spell.ID == 3050 ||
spell.ID == 3060 || spell.ID == 3080 || spell.ID == 3090)
return;
//if (Kernel.Rate(30))
{
attack.AttackType = Attack.Magic;
attack.Decoded = true;
attack.X = attacker.X;
attack.Y = attacker.Y;
attack.Attacked = attacker.UID;
attack.Attacker = attacker.UID;
attack.Damage = 11960;
goto restart;
}
}
}
}
#endregion
}
#endregion
}
#endregion
}
private void InfernalAction(Entity attacker, SpellUse suse, SpellInformation spell, ushort X, ushort Y)
{
var map = attacker.Owner.Map;
Point p1 = new Point() { X = attacker.X, Y = attacker.Y + 5 };
Point p2 = new Point() { X = attacker.X - 5, Y = attacker.Y };
Point p3 = new Point() { X = attacker.X - 4, Y = attacker.Y + 1 };
Point p4 = new Point() { X = attacker.X + 5, Y = attacker.Y - 4 };
///////////////////////
FloorItem floorItem = new FloorItem(true);
floorItem.ItemID = FloorItem.Infernal;
floorItem.MapID = attacker.MapID;
floorItem.Type = FloorItem.Effect;
floorItem.X = (ushort)(p1.X);
floorItem.Y = (ushort)(p1.Y);
floorItem.OnFloor = Time32.Now;
floorItem.Owner = attacker.Owner;
//while (map.Npcs.ContainsKey(floorItem.UID))
// floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
//map.AddFloorItem(floorItem);
///////////////////////////////////////////////
//attacker.Owner.SendScreenSpawn(floorItem, true);
FloorItem floorItem2 = new FloorItem(true);
floorItem2.ItemID = FloorItem.Infernal;
floorItem2.MapID = attacker.MapID;
floorItem2.Type = FloorItem.Effect;
floorItem2.X = (ushort)(p2.X);
floorItem2.Y = (ushort)(p2.Y);
floorItem2.OnFloor = Time32.Now;
floorItem2.Owner = attacker.Owner;
//while (map.Npcs.ContainsKey(floorItem2.UID))
// floorItem2.UID = Network.GamePackets.FloorItem.FloorUID.Next;
//map.AddFloorItem(floorItem2);
// attacker.Owner.SendScreenSpawn(floorItem2, true);
///////////////////////////////////////////////
FloorItem floorItem3 = new FloorItem(true);
floorItem3.ItemID = FloorItem.Infernal;
floorItem3.MapID = attacker.MapID;
floorItem3.Type = FloorItem.Effect;
floorItem3.X = (ushort)(p3.X);
floorItem3.Y = (ushort)(p3.Y);
floorItem3.OnFloor = Time32.Now;
floorItem3.Owner = attacker.Owner;
//while (map.Npcs.ContainsKey(floorItem3.UID))
// floorItem3.UID = Network.GamePackets.FloorItem.FloorUID.Next;
//map.AddFloorItem(floorItem3);
// attacker.Owner.SendScreenSpawn(floorItem3, true);
////////////////////////////////////////////
FloorItem floorItem4 = new FloorItem(true);
floorItem4.ItemID = FloorItem.Infernal;
floorItem4.MapID = attacker.MapID;
floorItem4.Type = FloorItem.Effect;
floorItem4.X = (ushort)(p4.X);
floorItem4.Y = (ushort)(p4.Y);
floorItem4.OnFloor = Time32.Now;
floorItem4.Owner = attacker.Owner;
//while (map.Npcs.ContainsKey(floorItem4.UID))
// floorItem4.UID = Network.GamePackets.FloorItem.FloorUID.Next;
//map.AddFloorItem(floorItem4);
// attacker.Owner.SendScreenSpawn(floorItem4, true);
/////////////////////////////////
attacker.Owner.SendScreenSpawn(floorItem, true);
attacker.Owner.SendScreenSpawn(floorItem2, true);
attacker.Owner.SendScreenSpawn(floorItem3, true);
attacker.Owner.SendScreenSpawn(floorItem4, true);
}
public static void HandleAura(Game.Entity attacker, Database.SpellInformation spell)
{
ulong statusFlag = 0;
ulong statusFlag2 = 0;
Update.AuraType aura = Update.AuraType.TyrantAura;
switch (spell.ID)
{
case 10424: statusFlag = Update.Flags2.EarthAura; break;
case 10423: statusFlag = Update.Flags2.FireAura; break;
case 10422: statusFlag = Update.Flags2.WaterAura; break;
case 10421: statusFlag = Update.Flags2.WoodAura; break;
case 10420: statusFlag = Update.Flags2.MetalAura; break;
case 10410: statusFlag = Update.Flags2.FendAura; break;
case 10395: statusFlag = Update.Flags2.TyrantAura; break;
}
switch (spell.ID)
{
case 10424: statusFlag2 = Update.Flags2.EarthAura2; break;
case 10423: statusFlag2 = Update.Flags2.FireAura2; break;
case 10422: statusFlag2 = Update.Flags2.WaterAura2; break;
case 10421: statusFlag2 = Update.Flags2.WoodAura2; break;
case 10420: statusFlag2 = Update.Flags2.MetalAura2; break;
case 10410: statusFlag2 = Update.Flags2.FendAura2; break;
case 10395: statusFlag2 = Update.Flags2.TyrantAura2; break;
}
if (attacker.Dead) return;
if (attacker.Aura_isActive)
{
switch (attacker.Aura_actType)
{
case 10424: aura = Update.AuraType.EarthAura; break;
case 10423: aura = Update.AuraType.FireAura; break;
case 10422: aura = Update.AuraType.WaterAura; break;
case 10421: aura = Update.AuraType.WoodAura; break;
case 10420: aura = Update.AuraType.MetalAura; break;
case 10410: aura = Update.AuraType.FendAura; break;
case 10395: aura = Update.AuraType.TyrantAura; break;
}
new Update(true).Aura(attacker, Update.AuraDataTypes.Remove, aura, spell);
attacker.RemoveFlag2(attacker.Aura_actType);
attacker.RemoveFlag2(attacker.Aura_actType2);
//attacker.Owner.removeAuraBonuses(statusFlag, spell.Power, 1);
attacker.Owner.removeAuraBonuses(attacker.Aura_actType, attacker.Aura_actPower, 1);
attacker.Aura_isActive = false;
attacker.AuraTime = 0;
if (statusFlag == attacker.Aura_actType)
{
attacker.Aura_actType = 0;
attacker.Aura_actType2 = 0;
attacker.Aura_actPower = 0;
attacker.Aura_actLevel = 0;
return;
}
}
if (CanUseSpell(spell, attacker.Owner))
{
if (statusFlag != 0)
{
switch (attacker.Aura_actType)
{
case 10424: aura = Update.AuraType.EarthAura; break;
case 10423: aura = Update.AuraType.FireAura; break;
case 10422: aura = Update.AuraType.WaterAura; break;
case 10421: aura = Update.AuraType.WoodAura; break;
case 10420: aura = Update.AuraType.MetalAura; break;
case 10410: aura = Update.AuraType.FendAura; break;
case 10395: aura = Update.AuraType.TyrantAura; break;
}
new Update(true).Aura(attacker, Update.AuraDataTypes.Remove, aura, spell);
attacker.RemoveFlag2(attacker.Aura_actType);
attacker.RemoveFlag2(attacker.Aura_actType2);
attacker.Owner.removeAuraBonuses(attacker.Aura_actType, attacker.Aura_actPower, 1);
attacker.Aura_isActive = false;
attacker.AuraTime = 0;
if (statusFlag == attacker.Aura_actType)
{
attacker.Aura_actType2 = 0;
attacker.Aura_actType = 0;
attacker.Aura_actPower = 0;
attacker.Aura_actLevel = 0;
}
}
attacker.AuraStamp = Time32.Now;
if (spell.Power == 0) spell.Power = 45;
attacker.AuraTime = (short)(spell.Power * 20);
PrepareSpell(spell, attacker.Owner);
SpellUse suse = new SpellUse(true);
suse.Attacker = attacker.UID;
suse.SpellID = spell.ID;
suse.SpellLevel = spell.Level;
suse.X = attacker.X;
suse.Y = attacker.Y;
suse.AddTarget(attacker, 0, null);
attacker.Owner.SendScreen(suse, true);
attacker.AddFlag2(statusFlag);
attacker.AddFlag2(statusFlag2);
attacker.Aura_isActive = true;
attacker.Aura_actType = statusFlag;
attacker.Aura_actType2 = statusFlag2;
attacker.Aura_actPower = spell.Power;
attacker.Aura_actLevel = spell.Level;
attacker.Owner.doAuraBonuses(statusFlag, spell.Power, 1);
switch (spell.ID)
{
case 10424: aura = Update.AuraType.EarthAura; break;
case 10423: aura = Update.AuraType.FireAura; break;
case 10422: aura = Update.AuraType.WaterAura; break;
case 10421: aura = Update.AuraType.WoodAura; break;
case 10420: aura = Update.AuraType.MetalAura; break;
case 10410: aura = Update.AuraType.FendAura; break;
case 10395: aura = Update.AuraType.TyrantAura; break;
}
new Update(true).Aura(attacker, Update.AuraDataTypes.Add, aura, spell);
}
}
public static List<IMapObject> GetObjects(UInt16 ox, UInt16 oy, Client.GameState c)
{
UInt16 x, y;
x = c.Player.X;
y = c.Player.Y;
var list = new List<IMapObject>();
c.Player.X = ox;
c.Player.Y = oy;
foreach (IMapObject objects in c.Screen.Objects)
{
if (objects != null)
if (objects.UID != c.Player.UID)
if (!list.Contains(objects))
list.Add(objects);
}
c.Player.X = x;
c.Player.Y = y;
foreach (IMapObject objects in c.Screen.Objects)
{
if (objects != null)
if (objects.UID != c.Player.UID)
if (!list.Contains(objects))
list.Add(objects);
}
if (list.Count > 0)
return list;
return null;
}
public static void ReceiveAttack(Game.Entity attacker, Game.Entity attacked, Attack attack, ref uint damage, Database.SpellInformation spell)
{
if (attacked == null || attacker == null) { damage = 0; return; };
bool loadItemStats = false;
#region WaniacDance
if (attacked.ContainsFlag3(Network.GamePackets.Update.Flags3.WaniacDance))
{
damage = 0;
}
#endregion
#region Perfection
if (attacker.EntityFlag == EntityFlag.Entity)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.CalmWind;
byte chance = 0;
new MsgRefineEffect().GenerateEffectandChance(attacker.Owner, ref effect, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacker, attacked, effect);
}
#endregion
}
if (attacker.EntityFlag == EntityFlag.Entity)
{
#region Perfection
byte chance = 0;
new MsgRefineEffect().HandleLuckyStrike(attacker, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacker, attacked, Game.Enums.PerfectionEffect.LuckyStrike);
damage *= (uint)(damage * 0.298);
}
#endregion
}
if (attacked.EntityFlag == EntityFlag.Entity)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.Stricklock;
byte chance = 0;
new MsgRefineEffect().HandleStrickeLock(attacker, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
return;
}
#endregion
}
if (attacked.EntityFlag == EntityFlag.Entity)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.Stricklock;
byte chance = 0;
new MsgRefineEffect().HandleBloodSpawn(attacked, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
attacked.Hitpoints = attacked.MaxHitpoints;
attacked.Mana = attacked.MaxMana;
}
#endregion
}
if (attacked.EntityFlag == EntityFlag.Entity)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.MirrorofSin;
byte chance = 0;
new MsgRefineEffect().HandleMirror(attacked, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
attacked.AddFlag(Network.GamePackets.Update.Flags.XPList);
}
#endregion
}
#endregion
/*#region Perfection
if (attacker.EntityFlag == EntityFlag.Entity)
{
uint rand = (uint)Mr_Panda.Kernel.Random.Next(2, 2);
switch (rand)
{
case 1:
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.CalmWind;
byte chance = 0;
new MsgRefineEffect().GenerateEffectandChance(attacker.Owner, ref effect, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacker, attacked, effect);
}
#endregion
break;
}
case 2:
{
#region Perfection
byte chance = 0;
new MsgRefineEffect().HandleLuckyStrike(attacker, ref chance);
if (Kernel.Rate(chance))
{
Network.Writer.WriteUInt16((ushort)(1 << 10), 36, attack.ToArray());
new MsgRefineEffect().SendEffect(attacker, attacked, Game.Enums.PerfectionEffect.LuckyStrike);
//damage = 200 ,100;
damage = (uint)(damage * 200.100);
}
#endregion
break;
}
}
}
#endregion*/
#region Perfection
if (attacked.EntityFlag == EntityFlag.Entity)
{
uint rand = (uint)Mr_Panda.Kernel.Random.Next(1, 2);
switch (rand)
{
case 1:
{
//if (attacked.PlayerFlag == PlayerFlag.Player)
{
#region Perfection
byte chance = 1;
new MsgRefineEffect().HandleStrickeLock(attacker, ref chance);
if (Kernel.Rate(chance))
{
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.Stricklock;
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
return;
}
#endregion
}
break;
}
case 2:
{
//if (attacked.PlayerFlag == PlayerFlag.Player)
{
#region Perfection
Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.MirrorofSin;
byte chance = 0;
new MsgRefineEffect().HandleMirror(attacked, ref chance);
if (Kernel.Rate(chance))
{
new MsgRefineEffect().SendEffect(attacked, attacker, effect);
attacked.AddFlag((ulong)Network.GamePackets.Update.Flags.XPList);
attacker.Owner.XPListStamp = Time32.Now;
}
#endregion
}
break;
}
}
}
#endregion
#region ThunderCloud
if (attacked.Name == "Thundercloud")
{
if (spell != null && spell.ID != 0)
{
if (Kernel.Rate(75)) damage = 1;
else damage = 0;
}
else if (spell == null || spell.ID == 0)
{
damage = 1;
}
}
foreach (var th in Kernel.Maps[attacker.MapID].Entities.Values.Where(i => i.Name == "Thundercloud"))
{
if (th.UID == attacked.UID)
{
if (attacker == null || Kernel.GetDistance(attacker.X, attacker.Y, th.X, th.Y) > th.MonsterInfo.AttackRange || attacker.Dead) break;
th.MonsterInfo.InSight = attacker.UID;
break;
}
}
#endregion
#region RevengeTaill
if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
{
if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
{
var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
if (damage <= spelll.Power)
{
SpellUse suses = new SpellUse(true);
suses.Attacker = attacked.UID;
suses.Attacker1 = attacker.UID;
suses.SpellID = 13030;
suses.SpecialEffect = 1;
suses.AddTarget(attacker.UID, damage, null);
if (attacker.Hitpoints <= damage)
{
attacker.Die(attacked);
}
else
{
attacker.Hitpoints -= damage;
}
attacked.Owner.SendScreen(suses, true);
}
}
}
#endregion
#region BackFire
if (attacked.ContainsFlag3((ulong)Network.GamePackets.Update.Flags3.BackFire))
{
if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(12680))
{
var spelll = Database.SpellTable.GetSpell(12680, attacked.Owner);
if (damage <= spelll.Power)
{
SpellUse suses = new SpellUse(true);
suses.Attacker = attacked.UID;
suses.Attacker1 = attacker.UID;
suses.SpellID = 12680;
suses.SpecialEffect = 1;
attack.AttackType = Attack.BackFire;
suses.AddTarget(attacker.UID, damage, null);
if (attacker.Hitpoints <= damage)
{
attacker.Die(attacked);
}
else
{
attacker.Hitpoints -= damage;
}
attacked.Owner.SendScreen(suses, true);
}
}
}
#endregion
#region ChillingSnow
if (attacked.ContainsFlag4(Update.Flags4.ChillingSnow) && attacked.IsStomper2() && attacker.EntityFlag == EntityFlag.Entity)
{
var spell1 = Database.SpellTable.GetSpell(12960, attacked.Owner);
int rate = 95;
int diff = attacker.BattlePower - attacked.BattlePower;
if (diff < 0) diff = 0;
rate -= (byte)(diff * 5);
if (rate < 0) rate = 0;
if (Kernel.Rate(rate))
{
attacker.AddFlag4(Update.Flags4.xChillingSnow);
attacker.ChillingSnowStamp = Time32.Now;
attacker.ChillingSnow = (byte)(spell1.Level + 1);
}
}
#endregion
#region FreezingPelter
if (attacked.ContainsFlag4(Update.Flags4.FreezingPelter) && attacked.IsStomper2() && attacker.EntityFlag == EntityFlag.Entity)
{
var spell1 = Database.SpellTable.GetSpell(13020, attacked.Owner);
int rate = 30;
int diff = attacker.BattlePower - attacked.BattlePower;
if (diff < 0) diff = 0;
rate -= (byte)(diff * 5);
if (rate < 0) rate = 0;
if (Kernel.Rate(rate))
{
attacker.AddFlag4(Update.Flags4.xFreezingPelter);
attacker.FreezingPelterStamp = Time32.Now;
byte num = 0;
if (spell1.Level == 0) num = 1;
if (spell1.Level == 1) num = 1;
if (spell1.Level == 2) num = 2;
if (spell1.Level == 3) num = 2;
if (spell1.Level == 4) num = 3;
if (spell1.Level == 5) num = 3;
if (spell1.Level == 5) num = 4;
attacker.FreezingPelter = num;
}
}
#endregion
if (!(attacked.Name.Contains("Guard") && attacked.EntityFlag == EntityFlag.Monster))
if (attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag != EntityFlag.Entity && !attacked.Name.Contains("Guard"))
{
if (damage > attacked.Hitpoints)
{
attacker.Owner.IncreaseExperience(Calculate.CalculateExpBonus(attacker.Level, attacked.Level, Math.Min(damage, attacked.Hitpoints)), true);
if (spell != null)
attacker.Owner.IncreaseSpellExperience((uint)Calculate.CalculateExpBonus(attacker.Level, attacked.Level, Math.Min(damage, attacked.Hitpoints)), spell.ID);
}
else
{
attacker.Owner.IncreaseExperience(Calculate.CalculateExpBonus(attacker.Level, attacked.Level, damage), true);
if (spell != null)
attacker.Owner.IncreaseSpellExperience((uint)Calculate.CalculateExpBonus(attacker.Level, attacked.Level, damage), spell.ID);
}
}
if (attacker.EntityFlag == EntityFlag.Monster && attacked.EntityFlag == EntityFlag.Entity)
{
if (attacked.Action == Enums.ConquerAction.Sit)
if (attacked.Stamina > 20)
attacked.Stamina -= 1;
else
attacked.Stamina = 0;
attacked.Action = Enums.ConquerAction.None;
}
if (attack.AttackType == Attack.Magic)
{
if (attacked.Hitpoints <= damage)
{
#region SkillSoul Name
if (attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag == EntityFlag.Entity)
{
if (attacker.MyJiang != null)
{
if (attacker.MyJiang.Inner_Strength >= 48600)
{
if (Npcs.SkillSoul_Allowed == null) return;
if (spell == null) return;
if (Npcs.SkillSoul_Allowed.Contains(spell.ID))
{
byte[] tets = new byte[12 + 8];
Writer.Ushort(12, 0, tets);
Writer.Ushort(2710, 2, tets);
Writer.Uint(spell.ID, 4, tets);
attacker.Owner.Send(tets);
}
}
}
}
#endregion
if (attacked.Owner != null)
{
attacker.Owner.UpdateQualifier(attacker.Owner, attacked.Owner, attacked.Hitpoints);
}
attacked.CauseOfDeathIsMagic = true;
attacked.Die(attacker);
attacked.IsDropped = false;
if (attacker.PKMode == Enums.PKMode.Jiang)
{
if (attacked.JiangActive)
{
if (attacker.MyJiang != null && attacker.MyJiang != null)
attacker.MyJiang.GetKill(attacker.Owner, attacked.MyJiang);
}
}
if (attacked.Owner != null && attacker.Owner != null)
{
if (attacked.Owner.Team != null && attacker.Owner.Team != null)
{
if (attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
{
if (attacker.Owner.Team.EliteMatch != null)
{
if (!attacked.Owner.Team.Alive)
{
attacker.Owner.Team.EliteFighterStats.Points += damage;
attacker.Owner.Team.EliteMatch.End(attacked.Owner.Team);
}
else
{
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
}
}
}
}
}
}
else
{
if (attacked.Owner != null && attacker.Owner != null)
{
if (attacked.Owner.Team != null && attacker.Owner.Team != null)
{
if (attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
{
if (attacker.Owner.Team.EliteMatch != null)
{
//if (attacker.MapID == attacked.Owner.Team.EliteMatch.Map.ID
attacker.Owner.Team.EliteFighterStats.Points += damage;
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
}
}
}
}
if (attacked.Owner != null)
{
attacker.Owner.UpdateQualifier(attacker.Owner, attacked.Owner, damage);
}
attacked.Hitpoints -= damage;
}
}
else
{
if (attacked.Hitpoints <= damage)
{
if (attacked.EntityFlag == EntityFlag.Entity)
{
attacker.Owner.UpdateQualifier(attacker.Owner, attacked.Owner, attacked.Hitpoints);
attacked.Owner.SendScreen(attack, true);
attacker.AttackPacket = null;
}
else
{
attacked.MonsterInfo.SendScreen(attack);
}
attacked.Die(attacker);
if (attacker.PKMode == Enums.PKMode.Jiang)
{
if (attacked.JiangActive)
{
if (attacker.MyJiang != null && attacker.MyJiang != null)
attacker.MyJiang.GetKill(attacker.Owner, attacked.MyJiang);
}
}
if (attacked.Owner != null && attacker.Owner != null)
{
if (attacked.Owner.Team != null && attacker.Owner.Team != null)
{
if (attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
{
if (attacker.Owner.Team.EliteMatch != null)
{
if (attacker.MapID == attacked.Owner.Team.EliteMatch.Map.ID)
{
if (!attacked.Owner.Team.Alive)
{
attacker.Owner.Team.EliteFighterStats.Points += damage;
attacker.Owner.Team.EliteMatch.End(attacked.Owner.Team);
}
else
{
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
}
}
}
}
}
}
}
else
{
if (attacked.Owner != null && attacker.Owner != null)
{
if (attacked.Owner.Team != null && attacker.Owner.Team != null)
{
if (attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
{
if (attacker.Owner.Team.EliteMatch != null)
{
if (attacker.MapID == attacked.Owner.Team.EliteMatch.Map.ID)
{
attacker.Owner.Team.EliteFighterStats.Points += damage;
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
}
}
}
}
}
attacked.Hitpoints -= damage;
if (attacked.EntityFlag == EntityFlag.Entity)
{
attacker.Owner.UpdateQualifier(attacker.Owner, attacked.Owner, damage);
attacked.Owner.SendScreen(attack, true);
}
else
attacked.MonsterInfo.SendScreen(attack);
attacker.AttackPacket = attack;
attacker.AttackStamp = Time32.Now;
}
}
#region Process Perfection Attributes After Attack Successed
if (attacked.EntityFlag == EntityFlag.Entity && loadItemStats)
{
attacked.Owner.LoadItemStats();
}
#endregion
#region ThunderCloud
foreach (var th in Kernel.Maps[attacker.MapID].Entities.Values.Where(i => i.Name == "Thundercloud"))
{
if (th.OwnerUID == attacker.UID)
{
if (attacked == null || Kernel.GetDistance(attacked.X, attacked.Y, th.X, th.Y) > th.MonsterInfo.AttackRange || attacked.Dead) break;
th.MonsterInfo.InSight = attacked.UID;
break;
}
}
#endregion
if (attacked.MonsterInfo != null)
{
Update up = new Update(true);
up.UID = attacked.UID;
up.Append(Update.MaxHitpoints, attacked.MaxHitpoints);
up.Append(Update.Hitpoints, attacked.Hitpoints);
attacked.MonsterInfo.SendScreen(up);
}
}
public static void ReceiveAttack(Game.Entity attacker, SobNpcSpawn attacked, Attack attack, uint damage, Database.SpellInformation spell)
{
#region Union War
if (attacker.EntityFlag == EntityFlag.Entity)
{
if (attacked.UID == 817)
{
Mr_Panda.Network.GamePackets.Union.UnionClass Union;
if (attacker.Owner.Union != null && attacker.Owner.UnionID != 0)
{
if (Kernel.Unions.TryGetValue(attacker.Owner.UnionID, out Union))
{
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.UnionWar.AddScore(damage, Union);
}
}
}
}
#endregion
if (attacker.EntityFlag == EntityFlag.Entity)
if (damage > attacked.Hitpoints)
{
if (attacker.MapID == 1039)
attacker.Owner.IncreaseExperience(Math.Min(damage, attacked.Hitpoints), true);
if (spell != null)
attacker.Owner.IncreaseSpellExperience(Math.Min(damage, attacked.Hitpoints), spell.ID);
}
else
{
if (attacker.MapID == 1039)
attacker.Owner.IncreaseExperience(damage, true);
if (spell != null)
attacker.Owner.IncreaseSpellExperience(damage, spell.ID);
}
if (attacked.UID == 123456)
{
}
if (attacker.MapID == CaptureTheFlag.MapID)
if (attacker.GuildID != 0 && Program.World.CTF.Bases[attacked.UID].CapturerID != attacker.GuildID)
{
Program.World.CTF.AddScore(damage, attacker.Owner.Guild, attacked);
}
#region StatuesWar
if (Game.StatuesWar.IsWar)
{
if (attacker.MapID == Game.StatuesWar.Map.ID)
{
if (attacked.UID == Game.StatuesWar.Pole.UID)
{
if (Game.StatuesWar.PoleKeeper == attacker.Owner.AsMember)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.StatuesWar.AddScore(damage, attacker.Owner.AsMember);
}
}
}
#endregion TWin War
#region Clan War
if (attacker.MapID == 1509)
{
if (attacked.UID == 812)
{
Clan clan = attacker.GetClan;
if (Game.ClanWar.PoleKeeper == clan)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.ClanWar.AddScore(damage, clan);
}
}
#endregion
#region Satke Cps 10 by ahmed
#region Satke Cps
if (attacker.MapID == 1039)
{
if (attacked.UID == 6462)
{
attacked.Die(attacker);
{
if (attacker.VIPLevel <= 6)
{
attacker.ConquerPoints += 10;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip [DevilPower]MR-Mahmuod" + attacker.VIPLevel + " lw m3ak vip 50 hygylk 7 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
else
{
attacker.ConquerPoints += 50;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip [DevilPower]MR-Mahmoud" + attacker.VIPLevel + " hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
}
}
}
#endregion
#region Satke Cps
if (attacker.MapID == 1039)
{
if (attacked.UID == 6463)
{
attacked.Die(attacker);
{
if (attacker.VIPLevel <= 6)
{
attacker.ConquerPoints += 10;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" + attacker.VIPLevel + " lw m3ak vip 7 hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
else
{
attacker.ConquerPoints += 50;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" + attacker.VIPLevel + " hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
}
}
}
#endregion
#region Satke Cps
if (attacker.MapID == 1039)
{
if (attacked.UID == 6464)
{
attacked.Die(attacker);
{
if (attacker.VIPLevel <= 6)
{
attacker.ConquerPoints += 10;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" + attacker.VIPLevel + " lw m3ak vip 7 hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
else
{
attacker.ConquerPoints += 50;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" + attacker.VIPLevel + " hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
}
}
}
#endregion
#region Satke Cps
if (attacker.MapID == 1039)
{
if (attacked.UID == 6465)
{
attacked.Die(attacker);
{
if (attacker.VIPLevel <= 6)
{
attacker.ConquerPoints += 10;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" + attacker.VIPLevel + " lw m3ak vip 7 hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
else
{
attacker.ConquerPoints += 50;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" + attacker.VIPLevel + " hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
}
}
}
#endregion
#region Satke Cps
if (attacker.MapID == 1039)
{
if (attacked.UID == 6005)
{
attacked.Die(attacker);
{
if (attacker.VIPLevel <= 6)
{
attacker.ConquerPoints += 10;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" + attacker.VIPLevel + " lw m3ak vip 7 hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
else
{
attacker.ConquerPoints += 50;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" + attacker.VIPLevel + " hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
}
}
}
#endregion
#region Satke Cps
if (attacker.MapID == 1039)
{
if (attacked.UID == 6006)
{
attacked.Die(attacker);
{
if (attacker.VIPLevel <= 6)
{
attacker.ConquerPoints += 10;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" + attacker.VIPLevel + " lw m3ak vip 7 hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
else
{
attacker.ConquerPoints += 50;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" + attacker.VIPLevel + " hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
}
}
}
#endregion
#region Satke Cps
if (attacker.MapID == 1039)
{
if (attacked.UID == 6014)
{
attacked.Die(attacker);
{
if (attacker.VIPLevel <= 6)
{
attacker.ConquerPoints += 10;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" + attacker.VIPLevel + " lw m3ak vip 7 hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
else
{
attacker.ConquerPoints += 50;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" + attacker.VIPLevel + " hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
}
}
}
#endregion
#region Satke Cps
if (attacker.MapID == 1002)
{
if (attacked.UID == 6025)
{
attacked.Die(attacker);
{
if (attacker.VIPLevel <= 6)
{
attacker.ConquerPoints += 10;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" + attacker.VIPLevel + " lw m3ak vip 7 hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
else
{
attacker.ConquerPoints += 50;
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" + attacker.VIPLevel + " hygylk 50 cps #00", System.Drawing.Color.Azure, Message.TopLeft));
}
}
}
}
#endregion
#endregion
if (Game.NobiltyPoleWar.IsWar)
{
if (attacker.MapID == NobiltyPoleWar.Map.ID)
{
NobiltyPoleWar.Attack(damage, attacker, attacked);
}
}
if (attacker.MapID == 1038)
{
if (attacked.UID == 810)
{
if (Game.GuildWar.PoleKeeper == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.GuildWar.AddScore(damage, attacker.Owner.Guild);
}
}
if (attacker.MapID == 10380)
{
if (attacked.UID == 8100)
{
if (Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.SuperGuildWar.AddScore(damage, attacker.Owner.Guild);
}
}
if (attacker.MapID == 2071)
{
if (attacked.UID == 811)
{
if (Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.EliteGuildWar.AddScore(damage, attacker.Owner.Guild);
}
if (Game.EliteGuildWar.Poles != null && Game.EliteGuildWar.Poles != null)
{
if (attacked.UID == Game.EliteGuildWar.Poles.UID)
{
if (Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.EliteGuildWar.AddScore(damage, attacker.Owner.Guild);
}
if (attacked.UID == Game.EliteGuildWar.Poles.UID)
{
if (Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.EliteGuildWar.AddScore(damage, attacker.Owner.Guild);
}
}
}
if (attack.AttackType == Attack.Magic)
{
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
if (attacker.Owner != null)
{
if (attacker.Owner.Map.Statues.ContainsKey(attacked.UID))
{
// attacker.Owner.Send(attacked.SpawnPacket);
attacked.SendSpawn(attacker.Owner);
}
}
}
}
else
{
attacker.Owner.SendScreen(attack, true);
if (attacked.Hitpoints <= damage)
{
attacked.Die(attacker);
}
else
{
attacked.Hitpoints -= damage;
if (attacker.Owner != null)
{
if (attacker.Owner.Map.Statues.ContainsKey(attacked.UID))
{
// attacker.Owner.Send(attacked.SpawnPacket);
attacked.SendSpawn(attacker.Owner);
}
}
attacker.AttackPacket = attack;
attacker.AttackStamp = Time32.Now;
}
}
}
public static bool isArcherSkill(uint ID)
{
if (ID >= 8000 && ID <= 9875)
return true;
return false;
}
public static bool CanUseSpell(Database.SpellInformation spell, Client.GameState client)
{
if (client.Player.SkillTeamWatchingElitePKMatch != null)
return false;
if (client.WatchingElitePKMatch != null)
return false;
if (client.WatchingGroup != null)
return false;
if (spell == null)
return false;
if (client.Player.Mana < spell.UseMana)
return false;
if (client.Player.Stamina < spell.UseStamina)
return false;
if (spell.UseArrows > 0 && isArcherSkill(spell.ID))
{
var weapons = client.Weapons;
if (weapons.Item2 != null)
if (!client.Player.ContainsFlag3(Update.Flags3.Assassin))
if (!PacketHandler.IsArrow(weapons.Item2.ID))
return false;
return true;
}
if (spell.NeedXP == 1 && !client.Player.ContainsFlag(Update.Flags.XPList))
return false;
return true;
}
public static void PrepareSpell(Database.SpellInformation spell, Client.GameState client)
{
if (spell.NeedXP == 1)
client.Player.RemoveFlag(Update.Flags.XPList);
if (client.Map.ID != 1039)
{
if (spell.UseMana > 0)
if (client.Player.Mana >= spell.UseMana)
client.Player.Mana -= spell.UseMana;
if (spell.UseStamina > 0)
if (client.Player.Stamina >= spell.UseStamina)
client.Player.Stamina -= spell.UseStamina;
}
}
public static bool CanAttack(Game.Entity attacker, SobNpcSpawn attacked, Database.SpellInformation spell)
{
if (attacked == null)
return false;
if (attacked.UID == 817 && attacker.Owner.Union != null)
{
if (attacked.Name == attacker.Owner.Union.Name)
return false;
else
return true;
}
if (Database.GuildCondutors.GuildConductors != null)
if (Database.GuildCondutors.GuildConductors.ContainsKey(attacked.UID))
return false;
if (attacker.MapID == CaptureTheFlag.MapID)
{
if (Program.World.CTF.Bases.ContainsKey(attacked.UID))
{
var _base = Program.World.CTF.Bases[attacked.UID];
if (_base.CapturerID == attacker.GuildID)
return false;
}
return true;
}
if (attacked.UID == 123456)
if (attacked.Hitpoints > 0)
return true;
else return false;
#region StatueWar
if (Game.StatuesWar.IsWar)
{
if (attacker.MapID == Game.StatuesWar.Map.ID)
{
if (attacker.GuildID == 0 || !Game.StatuesWar.IsWar)
if (attacked.UID == Game.StatuesWar.Pole.UID)
return false;
if (Game.StatuesWar.PoleKeeper != null)
{
if (Game.StatuesWar.PoleKeeper == attacker.Owner.AsMember)
if (attacked.UID == Game.StatuesWar.Pole.UID)
return false;
if (Game.StatuesWar.PoleKeeper == attacker.Owner.AsMember)
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
#endregion Twinwar
#region Clan War
if (attacker.MapID == 1509)
{
if (attacker.ClanId == 0 || !Game.ClanWar.IsWar)
{
if (attacked.UID == 812)
{
return false;
}
}
if (Game.ClanWar.PoleKeeper != null)
{
if (Game.ClanWar.PoleKeeper == attacker.GetClan)
{
if (attacked.UID == 812)
{
return false;
}
}
}
}
#endregion
if (NobiltyPoleWar.IsWar)
{
if (attacker.MapID == NobiltyPoleWar.Map.ID)
{
return NobiltyPoleWar.Attack(0, attacker, attacked);
}
}
if (attacker.MapID == 1038)
{
if (attacker.GuildID == 0 || !Game.GuildWar.IsWar)
{
if (attacked.UID == 810)
{
return false;
}
}
if (Game.GuildWar.PoleKeeper != null)
{
if (Game.GuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 810)
{
return false;
}
}
else if (attacked.UID == 516075 || attacked.UID == 516074)
{
if (Game.GuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
}
if (attacker.MapID == 10380)
{
if (attacker.GuildID == 0 || !Game.SuperGuildWar.IsWar)
{
if (attacked.UID == 8100)
{
return false;
}
}
if (Game.SuperGuildWar.PoleKeeper != null)
{
if (Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 8100)
{
return false;
}
}
else if (attacked.UID == 516175 || attacked.UID == 516174)
{
if (Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
}
if (attacker.MapID == 2071)
{
if (attacker.GuildID == 0 || !Game.EliteGuildWar.IsWar)
{
if (Game.EliteGuildWar.Poles != null && Game.EliteGuildWar.Poles != null && Game.EliteGuildWar.Poles != null)
if (attacked.UID == Game.EliteGuildWar.Poles.UID || attacked.UID == Game.EliteGuildWar.Poles.UID || attacked.UID == Game.EliteGuildWar.Poles.UID)
return false;
}
if (Game.EliteGuildWar.PoleKeeper != null)
{
if (Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 811)
{
return false;
}
}
}
if (Game.EliteGuildWar.PoleKeeper != null)
{
if (Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (Game.EliteGuildWar.Poles != null)
if (attacked.UID == Game.EliteGuildWar.Poles.UID)
return false;
}
}
if (Game.EliteGuildWar.PoleKeeper != null)
{
if (Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (Game.EliteGuildWar.Poles != null)
if (attacked.UID == Game.EliteGuildWar.Poles.UID)
return false;
}
}
if (attacked.UID == 516075 || attacked.UID == 516074)
{
if (Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
if (attacker.MapID == 1039)
{
bool stake = true;
if (attacked.LoweredName.Contains("crow"))
stake = false;
ushort levelbase = (ushort)(attacked.Mesh / 10);
if (stake)
levelbase -= 42;
else
levelbase -= 43;
byte level = (byte)(20 + (levelbase / 3) * 5);
if (levelbase == 108 || levelbase == 109)
level = 125;
if (attacker.Level >= level)
return true;
else
{
attacker.AttackPacket = null;
attacker.Owner.Send(Constants.DummyLevelTooHigh());
return false;
}
}
return true;
}
public static void cheakteam(Client.GameState client, Npcs dail)
{
if (client.Team == null)
client.Player.Teleport(1002, 300, 278);
client.Player.AddTopStatus(Update.Flags2.Top3Water, 2, DateTime.Now.AddMinutes(58));
uint TeamCount = 0;
foreach (Client.GameState clients in Program.Values)
{
if (clients.Player.MapID == 16414)
{
if (clients.Team != null)
{
if (!clients.Player.Dead)
TeamCount++;
}
}
}
if (TeamCount <= 5)
{
uint lastcheak = 0;
if (client.Team != null)
{
foreach (Client.GameState team in client.Team.Teammates)
{
if (team.Player.MapID == 16414 && !team.Player.Dead)
lastcheak++;
}
if (TeamCount == lastcheak)
{
uint won = (uint)(10000000 / client.Team.Teammates.Count());
foreach (Client.GameState team in client.Team.Teammates)
{
team.Player.Teleport(1002, 300, 278);
client.Player.ConquerPoints += 430;
client.Player.Update(_String.Effect, "moonpk_second", true);
client.Player.InnerPower.Potency += 15;
foreach (var clients in Program.Values)
{
if (clients.Player.MapID == 16414)
{
clients.Player.Teleport(1002, 300, 278);
clients.Send(new NpcReply(NpcReply.MessageBox, "Sorry Entity Good Luck Next Time ;) "));
}
}
}
Kernel.SendWorldMessage(new Message("Congratulations! " + client.Player.Name + " Team Has Won Last Team Standing and all Team Member Got 430 ConquerPoint And 15 Points For (InnerPower)", System.Drawing.Color.Red, 2011), Program.Values);
}
else
{
dail.Text("There Are:| " + (TeamCount - lastcheak) + " |: other Entity in other Team Kill Him");
dail.Option("i Will Kill him ", 255);
dail.Send();
}
}
}
else
{
dail.Text("There Are:| " + TeamCount + " |: other Entity in other Team Kill Him");
dail.Option("i Will Kill him ", 255);
dail.Send();
}
}
public static bool CanAttack(Game.Entity attacker, Game.Entity attacked, Database.SpellInformation spell, bool melee)
{
if (DateTime.Now < attacker.Owner.timerattack.AddSeconds(6))
return false;
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (attacked.Companion)
{
if (attacked.Owner == attacker.Owner)
return false;
}
}
#region ThunderCloud
if (attacked.Name == "Thundercloud")
{
if (attacked.OwnerUID == attacker.UID) return false;
if (!Constants.PKForbiddenMaps.Contains(attacker.MapID))
{
if (attacker.PKMode != Game.Enums.PKMode.PK &&
attacker.PKMode != Game.Enums.PKMode.Team)
return false;
else
{
attacker.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 20;
return true;
}
}
else return false;
}
#endregion
if (attacker.ContainsFlag4(Update.Flags4.xChillingSnow))
return false;
if (attacker.MapID == 1507)
{
if (!Game.ClanWarArena.Tournaments[4].Open)
{
if (!attacker.AllowToAttack)
return false;
}
}
if (attacker.EntityFlag == EntityFlag.Entity)
{
if (attacker.Owner.Map.BaseID == (ushort)ElitePKTournament.WaitingAreaID)
{
if (attacker.Owner.Team != null)
if (attacker.Owner.Team.EliteFighterStats != null)
return false;
if (attacker.Owner.ElitePKStats != null)
return false;
}
}
//if (attacker.MapID == CrossServer.mapid)
//{
// if (attacker.Owner.Country == attacked.Owner.Country)
// {
// return false;
// }
//}
//if (attacker.MapID == Hunt_Thief.MAPID)
//{
// if (Hunt_Thief.Hunters.ContainsKey(attacked.UID) && Hunt_Thief.Hunters.ContainsKey(attacker.UID))
// return false;
// if (Hunt_Thief.Thiefs.ContainsKey(attacked.UID) && Hunt_Thief.Thiefs.ContainsKey(attacker.UID))
// return false;
// return true;
//}
if (attacker.timerInportChampion.AddSeconds(10) > DateTime.Now)
return false;
if (attacker.UID == attacked.UID)
return false;
if (attacker.SkillTeamWatchingElitePKMatch != null)
return false;
if (attacked.SkillTeamWatchingElitePKMatch != null)
return false;
if (spell != null)
{//Ahmed Samak : fixing the scatter on fly issue .. the condition below to constraint the cecking for the attacked is on ground or not on any spell except the scatter.
if (spell.ID != 8001)
{
if (spell.OnlyGround)
if (attacked.ContainsFlag(Update.Flags.Fly))
return false;
if (melee && attacked.ContainsFlag(Update.Flags.Fly))
return false;
}
}
if (spell != null)
{
if (spell.ID == 6010)
{
if (attacked.ContainsFlag(Update.Flags.Fly))
return false;
}
}
if (spell != null)
{
if (spell.ID == 10381)
{
if (attacked.ContainsFlag(Update.Flags.Fly))
return false;
}
}
if (spell != null)
{
if (spell.ID == 6000)
{
if (attacked.ContainsFlag(Update.Flags.Fly))
return false;
}
}
if (spell != null)
{
if (spell.ID == 5030)
{
if (attacked.ContainsFlag(Update.Flags.Fly))
return false;
}
}
if (spell == null)
{
if (attacked.ContainsFlag(Update.Flags.Fly))
return false;
}
if (attacker.PKMode == Enums.PKMode.Jiang)
{
if (attacked.JiangActive)
{
if (!attacked.Owner.Attackable)
return false;
if (attacked.Dead)
return false;
if (attacker.MapID == 1002 || attacker.MapID == 1000
|| attacker.MapID == 1015 || attacker.MapID == 1020
|| attacker.MapID == 1011)
if (attacked.EntityFlag == EntityFlag.Entity)
if (!attacked.Owner.Attackable)
return false;
{
try
{
if (attacker.AttackJiang != JiangHu.AttackFlag.None)
{
if ((attacker.AttackJiang & JiangHu.AttackFlag.NotHitFriends) == JiangHu.AttackFlag.NotHitFriends)
{
if (attacker.Owner.Friends.ContainsKey(attacked.UID))
return false;
}
if ((attacker.AttackJiang & JiangHu.AttackFlag.NoHitAlliesClan) == JiangHu.AttackFlag.NoHitAlliesClan)
{
var attacker_clan = attacker.GetClan;
if (attacker_clan != null)
{
if (attacker_clan.Allies.ContainsKey(attacked.ClanId))
return false;
}
}
if ((attacker.AttackJiang & JiangHu.AttackFlag.NotHitAlliedGuild) == JiangHu.AttackFlag.NotHitAlliedGuild)
{
if (attacker.Owner.Guild != null)
{
if (attacker.Owner.Guild.Ally.ContainsKey(attacked.GuildID))
return false;
}
}
if ((attacker.AttackJiang & JiangHu.AttackFlag.NotHitClanMembers) == JiangHu.AttackFlag.NotHitClanMembers)
{
if (attacker.ClanId == attacked.ClanId)
return false;
}
if ((attacker.AttackJiang & JiangHu.AttackFlag.NotHitGuildMembers) == JiangHu.AttackFlag.NotHitGuildMembers)
{
if (attacker.GuildID == attacked.GuildID)
return false;
}
}
}
catch (Exception e) { Console.WriteLine(e.ToString()); }
return true;
}
// return false;
}
}
if (attacked.EntityFlag == EntityFlag.Monster)
if (attacked.MonsterInfo.ID == MonsterInformation.ReviverID)
return false;
if (attacked.Dead) return false;
if (attacker.EntityFlag == EntityFlag.Entity)
if (attacker.Owner.WatchingElitePKMatch != null)
return false;
if (attacked.EntityFlag == EntityFlag.Entity)
if (attacked.Owner.WatchingElitePKMatch != null)
return false;
if (attacker.EntityFlag == EntityFlag.Entity)
if (attacked != null && attacked.EntityFlag == EntityFlag.Entity)
if (attacker.Owner.InTeamQualifier() && attacked.Owner.InTeamQualifier())
return !attacker.Owner.Team.IsTeammate(attacked.UID);
if (attacker.MapID == CaptureTheFlag.MapID)
if (!CaptureTheFlag.Attackable(attacker) || !CaptureTheFlag.Attackable(attacked))
return false;
if (spell != null)
if (spell.CanKill && attacker.EntityFlag == EntityFlag.Entity && Constants.PKForbiddenMaps.Contains(attacker.Owner.Map.ID) && attacked.EntityFlag == EntityFlag.Entity)
return false;
if (attacker.EntityFlag == EntityFlag.Entity)
if (attacker.Owner.WatchingGroup != null)
return false;
if (attacked == null)
return false;
if (attacked.Dead)
{
attacker.AttackPacket = null;
return false;
}
if (attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag == EntityFlag.Entity)
if ((attacker.Owner.InQualifier() && attacked.Owner.IsWatching()) || (attacked.Owner.InQualifier() && attacker.Owner.IsWatching()))
return false;
if (attacker.EntityFlag == EntityFlag.Entity)
if (Time32.Now < attacker.Owner.CantAttack)
return false;
if (attacked.EntityFlag == EntityFlag.Monster)
{
if (attacked.Companion)
{
if (Constants.PKForbiddenMaps.Contains(attacker.Owner.Map.ID))
{
if (attacked.Owner == attacker.Owner)
return false;
if (attacker.PKMode != Mr_Panda.Game.Enums.PKMode.PK &&
attacker.PKMode != Mr_Panda.Game.Enums.PKMode.Team)
return false;
else
{
attacker.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 10;
return true;
}
}
}
if (attacked.Name.Contains("Guard"))
{
if (attacker.PKMode != Mr_Panda.Game.Enums.PKMode.PK &&
attacker.PKMode != Mr_Panda.Game.Enums.PKMode.Team)
return false;
else
{
attacker.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 10;
return true;
}
}
else
return true;
}
else
{
if (attacked.EntityFlag == EntityFlag.Entity)
if (!attacked.Owner.Attackable)
return false;
if (attacker.EntityFlag == EntityFlag.Entity)
if (attacker.Owner.WatchingGroup == null)
if (attacked.EntityFlag == EntityFlag.Entity)
if (attacked.Owner.WatchingGroup != null)
return false;
if (Constants.PKForbiddenMaps.Contains(attacker.Owner.Map.ID))
{
if (attacker.PKMode == Mr_Panda.Game.Enums.PKMode.PK ||
attacker.PKMode == Mr_Panda.Game.Enums.PKMode.Team || (spell != null && spell.CanKill))
{
attacker.Owner.Send(Constants.PKForbidden);
attacker.AttackPacket = null;
}
return false;
}
if (attacker.PKMode == Mr_Panda.Game.Enums.PKMode.Capture)
{
if (attacked.ContainsFlag(Update.Flags.FlashingName) || attacked.PKPoints > 99)
{
return true;
}
}
if (attacker.PKMode == Mr_Panda.Game.Enums.PKMode.Peace)
{
return false;
}
if (attacker.UID == attacked.UID)
return false;
if (attacker.PKMode == Mr_Panda.Game.Enums.PKMode.Team)
{
if (attacker.Owner.Team != null)
{
if (attacker.Owner.Team.IsTeammate(attacked.UID))
{
attacker.AttackPacket = null;
return false;
}
}
if (attacker.GuildID == attacked.GuildID && attacker.GuildID != 0)
{
attacker.AttackPacket = null;
return false;
}
if (attacker.ClanId == attacked.ClanId && attacker.ClanId != 0)
{
attacker.AttackPacket = null;
return false;
}
if (attacker.Owner.Friends.ContainsKey(attacked.UID))
{
attacker.AttackPacket = null;
return false;
}
if (attacker.Owner.Guild != null)
{
if (attacker.Owner.Guild.Ally != null)
if (attacker.Owner.Guild.Ally.ContainsKey(attacked.GuildID))
{
attacker.AttackPacket = null;
return false;
}
}
if (attacker.ClanId != 0)
{
var clan = attacker.GetClan;
if (clan != null)
if (clan.Allies.ContainsKey(attacked.ClanId))
{
attacker.AttackPacket = null;
return false;
}
}
}
if (spell != null)
if (spell.OnlyGround)
if (attacked.ContainsFlag(Update.Flags.Fly))
return false;
if (spell != null)
if (!spell.CanKill)
return true;
if (attacker.PKMode != Mr_Panda.Game.Enums.PKMode.PK &&
attacker.PKMode != Mr_Panda.Game.Enums.PKMode.Team && attacked.PKPoints < 99)
{
attacker.AttackPacket = null;
return false;
}
else
{
if (!attacked.ContainsFlag(Update.Flags.FlashingName))
{
if (!attacked.ContainsFlag(Update.Flags.BlackName))
{
if (Constants.PKFreeMaps.Contains(attacker.MapID))
return true;
if (Constants.Damage1Map.Contains(attacker.MapID))
return true;
if (attacker.Owner.Map.BaseID == 700)
return true;
attacker.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
attacker.FlashingNameStamp = Time32.Now;
attacker.FlashingNameTime = 10;
}
}
}
return true;
}
}
public static void CheckForExtraWeaponPowers(Client.GameState client, Entity attacked)
{
#region Right Hand
var weapons = client.Weapons;
if (weapons.Item1 != null)
{
if (weapons.Item1.ID != 0)
{
var Item = weapons.Item1;
if (Item.Effect != Enums.ItemEffect.None)
{
if (Kernel.Rate(30))
{
switch (Item.Effect)
{
case Enums.ItemEffect.HP:
{
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = 1;
spellUse.SpellID = 1175;
spellUse.SpellLevel = 4;
spellUse.X = client.Player.X;
spellUse.Y = client.Player.Y;
spellUse.AddTarget(client.Player, 300, null);
uint damage = Math.Min(300, client.Player.MaxHitpoints - client.Player.Hitpoints);
client.Player.Hitpoints += damage;
client.SendScreen(spellUse, true);
break;
}
case Enums.ItemEffect.MP:
{
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = 1;
spellUse.SpellID = 1175;
spellUse.SpellLevel = 2;
spellUse.X = client.Player.X;
spellUse.Y = client.Player.Y;
spellUse.AddTarget(client.Player, 300, null);
ushort damage = (ushort)Math.Min(300, client.Player.MaxMana - client.Player.Mana);
client.Player.Mana += damage;
client.SendScreen(spellUse, true);
break;
}
case Enums.ItemEffect.Shield:
{
if (client.Player.ContainsFlag(Update.Flags.MagicShield))
return;
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = 1;
spellUse.SpellID = 1020;
spellUse.SpellLevel = 0;
spellUse.X = client.Player.X;
spellUse.Y = client.Player.Y;
spellUse.AddTarget(client.Player, 120, null);
client.Player.ShieldTime = 0;
client.Player.ShieldStamp = Time32.Now;
client.Player.MagicShieldStamp = Time32.Now;
client.Player.MagicShieldTime = 0;
client.Player.AddFlag(Update.Flags.MagicShield);
client.Player.MagicShieldStamp = Time32.Now;
client.Player.MagicShieldIncrease = 1.1f;
client.Player.MagicShieldTime = 120;
if (client.Player.EntityFlag == EntityFlag.Entity)
client.Send(Constants.Shield(2, 120));
client.SendScreen(spellUse, true);
break;
}
case Enums.ItemEffect.Poison:
{
if (attacked != null)
{
if (Constants.PKForbiddenMaps.Contains(client.Player.MapID))
return;
if (client.Map.BaseID == 700)
return;
if (attacked.UID == client.Player.UID)
return;
if (attacked.ToxicFogLeft > 0)
return;
SpellUse spellUse = new SpellUse(true);
spellUse.SpellID = 5040;
spellUse.Attacker = attacked.UID;
spellUse.SpellLevel = 9;
spellUse.X = attacked.X;
spellUse.Y = attacked.Y;
spellUse.AddTarget(attacked, 0, null);
spellUse.Targets[attacked.UID].Hit = true;
attacked.ToxicFogStamp = Time32.Now;
attacked.ToxicFogLeft = 10;
attacked.ToxicFogPercent = 0.05F;
client.SendScreen(spellUse, true);
}
break;
}
}
}
}
}
}
#endregion
#region Left Hand
if (weapons.Item2 != null)
{
if (weapons.Item2.ID != 0)
{
var Item = weapons.Item2;
if (Item.Effect != Enums.ItemEffect.None)
{
if (Kernel.Rate(30))
{
switch (Item.Effect)
{
case Enums.ItemEffect.HP:
{
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = 1;
spellUse.SpellID = 1175;
spellUse.SpellLevel = 4;
spellUse.X = client.Player.X;
spellUse.Y = client.Player.Y;
spellUse.AddTarget(client.Player, 300, null);
uint damage = Math.Min(300, client.Player.MaxHitpoints - client.Player.Hitpoints);
client.Player.Hitpoints += damage;
client.SendScreen(spellUse, true);
break;
}
case Enums.ItemEffect.MP:
{
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = 1;
spellUse.SpellID = 1175;
spellUse.SpellLevel = 2;
spellUse.X = client.Player.X;
spellUse.Y = client.Player.Y;
spellUse.AddTarget(client.Player, 300, null);
ushort damage = (ushort)Math.Min(300, client.Player.MaxMana - client.Player.Mana);
client.Player.Mana += damage;
client.SendScreen(spellUse, true);
break;
}
case Enums.ItemEffect.Shield:
{
if (client.Player.ContainsFlag(Update.Flags.MagicShield))
return;
SpellUse spellUse = new SpellUse(true);
spellUse.Attacker = 1;
spellUse.SpellID = 1020;
spellUse.SpellLevel = 0;
spellUse.X = client.Player.X;
spellUse.Y = client.Player.Y;
spellUse.AddTarget(client.Player, 120, null);
client.Player.ShieldTime = 0;
client.Player.ShieldStamp = Time32.Now;
client.Player.MagicShieldStamp = Time32.Now;
client.Player.MagicShieldTime = 0;
client.Player.AddFlag(Update.Flags.MagicShield);
client.Player.MagicShieldStamp = Time32.Now;
client.Player.MagicShieldIncrease = 1.1f;
client.Player.MagicShieldTime = 120;
if (client.Player.EntityFlag == EntityFlag.Entity)
client.Send(Constants.Shield(2, 120));
client.SendScreen(spellUse, true);
break;
}
case Enums.ItemEffect.Poison:
{
if (attacked != null)
{
if (attacked.UID == client.Player.UID)
return;
if (Constants.PKForbiddenMaps.Contains(client.Player.MapID))
return;
if (client.Map.BaseID == 700)
return;
if (attacked.ToxicFogLeft > 0)
return;
SpellUse spellUse = new SpellUse(true);
spellUse.SpellID = 5040;
spellUse.Attacker = attacked.UID;
spellUse.SpellLevel = 9;
spellUse.X = attacked.X;
spellUse.Y = attacked.Y;
spellUse.AddTarget(attacked, 0, null);
spellUse.Targets[attacked.UID].Hit = true;
attacked.ToxicFogStamp = Time32.Now;
attacked.ToxicFogLeft = 10;
attacked.ToxicFogPercent = 0.05F;
client.SendScreen(spellUse, true);
}
break;
}
}
}
}
}
}
#endregion
}
public void CheckForSuperGems(Client.GameState client)
{
for (uint i = 1; i < 12; i++)
{
if (i != 7)
{
ConquerItem item = client.Equipment.TryGetItem(i);
if (item != null && item.ID != 0)
{
if (item.SocketOne != 0)
{
if (item.SocketOne == Enums.Gem.SuperPhoenixGem)
{
if (Kernel.Rate(3))
{
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("phoenix");
attacker.Owner.SendScreen(str, true);
}
}
if (item.SocketOne == Enums.Gem.SuperDragonGem)
{
if (Kernel.Rate(3)) //this is where your chances when to display the phoenix gem effect
{
_String str = new _String(true);
str.UID = attacker.UID;
str.TextsCount = 1;
str.Type = _String.Effect;
str.Texts.Add("dragon");
attacker.Owner.SendScreen(str, true);
}
}
}
}
}
}
}
}
}
والسلام عليكم ورحمه الله وبركاتو بتمني دعوه حلوه او كلمه شكر تكفي
|