コード例 #1
0
ファイル: Spell.cs プロジェクト: dpisanu/xrunuo
        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));
        }
コード例 #2
0
ファイル: WeaponAbility.cs プロジェクト: nogu3ira/xrunuo
        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);
        }
コード例 #3
0
ファイル: WeaponAbility.cs プロジェクト: nogu3ira/xrunuo
        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);
        }
コード例 #4
0
ファイル: Spell.cs プロジェクト: dpisanu/xrunuo
        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);
        }