Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,146 @@
using System;
using Server.Targeting;
namespace Server.Spells.Chivalry
{
public class CleanseByFireSpell : PaladinSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Cleanse By Fire", "Expor Flamus",
-1,
9002);
public CleanseByFireSpell(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 5.0;
}
}
public override int RequiredMana
{
get
{
return 10;
}
}
public override int RequiredTithing
{
get
{
return 10;
}
}
public override int MantraNumber
{
get
{
return 1060718;
}
}// Expor Flamus
public override void OnCast()
{
this.Caster.Target = new InternalTarget(this);
}
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable)
{
return true;
}
public void Target(Mobile m)
{
if (!m.Poisoned)
{
this.Caster.SendLocalizedMessage(1060176); // That creature is not poisoned!
}
else if (this.CheckBSequence(m))
{
SpellHelper.Turn(this.Caster, m);
/* Cures the target of poisons, but causes the caster to be burned by fire damage for 13-55 hit points.
* The amount of fire damage is lessened if the caster has high Karma.
*/
Poison p = m.Poison;
if (p != null)
{
// Cleanse by fire is now difficulty based
int chanceToCure = 10000 + (int)(this.Caster.Skills[SkillName.Chivalry].Value * 75) - ((p.RealLevel + 1) * 2000);
chanceToCure /= 100;
if (chanceToCure > Utility.Random(100))
{
if (m.CurePoison(this.Caster))
{
if (this.Caster != m)
this.Caster.SendLocalizedMessage(1010058); // You have cured the target of all poisons!
m.SendLocalizedMessage(1010059); // You have been cured of all poisons.
}
}
else
{
m.SendLocalizedMessage(1010060); // You have failed to cure your target!
}
}
m.PlaySound(0x1E0);
m.FixedParticles(0x373A, 1, 15, 5012, 3, 2, EffectLayer.Waist);
IEntity from = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 5), m.Map);
IEntity to = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 45), m.Map);
Effects.SendMovingParticles(from, to, 0x374B, 1, 0, false, false, 63, 2, 9501, 1, 0, EffectLayer.Head, 0x100);
this.Caster.PlaySound(0x208);
this.Caster.FixedParticles(0x3709, 1, 30, 9934, 0, 7, EffectLayer.Waist);
int damage = 50 - this.ComputePowerValue(4);
// TODO: Should caps be applied?
if (damage < 13)
damage = 13;
else if (damage > 55)
damage = 55;
AOS.Damage(this.Caster, this.Caster, damage, 0, 100, 0, 0, 0, true);
}
this.FinishSequence();
}
private class InternalTarget : Target
{
private readonly CleanseByFireSpell m_Owner;
public InternalTarget(CleanseByFireSpell owner)
: base(Core.ML ? 10 : 12, false, TargetFlags.Beneficial)
{
this.m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile)
this.m_Owner.Target((Mobile)o);
}
protected override void OnTargetFinish(Mobile from)
{
this.m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,141 @@
using System;
using Server.Mobiles;
using Server.Network;
using Server.Targeting;
namespace Server.Spells.Chivalry
{
public class CloseWoundsSpell : PaladinSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Close Wounds", "Obsu Vulni",
-1,
9002);
public CloseWoundsSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromSeconds(1.5);
}
}
public override double RequiredSkill
{
get
{
return 0.0;
}
}
public override int RequiredMana
{
get
{
return 10;
}
}
public override int RequiredTithing
{
get
{
return 10;
}
}
public override int MantraNumber
{
get
{
return 1060719;
}
}// Obsu Vulni
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable)
{
return true;
}
public override void OnCast()
{
this.Caster.Target = new InternalTarget(this);
}
public void Target(Mobile m)
{
if (!this.Caster.InRange(m, 2))
{
this.Caster.SendLocalizedMessage(1060178); // You are too far away to perform that action!
}
else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
{
this.Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive.
}
else if (m.IsDeadBondedPet)
{
this.Caster.SendLocalizedMessage(1060177); // You cannot heal a creature that is already dead!
}
else if (m.Hits >= m.HitsMax)
{
this.Caster.SendLocalizedMessage(500955); // That being is not damaged!
}
else if (m.Poisoned || Server.Items.MortalStrike.IsWounded(m))
{
this.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, (this.Caster == m) ? 1005000 : 1010398);
}
else if (this.CheckBSequence(m))
{
SpellHelper.Turn(this.Caster, m);
/* Heals the target for 7 to 39 points of damage.
* The caster's Karma affects the amount of damage healed.
*/
int toHeal = this.ComputePowerValue(6) + Utility.RandomMinMax(0, 2);
// TODO: Should caps be applied?
if (toHeal < 7)
toHeal = 7;
else if (toHeal > 39)
toHeal = 39;
if ((m.Hits + toHeal) > m.HitsMax)
toHeal = m.HitsMax - m.Hits;
//m.Hits += toHeal; //Was previosuly due to the message
//m.Heal( toHeal, Caster, false );
SpellHelper.Heal(toHeal, m, this.Caster, false);
m.SendLocalizedMessage(1060203, toHeal.ToString()); // You have had ~1_HEALED_AMOUNT~ hit points of damage healed.
m.PlaySound(0x202);
m.FixedParticles(0x376A, 1, 62, 9923, 3, 3, EffectLayer.Waist);
m.FixedParticles(0x3779, 1, 46, 9502, 5, 3, EffectLayer.Waist);
}
this.FinishSequence();
}
private class InternalTarget : Target
{
private readonly CloseWoundsSpell m_Owner;
public InternalTarget(CloseWoundsSpell owner)
: base(12, false, TargetFlags.Beneficial)
{
this.m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile)
this.m_Owner.Target((Mobile)o);
}
protected override void OnTargetFinish(Mobile from)
{
this.m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,231 @@
using System;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Chivalry
{
public class ConsecrateWeaponSpell : PaladinSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Consecrate Weapon", "Consecrus Arma",
-1,
9002);
private static Dictionary<Mobile, ConsecratedWeaponContext> m_Table = new Dictionary<Mobile, ConsecratedWeaponContext>();
public ConsecrateWeaponSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromSeconds(0.5);
}
}
public override double RequiredSkill
{
get
{
return 15.0;
}
}
public override int RequiredMana
{
get
{
return 10;
}
}
public override int RequiredTithing
{
get
{
return 10;
}
}
public override int MantraNumber
{
get
{
return 1060720;
}
}// Consecrus Arma
public override bool BlocksMovement
{
get
{
return false;
}
}
public override void OnCast()
{
BaseWeapon weapon = this.Caster.Weapon as BaseWeapon;
if (Caster.Player && (weapon == null || weapon is Fists))
{
this.Caster.SendLocalizedMessage(501078); // You must be holding a weapon.
}
else if (this.CheckSequence())
{
/* Temporarily enchants the weapon the caster is currently wielding.
* The type of damage the weapon inflicts when hitting a target will
* be converted to the target's worst Resistance type.
* Duration of the effect is affected by the caster's Karma and lasts for 3 to 11 seconds.
*/
int itemID, soundID;
switch ( weapon.Skill )
{
case SkillName.Macing:
itemID = 0xFB4;
soundID = 0x232;
break;
case SkillName.Archery:
itemID = 0x13B1;
soundID = 0x145;
break;
default:
itemID = 0xF5F;
soundID = 0x56;
break;
}
this.Caster.PlaySound(0x20C);
this.Caster.PlaySound(soundID);
this.Caster.FixedParticles(0x3779, 1, 30, 9964, 3, 3, EffectLayer.Waist);
IEntity from = new Entity(Serial.Zero, new Point3D(this.Caster.X, this.Caster.Y, this.Caster.Z), this.Caster.Map);
IEntity to = new Entity(Serial.Zero, new Point3D(this.Caster.X, this.Caster.Y, this.Caster.Z + 50), this.Caster.Map);
Effects.SendMovingParticles(from, to, itemID, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100);
double seconds = this.ComputePowerValue(20);
// TODO: Should caps be applied?
int pkarma = this.Caster.Karma;
if (pkarma > 5000)
seconds = 11.0;
else if (pkarma >= 4999)
seconds = 10.0;
else if (pkarma >= 3999)
seconds = 9.00;
else if (pkarma >= 2999)
seconds = 8.0;
else if (pkarma >= 1999)
seconds = 7.0;
else if (pkarma >= 999)
seconds = 6.0;
else
seconds = 5.0;
TimeSpan duration = TimeSpan.FromSeconds(seconds);
ConsecratedWeaponContext context;
if (IsUnderEffects(Caster))
{
context = m_Table[Caster];
if (context.Timer != null)
{
context.Timer.Stop();
context.Timer = null;
}
context.Weapon = weapon;
}
else
{
context = new ConsecratedWeaponContext(Caster, weapon);
}
weapon.ConsecratedContext = context;
context.Timer = Timer.DelayCall<Mobile>(duration, RemoveEffects, Caster);
m_Table[Caster] = context;
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.ConsecrateWeapon, 1151385, 1151386, duration, Caster, String.Format("{0}\t{1}", context.ConsecrateProcChance, context.ConsecrateDamageBonus)));
}
this.FinishSequence();
}
public static bool IsUnderEffects(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static void RemoveEffects(Mobile m)
{
if (m_Table.ContainsKey(m))
{
var context = m_Table[m];
context.Expire();
m_Table.Remove(m);
}
}
}
public class ConsecratedWeaponContext
{
public Mobile Owner { get; private set; }
public BaseWeapon Weapon { get; set; }
public Timer Timer { get; set; }
public int ConsecrateProcChance
{
get
{
if (!Core.SA || Owner.Skills.Chivalry.Value >= 80)
{
return 100;
}
return (int)Owner.Skills.Chivalry.Value;
}
}
public int ConsecrateDamageBonus
{
get
{
if (Core.SA)
{
double value = Owner.Skills.Chivalry.Value;
if (value >= 90)
{
return (int)Math.Truncate((value - 90) / 2);
}
}
return 0;
}
}
public ConsecratedWeaponContext(Mobile owner, BaseWeapon weapon)
{
Owner = owner;
Weapon = weapon;
}
public void Expire()
{
Weapon.ConsecratedContext = null;
Effects.PlaySound(Weapon.GetWorldLocation(), Weapon.Map, 0x1F8);
if (Timer != null)
{
Timer.Stop();
Timer = null;
}
}
}
}

