using System;
using System.Collections;
using Server.Network;
using Server.Items;
using Server.Targeting;
using Server.Regions;
using Server.Guilds;
using Server.Mobiles;
namespace Server.Spells.Seventh
{
public class ChainLightningSpell : MagerySpell
{
public override SpellCircle Circle { get { return SpellCircle.Seventh; } }
public override int Sound { get { return 0x29; } }
private static readonly SpellInfo m_Info = new SpellInfo(
"Chain Lightning", "Vas Ort Grav",
263,
9022,
true,
Reagent.BlackPearl,
Reagent.Bloodmoss,
Reagent.MandrakeRoot,
Reagent.SulfurousAsh
);
public ChainLightningSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override double GetResistPercent( Mobile target )
{
return 10.0;
}
public override void OnCast()
{
if(Caster is PlayerMobile)
Target( (IPoint3D)SphereSpellTarget );
else
Caster.Target = new InternalTarget( this );
}
public override bool DelayedDamage{ get{ return true; } }
public void Target( IPoint3D p)
{
if ( !Caster.CanSee( p ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( /*SpellHelper.CheckTown( p, Caster ) && */CheckSequence() )
{
SpellHelper.Turn( Caster, p );
if ( p is Item )
p = ((Item)p).GetWorldLocation();
ArrayList targets = new ArrayList();
Map map = Caster.Map;
bool playerVsPlayer = false;
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 5 );
foreach ( Mobile m in eable )
{
targets.Add( m );
if ( m.Player )
playerVsPlayer = true;
}
eable.Free();
}
double damage;
if ( Core.AOS )
damage = GetNewAosDamage( 48, 1, 5, Caster.Player && playerVsPlayer );
else
damage = Utility.Random( 32, 35 );
if ( targets.Count > 0 )
{
if ( Core.AOS && targets.Count > 1 )
damage = (damage * 2) / targets.Count;
else if ( !Core.AOS )
damage /= targets.Count;
for ( int i = 0; i < targets.Count; ++i )
{
Mobile m = (Mobile)targets[i];
Region house = m.Region;
double toDeal = damage;
/* if ( !Core.AOS && CheckResisted( m ) )
{
toDeal *= 0.5;
m.SendAsciiMessage(93,"You resist the Spell");
damage = (int)(damage * 0.7);
}*/
if( !(house is Regions.HouseRegion) )
{
Caster.DoHarmful( m );
Guild guild = Caster.Guild as Guild;
if (guild != null && Caster is PlayerMobile)
{
switch (Caster.Guild.Type)
{
case GuildType.Chaos: damage += 2; break;
case GuildType.Order: damage += 2; break;
}
}
SpellHelper.Damage( this, m, toDeal, 0, 0, 0, 0, 100 );
m.BoltEffect( 0 );
}
}
}
}
FinishSequence();
}
private class InternalTarget : Target
{
private ChainLightningSpell m_Owner;
public InternalTarget( ChainLightningSpell owner ) : base( 12, true, TargetFlags.Harmful )
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
IPoint3D p = o as IPoint3D;
if ( p != null )
m_Owner.Target( p );
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}
using System;
using System.Collections;
using Server.Network;
using Server.Items;
using Server.Targeting;
using Server.Regions;
using Server.Guilds;
using Server.Mobiles;
namespace Server.Spells.Seventh
{
public class ChainLightningSpell : MagerySpell
{
public override SpellCircle Circle { get { return SpellCircle.Seventh; } }
public override int Sound { get { return 0x29; } }
private static readonly SpellInfo m_Info = new SpellInfo(
"Chain Lightning", "Vas Ort Grav",
263,
9022,
true,
Reagent.BlackPearl,
Reagent.Bloodmoss,
Reagent.MandrakeRoot,
Reagent.SulfurousAsh
);
public ChainLightningSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override double GetResistPercent( Mobile target )
{
return 10.0;
}
public override void OnCast()
{
if(Caster is PlayerMobile)
Target( (IPoint3D)SphereSpellTarget );
else
Caster.Target = new InternalTarget( this );
}
public override bool DelayedDamage{ get{ return true; } }
public void Target( IPoint3D p)
{
if ( !Caster.CanSee( p ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( /*SpellHelper.CheckTown( p, Caster ) && */CheckSequence() )
{
SpellHelper.Turn( Caster, p );
if ( p is Item )
p = ((Item)p).GetWorldLocation();
ArrayList targets = new ArrayList();
Map map = Caster.Map;
bool playerVsPlayer = false;
if ( map != null )
{
IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 5 );
foreach ( Mobile m in eable )
{
if (m == null || m == Caster)
continue;
targets.Add( m );
if ( m.Player )
playerVsPlayer = true;
}
eable.Free();
}
double damage;
if ( Core.AOS )
damage = GetNewAosDamage( 48, 1, 5, Caster.Player && playerVsPlayer );
else
damage = Utility.Random( 32, 35 );
if ( targets.Count > 0 )
{
if ( Core.AOS && targets.Count > 1 )
damage = (damage * 2) / targets.Count;
else if ( !Core.AOS )
damage /= targets.Count;
for ( int i = 0; i < targets.Count; ++i )
{
Mobile m = (Mobile)targets[i];
Region house = m.Region;
double toDeal = damage;
/* if ( !Core.AOS && CheckResisted( m ) )
{
toDeal *= 0.5;
m.SendAsciiMessage(93,"You resist the Spell");
damage = (int)(damage * 0.7);
}*/
if( !(house is Regions.HouseRegion) )
{
Caster.DoHarmful( m );
Guild guild = Caster.Guild as Guild;
if (guild != null && Caster is PlayerMobile)
{
switch (Caster.Guild.Type)
{
case GuildType.Chaos: damage += 2; break;
case GuildType.Order: damage += 2; break;
}
}
SpellHelper.Damage( this, m, toDeal, 0, 0, 0, 0, 100 );
m.BoltEffect( 0 );
}
}
}
}
FinishSequence();
}
private class InternalTarget : Target
{
private ChainLightningSpell m_Owner;
public InternalTarget( ChainLightningSpell owner ) : base( 12, true, TargetFlags.Harmful )
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
IPoint3D p = o as IPoint3D;
if ( p != null )
m_Owner.Target( p );
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}
+ Spells/Seventh/ChainLightning.cs:
CS0103: Line 78: The name 'id' does not exist in the current context
CS0103: Line 78: The name 'id' does not exist in the current context
CS0103: Line 78: The name 'id' does not exist in the current context
We use essential cookies to make this site work, and optional cookies to enhance your experience.