This is my current code:
Code:
case 10490:
{
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 (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
{
if (attackedsob != null)
{
if (CanAttack(attacker, attackedsob, spell))
{
PrepareSpell(spell, attacker.Owner);
for (int count = 0; count < 4; count++)
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Math.Max(1, Calculate.Melee(attacker, attackedsob, ref attack) / 3);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attackedsob, attack, damage, spell);
suse.AddTarget(attackedsob.UID, damage, attack);
attacker.Owner.SendScreen(suse, true);
}
}
}
else
{
if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
{
PrepareSpell(spell, attacker.Owner);
for (int count = 0; count < 4; count++)
{
attack.Effect1 = Attack.AttackEffects1.None;
uint damage = Math.Max(1, Calculate.Melee(attacker, attackedsob, ref attack) / 3);
suse.Effect1 = attack.Effect1;
ReceiveAttack(attacker, attacked, attack, damage, spell);
suse.AddTarget(attacked.UID, damage, attack);
attacker.Owner.SendScreen(suse, true);
if (attacked.Dead) break;
}
}
}
attacker.AttackPacket = null;
}
else
{
attacker.AttackPacket = null;
}
}
attacker.AttackPacket = null;
break;
}