View File

@@ -0,0 +1,146 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Items;
using Server.Mobiles;
using Server.Spells.Necromancy;
namespace Server.Spells.Chivalry
{
public class DispelEvilSpell : PaladinSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Dispel Evil", "Dispiro Malas",
-1,
9002);
public DispelEvilSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromSeconds(0.25);
}
}
public override double RequiredSkill
{
get
{
return 35.0;
}
}
public override int RequiredMana
{
get
{
return 10;
}
}
public override int RequiredTithing
{
get
{
return 10;
}
}
public override int MantraNumber
{
get
{
return 1060721;
}
}// Dispiro Malas
public override bool BlocksMovement
{
get
{
return false;
}
}
public override bool DelayedDamage
{
get
{
return false;
}
}
public override void SendCastEffect()
{
Caster.FixedEffect(0x37C4, 10, 7, 4, 3); // At player
}
public override void OnCast()
{
if (this.CheckSequence())
{
Caster.PlaySound(0xF5);
Caster.PlaySound(0x299);
Caster.FixedParticles(0x37C4, 1, 25, 9922, 14, 3, EffectLayer.Head);
int dispelSkill = ComputePowerValue(2);
double chiv = Caster.Skills.Chivalry.Value;
foreach (var m in AcquireIndirectTargets(Caster.Location, 8).OfType<Mobile>())
{
BaseCreature bc = m as BaseCreature;
if (bc != null)
{
bool dispellable = bc.Summoned && !bc.IsAnimatedDead;
if (dispellable)
{
double dispelChance = (50.0 + ((100 * (chiv - bc.GetDispelDifficulty())) / (bc.DispelFocus * 2))) / 100;
dispelChance *= dispelSkill / 100.0;
if (dispelChance > Utility.RandomDouble())
{
Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
Effects.PlaySound(m, m.Map, 0x201);
m.Delete();
continue;
}
}
bool evil = !bc.Controlled && bc.Karma < 0;
if (evil)
{
// TODO: Is this right?
double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill;
fleeChance /= 1000000;
if (fleeChance > Utility.RandomDouble())
{
// guide says 2 seconds, it's longer
bc.BeginFlee(TimeSpan.FromSeconds(30.0));
}
}
}
TransformContext context = TransformationSpellHelper.GetContext(m);
if (context != null && context.Spell is NecromancerSpell) //Trees are not evil! TODO: OSI confirm?
{
// transformed ..
double drainChance = 0.5 * (this.Caster.Skills.Chivalry.Value / Math.Max(m.Skills.Necromancy.Value, 1));
if (drainChance > Utility.RandomDouble())
{
int drain = (5 * dispelSkill) / 100;
m.Stam -= drain;
m.Mana -= drain;
}
}
}
}
FinishSequence();
}
}
}

