|
private void TwilightAction(
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);
damage = (uint)(damage * SkillsAttack.TwilightDanceMonsters);
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 * SkillsAttack.TwilightDancePlayers);
// damage = (uint)(damage * 0.6);
//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);
damage = (uint)(damage * SkillsAttack.TwilightDancePoles);
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);
}
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
account password not same no login problem | marcbacor | مشكلات السيرفيرات كونكر الشخصيه | 13 | 2019-10-23 11:34 AM |