I can't seem to figure out how to fix this. super fun weapon but it does like 65k damage when you double click it then select the monster. any ideas?

using System;
using Server;
using System.Text;
using System.Collections;
using Server.Network;
using Server.Targeting;
using Server.Misc;
using Server.Spells;

namespace Server.Items
{
public class SOL : BaseRanged
{

public SkillMod m_SkillMod;


public override int LabelNumber{ get{ return 1061088; } }
public override int ArtifactRarity{ get{ return 500; } }

public override int EffectID{ get{ return 0x379F; } }
public override Type AmmoType{ get{ return typeof( Arrow ); } }
public override Item Ammo{ get{ return new Arrow(); } }

public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.LightningArrow; } }
public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.ArmorIgnore; } }

public override int AosStrengthReq{ get{ return 1000; } }
public override int AosMinDamage{ get{ return 140; } }
public override int AosMaxDamage{ get{ return 180; } }
public override int AosSpeed{ get{ return 30; } }

public override int OldStrengthReq{ get{ return 15; } }
public override int OldMinDamage{ get{ return 140; } }
public override int OldMaxDamage{ get{ return 180; } }
public override int OldSpeed{ get{ return 30; } }

public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.Bash2H; } }

public override int DefMaxRange{ get{ return 4; } }

public override int DefHitSound{ get{ return 1471; } }
public override int DefMissSound{ get{ return 522; } }


[Constructable]
public SOL() : base( 8875 )
{
Name = "<Body bgcolor=Black; text=gold><center>Reverant Storm's Staff Of Lightning";
Weight = 20.0;

Hue = 2053;
Layer = Layer.OneHanded;


Attributes.AttackChance = 100;
WeaponAttributes.HitLowerDefend = 100;

WeaponAttributes.HitLeechHits = 100;
WeaponAttributes.HitLightning = 100;
WeaponAttributes.HitFireball = 100;

WeaponAttributes.HitLeechMana = 90;
WeaponAttributes.HitLeechHits = 90;
WeaponAttributes.HitLeechStam = 90;

Attributes.SpellDamage = 100;
Attributes.SpellChanneling = 1;
Attributes.CastRecovery = 15;

Attributes.CastSpeed = 25;
Attributes.Luck = 1500;
Attributes.BonusStr = 105;

Attributes.BonusHits = 100;
Attributes.BonusDex = 100;
Attributes.WeaponDamage = 80;

Attributes.RegenHits = 100;
Attributes.DefendChance = 100;
WeaponAttributes.HitLowerAttack = 100;
}

public override void GetDamageTypes( Mobile weilder, out int phys, out int fire, out int cold, out int pois, out int nrgy )
{
phys = 0;
fire = 15;
pois = 15;
cold = 15;
nrgy = 150;
}

public override void OnHit(Mobile attacker, Mobile defender)
{
// defender.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
defender.BoltEffect( 0 );
base.OnHit(attacker, defender);
}

public override bool OnEquip( Mobile m )
{
base.OnEquip( m );
m_SkillMod = new DefaultSkillMod( SkillName.Archery, true, 50 );
m.AddSkillMod(m_SkillMod );
return true;
}

public override void OnRemoved( object parent )
{
base.OnRemoved( parent );

if ( m_SkillMod != null )
m_SkillMod.Remove();

}

private bool CheckUse( Mobile from )
{
if ( !this.IsAccessibleTo( from ) )
return false;

if ( from.Map != this.Map || !from.InRange( GetWorldLocation(), 12 ) )
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
return false;
}

if ( !from.CanBeginAction( typeof( SOL ) ) )
{
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, /*Hue->*/1174, 3, "", "You cannot invoke the power of this staff just yet." ) );
return false;
}
return true;
}

public override void OnDoubleClick( Mobile from )
{
if ( CheckUse( from ) )
{
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, /*Hue->*/1174, 3, "", "Who shall feel the wrath of your storm?" ) );
from.Target = new InternalTarget( this );
}
}

