Exemplo n.º 1
0
        public static void OnCreatureHit(Mobile attacker, Mobile defender, ref int damage)
        {
            if (attacker is BaseCreature && (((BaseCreature)attacker).Controlled || ((BaseCreature)attacker).Summoned))
            {
                CombatTrainingSpell spell = GetSpell <CombatTrainingSpell>(sp => sp.Target == attacker);

                if (spell != null)
                {
                    switch (spell.SpellType)
                    {
                    case TrainingType.Empowerment:
                        break;

                    case TrainingType.Berserk:
                        if (spell.Phase > 1)
                        {
                            damage = damage + (int)((double)damage * spell.DamageMod);
                            attacker.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                        }
                        break;

                    case TrainingType.ConsumeDamage:
                    case TrainingType.AsOne:
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public ChooseTrainingGump(Mobile caster, BaseCreature target, CombatTrainingSpell spell) : base(100, 100)
        {
            Spell  = spell;
            Caster = caster;
            Target = target;

            AddBackground(0, 0, 260, 187, 3600);
            AddAlphaRegion(10, 10, 240, 167);

            AddImageTiled(220, 15, 30, 162, 10464);

            AddHtmlLocalized(20, 20, 150, 16, 1156113, Hue, false, false); // Select Training

            AddButton(20, 40, 9762, 9763, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(43, 40, 150, 16, 1156109, Hue, false, false); // Empowerment

            AddButton(20, 60, 9762, 9763, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(43, 60, 150, 16, 1153271, Hue, false, false); // Berserk

            AddButton(20, 80, 9762, 9763, 3, GumpButtonType.Reply, 0);
            AddHtmlLocalized(43, 80, 150, 16, 1156108, Hue, false, false); // Consume Damage

            AddButton(20, 100, 9762, 9763, 4, GumpButtonType.Reply, 0);
            AddHtmlLocalized(43, 100, 150, 16, 1157544, Hue, false, false); // As One
        }
Exemplo n.º 3
0
        /// <summary>
        /// Called in BaseWeapon, intended as a melee/ranged hit
        /// </summary>
        /// <param name="attacker"></param>
        /// <param name="defender"></param>
        /// <param name="damage"></param>
        public static void OnHit(Mobile attacker, Mobile defender, ref int damage)
        {
            if (attacker == null || defender == null)
            {
                return;
            }

            foreach (SkillMasterySpell spell in EnumerateSpells(attacker))
            {
                spell.OnHit(defender, ref damage);
            }

            foreach (SkillMasterySpell spell in EnumerateSpells(defender))
            {
                spell.OnGotHit(defender, ref damage);
            }

            SkillMasteryMove move = SpecialMove.GetCurrentMove(defender) as SkillMasteryMove;

            if (move != null)
            {
                move.OnGotHit(attacker, defender, ref damage);
            }

            if (attacker is BaseCreature || defender is BaseCreature)
            {
                CombatTrainingSpell.OnCreatureHit(attacker, defender, ref damage);
            }
        }
Exemplo n.º 4
0
        public static void OnCreatureHit(Mobile attacker, Mobile defender, ref int damage)
        {
            if (attacker is BaseCreature && (((BaseCreature)attacker).Controlled || ((BaseCreature)attacker).Summoned))
            {
                Mobile master = ((BaseCreature)attacker).GetMaster();

                if (master != null)
                {
                    CombatTrainingSpell spell = GetSpell(master, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

                    if (spell != null)
                    {
                        switch (spell.SpellType)
                        {
                        case TrainingType.Empowerment:
                            break;

                        case TrainingType.Berserk:
                            damage = damage + (int)((double)damage * spell.DamageModifier(defender));
                            attacker.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                            break;

                        case TrainingType.ConsumeDamage:
                        case TrainingType.AsOne:
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Called in Aos.cs, should include all damage types
        /// </summary>
        /// <param name="victim"></param>
        /// <param name="damager"></param>
        /// <param name="damage"></param>
        public static void OnCasterDamaged(Mobile victim, Mobile damager, ref int damage)
        {
            if (victim == null)
            {
                return;
            }

            CheckTable(victim);

            if (m_Table.ContainsKey(victim))
            {
                foreach (SkillMasterySpell sp in EnumerateSpells(victim))
                {
                    if (sp.DamageCanDisrupt && damage > sp.DamageThreshold)
                    {
                        sp.Expire(true);
                    }

                    sp.OnDamaged(damager, damage);
                }
            }

            SkillMasteryMove move = SpecialMove.GetCurrentMove(victim) as SkillMasteryMove;

            if (move != null)
            {
                move.OnDamaged(damager, victim, damage);
            }

            CombatTrainingSpell.CheckDamage(damager, victim, ref damage);
        }
Exemplo n.º 6
0
        public override bool Cast()
        {
            CombatTrainingSpell spell = GetSpell(Caster, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

            if (spell != null)
            {
                spell.Expire();
                return(false);
            }

            return(base.Cast());
        }
Exemplo n.º 7
0
        public static int GetHitChanceBonus(Mobile m)
        {
            if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned))
            {
                CombatTrainingSpell spell = GetSpell <CombatTrainingSpell>(sp => sp.Target == m);

                if (spell != null && spell.SpellType == TrainingType.ConsumeDamage && spell.Phase > 1)
                {
                    return((int)(45 * spell.DamageMod));
                }
            }

            return(0);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Called in Aos.cs, should include all damage types
        /// </summary>
        /// <param name="victim"></param>
        /// <param name="damager"></param>
        /// <param name="damage"></param>
        public static void OnDamage(Mobile victim, Mobile damager, DamageType type, ref int damage)
        {
            if (victim == null || damager == null)
            {
                return;
            }

            CheckTable(victim);

            foreach (SkillMasterySpell sp in EnumerateSpells(victim))
            {
                if (sp.DamageCanDisrupt && damage > sp.DamageThreshold)
                {
                    sp.Expire(true);
                }

                sp.OnDamaged(damager, victim, type, ref damage);
            }

            foreach (SkillMasterySpell sp in GetSpells(s => s.Target == victim))
            {
                sp.OnTargetDamaged(damager, victim, type, ref damage);
            }

            SkillMasteryMove move = SpecialMove.GetCurrentMove(victim) as SkillMasteryMove;

            if (move != null)
            {
                move.OnDamaged(damager, victim, type, ref damage);
            }

            PerseveranceSpell preserve = SkillMasterySpell.GetSpellForParty(victim, typeof(PerseveranceSpell)) as PerseveranceSpell;

            if (preserve != null)
            {
                preserve.AbsorbDamage(ref damage);
            }

            InspireSpell inspire = SkillMasterySpell.GetSpellForParty(damager, typeof(InspireSpell)) as InspireSpell;

            if (inspire != null)
            {
                inspire.DoDamage(ref damage);
            }

            CombatTrainingSpell.CheckDamage(damager, victim, type, ref damage);
        }
Exemplo n.º 9
0
        public override bool CheckCast()
        {
            CombatTrainingSpell spell = GetSpell(Caster, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

            if (spell != null)
            {
                spell.Expire();
                return(false);
            }

            if (Caster is PlayerMobile && ((PlayerMobile)Caster).AllFollowers == null || ((PlayerMobile)Caster).AllFollowers.Count == 0)
            {
                Caster.SendLocalizedMessage(1156112); // This ability requires you to have pets.
                return(false);
            }

            return(base.CheckCast());
        }
Exemplo n.º 10
0
        public ChooseTrainingGump(Mobile caster, BaseCreature target, CombatTrainingSpell spell) : base(100, 100)
        {
            Spell  = spell;
            Caster = caster;
            Target = target;

            AddBackground(0, 0, 260, 187, 3600);
            AddAlphaRegion(10, 10, 240, 167);

            AddImageTiled(220, 15, 30, 162, 10464);

            AddHtmlLocalized(20, 20, 150, 16, 1156113, Hue, false, false); // Select Training

            int y = 40;

            if (MasteryInfo.HasLearned(caster, SkillName.AnimalTaming, 1))
            {
                AddButton(20, y, 9762, 9763, 1, GumpButtonType.Reply, 0);
                AddHtmlLocalized(43, y, 150, 16, 1156109, Hue, false, false); // Empowerment
                y += 20;
            }

            if (MasteryInfo.HasLearned(caster, SkillName.AnimalTaming, 2))
            {
                AddButton(20, y, 9762, 9763, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(43, y, 150, 16, 1153271, Hue, false, false); // Berserk
                y += 20;
            }

            if (MasteryInfo.HasLearned(caster, SkillName.AnimalTaming, 3))
            {
                AddButton(20, y, 9762, 9763, 3, GumpButtonType.Reply, 0);
                AddHtmlLocalized(43, y, 150, 16, 1156108, Hue, false, false); // Consume Damage
                y += 20;
            }

            if (MasteryInfo.HasLearned(caster, SkillName.AnimalTaming, 1))
            {
                AddButton(20, y, 9762, 9763, 4, GumpButtonType.Reply, 0);
                AddHtmlLocalized(43, y, 150, 16, 1157544, Hue, false, false); // As One
                y += 20;
            }
        }
Exemplo n.º 11
0
        public static int GetHitChanceBonus(Mobile m)
        {
            if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned))
            {
                Mobile master = ((BaseCreature)m).GetMaster();

                if (master != null)
                {
                    CombatTrainingSpell spell = GetSpell(master, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

                    if (spell != null && spell.SpellType != TrainingType.AsOne)
                    {
                        return((int)(45 * spell.DamageModifier(m)));
                    }
                }
            }

            return(0);
        }
Exemplo n.º 12
0
        public static int RegenBonus(Mobile m)
        {
            if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned))
            {
                Mobile master = ((BaseCreature)m).GetMaster();

                if (master != null)
                {
                    CombatTrainingSpell spell = GetSpell(master, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

                    if (spell != null)
                    {
                        return((int)(30.0 * spell.DamageModifier(m)));
                    }
                }
            }

            return(0);
        }
Exemplo n.º 13
0
 public InternalTarget(CombatTrainingSpell spell)
     : base(8, false, TargetFlags.None)
 {
     Spell = spell;
 }
Exemplo n.º 14
0
        public static void CheckDamage(Mobile attacker, Mobile defender, DamageType type, ref int damage)
        {
            if (defender is BaseCreature && (((BaseCreature)defender).Controlled || ((BaseCreature)defender).Summoned))
            {
                CombatTrainingSpell spell = GetSpell <CombatTrainingSpell>(sp => sp.Target == defender);

                if (spell != null)
                {
                    int storedDamage = damage;

                    switch (spell.SpellType)
                    {
                    case TrainingType.Empowerment:
                        break;

                    case TrainingType.Berserk:
                        if (InRageCooldown(defender))
                        {
                            return;
                        }

                        if (spell.Phase > 1)
                        {
                            damage = damage - (int)((double)damage * spell.DamageMod);
                            defender.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                        }
                        break;

                    case TrainingType.ConsumeDamage:
                        if (spell.Phase < 2)
                        {
                            defender.SendDamagePacket(attacker, damage);
                            damage = 0;
                        }
                        break;

                    case TrainingType.AsOne:
                        if (((BaseCreature)defender).GetMaster() is PlayerMobile)
                        {
                            var pm   = ((BaseCreature)defender).GetMaster() as PlayerMobile;
                            var list = pm.AllFollowers.Where(m => (m == defender || m.InRange(defender.Location, 3)) && m.CanBeHarmful(attacker)).ToList();

                            if (list.Count > 0)
                            {
                                damage = damage / list.Count;

                                foreach (var m in list.Where(mob => mob != defender))
                                {
                                    m.Damage(damage, attacker, true, false);
                                }
                            }

                            ColUtility.Free(list);
                        }
                        return;
                    }


                    if (spell.Phase < 2)
                    {
                        if (spell.Phase != 1)
                        {
                            spell.Phase = 1;

                            if (spell.SpellType != TrainingType.AsOne && (spell.SpellType != TrainingType.Berserk || !InRageCooldown(defender)))
                            {
                                Server.Timer.DelayCall(TimeSpan.FromSeconds(5), spell.EndPhase1);
                            }
                        }

                        if (spell.DamageTaken == 0)
                        {
                            defender.FixedEffect(0x3779, 10, 30, 1743, 0);
                        }

                        spell.DamageTaken += storedDamage;
                    }
                }
            }
            else if (attacker is BaseCreature && (((BaseCreature)attacker).Controlled || ((BaseCreature)attacker).Summoned))
            {
                CombatTrainingSpell spell = GetSpell <CombatTrainingSpell>(sp => sp.Target == attacker);

                if (spell != null)
                {
                    switch (spell.SpellType)
                    {
                    case TrainingType.Empowerment:
                        if (spell.Phase > 1)
                        {
                            damage = damage + (int)((double)damage * spell.DamageMod);
                            attacker.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                        }
                        break;

                    case TrainingType.Berserk:
                    case TrainingType.ConsumeDamage:
                    case TrainingType.AsOne:
                        break;
                    }
                }
            }
        }
Exemplo n.º 15
0
        public static int GetAttributeBonus(Mobile m, AosAttribute attr)
        {
            int value = 0;
            SkillMasterySpell spell = null;

            switch (attr)
            {
            case AosAttribute.AttackChance:
                spell = SkillMasterySpell.GetSpellForParty(m, typeof(InspireSpell));
                if (spell != null)
                {
                    value += spell.PropertyBonus();
                }

                spell = SkillMasterySpell.GetSpellForParty(m, typeof(TribulationSpell));
                if (spell != null)
                {
                    value += spell.PropertyBonus();
                }

                value += FocusedEyeSpell.HitChanceBonus(m);
                value += PlayingTheOddsSpell.HitChanceBonus(m);
                value += CalledShotSpell.GetHitChanceBonus(m);
                value += CombatTrainingSpell.GetHitChanceBonus(m);

                value += MasteryInfo.SavingThrowChance(m, attr);
                break;

            case AosAttribute.DefendChance:
                spell = SkillMasterySpell.GetSpellForParty(m, typeof(PerseveranceSpell));

                if (spell != null)
                {
                    value += spell.PropertyBonus();
                }

                if (Server.Spells.SkillMasteries.WhiteTigerFormSpell.IsActive(m))
                {
                    value += 20;
                }

                value += MasteryInfo.SavingThrowChance(m, attr);
                break;

            case AosAttribute.RegenHits:
                spell = SkillMasterySpell.GetSpellForParty(m, typeof(ResilienceSpell));

                if (spell != null)
                {
                    value += spell.PropertyBonus();
                }
                break;

            case AosAttribute.RegenStam:
                spell = SkillMasterySpell.GetSpellForParty(m, typeof(ResilienceSpell));

                if (spell != null)
                {
                    value += spell.PropertyBonus();
                }
                break;

            case AosAttribute.RegenMana:
                spell = SkillMasterySpell.GetSpellForParty(m, typeof(ResilienceSpell));

                if (spell != null)
                {
                    value += spell.PropertyBonus();
                }
                break;

            case AosAttribute.WeaponDamage:
                spell = SkillMasterySpell.GetSpellForParty(m, typeof(InspireSpell));

                if (spell != null)
                {
                    value += spell.DamageBonus();
                }

                value += MasteryInfo.SavingThrowChance(m, attr);
                break;

            case AosAttribute.SpellDamage:
                spell = SkillMasterySpell.GetSpellForParty(m, typeof(InspireSpell));

                if (spell != null)
                {
                    value += spell.PropertyBonus();
                }
                break;

            case AosAttribute.WeaponSpeed:
                value += RampageSpell.GetBonus(m, RampageSpell.BonusType.SwingSpeed);
                value += PlayingTheOddsSpell.SwingSpeedBonus(m);
                value -= StaggerSpell.GetStagger(m);
                break;

            case AosAttribute.BonusStr:
                value += MasteryInfo.SavingThrowChance(m, attr);
                break;
            }

            return(value);
        }
Exemplo n.º 16
0
        public static void CheckDamage(Mobile attacker, Mobile defender, DamageType type, ref int damage)
        {
            if (defender is BaseCreature && (((BaseCreature)defender).Controlled || ((BaseCreature)defender).Summoned))
            {
                Mobile master = ((BaseCreature)defender).GetMaster();

                if (master != null)
                {
                    CombatTrainingSpell spell = GetSpell(master, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

                    if (spell != null)
                    {
                        switch (spell.SpellType)
                        {
                        case TrainingType.Empowerment:
                            break;

                        case TrainingType.Berserk:
                            damage = damage - (int)((double)damage * spell.DamageModifier(defender));
                            defender.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                            break;

                        case TrainingType.ConsumeDamage:
                            break;

                        case TrainingType.AsOne:
                            if (master is PlayerMobile)
                            {
                                var list = ((PlayerMobile)master).AllFollowers.Where(m => (m == defender || m.InRange(defender.Location, 3)) && m.CanBeHarmful(attacker)).ToList();

                                if (list.Count > 0)
                                {
                                    damage = damage / list.Count;

                                    foreach (var m in list.Where(mob => mob != defender))
                                    {
                                        m.Damage(damage, attacker, true, false);
                                    }
                                }

                                ColUtility.Free(list);
                            }
                            break;
                        }

                        if (spell._DamageTaken == 0)
                        {
                            defender.FixedEffect(0x3779, 10, 90, 1743, 0);
                        }

                        spell._DamageTaken = damage;
                    }
                }
            }
            else if (attacker is BaseCreature && (((BaseCreature)attacker).Controlled || ((BaseCreature)attacker).Summoned))
            {
                Mobile master = ((BaseCreature)attacker).GetMaster();

                if (master != null)
                {
                    CombatTrainingSpell spell = GetSpell(master, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

                    if (spell != null)
                    {
                        switch (spell.SpellType)
                        {
                        case TrainingType.Empowerment:
                            damage = damage + (int)((double)damage * spell.DamageModifier(defender));
                            attacker.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                            break;

                        case TrainingType.Berserk:
                            break;

                        case TrainingType.ConsumeDamage:
                        case TrainingType.AsOne:
                            break;
                        }
                    }
                }
            }
        }