chris1212
Member
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();
}
}
}
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();
}
}
}