public void Use( Mobile from, IPoint3D loc )
{
if ( !CheckUse( from ) )
return;

from.BeginAction( typeof( SOL ) );
Timer.DelayCall( Core.AOS ? TimeSpan.FromSeconds( 10.0 ) : TimeSpan.FromSeconds( 10.0 ), new TimerStateCallback( EndAction ), from );

int music = from.Skills[SkillName.Musicianship].Fixed;

int sucChance = 500 + ( music - 775 ) * 2;
double dSucChance = ((double)sucChance) / 1000.0;

if ( !from.CheckSkill( SkillName.Musicianship, dSucChance ) )
{
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, /*Hue->*/1174, 3, "", "Your attempt to invoke a storm has failed." ) );

from.PlaySound( 0x18A );
return;
}

from.PlaySound( 756 );
Effects.SendPacket( from, from.Map, new HuedEffect( EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, /*Hue ->*/1174, 0 ) );

ArrayList targets = new ArrayList();
bool playerVsPlayer = false;

IPooledEnumerable eable = from.Map.GetMobilesInRange( new Point3D( loc ), 12 );

foreach ( Mobile m in eable )
{
if ( from != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) )
{
if ( Core.AOS && !from.InLOS( m ) )
continue;

targets.Add( m );

if ( m.Player )
playerVsPlayer = true;
}
}

eable.Free();

if ( targets.Count > 0 )
{
int prov = from.Skills[SkillName.Provocation].Fixed;
int disc = from.Skills[SkillName.Discordance].Fixed;
int peace = from.Skills[SkillName.Peacemaking].Fixed;

int minDamage, maxDamage;

if ( Core.AOS )
{
int musicScaled = music + Math.Max( 0, music - 900 ) * 18;
int provScaled = prov + Math.Max( 0, prov - 900 ) * 18;
int discScaled = disc + Math.Max( 0, disc - 900 ) * 18;
int peaceScaled = peace + Math.Max( 0, peace - 900 ) * 18;

int weightAvg = ( musicScaled + provScaled * 300 + discScaled * 300 + peaceScaled ) / 2;

int avgDamage;
if ( playerVsPlayer )
avgDamage = 0;
else
avgDamage = weightAvg / 2;

minDamage = ( avgDamage * 20 ) / 3;
maxDamage = ( avgDamage * 40 ) / 2;
}
else
{
int total = prov + disc / 5 + peace / 5;

if ( playerVsPlayer )
total /= 1;

maxDamage = ( total * 20 ) / 30;
minDamage = ( maxDamage * 40 ) / 10;
}

double damage = Utility.RandomMinMax( minDamage, maxDamage );

if ( Core.AOS && targets.Count > 1 )
damage = (damage * 125) / targets.Count;
else if ( !Core.AOS )
damage /= targets.Count;

for ( int i = 0; i < targets.Count; ++i )
{
Mobile m = (Mobile)targets;

double toDeal = damage;

if ( !Core.AOS && m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 ) )
{
toDeal *= 0.5;
m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
}

from.DoHarmful( m );
SpellHelper.Damage( TimeSpan.Zero, m, from, toDeal, 0, 0, 0, 0, 100 );

Effects.SendBoltEffect( m,true,0);
}
}
}

private static void EndAction( object state )
{
Mobile m = (Mobile) state;

m.EndAction( typeof( SOL ) );
}

private class InternalTarget : Target
{
private SOL m_Storm;

public InternalTarget( SOL storm ) : base( Core.AOS ? 3 : 2, true, TargetFlags.Harmful )
{
m_Storm = storm;
}

protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Storm.Deleted )
return;

IPoint3D loc;
if ( targeted is Item )
loc = ((Item)targeted).GetWorldLocation();
else
loc = targeted as IPoint3D;

m_Storm.Use( from, loc );
}
}

public SOL( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 );
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
}
}
}
 

