public Spell GetPaladinSpell()
        {
            if (CheckForRemoveCurse() == true && Utility.RandomDouble() > 0.25)
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.Say(1154, "Casting Remove Curse");
                }

                return(new RemoveCurseSpell(m_Mobile, null));
            }

            int whichone = Utility.RandomMinMax(1, 4);

            if (whichone == 4 && m_Mobile.Skills[SkillName.Chivalry].Value >= 55.0 && m_Mobile.Mana >= 10)
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.Say(1154, "Casting Holy Light");
                }

                return(new HolyLightSpell(m_Mobile, null));
            }
            else if (whichone >= 3 && CheckForDispelEvil())
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.Say(1154, "Casting Dispel Evil");
                }

                return(new DispelEvilSpell(m_Mobile, null));
            }
            else if (whichone >= 2 && !(DivineFurySpell.UnderEffect(m_Mobile)) && m_Mobile.Skills[SkillName.Chivalry].Value >= 35.0)
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.Say(1154, "Casting Divine Fury");
                }

                return(new DivineFurySpell(m_Mobile, null));
            }
            else if (CheckForConsecrateWeapon())
            {
                if (m_Mobile.Debug)
                {
                    m_Mobile.Say(1154, "Casting Consecrate Weapon");
                }

                return(new ConsecrateWeaponSpell(m_Mobile, null));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        public virtual Spell ChooseSpell()
        {
            Spell spell = CheckCastHealingSpell();

            if (spell != null)
            {
                return(spell);
            }

            switch (Utility.Random(5))
            {
            case 0:
            case 1:
                BaseWeapon weapon = m_Mobile.Weapon as BaseWeapon;

                if (weapon != null && weapon.ConsecratedContext != null)
                {
                    spell = new ConsecrateWeaponSpell(m_Mobile, null);
                }

                break;

            case 2:
            case 3:
                if (!DivineFurySpell.UnderEffect(m_Mobile))
                {
                    spell = new DivineFurySpell(m_Mobile, null);
                }

                break;

            case 4:
                spell = new HolyLightSpell(m_Mobile, null);
                break;
            }

            return(spell);
        }
Esempio n. 3
0
        private static bool CombatCheck(Mobile attacker, Mobile defender) /* mod'd from baseweapon */
        {
            var defWeapon = defender.Weapon as BaseWeapon;

            var atkSkill = defender.Skills.Ninjitsu;
            // Skill defSkill = defender.Skills[defWeapon.Skill];

            var atSkillValue  = attacker.Skills.Ninjitsu.Value;
            var defSkillValue = defWeapon?.GetDefendSkillValue(attacker, defender) ?? 0.0;

            if (defSkillValue <= -20.0)
            {
                defSkillValue = -19.9;
            }

            double attackValue = AosAttributes.GetValue(attacker, AosAttribute.AttackChance);

            if (DivineFurySpell.UnderEffect(attacker))
            {
                attackValue += 10;
            }

            if (AnimalForm.UnderTransformation(attacker, typeof(GreyWolf)) ||
                AnimalForm.UnderTransformation(attacker, typeof(BakeKitsune)))
            {
                attackValue += 20;
            }

            if (HitLower.IsUnderAttackEffect(attacker))
            {
                attackValue -= 25;
            }

            if (attackValue > 45)
            {
                attackValue = 45;
            }

            attackValue = (atSkillValue + 20.0) * (100 + attackValue);

            double defenseValue = AosAttributes.GetValue(defender, AosAttribute.DefendChance);

            if (DivineFurySpell.UnderEffect(defender))
            {
                defenseValue -= 20;
            }

            if (HitLower.IsUnderDefenseEffect(defender))
            {
                defenseValue -= 25;
            }

            var refBonus = 0;

            if (Block.GetBonus(defender, ref refBonus))
            {
                defenseValue += refBonus;
            }

            if (Discordance.GetEffect(attacker, ref refBonus))
            {
                defenseValue -= refBonus;
            }

            if (defenseValue > 45)
            {
                defenseValue = 45;
            }

            defenseValue = (defSkillValue + 20.0) * (100 + defenseValue);

            var chance = attackValue / (defenseValue * 2.0);

            if (chance < 0.02)
            {
                chance = 0.02;
            }

            return(attacker.CheckSkill(atkSkill.SkillName, chance));
        }