ModernUO/Scripts/Spells/Sixth/Explosion.cs
asayre 2ad37d54aa Lots of fixes, changes, rewrites of various things, including but not limited to:
Logging of staff crafting items,
Fixes for the OSI client changes
The potion stacking stuff
BaseWeapon fix, so that damage increase things don't multiply themselves.
admin gump fixes for Firewall
Various display tweaks for weight
SoS no longer spawn in Tokuno
Hiryu hues happified to OSI standards
staff now see alliance chat correctly
Play barkeeper text increased per OSI
Various other OSI skill requirement changes
Various unimplemented features of the SE moves
EventSink for when the client version is received from client.
Client validation moved out of the core.
Client version validation now has options to ignore/kick/warn/annoy.  Automagically tries to detect current client.
Reverted the delayeddamagecontext back to OSI standards.
Can no longer use bags of sending in jail.

MagerySpell implemented. Now only Magery spells have a circle, and various other properties of 'em.
TransformationSpellHelper now implemented.  Things moved around for this.
Spells now need a Timespan for the cast delay, instead of arbitrarily based on Circle.  Circle doesn't make sense for non-Magery spells!
Alot of the spellweaving spells added to OSI standards.
2007-05-26 03:12:41 +00:00

131 lines
No EOL
3 KiB
C#

using System;
using Server.Targeting;
using Server.Network;
namespace Server.Spells.Sixth
{
public class ExplosionSpell : MagerySpell
{
private static SpellInfo m_Info = new SpellInfo(
"Explosion", "Vas Ort Flam",
230,
9041,
Reagent.Bloodmoss,
Reagent.MandrakeRoot
);
public override SpellCircle Circle { get { return SpellCircle.Sixth; } }
public ExplosionSpell( Mobile caster, Item scroll )
: base( caster, scroll, m_Info )
{
}
public override bool DelayedDamageStacking { get { return !Core.AOS; } }
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public override bool DelayedDamage { get { return false; } }
public void Target( Mobile m )
{
if ( !Caster.CanSee( m ) )
{
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
}
else if ( Caster.CanBeHarmful( m ) && CheckSequence() )
{
Mobile attacker = Caster, defender = m;
SpellHelper.Turn( Caster, m );
SpellHelper.CheckReflect( (int) this.Circle, Caster, ref m );
InternalTimer t = new InternalTimer( this, attacker, defender, m );
t.Start();
}
FinishSequence();
}
private class InternalTimer : Timer
{
private MagerySpell m_Spell;
private Mobile m_Target;
private Mobile m_Attacker, m_Defender;
public InternalTimer( MagerySpell spell, Mobile attacker, Mobile defender, Mobile target )
: base( TimeSpan.FromSeconds( Core.AOS ? 3.0 : 2.5 ) )
{
m_Spell = spell;
m_Attacker = attacker;
m_Defender = defender;
m_Target = target;
if ( m_Spell != null )
m_Spell.StartDelayedDamageContext( attacker, this );
Priority = TimerPriority.FiftyMS;
}
protected override void OnTick()
{
if ( m_Attacker.HarmfulCheck( m_Defender ) )
{
double damage;
if ( Core.AOS )
{
damage = m_Spell.GetNewAosDamage( 40, 1, 5, m_Defender );
}
else
{
damage = Utility.Random( 23, 22 );
if ( m_Spell.CheckResisted( m_Target ) )
{
damage *= 0.75;
m_Target.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
}
damage *= m_Spell.GetDamageScalar( m_Target );
}
m_Target.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Head );
m_Target.PlaySound( 0x307 );
SpellHelper.Damage( m_Spell, m_Target, damage, 0, 100, 0, 0, 0 );
if ( m_Spell != null )
m_Spell.RemoveDelayedDamageContext( m_Attacker );
}
}
}
private class InternalTarget : Target
{
private ExplosionSpell m_Owner;
public InternalTarget( ExplosionSpell owner )
: base( 12, false, TargetFlags.Harmful )
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
if ( o is Mobile )
m_Owner.Target( (Mobile) o );
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}