ServUO Version
Publish 57
Ultima Expansion
Endless Journey
using System;
using System.Collections.Generic;
using Server.Items;

namespace Server.Spells.Spellweaving
{
public class ImmolatingWeaponSpell : ArcanistSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Immolating Weapon", "Thalshara",
-1);
private static readonly Dictionary<Mobile, ImmolatingWeaponEntry> m_WeaponDamageTable = new Dictionary<Mobile, ImmolatingWeaponEntry>();

public ImmolatingWeaponSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}

public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromSeconds(1.0);
}
}
public override double RequiredSkill
{
get
{
return 10.0;
}
}
public override int RequiredMana
{
get
{
return 32;
}
}
public static bool IsImmolating(Mobile m, BaseWeapon weapon)
{
if (m == null)
return false;

return m_WeaponDamageTable.ContainsKey(m) && m_WeaponDamageTable[m].m_Weapon == weapon;
}

public static int GetImmolatingDamage(Mobile attacker)
{
ImmolatingWeaponEntry entry;

if (m_WeaponDamageTable.TryGetValue(attacker, out entry))
return entry.m_Damage;

return 0;
}

public static void DoDelayEffect(Mobile attacker, Mobile target)
{
Timer.DelayCall(TimeSpan.FromSeconds(.25), () =>
{
if (m_WeaponDamageTable.ContainsKey(attacker))
AOS.Damage(target, attacker, m_WeaponDamageTable[attacker].m_Damage, 0, 100, 0, 0, 0);
});
}

public static void StopImmolating(Mobile mob)
{
if (m_WeaponDamageTable.ContainsKey(mob))
{
StopImmolating(m_WeaponDamageTable[mob].m_Weapon, mob);
}
}

public static void StopImmolating(BaseWeapon weapon, Mobile mob)
{
ImmolatingWeaponEntry entry;

if (m_WeaponDamageTable.TryGetValue(mob, out entry))
{
mob.PlaySound(0x27);

entry.m_Timer.Stop();

m_WeaponDamageTable.Remove(mob);

BuffInfo.RemoveBuff(mob, BuffIcon.ImmolatingWeapon);

weapon.InvalidateProperties();
}
}

public override bool CheckCast()
{
BaseWeapon weapon = Caster.Weapon as BaseWeapon;

if (Caster.Player && (weapon == null || weapon is Fists || weapon is BaseAxe || weapon is BaseBashing || weapon is BaseKnife || weapon is BasePoleArm || weapon is BaseSpear || weapon is BaseStaff || weapon is BaseSword || weapon is BaseWand ))
{
Caster.SendLocalizedMessage(1063526); // You must be wielding a weapon to use this ability!
return false;
}

return base.CheckCast();
}

public override void OnCast()
{
BaseWeapon weapon = Caster.Weapon as BaseWeapon;

if (Caster.Player && (weapon == null || weapon is Fists || weapon is BaseAxe || weapon is BaseBashing || weapon is BaseKnife || weapon is BasePoleArm || weapon is BaseSpear || weapon is BaseStaff || weapon is BaseSword || weapon is BaseWand ))
{
Caster.SendLocalizedMessage(1063526); // You must be wielding a weapon to use this ability!
}
else if (CheckSequence())
{
Caster.PlaySound(0x5CA);
Caster.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);

if (!IsImmolating(Caster, weapon)) // On OSI, the effect is not re-applied
{
double skill = Caster.Skills.Archery.Value;

int duration = 10 + (int)(skill * 2) + FocusLevel;
int damage = 15 + (int)(skill * 0.7) + FocusLevel;

Timer stopTimer = Timer.DelayCall<Mobile>(TimeSpan.FromSeconds(duration), StopImmolating, Caster);

m_WeaponDamageTable[Caster] = new ImmolatingWeaponEntry(damage, stopTimer, weapon);

BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.ImmolatingWeapon, 1060523, 1153782, damage.ToString()));

weapon.InvalidateProperties();
}
}

FinishSequence();
}

private class ImmolatingWeaponEntry
{
public readonly int m_Damage;
public readonly Timer m_Timer;
public readonly BaseWeapon m_Weapon;

public ImmolatingWeaponEntry(int damage, Timer stopTimer, BaseWeapon weapon)
{
m_Damage = damage;
m_Timer = stopTimer;
m_Weapon = weapon;
}
}
}
}
The above script is Imolating Weapon Spell from Spellweaving. This magic gives the weapon a flame property. I was wondering where I need to modify to change the flame properties given to this weapon to other properties such as ice properties or toxicities. And one more question.
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();
}
}
}
}
The above script is Fireballspell from MagerySpell. This magic has flame properties. I wonder where I need to modify to change the flame property to another property.
 
m_WeaponDamageTable[attacker].m_Damage, 0, 100, 0, 0, 0);

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

100 Equal to 100% Fire attribute
0, 100, 0, 0, 0
phy,fire,cold,pos,en
 
Last edited:
m_WeaponDamageTable[attacker].m_Damage, 0, 100, 0, 0, 0);

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

100 Equal to 100% Fire attribute
0, 100, 0, 0, 0
phy,fire,cold,pos,en
Thank you so much for letting me know. You've been a great help. Thank you from the bottom of my heart!
 
Back