كود:
#region BladeTempest
case 11110:
{
if (CanUseSpell(spell, attacker.Owner))
{
PrepareSpell(spell, attacker.Owner);
MsgMagicEffect suse = new MsgMagicEffect(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;
MsgMapItem flooritem = new MsgMapItem(true);
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.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;
}
}
suse.X = X;
suse.Y = Y;
if (!attacker.Owner.Map.Floor[X, Y, MapObjectType.Player, 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 Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
var damage = Calculate.Melee(attacker, attacked, ref attack);
flooritem.TideTrapOnMonster = damage;
// damage = (damage * 100) / 100;
ReceiveAttack(attacker, attacked, attack, ref damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.Player)
{
attacked = _obj as Player;
if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
{
MsgMagicEffect.DamageClass SpellObj;
Physical.OnPlayer(attacker, attacked, spell, out SpellObj, ref attack);
ReceiveAttack(attacker, attacked, attack, ref SpellObj.Damage, spell);
flooritem.TideTrapOnPlayer = SpellObj.Damage;
suse.AddTarget(attacked.UID, SpellObj.Damage, attack);
}
}
else if (_obj.MapObjType == MapObjectType.SobNpc)
{
attackedsob = _obj as MsgNpcInfoEX;
if (CanAttack(attacker, attackedsob, spell))
{
var damage = Calculate.Melee(attacker, attackedsob, ref attack);
//damage = (damage * spell.IncreaseDMG);
//damage = (damage / spell.DecreaseDMG);
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
}
}
}
}
bool TideTrap = false;
foreach (var RuneID in attacker.Owner.RunesItem.Values.Where(x => x.Position >= 100 && x.Position <= 125))
{
if (RuneID.ID == RunesSystem.RunasRojas.TideTrap && attacker.Owner.Spells.ContainsKey(14250))
{
TideTrap = true;
}
}
if (TideTrap)
{
#region Floor
var map = Kernel.Maps[attacker.MapID];
flooritem.UID = MsgMapItem.FloorUID.Next;
while (map.FloorItems.ContainsKey(flooritem.UID))
flooritem.UID = MsgMapItem.FloorUID.Next;
suse.SpellEffect = 1;
flooritem.ItemID = MsgMapItem.TideTrap;
flooritem.X2 = X;
flooritem.MapID = map.ID;
flooritem.Y2 = Y;
flooritem.Type = MsgMapItem.Effect;
flooritem.mColor = 14;
flooritem.OwnerUID = attacker.UID;
flooritem.OwnerGuildUID = attacker.GuildID;
flooritem.OnFloor = Time32.Now;
flooritem.FlowerType = 0;
flooritem.X = attacker.X;
flooritem.Angle = attacker.Facing;
flooritem.Y = attacker.Y;
flooritem.Owner = attacker.Owner;
flooritem.Attack = attack;
map.AddFloorItem(flooritem);
attacker.Owner.SendScreenSpawn(flooritem, true);
#endregion
}
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