ElSaher |
2019-10-01 02:30 AM |
رد: ضربة القرصان
كود PHP:
#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;
MessiProject.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 (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 = 1.6;
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, 0);
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, 0);
damage = (uint)(damage * 1.1);
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) * 3;
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;
MessiProject.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.Entity.ContainsFlag(MessiProject.Network.GamePackets.Update.Flags.XPList))
{
attacker.Owner.Entity.RemoveFlag(MessiProject.Network.GamePackets.Update.Flags.XPList);
attacker.Owner.Entity.AddFlag2(MessiProject.Network.GamePackets.Update.Flags2.CannonBarrage);
attacker.Owner.Entity.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;
MessiProject.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.Entity.X, attacker.Owner.Entity.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.Entity.ContainsFlag(MessiProject.Network.GamePackets.Update.Flags.XPList))
{
attacker.Owner.Entity.RemoveFlag(MessiProject.Network.GamePackets.Update.Flags.XPList);
attacker.Owner.Entity.AddFlag2(MessiProject.Network.GamePackets.Update.Flags2.BlackbeardsRage);
attacker.Owner.Entity.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;
MessiProject.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.Entity.X, attacker.Owner.Entity.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
|