ServUO Version
Publish 57
Ultima Expansion
Endless Journey
using System;

namespace Server.Spells.Spellweaving
{
public class EtherealVoyageSpell : ArcaneForm
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Ethereal Voyage", "Orlavdra",
-1);
public EtherealVoyageSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}

public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromSeconds(3.5);
}
}
public override double RequiredSkill
{
get
{
return 24.0;
}
}
public override int RequiredMana
{
get
{
return 32;
}
}
public override int Body
{
get
{
return 0x302;
}
}
public override int Hue
{
get
{
return 0x48F;
}
}
public static void Initialize()
{
EventSink.AggressiveAction += new AggressiveActionEventHandler(delegate(AggressiveActionEventArgs e)
{
if (TransformationSpellHelper.UnderTransformation(e.Aggressor, typeof(EtherealVoyageSpell)))
{
TransformationSpellHelper.RemoveContext(e.Aggressor, true);
}
});
}

public override bool CheckCast()
{
if (TransformationSpellHelper.UnderTransformation(this.Caster, typeof(EtherealVoyageSpell)))
{
this.Caster.SendLocalizedMessage(501775); // This spell is already in effect.
}
else if (!this.Caster.CanBeginAction(typeof(EtherealVoyageSpell)))
{
this.Caster.SendLocalizedMessage(1075124); // You must wait before casting that spell again.
}
else if (this.Caster.Combatant != null)
{
this.Caster.SendLocalizedMessage(1072586); // You cannot cast Ethereal Voyage while you are in combat.
}
else
{
return base.CheckCast();
}

return false;
}

public override void DoEffect(Mobile m)
{
m.PlaySound(0x5C8);
m.SendLocalizedMessage(1074770); // You are now under the effects of Ethereal Voyage.

double skill = this.Caster.Skills.Spellweaving.Value;

TimeSpan duration = TimeSpan.FromSeconds(12 + (int)(skill / 24) + (this.FocusLevel * 2));

Timer.DelayCall<Mobile>(duration, new TimerStateCallback<Mobile>(RemoveEffect), this.Caster);

this.Caster.BeginAction(typeof(EtherealVoyageSpell)); //Cannot cast this spell for another 5 minutes(300sec) after effect removed.

BuffInfo.AddBuff(this.Caster, new BuffInfo(BuffIcon.EtherealVoyage, 1031613, 1075805, duration, this.Caster));
}

public override void RemoveEffect(Mobile m)
{
m.SendLocalizedMessage(1074771); // You are no longer under the effects of Ethereal Voyage.

TransformationSpellHelper.RemoveContext(m, true);

Timer.DelayCall(TimeSpan.FromMinutes(5), delegate
{
m.EndAction(typeof(EtherealVoyageSpell));
});

BuffInfo.RemoveBuff(m, BuffIcon.EtherealVoyage);
}
}
}
The above script is Spellweaving's Ethereal Voyage magic. After using the forehead method, there is a 5-minute wait for reuse. For example, I want to set the same 5-minute reuse wait time for the Fireball magic of Magery skill. The script below is a Fireball magic.
using System;
using Server.Targeting;

namespace Server.Spells.Third
{
public class FireballSpell : MagerySpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Fireball", "Vas Flam",
203,
9041,
Reagent.BlackPearl);
public FireballSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}

public override SpellCircle Circle
{
get
{
return SpellCircle.Third;
}
}



public override double RequiredSkill
{
get
{
return 45.0;
}
}
public override bool DelayedDamage
{
get
{
return true;
}
}
public override void OnCast()
{
Caster.Target = new InternalTarget(this);
}

public void Target(IDamageable m)
{
if (!Caster.CanSee(m))
{
Caster.SendLocalizedMessage(500237); // Target can not be seen.
}
else if (CheckHSequence(m))
{
IDamageable source = Caster;
IDamageable target = m;

SpellHelper.Turn(Caster, m);

if (SpellHelper.CheckReflect((int)Circle, ref source, ref target))
{
Timer.DelayCall(TimeSpan.FromSeconds(.5), () =>
{
source.MovingParticles(target, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
source.PlaySound(Core.AOS ? 0x15E : 0x44B);
});
}

double damage = 0;

if (Core.AOS)
{
damage = GetNewAosDamage(29, 1, 5, m);
}
else if (m is Mobile)
{
damage = Utility.Random(10, 20);

if (CheckResisted((Mobile)m))
{
damage *= 0.75;

((Mobile)m).SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
}

damage *= GetDamageScalar((Mobile)m);
}

if (damage > 0)
{
Caster.MovingParticles(m, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
Caster.PlaySound(Core.AOS ? 0x15E : 0x44B);

SpellHelper.Damage(this, target, damage, 0, 100, 0, 0, 0);
}
}

FinishSequence();
}

private class InternalTarget : Target
{
private readonly FireballSpell m_Owner;
public InternalTarget(FireballSpell owner)
: base(Core.ML ? 10 : 12, false, TargetFlags.Harmful)
{
m_Owner = owner;
}

protected override void OnTarget(Mobile from, object o)
{
if (o is IDamageable)
m_Owner.Target((IDamageable)o);
}

protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}
Can you help me with what commands I should add here? I've tried a lot of things in one way or another, but it didn't work, so I'm asking for help.
 
Back