Attachments

  • SOL.cs
    8.1 KB · Views: 2
That would be here..
Code:
public override int AosStrengthReq{ get{ return 1000; } }
public override int AosMinDamage{ get{ return 140; } }
public override int AosMaxDamage{ get{ return 180; } }
public override int AosSpeed{ get{ return 30; } }

public override int OldStrengthReq{ get{ return 15; } }
public override int OldMinDamage{ get{ return 140; } }
public override int OldMaxDamage{ get{ return 180; } }
public override int OldSpeed{ get{ return 30; } }
Your Min & Max damage are extremely high and when combined with a 1000 str req, its no wonder it does so much damage. Also, in the future, when posting the script coding, please the code tags. See the little + in a box up top of where you type? Click on that & select code. Then just paste the coding into that. Makes it much easier to read if we can just scroll the code & not the entire page. :)
 
Sorry! haha I will make sure to do that and thank you ill see if I can fix it now
[doublepost=1486543854][/doublepost]I dropped it waaaaaaaay down, still hitting over 50k =/
 
Code:
using System;
using Server;
using System.Text;
using System.Collections;
using Server.Network;
using Server.Targeting;
using Server.Misc;
using Server.Spells;

namespace Server.Items
{
    public class SOL : BaseRanged
    {

        public SkillMod m_SkillMod;


        public override int LabelNumber{ get{ return 1061088; } }
        public override int ArtifactRarity{ get{ return 500; } }

        public override int EffectID{ get{ return 0x379F; } }
        public override Type AmmoType{ get{ return typeof( Arrow ); } }
        public override Item Ammo{ get{ return new Arrow(); } }

        public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.LightningArrow; } }
        public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.ArmorIgnore; } }

        public override int AosStrengthReq{ get{ return 250; } }
        public override int AosMinDamage{ get{ return 100; } }
        public override int AosMaxDamage{ get{ return 140; } }
        public override int AosSpeed{ get{ return 30; } }

        public override int OldStrengthReq{ get{ return 15; } }
        public override int OldMinDamage{ get{ return 100; } }
        public override int OldMaxDamage{ get{ return 140; } }
        public override int OldSpeed{ get{ return 30; } }

        public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.Bash2H; } }
       
        public override int DefMaxRange{ get{ return 4; } }

        public override int DefHitSound{ get{ return 1471; } }
        public override int DefMissSound{ get{ return 522; } }


        [Constructable]
        public SOL() : base( 8875 )
        {
            Name = "<Body bgcolor=Black; text=gold><center>Reverant Storm's Staff Of Lightning";
            Weight = 20.0;

            Hue = 2053;
            Layer = Layer.OneHanded;


            Attributes.AttackChance = 100;
            WeaponAttributes.HitLowerDefend = 100;

            WeaponAttributes.HitLeechHits = 100;
            WeaponAttributes.HitLightning = 100;
            WeaponAttributes.HitFireball = 100;

            WeaponAttributes.HitLeechMana = 90;
            WeaponAttributes.HitLeechHits = 90;
            WeaponAttributes.HitLeechStam = 90;

            Attributes.SpellDamage = 100;
            Attributes.SpellChanneling = 1;
            Attributes.CastRecovery = 15;

            Attributes.CastSpeed = 25;
            Attributes.Luck = 1500;
            Attributes.BonusStr = 105;

            Attributes.BonusHits = 100;
            Attributes.BonusDex = 100;
            Attributes.WeaponDamage = 80;

            Attributes.RegenHits = 100;
            Attributes.DefendChance = 100;
            WeaponAttributes.HitLowerAttack = 100;
        }

public override void GetDamageTypes( Mobile weilder, out int phys, out int fire, out int cold, out int pois, out int nrgy )
        {
            phys = 0;
            fire = 15;
            pois = 15;
            cold = 15;
            nrgy = 150;
        }

        public override void OnHit(Mobile attacker, Mobile defender)
        {
            // defender.FixedParticles(  0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
            defender.BoltEffect( 0 );
            base.OnHit(attacker, defender);
        }

        public override bool OnEquip( Mobile m )
        {
            base.OnEquip( m );
            m_SkillMod = new DefaultSkillMod( SkillName.Archery, true, 50 );
            m.AddSkillMod(m_SkillMod );
            return true;
        }

        public override void OnRemoved( object parent )
        {
            base.OnRemoved( parent );

            if ( m_SkillMod != null )
            m_SkillMod.Remove();

        }

        private bool CheckUse( Mobile from )
        {
            if ( !this.IsAccessibleTo( from ) )
                return false;

            if ( from.Map != this.Map || !from.InRange( GetWorldLocation(), 12 ) )
            {
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
                return false;
            }

            if ( !from.CanBeginAction( typeof( SOL ) ) )
            {
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, /*Hue->*/1174, 3, "", "You cannot invoke the power of this staff just yet." ) );
                return false;
            }
            return true;
        }

        public override void OnDoubleClick( Mobile from )
        {
            if ( CheckUse( from ) )
            {
    from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, /*Hue->*/1174, 3, "", "Who shall feel the wrath of your storm?" ) );
                                from.Target = new InternalTarget( this );
            }
        }

        public void Use( Mobile from, IPoint3D loc )
        {
            if ( !CheckUse( from ) )
                return;

            from.BeginAction( typeof( SOL ) );
            Timer.DelayCall( Core.AOS ? TimeSpan.FromSeconds( 10.0 ) : TimeSpan.FromSeconds( 10.0 ), new TimerStateCallback( EndAction ), from );

            int music = from.Skills[SkillName.Musicianship].Fixed;

            int sucChance = 500 + ( music - 775 ) * 2;
            double dSucChance = ((double)sucChance) / 1000.0;

            if ( !from.CheckSkill( SkillName.Musicianship, dSucChance ) )
            {
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, /*Hue->*/1174, 3, "", "Your attempt to invoke a storm has failed." ) );

                from.PlaySound( 0x18A );
                return;
            }

            from.PlaySound( 756 );
            Effects.SendPacket( from, from.Map, new HuedEffect( EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, /*Hue ->*/1174, 0 ) );

            ArrayList targets = new ArrayList();
            bool playerVsPlayer = false;

            IPooledEnumerable eable = from.Map.GetMobilesInRange( new Point3D( loc ), 12 );

            foreach ( Mobile m in eable )
            {
                if ( from != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) )
                {
                    if ( Core.AOS && !from.InLOS( m ) )
                        continue;

                    targets.Add( m );

                    if ( m.Player )
                        playerVsPlayer = true;
                }
            }

            eable.Free();

            if ( targets.Count > 0 )
            {
                int prov = from.Skills[SkillName.Provocation].Fixed;
                int disc = from.Skills[SkillName.Discordance].Fixed;
                int peace = from.Skills[SkillName.Peacemaking].Fixed;

                int minDamage, maxDamage;

                if ( Core.AOS )
                {
                    int musicScaled = music + Math.Max( 0, music - 100 ) * 3;
                    int provScaled = prov + Math.Max( 0, prov - 100 ) * 3;
                    int discScaled = disc + Math.Max( 0, disc - 100 ) * 3;
                    int peaceScaled = peace + Math.Max( 0, peace - 100 ) * 3;

                    int weightAvg = ( musicScaled + provScaled * 10 + discScaled * 10 + peaceScaled ) / 2;

                    int avgDamage;
                    if ( playerVsPlayer )
                        avgDamage = 0;
                    else
                        avgDamage = weightAvg / 2;

                    minDamage = ( avgDamage * 3 ) / 3;
                    maxDamage = ( avgDamage * 8 ) / 2;
                }
                else
                {
                    int total = prov + disc / 5 + peace / 5;

                    if ( playerVsPlayer )
                        total /= 1;

                    maxDamage = ( total * 6 ) / 30;
                    minDamage = ( maxDamage * 15 ) / 10;
                }

                double damage = Utility.RandomMinMax( minDamage, maxDamage );

                if ( Core.AOS && targets.Count > 1 )
                    damage = (damage * 16) / targets.Count;
                else if ( !Core.AOS )
                    damage /= targets.Count;

                for ( int i = 0; i < targets.Count; ++i )
                {
                    Mobile m = (Mobile)targets[i];

                    double toDeal = damage;

                    if ( !Core.AOS && m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 ) )
                    {
                        toDeal *= 0.5;
                        m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
                    }

                    from.DoHarmful( m );
                    SpellHelper.Damage( TimeSpan.Zero, m, from, toDeal, 0, 0, 0, 0, 100 );

                    Effects.SendBoltEffect( m,true,0);
                }
            }
        }

        private static void EndAction( object state )
        {
            Mobile m = (Mobile) state;

            m.EndAction( typeof( SOL ) );
        }

        private class InternalTarget : Target
        {
            private SOL m_Storm;

            public InternalTarget( SOL storm ) : base( Core.AOS ? 3 : 2, true, TargetFlags.Harmful )
            {
                m_Storm = storm;
            }

            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( m_Storm.Deleted )
                    return;

                IPoint3D loc;
                if ( targeted is Item )
                    loc = ((Item)targeted).GetWorldLocation();
                else
                    loc = targeted as IPoint3D;

                m_Storm.Use( from, loc );
            }
        }

        public SOL( Serial serial ) : base( serial )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }
}
 
Ok, 200 str + 105 bonus str + 140 damage + 80% weapon damage increase + 190 total leech hits + 100 hit lightning + 100 hit fireball + 90 hit stam + your damage types are out of whack. Those should only equal 100 total not 195. That's why its hitting so hard. The rather unrealistic bonuses & damages.
 
Well I thought the issue was from the double click calced damaged?

Are you using AOS or an higher expansion? If so I would check how much min and maxdamage you are calculating there? Since you have a lot of multiplicators there it kind of scales fast.
 
So lets try to calc it with 100 all skills, and I think the skill values get returned as 1000 in that case not 100.0
for AOS
musicScaled = 1000+ (900 * 3) = 3700, that for each skills.
weightAvg = 40700;
avgDamage = 20350;
minDamage = 20350;
maxDamage = 81400;

*had a mistake there :p

Does that seem familiar?

for non Aos
total = 1400
maxDamage = 280
minDamage = 420
 
Last edited:
So lets try to calc it with 100 all skills, and I think the skill values get returned as 1000 in that case not 100.0
for AOS
musicScaled = 1000+ (900 * 3) = 12700, that for each skills.
weightAvg = 139700;
avgDamage = 69850;
minDamage = 69850;
maxDamage = 279600;

Does that seem familiar?

for non Aos
total = 1400
maxDamage = 280
minDamage = 420

I'm going to toy around with those and change it up I just do not see the musicScaled = 1000 then 900 * 3
This is the code now after dumbing it down a TON. I'm trying to make it so the use on click does like 6-15k damage on use


Code:
using System;
using Server;
using System.Text;
using System.Collections;
using Server.Network;
using Server.Targeting;
using Server.Misc;
using Server.Spells;

namespace Server.Items
{
    public class SOL : BaseRanged
    {

        public SkillMod m_SkillMod;


        public override int LabelNumber{ get{ return 1061088; } }
        public override int ArtifactRarity{ get{ return 500; } }

        public override int EffectID{ get{ return 0x379F; } }
        public override Type AmmoType{ get{ return typeof( Arrow ); } }
        public override Item Ammo{ get{ return new Arrow(); } }

        public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.LightningArrow; } }
        public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.ArmorIgnore; } }

        public override int AosStrengthReq{ get{ return 250; } }
        public override int AosMinDamage{ get{ return 100; } }
        public override int AosMaxDamage{ get{ return 140; } }
        public override int AosSpeed{ get{ return 30; } }

        public override int OldStrengthReq{ get{ return 15; } }
        public override int OldMinDamage{ get{ return 100; } }
        public override int OldMaxDamage{ get{ return 140; } }
        public override int OldSpeed{ get{ return 30; } }

        public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.Bash2H; } }
       
        public override int DefMaxRange{ get{ return 4; } }

        public override int DefHitSound{ get{ return 1471; } }
        public override int DefMissSound{ get{ return 522; } }


        [Constructable]
        public SOL() : base( 8875 )
        {
            Name = "<Body bgcolor=Black; text=gold><center>Reverant Storm's Staff Of Lightning";
            Weight = 20.0;

            Hue = 2053;
            Layer = Layer.OneHanded;


            Attributes.AttackChance = 100;
            WeaponAttributes.HitLowerDefend = 100;

            WeaponAttributes.HitLeechHits = 100;
            WeaponAttributes.HitLightning = 100;
            WeaponAttributes.HitFireball = 100;

            WeaponAttributes.HitLeechMana = 90;
            WeaponAttributes.HitLeechHits = 90;
            WeaponAttributes.HitLeechStam = 90;

            Attributes.SpellDamage = 100;
            Attributes.SpellChanneling = 1;
            Attributes.CastRecovery = 15;

            Attributes.CastSpeed = 25;
            Attributes.Luck = 1500;
            Attributes.BonusStr = 105;

            Attributes.BonusHits = 100;
            Attributes.BonusDex = 100;
            Attributes.WeaponDamage = 80;

            Attributes.RegenHits = 100;
            Attributes.DefendChance = 100;
            WeaponAttributes.HitLowerAttack = 100;
        }