View File

@@ -0,0 +1,158 @@
using System;
using System.Collections.Generic;
namespace Server.Spells.Chivalry
{
public class DivineFurySpell : PaladinSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Divine Fury", "Divinum Furis",
-1,
9002);
private static readonly Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
public DivineFurySpell(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 25.0;
}
}
public override int RequiredMana
{
get
{
return 15;
}
}
public override int RequiredTithing
{
get
{
return 10;
}
}
public override int MantraNumber
{
get
{
return 1060722;
}
}// Divinum Furis
public override bool BlocksMovement
{
get
{
return false;
}
}
public static bool UnderEffect(Mobile m)
{
return m_Table.ContainsKey(m);
}
public override void OnCast()
{
if (CheckSequence())
{
Caster.PlaySound(0x20F);
Caster.PlaySound(Caster.Female ? 0x338 : 0x44A);
Caster.FixedParticles(0x376A, 1, 31, 9961, 1160, 0, EffectLayer.Waist);
Caster.FixedParticles(0x37C4, 1, 31, 9502, 43, 2, EffectLayer.Waist);
Caster.Stam = Caster.StamMax;
Timer t;
if (m_Table.ContainsKey(Caster))
{
t = m_Table[Caster];
if (t != null)
t.Stop();
}
int delay = ComputePowerValue(10);
// TODO: Should caps be applied?
if (delay < 7)
delay = 7;
else if (delay > 24)
delay = 24;
m_Table[Caster] = t = Timer.DelayCall(TimeSpan.FromSeconds(delay), new TimerStateCallback(Expire_Callback), Caster);
Caster.Delta(MobileDelta.WeaponDamage);
string args = String.Format("{0}\t{1}\t{2}\t{3}", GetAttackBonus(Caster).ToString(), GetDamageBonus(Caster).ToString(), GetWeaponSpeedBonus(Caster).ToString(), GetDefendMalus(Caster).ToString());
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.DivineFury, 1060589, 1150218, TimeSpan.FromSeconds(delay), Caster, args));
// ~1_HCI~% hit chance<br> ~2_DI~% damage<br>~3_SSI~% swing speed increase<br>-~4_DCI~% defense chance
}
FinishSequence();
}
public static int GetDamageBonus(Mobile m)
{
if (m_Table.ContainsKey(m))
{
return m.Skills[SkillName.Chivalry].Value >= 120.0 && m.Karma >= 10000 ? 20 : 10;
}
return 0;
}
public static int GetWeaponSpeedBonus(Mobile m)
{
if (m_Table.ContainsKey(m))
{
return m.Skills[SkillName.Chivalry].Value >= 120.0 && m.Karma >= 10000 ? 15 : 10;
}
return 0;
}
public static int GetAttackBonus(Mobile m)
{
if (m_Table.ContainsKey(m))
{
return m.Skills[SkillName.Chivalry].Value >= 120.0 && m.Karma >= 10000 ? 15 : 10;
}
return 0;
}
public static int GetDefendMalus(Mobile m)
{
if (m_Table.ContainsKey(m))
{
return m.Skills[SkillName.Chivalry].Value >= 120.0 && m.Karma >= 10000 ? 10 : 20;
}
return 0;
}
private static void Expire_Callback(object state)
{
Mobile m = (Mobile)state;
if(m_Table.ContainsKey(m))
m_Table.Remove(m);
m.Delta(MobileDelta.WeaponDamage);
m.PlaySound(0xF8);
}
}
}

