Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -4,181 +4,175 @@ using Server.Targeting;
|
|||
|
||||
namespace Server.Spells.Spellweaving
|
||||
{
|
||||
public class GiftOfRenewalSpell : ArcanistSpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Gift of Renewal", "Olorisstra",
|
||||
-1
|
||||
);
|
||||
public class GiftOfRenewalSpell : ArcanistSpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Gift of Renewal", "Olorisstra",
|
||||
-1
|
||||
);
|
||||
|
||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds( 3.0 );
|
||||
private static Dictionary<Mobile, GiftOfRenewalInfo> m_Table = new Dictionary<Mobile, GiftOfRenewalInfo>();
|
||||
|
||||
public override double RequiredSkill => 0.0;
|
||||
public override int RequiredMana => 24;
|
||||
public GiftOfRenewalSpell(Mobile caster, Item scroll)
|
||||
: base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public GiftOfRenewalSpell( Mobile caster, Item scroll )
|
||||
: base( caster, scroll, m_Info )
|
||||
{
|
||||
}
|
||||
public override TimeSpan CastDelayBase => TimeSpan.FromSeconds(3.0);
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget( this );
|
||||
}
|
||||
public override double RequiredSkill => 0.0;
|
||||
public override int RequiredMana => 24;
|
||||
|
||||
public void Target( Mobile m )
|
||||
{
|
||||
if ( !Caster.CanSee( m ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
|
||||
}
|
||||
if ( m_Table.ContainsKey( m ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 501775 ); // This spell is already in effect.
|
||||
}
|
||||
else if ( !Caster.CanBeginAction( typeof( GiftOfRenewalSpell ) ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 501789 ); // You must wait before trying again.
|
||||
}
|
||||
else if ( CheckBSequence( m ) )
|
||||
{
|
||||
SpellHelper.Turn( Caster, m );
|
||||
public override void OnCast()
|
||||
{
|
||||
Caster.Target = new InternalTarget(this);
|
||||
}
|
||||
|
||||
Caster.FixedEffect( 0x374A, 10, 20 );
|
||||
Caster.PlaySound( 0x5C9 );
|
||||
public void Target(Mobile m)
|
||||
{
|
||||
if (!Caster.CanSee(m)) Caster.SendLocalizedMessage(500237); // Target can not be seen.
|
||||
if (m_Table.ContainsKey(m))
|
||||
{
|
||||
Caster.SendLocalizedMessage(501775); // This spell is already in effect.
|
||||
}
|
||||
else if (!Caster.CanBeginAction(typeof(GiftOfRenewalSpell)))
|
||||
{
|
||||
Caster.SendLocalizedMessage(501789); // You must wait before trying again.
|
||||
}
|
||||
else if (CheckBSequence(m))
|
||||
{
|
||||
SpellHelper.Turn(Caster, m);
|
||||
|
||||
if ( m.Poisoned )
|
||||
{
|
||||
m.CurePoison( m );
|
||||
}
|
||||
else
|
||||
{
|
||||
double skill = Caster.Skills[SkillName.Spellweaving].Value;
|
||||
Caster.FixedEffect(0x374A, 10, 20);
|
||||
Caster.PlaySound(0x5C9);
|
||||
|
||||
int hitsPerRound = 5 + (int)(skill / 24) + FocusLevel;
|
||||
TimeSpan duration = TimeSpan.FromSeconds( 30 + (FocusLevel * 10) );
|
||||
if (m.Poisoned)
|
||||
{
|
||||
m.CurePoison(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
double skill = Caster.Skills[SkillName.Spellweaving].Value;
|
||||
|
||||
GiftOfRenewalInfo info = new GiftOfRenewalInfo( Caster, m, hitsPerRound );
|
||||
int hitsPerRound = 5 + (int)(skill / 24) + FocusLevel;
|
||||
TimeSpan duration = TimeSpan.FromSeconds(30 + FocusLevel * 10);
|
||||
|
||||
Timer.DelayCall( duration,
|
||||
delegate
|
||||
{
|
||||
if ( StopEffect( m ) )
|
||||
{
|
||||
m.PlaySound( 0x455 );
|
||||
m.SendLocalizedMessage( 1075071 ); // The Gift of Renewal has faded.
|
||||
}
|
||||
} );
|
||||
GiftOfRenewalInfo info = new GiftOfRenewalInfo(Caster, m, hitsPerRound);
|
||||
|
||||
Timer.DelayCall(duration,
|
||||
delegate
|
||||
{
|
||||
if (StopEffect(m))
|
||||
{
|
||||
m.PlaySound(0x455);
|
||||
m.SendLocalizedMessage(1075071); // The Gift of Renewal has faded.
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
m_Table[m] = info;
|
||||
|
||||
m_Table[m] = info;
|
||||
Caster.BeginAction(typeof(GiftOfRenewalSpell));
|
||||
|
||||
Caster.BeginAction( typeof( GiftOfRenewalSpell ) );
|
||||
BuffInfo.AddBuff(m,
|
||||
new BuffInfo(BuffIcon.GiftOfRenewal, 1031602, 1075797, duration, m, hitsPerRound.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.GiftOfRenewal, 1031602, 1075797, duration, m, hitsPerRound.ToString() ) );
|
||||
}
|
||||
}
|
||||
FinishSequence();
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
public static bool StopEffect(Mobile m)
|
||||
{
|
||||
if (m_Table.TryGetValue(m, out GiftOfRenewalInfo info))
|
||||
{
|
||||
m_Table.Remove(m);
|
||||
|
||||
private static Dictionary<Mobile, GiftOfRenewalInfo> m_Table = new Dictionary<Mobile, GiftOfRenewalInfo>();
|
||||
info.m_Timer.Stop();
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.GiftOfRenewal);
|
||||
|
||||
private class GiftOfRenewalInfo
|
||||
{
|
||||
public Mobile m_Caster;
|
||||
public Mobile m_Mobile;
|
||||
public int m_HitsPerRound;
|
||||
public InternalTimer m_Timer;
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(60), delegate { info.m_Caster.EndAction(typeof(GiftOfRenewalSpell)); });
|
||||
|
||||
public GiftOfRenewalInfo( Mobile caster, Mobile mobile, int hitsPerRound )
|
||||
{
|
||||
m_Caster = caster;
|
||||
m_Mobile = mobile;
|
||||
m_HitsPerRound = hitsPerRound;
|
||||
return true;
|
||||
}
|
||||
|
||||
m_Timer = new InternalTimer( this );
|
||||
m_Timer.Start();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
public GiftOfRenewalInfo m_Info;
|
||||
private class GiftOfRenewalInfo
|
||||
{
|
||||
public Mobile m_Caster;
|
||||
public int m_HitsPerRound;
|
||||
public Mobile m_Mobile;
|
||||
public InternalTimer m_Timer;
|
||||
|
||||
public InternalTimer( GiftOfRenewalInfo info )
|
||||
: base( TimeSpan.FromSeconds( 2.0 ), TimeSpan.FromSeconds( 2.0 ) )
|
||||
{
|
||||
m_Info = info;
|
||||
}
|
||||
public GiftOfRenewalInfo(Mobile caster, Mobile mobile, int hitsPerRound)
|
||||
{
|
||||
m_Caster = caster;
|
||||
m_Mobile = mobile;
|
||||
m_HitsPerRound = hitsPerRound;
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
Mobile m = m_Info.m_Mobile;
|
||||
m_Timer = new InternalTimer(this);
|
||||
m_Timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_Table.ContainsKey( m ) )
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
public GiftOfRenewalInfo m_Info;
|
||||
|
||||
if ( !m.Alive )
|
||||
{
|
||||
Stop();
|
||||
StopEffect( m );
|
||||
return;
|
||||
}
|
||||
public InternalTimer(GiftOfRenewalInfo info)
|
||||
: base(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.0))
|
||||
{
|
||||
m_Info = info;
|
||||
}
|
||||
|
||||
if ( m.Hits >= m.HitsMax )
|
||||
return;
|
||||
protected override void OnTick()
|
||||
{
|
||||
Mobile m = m_Info.m_Mobile;
|
||||
|
||||
int toHeal = m_Info.m_HitsPerRound;
|
||||
if (!m_Table.ContainsKey(m))
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
SpellHelper.Heal( toHeal, m, m_Info.m_Caster );
|
||||
m.FixedParticles( 0x376A, 9, 32, 5005, EffectLayer.Waist );
|
||||
}
|
||||
}
|
||||
if (!m.Alive)
|
||||
{
|
||||
Stop();
|
||||
StopEffect(m);
|
||||
return;
|
||||
}
|
||||
|
||||
public static bool StopEffect( Mobile m )
|
||||
{
|
||||
if (m_Table.TryGetValue( m, out GiftOfRenewalInfo info ))
|
||||
{
|
||||
m_Table.Remove( m );
|
||||
if (m.Hits >= m.HitsMax)
|
||||
return;
|
||||
|
||||
info.m_Timer.Stop();
|
||||
BuffInfo.RemoveBuff( m, BuffIcon.GiftOfRenewal );
|
||||
int toHeal = m_Info.m_HitsPerRound;
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 60 ), delegate { info.m_Caster.EndAction( typeof( GiftOfRenewalSpell ) ); } );
|
||||
SpellHelper.Heal(toHeal, m, m_Info.m_Caster);
|
||||
m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private GiftOfRenewalSpell m_Owner;
|
||||
|
||||
return false;
|
||||
}
|
||||
public InternalTarget(GiftOfRenewalSpell owner)
|
||||
: base(10, false, TargetFlags.Beneficial)
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
{
|
||||
private GiftOfRenewalSpell m_Owner;
|
||||
protected override void OnTarget(Mobile m, object o)
|
||||
{
|
||||
if (o is Mobile) m_Owner.Target((Mobile)o);
|
||||
}
|
||||
|
||||
public InternalTarget( GiftOfRenewalSpell owner )
|
||||
: base( 10, false, TargetFlags.Beneficial )
|
||||
{
|
||||
m_Owner = owner;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile m, object o )
|
||||
{
|
||||
if ( o is Mobile )
|
||||
{
|
||||
m_Owner.Target( (Mobile)o );
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish( Mobile m )
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected override void OnTargetFinish(Mobile m)
|
||||
{
|
||||
m_Owner.FinishSequence();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue