public override void OnCast() { BaseWeapon wep = Caster.Weapon as BaseWeapon; if (wep == null || wep != Weapon) { Caster.SendLocalizedMessage(501078); // You must be holding a weapon. } else if (IsUnderSpellEffects(Caster, Weapon)) { Caster.SendLocalizedMessage(501775); // This spell is already in effect. } else if (Weapon.Immolating || Weapon.ConsecratedContext != null) { Caster.SendLocalizedMessage(1080128); //You cannot use this ability while your weapon is enchanted. } else if (Weapon.FocusWeilder != null) { Caster.SendLocalizedMessage(1080446); // You cannot enchant an item that is under the effects of the ninjitsu focus attack ability. } else if (Weapon.WeaponAttributes.HitLightning > 0 || Weapon.WeaponAttributes.HitFireball > 0 || Weapon.WeaponAttributes.HitHarm > 0 || Weapon.WeaponAttributes.HitMagicArrow > 0 || Weapon.WeaponAttributes.HitDispel > 0) { Caster.SendLocalizedMessage(1080127); // This weapon already has a hit spell effect and cannot be enchanted. } else if (CheckSequence() && Caster.Weapon == Weapon) { Caster.PlaySound(0x64E); Caster.FixedEffect(0x36CB, 1, 9, 1915, 0); int prim = (int)Caster.Skills[CastSkill].Value; int sec = (int)Caster.Skills[DamageSkill].Value; int value = (50 * (prim + sec)) / 240; double duration = ((double)(prim + sec) / 2.0) + 30.0; int malus = 0; if (Table == null) { Table = new Dictionary <Mobile, EnchantmentTimer>(); } Enhancement.SetValue(Caster, this.Attribute, value, ModName); if (prim >= 80 && sec >= 80 && Weapon.Attributes.SpellChanneling == 0) { Enhancement.SetValue(Caster, AosAttribute.SpellChanneling, 1, ModName); Enhancement.SetValue(Caster, AosAttribute.CastSpeed, -1, ModName); malus = 1; } Table[Caster] = new EnchantmentTimer(Caster, Weapon, this.Attribute, value, malus, duration); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Enchant, 1080126, 1080129, TimeSpan.FromSeconds(duration), Caster, value)); Weapon.EnchantedWeilder = Caster; Weapon.InvalidateProperties(); } FinishSequence(); }
public override void OnCast() { if (CheckWSequence() && CheckSequence() && Caster.Weapon == Weapon) { Caster.PlaySound(0x64E); Caster.FixedEffect(0x37C4, 10, 14, 4, 3); Caster.SendMessage("You enchant the weapon."); int prim = (int)Caster.Skills[CastSkill].Value; int sec = (int)Caster.Skills[DamageSkill].Value; int value = (50 * (prim + sec)) / 240; double duration = ((double)(prim + sec) / 2.0) + 30.0; if (Table == null) { Table = new Dictionary <Mobile, EnchantmentTimer>(); } if (Table.ContainsKey(Caster)) { RemoveEnchantment(Caster); } Enhancement.SetValue(Caster, this.Attribute, value, ModName); if (prim >= 80 && sec >= 80) { Enhancement.SetValue(Caster, AosAttribute.SpellChanneling, 1, ModName); Enhancement.SetValue(Caster, AosAttribute.CastSpeed, -1, ModName); } Table[Caster] = new EnchantmentTimer(Caster, Weapon, this.Attribute, value, duration); BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Enchant, 1080126, 1080129, TimeSpan.FromSeconds(duration), Caster, value)); Weapon.EnchantedWeilder = Caster; Weapon.InvalidateProperties(); } FinishSequence(); }