View File

@@ -0,0 +1,317 @@
using System;
using Server.Mobiles;
using System.Collections.Generic;
namespace Server.Spells.Chivalry
{
public class EnemyOfOneSpell : PaladinSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Enemy of One", "Forul Solum",
-1,
9002);
public EnemyOfOneSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase { get { return TimeSpan.FromSeconds(0.5); } }
public override double RequiredSkill { get { return 45.0; } }
public override int RequiredMana { get { return 20; } }
public override int RequiredTithing { get { return 10; } }
public override int MantraNumber { get { return 1060723; } } // Forul Solum
public override bool BlocksMovement { get { return false; } }
public override TimeSpan GetCastDelay()
{
TimeSpan delay = base.GetCastDelay();
if (Core.SA && UnderEffect(Caster))
{
double milliseconds = delay.TotalMilliseconds / 2;
delay = TimeSpan.FromMilliseconds(milliseconds);
}
return delay;
}
public override void OnCast()
{
if (Core.SA && UnderEffect(Caster))
{
PlayEffects();
// As per Pub 71, Enemy of one has now been changed to a Spell Toggle. You can remove the effect
// before the duration expires by recasting the spell.
RemoveEffect(Caster);
}
else if (CheckSequence())
{
PlayEffects();
// TODO: validate formula
var seconds = ComputePowerValue(1);
Utility.FixMinMax(ref seconds, 67, 228);
var delay = TimeSpan.FromSeconds(seconds);
var timer = Timer.DelayCall(delay, RemoveEffect, Caster);
var expire = DateTime.UtcNow + delay;
var context = new EnemyOfOneContext(Caster, timer, expire);
context.OnCast();
m_Table[Caster] = context;
}
FinishSequence();
}
private void PlayEffects()
{
Caster.PlaySound(0x0F5);
Caster.PlaySound(0x1ED);
Caster.FixedParticles(0x375A, 1, 30, 9966, 33, 2, EffectLayer.Head);
Caster.FixedParticles(0x37B9, 1, 30, 9502, 43, 3, EffectLayer.Head);
}
private static readonly Dictionary<Mobile, EnemyOfOneContext> m_Table = new Dictionary<Mobile, EnemyOfOneContext>();
public static EnemyOfOneContext GetContext(Mobile m)
{
if (!m_Table.ContainsKey(m))
return null;
return m_Table[m];
}
public static bool UnderEffect(Mobile m)
{
return m_Table.ContainsKey(m);
}
public static void RemoveEffect(Mobile m)
{
if (m_Table.ContainsKey(m))
{
var context = m_Table[m];
m_Table.Remove(m);
context.OnRemoved();
m.PlaySound(0x1F8);
}
}
public static Dictionary<Type, string> NameCache { get; set; }
public static void Configure()
{
if (NameCache == null)
NameCache = new Dictionary<Type, string>();
}
public static string GetTypeName(Mobile defender)
{
if (defender is PlayerMobile || (defender is BaseCreature && ((BaseCreature)defender).GetMaster() is PlayerMobile))
{
return defender.Name;
}
Type t = defender.GetType();
if (NameCache.ContainsKey(t))
{
return NameCache[t];
}
return AddNameToCache(t);
}
public static string AddNameToCache(Type t)
{
string name = t.Name;
if (name != null)
{
for (int i = 0; i < name.Length; i++)
{
if (i > 0 && Char.IsUpper(name[i]))
{
name = name.Insert(i, " ");
i++;
}
}
if (name.EndsWith("y"))
{
name = name.Substring(0, name.Length - 1);
name = name + "ies";
}
else if (!name.EndsWith("s"))
{
name = name + "s";
}
NameCache[t] = name.ToLower();
}
return name;
}
}
public class EnemyOfOneContext
{
private Mobile m_Owner;
private Timer m_Timer;
private DateTime m_Expire;
private Type m_TargetType;
private int m_DamageScalar;
private string m_TypeName;
private Mobile m_PlayerOrPet;
public Mobile Owner { get { return m_Owner; } }
public Timer Timer { get { return m_Timer; } }
public Type TargetType { get { return m_TargetType; } }
public int DamageScalar { get { return m_DamageScalar; } }
public string TypeName { get { return m_TypeName; } }
public EnemyOfOneContext(Mobile owner, Timer timer, DateTime expire)
{
m_Owner = owner;
m_Timer = timer;
m_Expire = expire;
m_TargetType = null;
m_DamageScalar = 50;
}
public bool IsWaitingForEnemy { get { return m_TargetType == null; } }
public bool IsEnemy(Mobile m)
{
if (m is BaseCreature && ((BaseCreature)m).GetMaster() == Owner)
{
return false;
}
if (m_PlayerOrPet != null)
{
if (m_PlayerOrPet == m)
{
return true;
}
}
else if (m_TargetType == m.GetType())
{
return true;
}
return false;
}
public void OnCast()
{
UpdateBuffInfo();
}
private void UpdateDamage()
{
var chivalry = (int)m_Owner.Skills.Chivalry.Value;
m_DamageScalar = 10 + ((chivalry - 40) * 9) / 10;
if (m_PlayerOrPet != null)
m_DamageScalar /= 2;
}
private void UpdateBuffInfo()
{
if (m_TypeName == null)
{
BuffInfo.AddBuff(m_Owner, new BuffInfo(BuffIcon.EnemyOfOne, 1075653, 1075902, m_Expire - DateTime.UtcNow, m_Owner, string.Format("{0}\t{1}", m_DamageScalar, "100"), true));
}
else
{
BuffInfo.AddBuff(m_Owner, new BuffInfo(BuffIcon.EnemyOfOne, 1075653, 1075654, m_Expire - DateTime.UtcNow, m_Owner, string.Format("{0}\t{1}\t{2}\t{3}", m_DamageScalar, TypeName, ".", "100"), true));
}
}
public void OnHit(Mobile defender)
{
if (m_TargetType == null)
{
m_TypeName = EnemyOfOneSpell.GetTypeName(defender);
if (defender is PlayerMobile || (defender is BaseCreature && ((BaseCreature)defender).GetMaster() is PlayerMobile))
{
m_PlayerOrPet = defender;
TimeSpan duration = TimeSpan.FromSeconds(8);
if (DateTime.UtcNow + duration < m_Expire)
{
m_Expire = DateTime.UtcNow + duration;
}
if (m_Timer != null)
{
m_Timer.Stop();
m_Timer = null;
}
m_Timer = Timer.DelayCall(duration, EnemyOfOneSpell.RemoveEffect, m_Owner);
}
else
{
m_TargetType = defender.GetType();
}
UpdateDamage();
DeltaEnemies();
UpdateBuffInfo();
}
else if (Core.SA)
{
// Odd but OSI recalculates when the target changes...
UpdateDamage();
}
}
public void OnRemoved()
{
if (m_Timer != null)
m_Timer.Stop();
DeltaEnemies();
BuffInfo.RemoveBuff(m_Owner, BuffIcon.EnemyOfOne);
}
private void DeltaEnemies()
{
IPooledEnumerable eable = m_Owner.GetMobilesInRange(18);
foreach (Mobile m in eable)
{
if (m_PlayerOrPet != null)
{
if (m == m_PlayerOrPet)
{
m.Delta(MobileDelta.Noto);
}
}
else if (m.GetType() == m_TargetType)
{
m.Delta(MobileDelta.Noto);
}
}
eable.Free();
}
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using Server.Items;
namespace Server.Spells.Chivalry
{
public class HolyLightSpell : PaladinSpell
{
public override DamageType SpellDamageType { get { return DamageType.SpellAOE; } }
private static readonly SpellInfo m_Info = new SpellInfo(
"Holy Light", "Augus Luminos",
-1,
9002);
public HolyLightSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromSeconds(1.75);
}
}
public override double RequiredSkill
{
get
{
return 55.0;
}
}
public override int RequiredMana
{
get
{
return 10;
}
}
public override int RequiredTithing
{
get
{
return 10;
}
}
public override int MantraNumber
{
get
{
return 1060724;
}
}// Augus Luminos
public override bool BlocksMovement
{
get
{
return false;
}
}
public override bool DelayedDamage
{
get
{
return false;
}
}
public override void OnCast()
{
if (CheckSequence())
{
foreach (var id in AcquireIndirectTargets(Caster.Location, 3))
{
Mobile m = id as Mobile;
int damage = ComputePowerValue(10) + Utility.RandomMinMax(0, 2);
// TODO: Should caps be applied?
if (damage < 8)
damage = 8;
else if (damage > 24)
damage = 24;
Caster.DoHarmful(m);
SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100);
}
Caster.PlaySound(0x212);
Caster.PlaySound(0x206);
Effects.SendLocationParticles(EffectItem.Create(Caster.Location, Caster.Map, EffectItem.DefaultDuration), 0x376A, 1, 29, 0x47D, 2, 9962, 0);
Effects.SendLocationParticles(EffectItem.Create(new Point3D(Caster.X, Caster.Y, Caster.Z - 7), Caster.Map, EffectItem.DefaultDuration), 0x37C4, 1, 29, 0x47D, 2, 9502, 0);
}
FinishSequence();
}
}
}

