public virtual int ScaleMana(int mana) { double scalar = 1.0; if (!Necromancy.MindRotSpell.GetMindRotScalar(Caster, ref scalar)) { scalar = 1.0; } int lmc = Caster.GetMagicalAttribute(AosAttribute.LowerManaCost); if (lmc > 40) { lmc = 40; } scalar -= (double)lmc / 100; #region Mana Phase if (ManaPhase.UnderEffect(Caster)) { scalar = 0.0; } #endregion return((int)(mana * scalar)); }
public virtual bool CheckMana(Mobile from, bool consume) { int mana = CalculateMana(from); if (from.Mana < mana) { from.SendLocalizedMessage(1060181, mana.ToString()); // You need ~1_MANA_REQUIREMENT~ mana to perform that attack return(false); } if (consume) { if (GetContext(from) == null) { Timer timer = new WeaponAbilityTimer(from); timer.Start(); AddContext(from, new WeaponAbilityContext(timer)); } from.Mana -= mana; #region Mana Phase if (ManaPhase.UnderEffect(from)) { ManaPhase.OnManaConsumed(from); } #endregion } return(true); }
public virtual int CalculateMana(Mobile from) { int mana = BaseMana; #region Mana Phase if (ManaPhase.UnderEffect(from)) { return(0); } #endregion double skillTotal = GetSkill(from, SkillName.Swords) + GetSkill(from, SkillName.Macing) + GetSkill(from, SkillName.Fencing) + GetSkill(from, SkillName.Archery) + GetSkill(from, SkillName.Parry) + GetSkill(from, SkillName.Lumberjacking) + GetSkill(from, SkillName.Stealth) + GetSkill(from, SkillName.Poisoning) + GetSkill(from, SkillName.Bushido) + GetSkill(from, SkillName.Ninjitsu) + GetSkill(from, SkillName.Throwing); if (skillTotal >= 300.0) { mana -= 10; } else if (skillTotal >= 200.0) { mana -= 5; } double scalar = 1.0; if (!Server.Spells.Necromancy.MindRotSpell.GetMindRotScalar(from, ref scalar)) { scalar = 1.0; } int lmc = from.GetMagicalAttribute(MagicalAttribute.LowerManaCost); if (lmc > 40) { lmc = 40; } scalar -= (double)lmc / 100; mana = (int)(mana * scalar); // Using a special move within 3 seconds of the previous special move costs double mana if (GetContext(from) != null) { mana *= 2; } return(mana); }
public override void OnDoubleClick(Mobile m) { if (m_TalismanType == TalismanType.None) { return; } if (this.Parent != m) { m.SendLocalizedMessage(502641); // You must equip this item to use it. } else if (m_ChargeTimeLeft > 0) { int tmptime = (m_ChargeTimeLeft2 - (DateTime.Now.Second - m_ChargeTimeLeft3.Second) + 1); if (tmptime > (m_ChargeTimeLeft2 + 1)) { tmptime -= 60; } if (tmptime > m_ChargeTimeLeft2) { tmptime = m_ChargeTimeLeft2; } m.SendLocalizedMessage(1074882, tmptime.ToString()); // You must wait ~1_val~ seconds for this to recharge. } else if (m_Charges == 0) { m.SendLocalizedMessage(501250); // This magic item is out of charges. } else { if ((int)m_TalismanType <= 4) { //Removal m.Target = new InternalTarget(this); } //Mana Phase else if (m_TalismanType == TalismanType.ManaPhase) { ManaPhase.OnUse(m, this); } else if ((int)m_TalismanType >= 9) { //Summon creature BaseCreature bc = (BaseCreature)Activator.CreateInstance(SummonEntry.GetNPC(m_TalismanType)); if (BaseCreature.Summon(bc, m, m.Location, -1, TimeSpan.FromMinutes(10.0))) { bc.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head); bc.PlaySound(bc.GetIdleSound()); m_SummonedCreature = bc; m_Charges--; InvalidateProperties(); ChargeTimeLeft = 1800; m_ChargeTimer = new ChargeTimeLeftTimer(this); m_ChargeTimer.Start(); m_ChargeTimeLeft3 = DateTime.Now; } } else if (m_TalismanType == TalismanType.SummonRandom) { //Summon Random TalismanType tmpbc = SummonEntry.GetRandom(); BaseCreature bc = (BaseCreature)Activator.CreateInstance(SummonEntry.GetNPC(tmpbc)); if (BaseCreature.Summon(bc, m, m.Location, -1, TimeSpan.FromMinutes(10.0))) { bc.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head); bc.PlaySound(bc.GetIdleSound()); m_SummonedCreature = bc; m_Charges--; InvalidateProperties(); ChargeTimeLeft = 1800; m_ChargeTimer = new ChargeTimeLeftTimer(this); m_ChargeTimer.Start(); m_ChargeTimeLeft3 = DateTime.Now; } } else { Item summonitem; int message; // Summon item if (m_TalismanType == TalismanType.SummonBandage) { summonitem = new Bandage(10); summonitem.ItemID = 0x0EE9; summonitem.Hue = 0xA3; message = 1075002; // You have been given some clean bandages. } else if (m_TalismanType == TalismanType.SummonBoard) { summonitem = new Board(10); summonitem.Hue = 0xA3; message = 1075000; // You have been given some wooden boards. } else // if ( m_TalismanType == TalismanType.SummonIngot ) { summonitem = new IronIngot(10); summonitem.Hue = 0xA3; message = 1075001; // You have been given some ingots. } m.AddToBackpack(summonitem); m.SendLocalizedMessage(message); m_Charges--; InvalidateProperties(); ChargeTimeLeft = 60; m_ChargeTimer = new ChargeTimeLeftTimer(this); m_ChargeTimer.Start(); m_ChargeTimeLeft3 = DateTime.Now; } } }
public virtual bool CheckSequence() { int mana = ScaleMana(GetMana()); if (Caster.Deleted || !Caster.Alive || Caster.Spell != this || State != SpellState.Sequencing) { DoFizzle(); } else if (Scroll != null && !(Scroll is Runebook) && (Scroll.Amount <= 0 || Scroll.Deleted || Scroll.RootParent != Caster || (Scroll is BaseWand && (((BaseWand)Scroll).Charges <= 0 || Scroll.Parent != Caster)))) { DoFizzle(); } else if (!ConsumeReagents()) { Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502630); // More reagents are needed for this spell. } else if (Caster.Mana < mana) { Caster.LocalOverheadMessage(MessageType.Regular, 0x22, 502625); // Insufficient mana for this spell. } else if (Caster.Frozen || Caster.Paralyzed) { Caster.SendLocalizedMessage(502646); // You cannot cast a spell while frozen. DoFizzle(); } else if (CheckFizzle()) { Caster.Mana -= mana; #region ManaPhase if (ManaPhase.UnderEffect(Caster)) { ManaPhase.OnManaConsumed(Caster); } #endregion if (Scroll is SpellStone) { ((SpellStone)Scroll).Use(Caster); } if (Scroll is SpellScroll) { Scroll.Consume(); } else if (Scroll is BaseWand) { ((BaseWand)Scroll).ConsumeCharge(Caster); } if (Scroll is BaseWand) { bool m = Scroll.Movable; Scroll.Movable = false; if (ClearHandsOnCast) { Caster.ClearHands(); } Scroll.Movable = m; } else { if (ClearHandsOnCast) { Caster.ClearHands(); } } int karma = ComputeKarmaAward(); if (karma != 0) { Misc.Titles.AwardKarma(Caster, karma, true); } if (TransformationSpell.UnderTransformation(Caster, typeof(VampiricEmbraceSpell))) { bool garlic = false; for (int i = 0; !garlic && i < Info.Reagents.Length; ++i) { garlic = (Info.Reagents[i] == Reagent.Garlic); } if (garlic) { Caster.SendLocalizedMessage(1061651); // The garlic burns you! AOS.Damage(Caster, Utility.RandomMinMax(17, 23), 100, 0, 0, 0, 0); } } return(true); } else { DoFizzle(); } return(false); }