Can someone englighten me here about the scatter issue. When i scatter on huge spawn i get dced..
Heres the code:
Code:
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.Player)
{
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);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, damage, spell);
suse.Targets.Add(attacked.UID, damage);
}
}
}
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, null);
suse.Targets.Add(attackedsob.UID, damage);
}
}
}
}
attacker.Owner.SendScreen(suse, true);
}
break;
}