View File

@@ -0,0 +1,189 @@
using System;
using System.Collections.Generic;
using Server.Gumps;
using Server.Mobiles;
using Server.Spells.Necromancy;
namespace Server.Spells.Chivalry
{
public class NobleSacrificeSpell : PaladinSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Noble Sacrifice", "Dium Prostra",
-1,
9002);
public NobleSacrificeSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromSeconds(1.5);
}
}
public override double RequiredSkill
{
get
{
return 65.0;
}
}
public override int RequiredMana
{
get
{
return 20;
}
}
public override int RequiredTithing
{
get
{
return 30;
}
}
public override int MantraNumber
{
get
{
return 1060725;
}
}// Dium Prostra
public override bool BlocksMovement
{
get
{
return false;
}
}
public override void OnCast()
{
if (CheckSequence())
{
List<Mobile> targets = new List<Mobile>();
IPooledEnumerable eable = Caster.GetMobilesInRange(6);
foreach (Mobile m in eable)
{
if (m is BaseCreature || (m.Player && (m.Criminal || m.Murderer)))
continue;
if (Caster != m && m.InLOS(Caster) && Caster.CanBeBeneficial(m, false, true) && !(m is IRepairableMobile))
targets.Add(m);
}
eable.Free();
Caster.PlaySound(0x244);
Caster.FixedParticles(0x3709, 1, 30, 9965, 5, 7, EffectLayer.Waist);
Caster.FixedParticles(0x376A, 1, 30, 9502, 5, 3, EffectLayer.Waist);
/* Attempts to Resurrect, Cure and Heal all targets in a radius around the caster.
* If any target is successfully assisted, the Paladin's current
* Hit Points, Mana and Stamina are set to 1.
* Amount of damage healed is affected by the Caster's Karma, from 8 to 24 hit points.
*/
bool sacrifice = false;
// TODO: Is there really a resurrection chance?
double resChance = 0.1 + (0.9 * ((double)Caster.Karma / 10000));
for (int i = 0; i < targets.Count; ++i)
{
Mobile m = targets[i];
if (!m.Alive)
{
if (m.Region != null && m.Region.IsPartOf("Khaldun"))
{
Caster.SendLocalizedMessage(1010395); // The veil of death in this area is too strong and resists thy efforts to restore life.
}
else if (resChance > Utility.RandomDouble())
{
m.FixedParticles(0x375A, 1, 15, 5005, 5, 3, EffectLayer.Head);
m.CloseGump(typeof(ResurrectGump));
m.SendGump(new ResurrectGump(m, Caster));
sacrifice = true;
}
}
else
{
bool sendEffect = false;
if (m.Poisoned && m.CurePoison(Caster))
{
Caster.DoBeneficial(m);
if (Caster != m)
Caster.SendLocalizedMessage(1010058); // You have cured the target of all poisons!
m.SendLocalizedMessage(1010059); // You have been cured of all poisons.
sendEffect = true;
sacrifice = true;
}
if (m.Hits < m.HitsMax)
{
int toHeal = ComputePowerValue(10) + Utility.RandomMinMax(0, 2);
// TODO: Should caps be applied?
if (toHeal < 8)
toHeal = 8;
else if (toHeal > 24)
toHeal = 24;
Caster.DoBeneficial(m);
m.Heal(toHeal, Caster);
sendEffect = true;
}
if(m.RemoveStatMod("[Magic] Str Offset"))
sendEffect = true;
if(m.RemoveStatMod("[Magic] Dex Offset"))
sendEffect = true;
if(m.RemoveStatMod("[Magic] Int Offset"))
sendEffect = true;
if (m.Paralyzed)
{
m.Paralyzed = false;
sendEffect = true;
}
if (EvilOmenSpell.TryEndEffect(m))
sendEffect = true;
if (StrangleSpell.RemoveCurse(m))
sendEffect = true;
if (CorpseSkinSpell.RemoveCurse(m))
sendEffect = true;
// TODO: Should this remove blood oath? Pain spike?
if (sendEffect)
{
m.FixedParticles(0x375A, 1, 15, 5005, 5, 3, EffectLayer.Head);
sacrifice = true;
}
}
}
if (sacrifice)
{
Caster.PlaySound(Caster.Body.IsFemale ? 0x150 : 0x423);
Caster.Hits = 1;
Caster.Stam = 1;
Caster.Mana = 1;
}
}
FinishSequence();
}
}
}