public override void GetDamageTypes( Mobile weilder, out int phys, out int fire, out int cold, out int pois, out int nrgy )
        {
            phys = 0;
            fire = 15;
            pois = 15;
            cold = 15;
            nrgy = 150;
        }

        public override void OnHit(Mobile attacker, Mobile defender)
        {
            // defender.FixedParticles(  0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
            defender.BoltEffect( 0 );
            base.OnHit(attacker, defender);
        }

        public override bool OnEquip( Mobile m )
        {
            base.OnEquip( m );
            m_SkillMod = new DefaultSkillMod( SkillName.Archery, true, 50 );
            m.AddSkillMod(m_SkillMod );
            return true;
        }

        public override void OnRemoved( object parent )
        {
            base.OnRemoved( parent );

            if ( m_SkillMod != null )
            m_SkillMod.Remove();

        }

        private bool CheckUse( Mobile from )
        {
            if ( !this.IsAccessibleTo( from ) )
                return false;

            if ( from.Map != this.Map || !from.InRange( GetWorldLocation(), 12 ) )
            {
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
                return false;
            }

            if ( !from.CanBeginAction( typeof( SOL ) ) )
            {
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, /*Hue->*/1174, 3, "", "You cannot invoke the power of this staff just yet." ) );
                return false;
            }
            return true;
        }

        public override void OnDoubleClick( Mobile from )
        {
            if ( CheckUse( from ) )
            {
    from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, /*Hue->*/1174, 3, "", "Who shall feel the wrath of your storm?" ) );
                                from.Target = new InternalTarget( this );
            }
        }

        public void Use( Mobile from, IPoint3D loc )
        {
            if ( !CheckUse( from ) )
                return;

            from.BeginAction( typeof( SOL ) );
            Timer.DelayCall( Core.AOS ? TimeSpan.FromSeconds( 10.0 ) : TimeSpan.FromSeconds( 10.0 ), new TimerStateCallback( EndAction ), from );

            int music = from.Skills[SkillName.Musicianship].Fixed;

            int sucChance = 500 + ( music - 775 ) * 2;
            double dSucChance = ((double)sucChance) / 1000.0;

            if ( !from.CheckSkill( SkillName.Musicianship, dSucChance ) )
            {
from.Send( new AsciiMessage( this.Serial, this.ItemID, MessageType.Regular, /*Hue->*/1174, 3, "", "Your attempt to invoke a storm has failed." ) );

                from.PlaySound( 0x18A );
                return;
            }

            from.PlaySound( 756 );
            Effects.SendPacket( from, from.Map, new HuedEffect( EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, /*Hue ->*/1174, 0 ) );

            ArrayList targets = new ArrayList();
            bool playerVsPlayer = false;

            IPooledEnumerable eable = from.Map.GetMobilesInRange( new Point3D( loc ), 12 );

            foreach ( Mobile m in eable )
            {
                if ( from != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) )
                {
                    if ( Core.AOS && !from.InLOS( m ) )
                        continue;

                    targets.Add( m );

                    if ( m.Player )
                        playerVsPlayer = true;
                }
            }

            eable.Free();

            if ( targets.Count > 0 )
            {
                int prov = from.Skills[SkillName.Provocation].Fixed;
                int disc = from.Skills[SkillName.Discordance].Fixed;
                int peace = from.Skills[SkillName.Peacemaking].Fixed;

                int minDamage, maxDamage;

                if ( Core.AOS )
                {
                    int musicScaled = music + Math.Max( 0, music - 12 ) * 3;
                    int provScaled = prov + Math.Max( 0, prov - 12 ) * 3;
                    int discScaled = disc + Math.Max( 0, disc - 12 ) * 3;
                    int peaceScaled = peace + Math.Max( 0, peace - 12 ) * 3;

                    int weightAvg = ( musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled ) / 2;

                    int avgDamage;
                    if ( playerVsPlayer )
                        avgDamage = 0;
                    else
                        avgDamage = weightAvg / 2;

                    minDamage = ( avgDamage * 2 ) / 3;
                    maxDamage = ( avgDamage * 3 ) / 2;
                }
                else
                {
                    int total = prov + disc / 5 + peace / 5;

                    if ( playerVsPlayer )
                        total /= 1;

                    maxDamage = ( total * 2 ) / 30;
                    minDamage = ( maxDamage * 3 ) / 10;
                }

                double damage = Utility.RandomMinMax( minDamage, maxDamage );

                if ( Core.AOS && targets.Count > 1 )
                    damage = (damage * 3) / targets.Count;
                else if ( !Core.AOS )
                    damage /= targets.Count;

                for ( int i = 0; i < targets.Count; ++i )
                {
                    Mobile m = (Mobile)targets[i];

                    double toDeal = damage;

                    if ( !Core.AOS && m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 ) )
                    {
                        toDeal *= 0.5;
                        m.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
                    }

                    from.DoHarmful( m );
                    SpellHelper.Damage( TimeSpan.Zero, m, from, toDeal, 0, 0, 0, 0, 100 );

                    Effects.SendBoltEffect( m,true,0);
                }
            }
        }

        private static void EndAction( object state )
        {
            Mobile m = (Mobile) state;

            m.EndAction( typeof( SOL ) );
        }

        private class InternalTarget : Target
        {
            private SOL m_Storm;

            public InternalTarget( SOL storm ) : base( Core.AOS ? 3 : 2, true, TargetFlags.Harmful )
            {
                m_Storm = storm;
            }

            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( m_Storm.Deleted )
                    return;

                IPoint3D loc;
                if ( targeted is Item )
                    loc = ((Item)targeted).GetWorldLocation();
                else
                    loc = targeted as IPoint3D;

                m_Storm.Use( from, loc );
            }
        }

        public SOL( Serial serial ) : base( serial )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }
}
 
It would be the best if you either calculate the min and max damage for like 100% skill yourself based on your formula or to simply let it return to the console. That would help you seeing where you scale too much and all that your current one should be going into the right direction
 
Back