View File

@@ -0,0 +1,142 @@
#region References
using System;
using Server.Network;
#endregion
namespace Server.Spells.Chivalry
{
public abstract class PaladinSpell : Spell
{
public PaladinSpell(Mobile caster, Item scroll, SpellInfo info)
: base(caster, scroll, info)
{ }
public abstract double RequiredSkill { get; }
public abstract int RequiredMana { get; }
public abstract int RequiredTithing { get; }
public abstract int MantraNumber { get; }
public override SkillName CastSkill { get { return SkillName.Chivalry; } }
public override SkillName DamageSkill { get { return SkillName.Chivalry; } }
public override bool ClearHandsOnCast { get { return false; } }
public override int CastRecoveryBase { get { return 7; } }
public static int ComputePowerValue(Mobile from, int div)
{
if (from == null)
{
return 0;
}
int v = (int)Math.Sqrt(from.Karma + 20000 + (from.Skills.Chivalry.Fixed * 10));
return v / div;
}
public override bool CheckCast()
{
int mana = ScaleMana(RequiredMana);
if (!base.CheckCast())
{
return false;
}
if (Caster.Player && Caster.TithingPoints < RequiredTithing)
{
Caster.SendLocalizedMessage(1060173, RequiredTithing.ToString());
// You must have at least ~1_TITHE_REQUIREMENT~ Tithing Points to use this ability,
return false;
}
else if (Caster.Mana < mana)
{
Caster.SendLocalizedMessage(1060174, mana.ToString());
// You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
return false;
}
return true;
}
public override bool CheckFizzle()
{
int requiredTithing = Caster.Player ? RequiredTithing : 0;
if (AosAttributes.GetValue(Caster, AosAttribute.LowerRegCost) > Utility.Random(100))
{
requiredTithing = 0;
}
int mana = ScaleMana(RequiredMana);
if (Caster.TithingPoints < requiredTithing)
{
Caster.SendLocalizedMessage(1060173, RequiredTithing.ToString());
// You must have at least ~1_TITHE_REQUIREMENT~ Tithing Points to use this ability,
return false;
}
else if (Caster.Mana < mana)
{
Caster.SendLocalizedMessage(1060174, mana.ToString());
// You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
return false;
}
Caster.TithingPoints -= requiredTithing;
if (!base.CheckFizzle())
{
return false;
}
Caster.Mana -= mana;
return true;
}
public override void SayMantra()
{
if (Caster.Player)
Caster.PublicOverheadMessage( MessageType.Regular, 0x3B2, MantraNumber, "", false );
}
public override void DoFizzle()
{
Caster.PlaySound(0x1D6);
Caster.NextSpellTime = Core.TickCount;
}
public override void DoHurtFizzle()
{
Caster.PlaySound(0x1D6);
}
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable)
{
// Cannot disturb Chivalry spells
return false;
}
public override void SendCastEffect()
{
if(Caster.Player)
Caster.FixedEffect(0x37C4, 87, (int)(GetCastDelay().TotalSeconds * 28), 4, 3);
}
public override void GetCastSkills(out double min, out double max)
{
min = RequiredSkill;
max = RequiredSkill + 50.0;
}
public override int GetMana()
{
return 0;
}
public int ComputePowerValue(int div)
{
return ComputePowerValue(Caster, div);
}
}
}

View File

@@ -0,0 +1,152 @@
using System;
using Server.Items;
using Server.Spells.First;
using Server.Spells.Fourth;
using Server.Spells.Necromancy;
using Server.Targeting;
using Server.Spells.Mysticism;
namespace Server.Spells.Chivalry
{
public class RemoveCurseSpell : PaladinSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Remove Curse", "Extermo Vomica",
-1,
9002);
public RemoveCurseSpell(Mobile caster, Item scroll)
: base(caster, scroll, m_Info)
{
}
public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromSeconds(1.5);
}
}
public override double RequiredSkill
{
get
{
return 5.0;
}
}
public override int RequiredMana
{
get
{
return 20;
}
}
public override int RequiredTithing
{
get
{
return 10;
}
}
public override int MantraNumber
{
get
{
return 1060726;
}
}// Extermo Vomica
public override bool CheckDisturb(DisturbType type, bool firstCircle, bool resistable)
{
return true;
}
public override void OnCast()
{
this.Caster.Target = new InternalTarget(this);
}
public void Target(Mobile m)
{
if (this.CheckBSequence(m))
{
SpellHelper.Turn(this.Caster, m);
/* Attempts to remove all Curse effects from Target.
* Curses include Mage spells such as Clumsy, Weaken, Feeblemind and Paralyze
* as well as all Necromancer curses.
* Chance of removing curse is affected by Caster's Karma.
*/
int chance = 0;
if (this.Caster.Karma < -5000)
chance = 0;
else if (this.Caster.Karma < 0)
chance = (int)Math.Sqrt(20000 + this.Caster.Karma) - 122;
else if (this.Caster.Karma < 5625)
chance = (int)Math.Sqrt(this.Caster.Karma) + 25;
else
chance = 100;
if (chance > Utility.Random(100))
{
m.PlaySound(0xF6);
m.PlaySound(0x1F7);
m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);
IEntity from = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 10), this.Caster.Map);
IEntity to = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 50), this.Caster.Map);
Effects.SendMovingParticles(from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);
m.Paralyzed = false;
EvilOmenSpell.TryEndEffect(m);
StrangleSpell.RemoveCurse(m);
CorpseSkinSpell.RemoveCurse(m);
CurseSpell.RemoveEffect(m);
MortalStrike.EndWound(m);
WeakenSpell.RemoveEffects(m);
FeeblemindSpell.RemoveEffects(m);
ClumsySpell.RemoveEffects(m);
if (Core.ML)
{
BloodOathSpell.RemoveCurse(m);
}
MindRotSpell.ClearMindRotScalar(m);
SpellPlagueSpell.RemoveFromList(m);
BuffInfo.RemoveBuff(m, BuffIcon.MassCurse);
}
else
{
m.PlaySound(0x1DF);
}
}
this.FinishSequence();
}
private class InternalTarget : Target
{
private readonly RemoveCurseSpell m_Owner;
public InternalTarget(RemoveCurseSpell owner)
: base(Core.ML ? 10 : 12, false, TargetFlags.Beneficial)
{
this.m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile)
this.m_Owner.Target((Mobile)o);
}
protected override void OnTargetFinish(Mobile from)
{
this.m_Owner.FinishSequence();
}
}
}
}

View File

@@ -0,0 +1,304 @@
using System;
using Server.Items;
using Server.Mobiles;
using Server.Multis;
using Server.Network;
using Server.Targeting;
namespace Server.Spells.Chivalry
{
public class SacredJourneySpell : PaladinSpell
{
private static readonly SpellInfo m_Info = new SpellInfo(
"Sacred Journey", "Sanctum Viatas",
-1,
9002);
private readonly RunebookEntry m_Entry;
private readonly Runebook m_Book;
public SacredJourneySpell(Mobile caster, Item scroll)
: this(caster, scroll, null, null)
{
}
public SacredJourneySpell(Mobile caster, Item scroll, RunebookEntry entry, Runebook book)
: base(caster, scroll, m_Info)
{
m_Entry = entry;
m_Book = book;
}
public override TimeSpan CastDelayBase
{
get
{
return TimeSpan.FromSeconds(1.5);
}
}
public override double RequiredSkill
{
get
{
return 15.0;
}
}
public override int RequiredMana
{
get
{
return 10;
}
}
public override int RequiredTithing
{
get
{
return 15;
}
}
public override int MantraNumber
{
get
{
return 1060727;
}
}// Sanctum Viatas
public override bool BlocksMovement
{
get
{
return false;
}
}
public override void OnCast()
{
if (m_Entry == null)
{
Caster.SendLocalizedMessage(501029); // Select Marked item.
Caster.Target = new InternalTarget(this);
}
else
{
if (m_Entry.Type == RecallRuneType.Ship)
{
Effect(m_Entry.Galleon);
}
else
{
Effect(m_Entry.Location, m_Entry.Map, true, false);
}
}
}
public override bool CheckCast()
{
if (!base.CheckCast())
return false;
if (Factions.Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
return false;
}
else if (Caster.Criminal)
{
Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
return false;
}
else if (SpellHelper.CheckCombat(Caster))
{
Caster.SendLocalizedMessage(1061282); // You cannot use the Sacred Journey ability to flee from combat.
return false;
}
else if (Misc.WeightOverloading.IsOverloaded(Caster))
{
Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
return false;
}
return SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom);
}
public void Effect(BaseGalleon galleon)
{
if (galleon == null)
{
Caster.SendLocalizedMessage(1116767); // The ship could not be located.
}
else if (galleon.Map == Map.Internal)
{
Caster.SendLocalizedMessage(1149569); // That ship is in dry dock.
}
else if (!galleon.HasAccess(Caster))
{
Caster.SendLocalizedMessage(1116617); // You do not have permission to board this ship.
}
else
{
Effect(galleon.GetMarkedLocation(), galleon.Map, false, true);
}
}
public void Effect(Point3D loc, Map map, bool checkMulti, bool isboatkey = false)
{
if (Factions.Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
}
else if (map == null || (!Core.AOS && Caster.Map != map))
{
Caster.SendLocalizedMessage(1005569); // You can not recall to another facet.
}
else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom))
{
}
else if (!SpellHelper.CheckTravel(Caster, map, loc, TravelCheckType.RecallTo))
{
}
else if (map == Map.Felucca && Caster is PlayerMobile && ((PlayerMobile)Caster).Young)
{
Caster.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
}
else if (SpellHelper.RestrictRedTravel && Caster.Murderer && map.Rules != MapRules.FeluccaRules)
{
Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
}
else if (Caster.Criminal)
{
Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
}
else if (SpellHelper.CheckCombat(Caster))
{
Caster.SendLocalizedMessage(1061282); // You cannot use the Sacred Journey ability to flee from combat.
}
else if (Misc.WeightOverloading.IsOverloaded(Caster))
{
Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
}
else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z) && !isboatkey)
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if ((checkMulti && SpellHelper.CheckMulti(loc, map)) && !isboatkey)
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if (m_Book != null && m_Book.CurCharges <= 0)
{
Caster.SendLocalizedMessage(502412); // There are no charges left on that item.
}
else if (Engines.CityLoyalty.CityTradeSystem.HasTrade(Caster))
{
Caster.SendLocalizedMessage(1151733); // You cannot do that while carrying a Trade Order.
}
else if (CheckSequence())
{
BaseCreature.TeleportPets(Caster, loc, map, true);
if (m_Book != null)
--m_Book.CurCharges;
Effects.SendLocationParticles(EffectItem.Create(Caster.Location, Caster.Map, EffectItem.DefaultDuration), 0, 0, 0, 5033);
Caster.PlaySound(0x1FC);
Caster.MoveToWorld(loc, map);
Caster.PlaySound(0x1FC);
}
FinishSequence();
}
private class InternalTarget : Target
{
private readonly SacredJourneySpell m_Owner;
public InternalTarget(SacredJourneySpell owner)
: base(Core.ML ? 10 : 12, false, TargetFlags.None)
{
m_Owner = owner;
}
protected override void OnTarget(Mobile from, object o)
{
if (o is RecallRune)
{
RecallRune rune = (RecallRune)o;
if (rune.Marked)
{
if (rune.Type == RecallRuneType.Ship)
{
m_Owner.Effect(rune.Galleon);
}
else
{
m_Owner.Effect(rune.Target, rune.TargetMap, true);
}
}
else
{
from.SendLocalizedMessage(501805); // That rune is not yet marked.
}
}
else if (o is Runebook)
{
RunebookEntry e = ((Runebook)o).Default;
if (e != null)
{
if (e.Type == RecallRuneType.Ship)
{
m_Owner.Effect(e.Galleon);
}
else
{
m_Owner.Effect(e.Location, e.Map, true);
}
}
else
{
from.SendLocalizedMessage(502354); // Target is not marked.
}
}
else if (o is Key && ((Key)o).KeyValue != 0 && ((Key)o).Link is BaseBoat)
{
BaseBoat boat = ((Key)o).Link as BaseBoat;
if (!boat.Deleted && boat.CheckKey(((Key)o).KeyValue))
m_Owner.Effect(boat.GetMarkedLocation(), boat.Map, false);
else
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
}
else if (o is HouseRaffleDeed && ((HouseRaffleDeed)o).ValidLocation())
{
HouseRaffleDeed deed = (HouseRaffleDeed)o;
m_Owner.Effect(deed.PlotLocation, deed.PlotFacet, true);
}
else if (o is Engines.NewMagincia.WritOfLease)
{
Engines.NewMagincia.WritOfLease lease = (Engines.NewMagincia.WritOfLease)o;
if (lease.RecallLoc != Point3D.Zero && lease.Facet != null && lease.Facet != Map.Internal)
m_Owner.Effect(lease.RecallLoc, lease.Facet, false);
else
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
}
else
{
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name, "")); // I can not recall from that object.
}
}
protected override void OnNonlocalTarget(Mobile from, object o)
{
}
protected override void OnTargetFinish(Mobile from)
{
m_Owner.FinishSequence();
}
}
}
}